KiCad - the KiCad Bridge
Public Made by Adomby adom
Drive your own KiCad from an AI, in the background: open every editor, read the whole board as data (the EDA Bridge Standard board model), stack-up, part heights, netlists, place, route, pour, DRC and exports.
Library rescan verb: installing a part costs a full KiCad restart, ~150s per part (75% of every run)
A library rescan verb, so installing a part does not cost a full KiCad restart
Installing a symbol/footprint into a library that KiCad already has open makes the new part invisible until KiCad re-reads its library tables. The bridge's current remedy is to restart the whole application. That is correct, and it works - it is just extremely expensive, and it dominates every batch workflow.
Measured today on kicad-bridge 0.9.236, KiCad 10.0, plugin 0.9.1 (pcbnew, IPC on 127.0.0.1:8871), running the web-control library card over Adom basic parts one at a time:
| n | min | median | max | |
|---|---|---|---|---|
| part needed NO restart | 3 | 50s | 55s | 105s |
| part triggered a restart | 14 | 184s | 212s | 619s |
14 of 17 parts triggered one. The restart is costing roughly 150 seconds per part, which is about 75% of the total. The actual proving work is cheap by comparison: three captures at a 3.5s settle each, about 10.5s, plus a few seconds to fetch, stage and install.
For a 30-part run that is ~50 minutes of restarts to do ~5 minutes of work.
What the bridge reports
From the card log of a part that hit it:
installed symbol into the 'Adom' library
Opening the 'Adom' library at 0603SAF1500T5E ...
step: Symbol Editor is up, letting it settle
step: navigating the library tree to '0603SAF1500T5E'
footprint: the bridge restarted KiCad to rebuild its cache and timed out
waiting for it. That work is DONE, so retrying once ...
waiting for the restarted KiCad to answer ...
Note the restart also frequently outlives its own budget - the caller sees a timeout, has to recognise that the restart IS the remedy rather than a failure, and retry. My card carries explicit code for exactly that, which is a sign the contract is doing something awkward:
var restarted = !ok && /cache predated|restarted kicad|ran out of time waiting/.test(msg);
The ask
A verb that makes a newly-installed part visible without bouncing the application - something like kicad_rescan_libraries {kind?: "symbol"|"footprint"|"both"}.
Two reasons to think this is achievable without a restart:
- KiCad re-reads its library tables on demand in normal use (the Manage Symbol/Footprint Libraries dialogs take effect without an application restart), so the capability exists inside the app.
- The bridge already has a resident IPC plugin inside the process (
pcbnew,:8871, answering RPC). It is in a position to ask the running instance to reload rather than kill and relaunch it.
If a full rescan is not reachable through the plugin API, even a narrower kicad_refresh_library {name} for a single library would remove nearly all of this cost, since we only ever touch the one Adom library.
Secondary asks, in priority order
- If a restart is genuinely unavoidable, make it explicit rather than a timeout. Returning
restarting: truewith astatusVerbto poll would be far better than a timeout the caller has to pattern-match on message text. Right now every caller has to reimplement the regex above or mis-read a successful remedy as a failure. - Batch-friendly install. If the restart cannot go away, a way to install N parts and rescan once would collapse 30 restarts into one. Today each install-then-prove cycle pays the full price.
Why this matters beyond speed
The per-part restart is also the source of the flakiness around it. The 619s outlier, the "cache predated" retries, and the timeouts-that-are-not-failures all trace back to the same place. Removing the restart removes that whole class at once.
What is working well, for balance
The library card itself passed 17 of 17 parts in this run, and every capture carried the correct Adom:<MPN> identity in its window title, so the bridge is opening the right library and loading the right part every time. The restart is a performance and contract problem, not a correctness one - with one exception I am filing separately: a single capture came back as a 100%-uniform white canvas while kicad-cli renders that same symbol to 221 drawn elements, which looks like a capture-before-render race.
Happy to re-run the 30-part matrix against any change and post before/after numbers - the harness is scripted and the timings above came straight out of it.