Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions deploy/skills/backplane-buy/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: backplane-buy
description: "Follow when Backplane opens a Buy it thread to prepare and quote an order."
---

# backplane-buy

This thread orders the project's parts; the person pressed Buy it. Be brief: short messages, a small table at most, no walls of text. Steps:
1. Read `.backplane/intent.md` and every `*.fab.json` (find . -name '*.fab.json' -not -path './extra/*' -not -path './mfg/*'). If a board or part to order has none yet, write it first, measured using the bundled fab-spec skill, and say so in a line. Then let the person choose what to order: call `order_ask` with `pick` true, the question "What should this order include?" and one option per board or part (its name, what it is and the quantity, e.g. "Main board · 4-layer PCB · 5"), all of them, and end your turn. Backplane shows them as a list they untick and may add parts to. Their answer says what to order, what to leave out and anything they added: order only what they kept; for a part they added, find it in the project, write its fab.json as above and say so in a line; if you cannot find it, ask with `order_ask`.
2. Call the backplane tool `order_review` with action "gate". When the review is current and passed it says so: go on. Otherwise Backplane itself tells the person where the review stands (the issues as a list, with the link to `.backplane/review.md`) and asks them; end your turn, and their answer comes as their next message: "Review for manufacturing": call delegate_task with the prompt "Review this project for manufacturing." (the task works in this thread's folder, on the very files to be ordered, and its result comes back here), say in one line that it runs as a task of this thread and the order goes on when it's done, and end your turn; when its result comes, call the gate again. "Fix them first": delegate_task again with the exact changes `.backplane/review.md` asks for (in this folder, so the order gets them), and once that is done the review once more, then the gate. "Order without a review" or "Order anyway": go on. Export nothing until the gate passes or the person says to order anyway. Never review or change the design yourself here; this thread only orders.
3. Ask only what is missing, one question at a time with the backplane tool `order_ask` (it never waits: end your turn after each, and the answer comes as the person's next message), never in plain words in your reply: Backplane shows each question in its own card above the message box. Questions with choices get two to four short ones, the likely one first: quantities, and for each rigid board (kind pcb) whether it comes assembled or bare; other board kinds come bare. Where it ships is typed: `order_ask` with the question "Ship to which country?", `typed` true and no options, so the person gets a box to type it in; when an earlier order's `mfg/*/manifest.json` exists, add `last` with its country's name (it shows as a quick choice). Use the country's two-letter ISO code as ship_to. A region (EU, Europe, Asia) is not a country: ask which country. When it ships to the US, ask the state the same way next (its sales tax is in the quote): `order_ask` with the question "Ship to which US state?", `typed` true and no options, and `last` with the earlier order's state when it shipped to the US; use the state's two-letter code (GA, WA) as ship_region. When an earlier order exists, offer its answers first (its quantities and assembly as choices, its country as `last`) and skip what still holds. Boards come in at least 5 and assembly starts at 2 boards (any number up to the quantity). Bare boards can come with a BOM they order parts with themselves (by manufacturer part number at any distributor).
4. Export from the saved files (a fix made through `kicad_ipc` counts once saved with SaveDocument) into `mfg/<YYYYMMDD-HHMM>/`: for each board `<name>/gerbers/` (kicad-cli pcb export gerbers, and kicad-cli pcb export drill with Excellon, mm, PTH and NPTH in separate files, into the same folder), and when it is assembled `<name>/bom.csv` (columns Designator, Quantity, Value, Footprint, MPN, Manufacturer, and LCSC when known; one line per part number) and `<name>/positions.csv` (kicad-cli pcb export pos --format csv --units mm --side both; columns Designator, Mid X, Mid Y, Rotation, Layer); for each mechanical part `<name>/<name>.step`, and for sheet metal also its flat pattern `<name>/<name>.dxf`. Then write `manifest.json` there: {"spec": 1, "title": "<the project, in words>", "ship_to": "US", "ship_region": "<the state's two-letter code; only for the US>", "parts": [{"name" (its fab.json name, e.g. Main board), "kind", "qty", "options", "features" (sheet metal: its bends), "files": {"gerbers": "<name>/gerbers", "bom", "positions"} or {"step", "dxf"}, "assemble": <boards to assemble, 0 for bare>}], "files": {"<path from the folder>": "<sha256>"}}, listing every file (sha256sum).
5. Call the backplane tool `order_quote` with the folder (`mfg/<...>`) and end your turn: Backplane shows the person every file it would send and asks them first. Once they send, the files go to the order server and the quote is made (usually 1-2 minutes); meanwhile the thread shows that the quote is on its way. Backplane then posts it with its Buy now link (it opens Stripe) in this thread and you get a message with its total; do not repeat its table. Say in a line or two what it covers, and if it lists problems, what fixes each. If the person writes before the quote comes, call `order_status`: it says whether the files were sent and the quote is being made; never ask them to send or approve again unless it says the files were not sent, and never guess at problems.
Only order_quote ever sends anything: never upload files or contact a manufacturer yourself. The person never deals with the fab: there is no fab website, account or preview for them, so never ask them to check anything there; check what can be checked here (the exported files, the positions file, the renders) and say what you checked. Prices are estimates until paid; the person can always take the mfg folder to any manufacturer themselves. Never name the manufacturer.
32 changes: 32 additions & 0 deletions deploy/skills/fab-spec/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
name: fab-spec
description: "Use when creating, measuring, or updating a part's .fab.json for fabrication."
---

# fab-spec

Each thing to be ordered has a `<name>.fab.json` beside it (a board's in its folder, a part's beside its STEP in mech/): {"kind": "pcb" | "flex" | "hdi" | "aluminum" | "copper_core" | "rogers" | "ptfe" | "3dp" | "cnc" | "sheetmetal", "name": "Main board", "source": "<its file, from the fab.json's folder>", "qty": 5, "options": {...}, "features": {...}}; add "order": false for one not to be ordered. Features are measured, never guessed, and kept current whenever the design changes, because Backplane shows the person a price from them: a board's `width_mm` and `height_mm` (its Edge.Cuts box) and `min_drill_mm` (its smallest plated hole, usually a via); a solid's `volume_cm3`, `area_cm2`, `size_x_mm`, `size_y_mm`, `size_z_mm` (FreeCAD: shape.Volume/1000, shape.Area/100, the tightest box, largest first); a sheet part's `flat_x_mm`, `flat_y_mm`, `cut_length_mm`, `holes`, `bends`, `countersinks` (its flat pattern; the last four default to 0). Boards come in kinds: pcb is a rigid FR-4 board; flex a flexible polyimide one; hdi one with microvias and build-up layers; aluminum and copper_core single-layer metal-core boards (LEDs, power); rogers (RO4350B) and ptfe two-layer high-frequency boards. Every board kind is measured and exported the same way; only pcb boards come assembled.

## Options

Omitted options take the first value.

- pcb: layers 1|2|4|6|8|10|12|14|16 (default 2), thickness_mm 1.6|0.4|0.6|0.8|1.0|1.2|2.0, color green|black|white|blue|red|yellow|purple, finish hasl|hasl_lead_free|enig|osp, copper_oz 1|2, castellated, gold_fingers

- flex: layers 2|1|4, thickness_mm (the total, which sets the substrate and copper; 1 layer: 0.07|0.11|0.12|0.14, 2 layers: 0.11|0.12|0.19|0.2|0.24, 4 layers: 0.2|0.25|0.3|0.35|0.45; left out, the first for its layers), coverlay yellow|black|white, stiffener none|polyimide_0.1|polyimide_0.15|polyimide_0.2|polyimide_0.225|polyimide_0.25|fr4_0.1|fr4_0.2|fr4_0.4|fr4_0.6|fr4_0.8|fr4_1.0|fr4_1.2|fr4_1.6|steel_0.1|steel_0.2|steel_0.3|tape_3m468|tape_tesa8854|tape_3m9077 (mm), emi_shield none|one_side|both_sides, gold_uin 1|2 (its ENIG gold), gold_fingers

- hdi: layers 4|6|8|10|12|14|16, thickness_mm 1.6 (0.6|0.8|1.0|1.2|1.4|1.6|1.8|2.0|2.5|3.0 as the layers allow), steps 1|2|3 (build-up steps: 1 at 4 layers, up to 2 at 6, up to 3 from 8), laminate np175f|s1000_2m (only s1000_2m from 8 layers), color as pcb, finish hasl|hasl_lead_free|enig|osp (only enig|osp from 6 layers), via_fill plugged|untented|epoxy_filled|copper_filled (only epoxy_filled from 6 layers), castellated, gold_fingers, edge_plating

- aluminum: thickness_mm 1.6|0.8|1.0|1.2, color white|black, finish hasl|hasl_lead_free

- copper_core: thickness_mm 1.6|1.0|1.2, color white|black (OSP)

- rogers: thickness_mm 0.51|0.76|1.52, color green|purple, finish enig|osp, gold_uin 1|2, via_fill tented|untented

- ptfe: thickness_mm 0.76|1.52, laminate dk2.94|dk3.0|dk2.65|dk2.55 (its dielectric constant), finish enig|osp, gold_uin 1|2, via_fill tented|untented

- 3dp: process mjf|sla|sls|fdm|slm, material (mjf: pa12|pa11|pa12_glass; sla: standard_resin|black_resin|tough_resin|high_temp_resin|clear_resin; sls: pa12|pa12_glass; fdm: abs|asa|pla|tpu|pa12_cf|pc_abs|peek; slm: stainless_316l|titanium), color, which the material decides (mjf pa12 and pa11: black|gray, pa12_glass: black|white; sla standard_resin: white, black_resin: black, tough_resin: green, high_temp_resin: yellow, clear_resin: translucent|transparent; sls pa12: black, pa12_glass: white; fdm abs and asa: black|white, pla: black|white|red|blue, tpu: black|white|gray|translucent|green, pa12_cf and pc_abs: black, peek: brown; slm: metal)

- cnc: material aluminum_6061|aluminum_7075|stainless_304|steel_45|steel_q235|brass|copper|abs_black|abs_white|pom_black|pom_white|pmma|nylon|polycarbonate|fr4, finish none|anodize|bead_blast|bead_blast_anodize|hard_anodize|conductive_anodize|brushed|brushed_anodize|laser_mark, tolerance standard|0.1|0.05|0.02

- sheetmetal: material aluminum_5052|stainless_304|stainless_201|steel_cold_rolled|steel_galvanized, thickness_mm (0.5 to 6), finish none|powder_coat|anodize|conductive_anodize|hard_anodize.
18 changes: 18 additions & 0 deletions deploy/skills/freecad/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: freecad
description: "Use for mechanical modeling, STEP export, assemblies, and fit checks in FreeCAD."
---

# freecad

Model with FreeCAD. Each part is one script in the project's `mech/` folder with its dimensions as named parameters at the top, in millimetres, Z up, the part's front facing -Y; it checks `shape.isValid()`, saves `mech/<part>.FCStd` and exports `mech/<part>.step`.

An assembly is one more script that places the parts and exports one STEP. Give every part a colour that reads as what it is (a printed housing, aluminium, rubber, the board's green): STEP files keep colours only when FreeCAD's GUI writes them, so run the script with the GUI offscreen (no window opens): `QT_QPA_PLATFORM=offscreen timeout 300 "<FreeCAD GUI>" mech/<part>.py`. In it, after `doc.recompute()`, set each object's `ViewObject.ShapeColor = (r, g, b)` (0 to 1), export with `ImportGui.export(objects, 'mech/<part>.step')`, write any messages to a log file (the GUI's output is not shown), and end with `os._exit(0)` or it keeps running.

Bring a board or vendor STEP into an assembly with `ImportGui.insert` so its colours stay. Before the first `ImportGui.insert`, run `App.ParamGet("User parameter:BaseApp/Preferences/Mod/Import").SetInt("ImportMode", 0)` (in memory only: nothing is saved): a person's Import mode of 2 makes `ImportGui.insert` wait forever offscreen.

The console build, `"<FreeCAD console>" -c "exec(open('mech/<part>.py').read())"`, is quicker for checking geometry but writes STEP without colours.

Use the GUI and console paths reported in the system prompt. Clear DISPLAY and WAYLAND_DISPLAY on graphical Linux shells before launching offscreen. Inspect the script log and check that the saved files exist before opening the STEP with `viewer_show` (kind `mech`).

If you need a static check, run the selected Backplane renderer with `--render mech/a.step mech/b.step`. Inspect the isometric image first in `mech/renders/`, which also contains front, top and right views. Report renderer errors. For a fit check, export the KiCad board with `kicad-cli pcb export step --board-only` unless component heights matter.
12 changes: 12 additions & 0 deletions deploy/skills/kicad-ipc/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: kicad-ipc
description: "Read only when kicad_edit lacks a required operation and raw KiCad IPC is needed."
---

# kicad-ipc

- Call `kicad_ipc_status` for the installed API, capabilities and command names. Send one command at a time with `kicad_ipc {path, type, message}`. Short types like `GetItems` work. The hub opens the document and manages its named lock.
- Target explicit item IDs. Headless editors have no selection or view state. Wrap mutations in `BeginCommit` and `EndCommit`, then `SaveDocument` at each milestone. Use `EndCommit` with `CMA_DROP` to discard an unfinished commit. Check `GetNotices` after a deferred change.
- If the runtime lacks `footprint-partial-update`, send the full FootprintInstance. If it lacks `symbol-from-libid`, use `LoadAllLibraries`, `GetLibraryStatuses`, then `PlaceSymbolFromLibrary`.
- With `runaction-frame`, set `RunAction.frame` to `FT_SCHEMATIC_EDITOR` or `FT_PCB_EDITOR` for actions shared by both editors, including undo and redo. Older builds can send a shared action to the board editor while it is open.
- Use the hub's IPC connection. If IPC is unavailable, report the tool's reason and follow its supported recovery. Direct file writes are forbidden while KiCad has the project open.
8 changes: 8 additions & 0 deletions deploy/skills/kicad-sim/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
name: kicad-sim
description: "Use for schematic simulation when the selected KiCad runtime exposes sim-run."
---

# kicad-sim

Simulate with the backplane MCP tool `kicad_sim` {path, ops} (KiCad's simulator, ngspice): one call opens the schematic, runs its ops in order and answers numbers. Start with `models` (what would not simulate and why), settle each part with `model`, `exclude` or `import`, add `source`s, then `run` an analysis with the `measures` you need (corner, phase_margin, overshoot, ripple, settling_time and the rest are computed for you: never ask for whole waveforms to measure them yourself), `sweep` a value for a table and `tune` it to a target. Give a whole step as one call. The schematic is the real one, set up as KiCad's Simulator needs it, so the person can open the Simulation tab on the same set-up; sweeps and tunes change nothing unless you ask to write. A part without a model: find its maker's SPICE model by MPN on the maker's own site and give it with `import` (it is kept in the project's sim/models/ with its source and licence line). When the maker has none, or getting it needs a login, a licence acceptance or a purchase, stop and ask the person, naming the part and what you found; never substitute a generic or similar part's model without their word. Never run ngspice or kicad-cli yourself for a simulation, and never write Sim.* fields into the file.
8 changes: 8 additions & 0 deletions deploy/skills/manufacturing-review/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
name: manufacturing-review
description: "Follow when asked to review a project for manufacturing or order readiness."
---

# manufacturing-review

When asked to review the project for manufacturing, check what makes a fab ask questions or refuse, not the circuit: DRC against the fab's limits, taken from the backplane tool `fab_profile` (the project's fab, board kind and options: each limit with its source and date), never from memory; `fab_profile` with action "drc" puts them in the project's DRC rules (tracks and gaps, vias, rings, hole and edge clearances, silkscreen: a value under a limit's free value but within the one that costs more is fine but costs more, so say so rather than calling it an error; under both, it must change; where Backplane recommends more than the fab's limit, a design between the two is a note, not a must-change, "meets the fab's 0.2 mm, under the recommended 0.3 mm": fab_profile gives Backplane's recommended value with each limit it has one for, as `recommended`), every BOM line has a manufacturer part number that is in stock (pcbparts tools; prefer basic/preferred parts, name extended ones), parts on one side for the cheaper assembly, footprint rotations sane, an outline that is closed, every part to order has a current fab file; for printed parts walls 1 mm or more (0.8 for SLA), for sheet metal flanges at least 4x the thickness and holes at least the thickness from a bend, for CNC inside corners with radii of 1 mm or more and no undercuts. A part whose fab file has a `sendcutsend` block is made for SendCutSend: check it with the sendcutsend skill (`scs.py dfm <its fab file>`, against SendCutSend's live specs), give each failed rule with its source, and call the check stale when the part file no longer matches its `dfm.source_sha256`. Run every check in the foreground (no background commands, monitors or waits) and keep each one short. Start with the backplane tool `design_review` (scope "order"): its findings are the deterministic part; then `design_review` with scope "judged" and record your datasheet checks with `design_review_judged`. Write the findings to `.backplane/review.md` (per part: what is fine, what must change and why), then call the backplane tool `order_review` with action "record", verdict "ok" when nothing must change or "issues", a one-line summary and issues: what must change, one short line each ("Shade: walls 0.6 mm, need 0.8 for SLA"). Your last message is what the thread that asked hears: make it that list and the link `.backplane/review.md`, then end. Change nothing while reviewing: say what must change; the person decides. Call the manufacturer "the fab", never by name, except SendCutSend for the parts made for it.
11 changes: 10 additions & 1 deletion native/host/src/agents/bundled.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ const MANIFEST: &str = "{\"name\":\"backplane\",\"description\":\"Backplane's ow

/// (path under `<home>/bundled`, contents)
pub const FILES: &[(&str, &str)] = &[
("skills/backplane-buy/SKILL.md", include_str!("../../../../deploy/skills/backplane-buy/SKILL.md")),
("skills/manufacturing-review/SKILL.md", include_str!("../../../../deploy/skills/manufacturing-review/SKILL.md")),
("skills/fab-spec/SKILL.md", include_str!("../../../../deploy/skills/fab-spec/SKILL.md")),
("skills/kicad-sim/SKILL.md", include_str!("../../../../deploy/skills/kicad-sim/SKILL.md")),
("skills/freecad/SKILL.md", include_str!("../../../../deploy/skills/freecad/SKILL.md")),
("skills/kicad-ipc/SKILL.md", include_str!("../../../../deploy/skills/kicad-ipc/SKILL.md")),
("skills/sendcutsend/SKILL.md", include_str!("../../../../deploy/skills/sendcutsend/SKILL.md")),
("skills/sendcutsend/scripts/scs.py", include_str!("../../../../deploy/skills/sendcutsend/scripts/scs.py")),
("skills/sendcutsend/scripts/scs_step.py", include_str!("../../../../deploy/skills/sendcutsend/scripts/scs_step.py")),
Expand Down Expand Up @@ -112,7 +118,10 @@ mod tests {
let t0 = std::fs::metadata(d.join("skills/sendcutsend/SKILL.md")).unwrap().modified().unwrap();
std::thread::sleep(std::time::Duration::from_millis(20)); install(&h).unwrap();
assert_eq!(std::fs::metadata(d.join("skills/sendcutsend/SKILL.md")).unwrap().modified().unwrap(), t0, "an unchanged file is not rewritten");
let l = list(&d); assert_eq!(l.len(), 2); assert_eq!(l[0].0, "sendcutsend"); assert_eq!(l[1].0, "altium"); assert!(l[1].1.contains("Altium")); assert!(l[0].1.contains("SendCutSend")); assert!(l[0].2.replace('\\', "/").ends_with("bundled/skills/sendcutsend/SKILL.md"));
let l = list(&d); for name in ["backplane-buy", "manufacturing-review", "fab-spec", "kicad-sim", "freecad", "kicad-ipc", "altium", "sendcutsend"] {
let (_, trigger, path) = l.iter().find(|s| s.0 == name).expect(name);
assert!(!trigger.is_empty() && Path::new(path).is_file(), "{name}");
}
let _ = std::fs::remove_dir_all(&h);
}

Expand Down
Loading
Loading