app
KiCad - the KiCad Bridge
Public Made by Adomby adom
Reference implementation of the KiCad bridge: multi-instance Python server, forward path via kicad-cli, reverse path via in-process plugin. Most complex of the three bundled bridges.
← Commit history
autorouting: the kicad-autorouting skill (AI engine recommended, Freerouting on demand), package 1.0.138; plan records the Freerouting decision
6 files changed
+44−5
SKILL.md+1−1@@ -305,7 +305,7 @@ Every response: `success`, `output`, `path`, `backup`, `uuid`, `erc {ran, before `{"filePath": B, "engine": "ai" | "freerouting", "nets"?: [...], "dryRun"?: true}`. Without `engine` it answers `engine_required` with both engines described: ask the user which they want before routing. - **`ai` is the recommendation.** It returns a plan request (pads, nets with their pads, the live routing state when the PCB editor has the board open) and mutates nothing; you then route with `kicad_route_net`, one native undo step per trace, DRC-checked per step, and you can explain every trace. Frontier models route real boards this way (the recorded Astra runs on the adom/codex page rebuilt a 94-footprint board to zero unconnected items).-- **`freerouting`** is reserved for the user who wants a deterministic pass; it answers `not_implemented` (phase 2b) until it ships.+- **`freerouting`** is for the user who wants a deterministic pass. It is not installed by default: `kicad_freerouting {"action":"status"|"install"|"uninstall"}` fetches Freerouting's own bundle (88 MB download, 141 MB on disk, its own Java runtime inside, nothing installed on the PC, no UAC) into the bridge cache only when the user says yes, and removes it on its own. The full choice, the AI recipe and the verification rules are in the `kicad-autorouting` skill. ## Rescan after installs: `kicad_rescan_libraries`
docs/rust-port-plan.md+1−1@@ -178,7 +178,7 @@ KiCad 10 has no schematic API, so every tool that edits a schematic today rewrit `kicad_autoroute {engine: "ai" | "freerouting", nets?, dryRun?}`. - **`ai` is the default and the recommendation.** The routing verbs already give the AI what it needs: pads, nets, zones, live revision, one native undo step per trace, DRC per step. GPT-6 Astra in Codex has routed a 94-footprint public board this way to zero unconnected items ([recorded](https://wiki.adom.inc/adom/codex)), Claude Fable 5.1 handles the same verbs well, and newer models arriving in the coming weeks are expected to be better still. The AI sees the board, honours the schematic's intent (current, return paths, thermal), and can explain every trace; an autorouter cannot.-- **`freerouting` stays for the user who wants a deterministic pass.** The bridge writes a Specctra DSN from the parsed board (own writer; kicad-cli has no DSN export and RunAction names are unstable), fetches the Freerouting release and a portable Java runtime the way it fetches Mesa today (once, verified, into the bridge cache, never a UAC prompt), runs it headless, and applies the SES result through `kicad_add_track` and `kicad_add_via`, so even the autorouter's copper lands as native undo steps with a DRC check.+- **`freerouting` stays for the user who wants a deterministic pass, and only on request.** Decided with John on 2026-09-12 after weighing three placements: a shared service (rejected: Adom will not run every user's autorouting), the user's own container (workable), and the desktop. Verified that day on ConfRoomROG: Freerouting 2.4.1 ships every platform build with its own Java runtime, and its Windows MSI extracts with `msiexec /a` in two seconds with no elevation into a 141 MB folder whose `freerouting.exe` runs headless. So the desktop wins, with rules: never installed by default; `kicad_freerouting {status|install|uninstall}` fetches the 88 MB bundle only when the user says yes and removes it on its own; `kicad_uninstall` removes it too; nothing named Java is installed, nothing on PATH, no UAC. The bridge writes a Specctra DSN from the parsed board (own writer; kicad-cli has no DSN export and RunAction names are unstable), runs the bundle headless with a deadline, and applies the SES as native undo steps through the IPC API (or into the file with a backup), then a DRC. Every reply of `kicad_autoroute` names both engines and says why the AI is the recommendation; the `kicad-autorouting` skill carries the choice, the AI recipe and the honesty rules. - **The hints decide nothing for the user.** The verb's `_hint` and `describe` entry tell the AI to ask the user which engine they want before routing, to say why `ai` is recommended, and to report which engine produced the copper. That is the same pattern as `foregroundReason`: the bridge makes the AI ask. ### Runs with no KiCad installed (already true, made visible in phase 1)
install.sh+1−1@@ -4,7 +4,7 @@ H="$(cd "$(dirname "$0")"&&pwd)" D="$HOME/.claude/skills" mkdir -p "$D/kicad-bridge" cp -f "$H/SKILL.md" "$D/kicad-bridge/SKILL.md"-for sk in kicad-interaction kicad-3d-models kicad-tour kicad-web-control kicad-uia kicad-bridge-dev kicad-bridge-publish kicad-bridge-hero kicad-bridge-test kicad-bridge-background; do+for sk in kicad-interaction kicad-3d-models kicad-autorouting kicad-tour kicad-web-control kicad-uia kicad-bridge-dev kicad-bridge-publish kicad-bridge-hero kicad-bridge-test kicad-bridge-background; do mkdir -p "$D/$sk" cp -f "$H/skills/$sk/SKILL.md" "$D/$sk/SKILL.md" done
package.json+2−1@@ -1,6 +1,6 @@ { "slug": "kicad-bridge",- "version": "1.0.137",+ "version": "1.0.138", "type": "app", "description": "Skills for your container so your AI knows how to drive the KiCad bridge. The bridge runtime itself is the release zip; Adom Bridge loads that.", "tags": [@@ -28,6 +28,7 @@ "uninstall.sh", "skills/kicad-interaction/SKILL.md", "skills/kicad-3d-models/SKILL.md",+ "skills/kicad-autorouting/SKILL.md", "skills/kicad-tour/SKILL.md", "skills/kicad-tour/tour_runner.py", "skills/kicad-web-control/SKILL.md",
skills/kicad-autorouting/SKILL.mdadded+38@@ -0,0 +1,38 @@+---+name: kicad-autorouting+description: How to route a KiCad board through the Adom KiCad Bridge, and how to choose between the two engines the bridge offers: AI routing (the AI plans each trace and commits it through kicad_route_net as a native undo step with a DRC check; recommended) and Freerouting (a deterministic autorouter, installed on demand into the bridge cache, about 141 MB, uninstallable on its own). Covers asking the user which engine they want, the AI routing recipe, kicad_autoroute, kicad_freerouting status install uninstall, what Freerouting bundles (its own Java runtime, nothing installed on the PC), and verification. Trigger words: autoroute, autorouter, route the board, route this pcb, freerouting, install freerouting, uninstall freerouting, ai routing, route_net, routing engine, which router, traces, unrouted nets.+---++# Routing a board: two engines, the user chooses++The bridge never routes on its own initiative and never picks the engine for the user. `kicad_autoroute` with no `engine` answers `engine_required` and describes both. Ask the user which they want, in one sentence, with the recommendation and the reason. Then do exactly that.++| Engine | What it is | When |+|---|---|---|+| `ai` (recommended) | You plan every trace from the board's pads, nets and existing copper, and commit each through `kicad_route_net`: one native Undo step per call, DRC-checked against a snapshot before it lands. You see the schematic's intent (current, return paths, thermals) and can explain every trace. GPT-6 Astra in Codex has routed a 94-footprint public board this way to zero unconnected items (recorded on the adom/codex page); Claude Fable 5.1 drives the same verbs; newer models will be better still. | Default. Anything the user will look at, review, or ship. |+| `freerouting` | Freerouting 2.4.1, the open-source shape-based autorouter everyone else wraps. Deterministic, fast on simple boards, no judgement. Not part of KiCad and not installed by default: the bridge fetches it only when the user asks. | The user wants a quick deterministic pass, or a first draft to hand-tune. |++Say the sizes when you offer Freerouting: an 88 MB download once, 141 MB on disk in the bridge cache, removable with one call. Do not install it without the user saying yes.++## AI routing, step by step++1. `kicad_routing_state {"filePath": B}` with the board open in the PCB editor and the IPC API on (`kicad_ipc_api {}` tells you; `no_pcb_frame` means the PCB editor must be the KiCad process that owns the API socket, see the kicad-bridge skill). Read `revision`, the pads, `netsRemaining`, existing copper.+2. Plan a net: waypoints from pad to pad, a layer per segment, vias where you change layer. Keep clearance in mind; the DRC will tell you when you did not.+3. `kicad_route_net {"filePath": B, "expectedRevision": "<rev>", "net": "NET_1", "points": ["J1.1", [112, 85], [138, 85], "J2.1"], "width": 0.25, "dryRun": true}` first; read `drc`; then the same call without `dryRun`. A crossing or clearance hit comes back as `drc_rejected` and nothing lands. A stale revision comes back as `stale_board`: read state again.+4. Repeat per net. `kicad_remove_route` takes back a commit by `itemIds`. `kicad_routing_validate` gives the board-level DRC at the end.+5. The board is not saved for you; the user saves, or you tell them what to review first.++The worked examples, power pours and current-density review live in the adom/codex electrical-routing guide (`docs/ELECTRICAL-ROUTING.md` on the adom/codex page). Read it for anything beyond connectivity.++## Freerouting, on demand++- `kicad_freerouting {"action": "status"}`: installed or not, version, folder size. Cheap; call it before offering the engine so you can say "installed" or "88 MB download".+- `kicad_freerouting {"action": "install"}`: downloads Freerouting's own Windows bundle from its GitHub release, extracts it with an administrative extract (files only, no registry, no shortcuts, no elevation) into `%LOCALAPPDATA%\Adom Bridge\freerouting\`, verifies the executable answers, deletes the archive. Freerouting ships its own Java runtime inside that folder: nothing named Java is installed on the PC, nothing goes on PATH. About a minute on a normal connection; the reply carries the timings. On Linux the same verb uses their Linux bundle; macOS is not supported yet.+- `kicad_autoroute {"engine": "freerouting", "filePath": B, "passes": 20}`: writes a Specctra DSN from the board, runs Freerouting headless with a deadline, reads the SES back, and lands the copper: as native Undo steps through the IPC API when the PCB editor has the board open, or into the file with a `.adom-bak` when it does not. Then a DRC. Read `routed`, `drc` and `applied`; tell the user what to inspect. `dryRun: true` routes but lands nothing.+- `kicad_freerouting {"action": "uninstall"}`: removes that folder and nothing else. The bridge keeps working; the engine is offered again next time and installs again on request. `kicad_uninstall` (the bridge's own removal) also removes it.++## Honesty rules++- Never say a board is routed because a verb returned success; say what `drc` and `unconnected` say.+- Freerouting's result is connectivity, not electrical sign-off. Current, impedance and thermal review remain the user's or the AI's job.+- If Freerouting is not installed and the user did not ask for it, do not install it. Offer, with the size, and wait.
uninstall.sh+1−1@@ -1,7 +1,7 @@ #!/usr/bin/env bash set -euo pipefail D="$HOME/.claude/skills"-rm -rf "$D/kicad-bridge" "$D/kicad-interaction" "$D/kicad-3d-models" "$D/kicad-tour" \+rm -rf "$D/kicad-bridge" "$D/kicad-interaction" "$D/kicad-3d-models" "$D/kicad-autorouting" "$D/kicad-tour" \ "$D/kicad-bridge-dev" "$D/kicad-bridge-publish" "$D/kicad-bridge-hero" "$D/kicad-bridge-test" "$D/kicad-bridge-background" \ "$D/adom-desktop-kicad-bridge" echo "[kicad-bridge] skills removed."