Read thorugh the current agent system: this means how the agent is prompted, how it creates tool calls to make changes, etc. Give me a brief summary of what you read
Assistant· claude-opus-4-8
I'll explore the codebase to find the agent system you're referring to. Let me search for it.
Assistant· claude-opus-4-8
Here's a brief summary of the zeo agent system, based on reading through src/zeo/agent/:
What I read
Architecture. It's a native C++ agent embedded in the (KiCad-based) editor, living in src/zeo/agent/. A wxWidgets chat window (agent_frame.cpp) drives a state machine (core/chat_controller.cpp) that talks to Claude through a streaming HTTP client (agent_llm_client.cpp).
How it's prompted. The system prompt is assembled at startup in AGENT_FRAME::LoadAndSetSystemPrompt() by concatenating three markdown files from the app bundle:
prompts/core.md — the main KiCad-design persona, workflow ("always call check_status first"), and conventions.
prompts/plan.md — a read-only "planner" addendum appended only in PLAN mode.
How tools are defined.tools/tool_manifest.json is the single source of truth — each entry has a name, description, JSON input_schema, owning app (sch/pcb/mbs/agent), a Python script path, read_only, group, and deferred flags. tool_schemas.cpp loads these plus a few hard-coded general tools into the request as native Anthropic tools.
How it makes/executes changes. Standard Anthropic native tool-use loop:
Request goes to <ZEO_BASE_URL>/api/llm/messages (an authenticated proxy in front of Claude, Bearer token from Supabase/keychain), streamed via SSE on a background thread.
The SSE callback parses tool_use blocks, accumulates the JSON input, and posts wx events to the main thread.
chat_controller batches the pending tool calls and dispatches them through TOOL_REGISTRY to handlers. Most editing tools (sch_*, pcb_*) route to PYTHON_TOOL_HANDLER, which loads the tool's Python script + a shared preamble.py and ships it over IPC to the live editor, which runs it against in-memory state (changes aren't saved until the user hits Cmd+S). Other tools (check_status, screenshot, file I/O) are handled directly in C++.
Results are appended to history as tool_result messages and the loop continues until the model ends its turn.
Model. Defaults to claude-opus-4-7, with claude-opus-4-6 and claude-sonnet-4-6 selectable.
One note: the report from my search is detailed but largely paraphrased the code — if you want, I can pull exact line numbers and verbatim text for any specific piece (e.g., the streaming parser, the tool-batching/classification logic, or the full core.md). Which part are you most interested in digging into?
User
There is a large problem with this system: the agent is really bad at spatial awareness. To fix this, we want the agent to write a DSL, likely a fork of https://github.com/diodeinc/pcb, which you can read in ../../pcb and use a compiler that we prototyped in a project called zeo1 (../zeo1). The idea of this change is that the agent writes all the nets and pins in a DSL where we can include other options in that DSL for the agent to enforce constraints, breakpoints to declare what groups should be together on a schematic, etc. Read thorugh all of these and let's think about the implementation and what we would need to change. Note Zeo, has a rust API under zeo-rust, but it has not updated like zeo-python to have full control over the entire system. If we are using a DSL, we may not even need that full control, so let's think about what needs to happen for this to work. Also note that this is a full roudtrip system. When a user edits a schamtiatc, those edits are also made to the DSL as well as diffed so an agent can keep track of changes.
Assistant· claude-opus-4-8
This is a meaty architectural exploration. Let me first verify the paths and repo layout, then fan out focused research across the relevant codebases.
Assistant· claude-opus-4-8
Good, all paths exist. Let me get a quick structural overview of each codebase before dispatching deep-dive research.
Assistant· claude-opus-4-8
All four target codebases are present. Key finding already: zeo1 is "code-first" with .zeo as source of truth and schematics as derived views — which is essentially the roundtrip architecture being described. Let me fan out deep research across the four relevant systems in parallel.
Assistant· claude-opus-4-8
I've now read through all four systems (zeo1's zeo-lang, the diodeinc pcb/Zener compiler, zeo-rust, and zeo-python/kipy) plus the existing agent. Here's my synthesis and how I'd think about the implementation.
The core reframe (and why this is the right fix)
Today the agent manipulates the schematic geometrically: sch_add slides symbols to avoid collisions, sch_connect_net runs A* routing, the agent reasons about x/y, pin positions, rotations. That's asking an LLM to do the one thing it's worst at. The DSL approach removes geometry from the agent's job entirely — the agent declares logical intent (components, nets, pin→net bindings, constraints, grouping) and a compiler + auto-placer owns all spatial decisions.
Crucially, zeo1 was already designed around exactly this thesis ("code-first: .zeo is the source of truth, visual schematics are derived views") and pcb/Zener is a mature production version of the same idea. So we're not inventing — we're choosing which engine to adopt and how to wire it into the current KiCad-fork product.
What each codebase actually gives us
System
Verdict for this project
zeo1 zeo-lang
Python-like .zeo DSL with a working compiler AND decompiler, deterministic output, constrain blocks that round-trip (incl. impedance — your current branch), and a real schematic auto-layout pipeline (cluster→place→route→label). But: prototype-grade (control flow is single-statement only, DSL group/module don't survive recompile), decompile is destructive (regenerates from scratch, kills comments), and it runs on its own ECS World, not KiCad.
pcb / Zener
The strongest language + compiler (Starlark, MIT-licensed, LSP, hierarchical modules, KiCad-native symbols/footprints, net-class/impedance/diff-pair metadata). But it is strictly one-way (.zen → netlist/layout), has no live view→DSL topology sync, no length-matching, and a soft dependency on Diode's hosted API for search/BOM. Its pcb import is a one-shot KiCad→.zen decompiler — a good starting point for the reverse direction but regenerate-only, not incremental.
Assistant· claude-opus-4-8
Good — those three choices lock the design, and together they're the most demanding but coherent combination. Let me lay out the resulting architecture, the one real tension they create, and what we'd build.
The pivot: pcb_sch::Schematic as the common currency
The elegant consequence of "fork Zener" + "KiCad is truth" is that both directions route through Zener's netlist IR (pcb_sch::Schematic — a serde-serializable, read-only netlist of instances + nets). Everything becomes a translation to/from that pivot:
DSL → view:evaluate(.zen) → IR, diff IR against the current board's netlist, apply the delta through kipy (create/delete symbols, set value/footprint, connect via labels), then run a placement service for any new symbols.
view → DSL: read the live schematic through kipy → build an IR → patch the existing .zen AST so it compiles to that IR.
Diffing: compare IR-vs-IR semantically (robust to cosmetic noise) → feed the agent; text-diff the .zen for human review.
The IR is the contract; neither side ever talks geometry to the agent.
The one real tension to resolve up front
"KiCad is truth" + "preserve human structure" collide at exactly one place, and it's the classic bidirectional-transform / view-update problem. Example: the has
Assistant· claude-opus-4-8
I've recorded the direction. To recap where we landed:
The plan: the agent authors a forked Zener DSL of logical intent; a compiler + deterministic placement service owns all geometry, eliminating the spatial-reasoning problem. The live KiCad document stays the source of truth and the DSL is a projection on top of it. Both directions pivot through Zener's pcb_sch::Schematic netlist IR, with kipy as the KiCad bridge. Roundtrips preserve human-authored structure via in-place AST patching, with lowering-on-conflict as the escape hatch for the view-update problem.
The two things I'd most want to validate next, in order, are Phase 0 (prove the forked Zener compiles against Zeo's bundled libraries with the Diode API removed) and the Phase 3 structure-preserving patcher spike (the genuine research risk). Point me at one when you're ready and I'll dig in — until then this stays at the design level.
User
Interesting note on the zeo-rust/zeo-python problem. We build out zeo-python to allow it to have full schamtic communication. The IPC hooks in application already exist so the question is would wiring up zeo-rust to those hooks be a trivial problem. There is also this rust package: https://github.com/Milind220/kicad-ipc-rs which seems to be al alternative to the rust ipc library. I would prefer to use zeo-rust as that makes it easer to merge back into KiCad, but this is also an option
Assistant· claude-opus-4-8
Good question — and it connects directly to the DSL plan, because the DSL bridge needs a much smaller API surface than full kipy parity. Let me verify the actual proto/codegen situation in the repo rather than rely on the earlier summary, and look at the alternative library.
Assistant· claude-opus-4-8
zeo-rust is a near-verbatim vendored copy of KiCad's upstream kicad-api-rs (GPL-3.0), and its codegen walks all.proto files under kicad/api/proto and generates bindings for every one. So the real question isn't "can it do schematic" — it's whether the proto tree it compiles against contains the schematic protos (Zeo's C++ fork added those; upstream KiCad's API was board-only). Let me check that, find the canonical schematic protos, and look at the alternative library.
Assistant· claude-opus-4-8
Now I have the concrete picture. Let me quantify the actual surface so the "trivial?" answer is grounded.
Assistant· claude-opus-4-8
Verified against the actual code — here's the grounded answer.
Is wiring zeo-rust to schematic "trivial"?
Low-risk and mostly mechanical, but not zero-effort. The reason it's not scary: every layer below the wrapper already exists.
The C++ hooks exist. Zeo's canonical schematic protos are at src/zeo/api/proto/schematic/ — 2,506 lines, 206 message types, ~100 command request/response pairs (annotation, ERC, nets, sheet hierarchy, transformed pin positions, design blocks, MBS, etc.). The C++ app implements all these handlers — that's exactly what kipy talks to.
The transport is done and generic. zeo-rust's NNG/protobuf send_request + ApiRequest/ApiResponse envelope is app-agnostic; it packs any Any message. Nothing schematic-specific is needed there.
The codegen is automatic.build/protobuf.rs recursively walks the entire proto tree and generates Rust for every .proto. zeo-rust is board-only today purely because its proto source (kicad/api/proto) points at upstream KiCad's board-only set — and in this checkout that path is empty/unregistered, so zeo-rust currently won't even build.
So the work is three steps, in increasing effort:
Point codegen at Zeo's tree. Change the include path in build/protobuf.rs from the absent kicad/api/proto to src/zeo/api/proto (vendor or symlink). This both fixes the build and generates all 206 schematic message structs for free — no hand-written protos. Small, fiddly (paths + GPL headers).
Schematic item CRUD comes nearly free. Here's the key find: creating/moving/deleting symbols, wires, labels, junctions flows through the genericCreateItems / GetItems / UpdateItems / DeleteItems editor commands in common/commands/editor_commands.proto — the exact commands board.rs already wraps (just with schematic item types instead of Track/Via). So you add a Schematic handle mirroring Board (392 lines is the whole template) plus item wrapper types following the same unpack_any + getter/setter pattern. Purely mechanical.
Schematic-specific commands (GetNets/GetNetItems, , , sheet hierarchy, …) are individual ~10-20-line request/response wrappers — add only the ones you need.
Assistant· claude-opus-4-8
Bottom line: wiring zeo-rust to schematic is mechanical, not hard — the protos and C++ handlers already exist, the transport is generic, and ~half the surface (symbol/wire/label CRUD) rides the same generic editor commands board.rs already wraps. The DSL bridge only needs a ~20-30-method subset. Stick with zeo-rust over kicad-ipc-rs (the latter is also board-only and MIT, so it neither closes the schematic gap nor helps you merge upstream), and the bonus is a single-language Rust pipeline since Zener is Rust too.
Want me to spike step 1 — repoint zeo-rust's codegen at src/zeo/api/proto and confirm the schematic bindings generate and compile? That's the cheapest way to validate the whole premise before any wrapper work.
User
no changes to the code for now, just planning - we will plan in detail on linear and then proceed to implementation. The next thing to discuss are the changes to the Zener language itself. The idea is to reduce the amount of tool calls made with questionable feedback to the model and instead try and declaure everything in the code files. This includes seperate boards, seperate sheets, groups of symbols together, contraints, impedence control values, etc. LEt's go through the current features of the languauge and see where we will need to expand it for our use
Assistant· claude-opus-4-8
No code changes — just language design planning. Let me pull the actual current Zener spec and stdlib so the gap analysis is precise rather than from memory.
Assistant· claude-opus-4-8
Let me read the spec and the key stdlib/config files that define current capabilities.
Assistant· claude-opus-4-8
Now let me read the board config, properties (Layout/Hint), and interfaces stdlib to nail down the current constraint/grouping primitives.
Assistant· claude-opus-4-8
I now have the full current Zener surface in front of me. Here's a feature-by-feature inventory and where we'd need to extend it for the "declare everything in code" goal. This is framed for a Linear breakdown.
NetClass.single_ended_impedance, .differential_pair_impedance, diff_pair_width/gap, predefined 50Ω SE / 85/90/100Ω diff classes per stackup
board_config.zen
Placement hints
Layout(hints=[Hint.near(a,b), Hint.right(…)…]) → advisory layout_hints property (PCB, not schematic)
properties.zen
User
Let's compare this to .zeo. I prefer to use Zener since its being actively developed unlike .zeo which was a prototype, but a place where we considered a lot of these problems. It is however, not a fully fluched out languange. LEt's see if the .zeo answers some of the open design questions for us
Assistant· claude-opus-4-8
Good instinct — .zeo's whole reason for existing was wrestling with exactly these problems, even if the language never shipped. Let me pull the actual .zeo syntax for the constructs that map to our open questions (constraints, multi-board, groups, sheets) rather than rely on the earlier summary.
User
[Request interrupted by user for tool use]
User
proceed
Assistant· claude-opus-4-8
.zeo turns out to answer four of our five open questions directly — because its whole data model was built around these exact concepts as first-class entities, even though the language around them never got fleshed out. Here's what it decided, mapped onto our open questions.
The core structural difference
Zener carries design intent as strings on the generic add_property channel plus a few scattered typed spots (Net(impedance=), DiffPair(impedance=), NetClass). .zeo made every one of these a typed first-class entity in its store: NetConstraints, Sheet, Group, Board/Connection. That single decision is what makes them round-trip in .zeo — and it's the strongest signal for our fork.
Concept
Zener today
.zeo
Per-net constraints
scattered (Net(impedance), netclass)
one NetConstraints struct + constrain <net>: block
first-class Sheet (hierarchical, pins, paper size)
Groups
none (module only)
first-class Group (scoped, nestable, property bag)
Multi-board
none
board "x": include:[…] + connection "y": from/to
What .zeo answers, question by question
Q2 (sheet model) → "sheets = module/file boundaries." .zeo's decompile_per_sheet emits one file per sheet and reconstructs the hierarchy with load(). It did not invent a separate Sheet() block in the language — the file/module boundary is the sheet. This validates keeping Zener's existing Module→KiCad-sheet mapping rather than adding a parallel Sheet() primitive. We just need to make it controllable (title, ordering — is already the seed). So my earlier "Sheet() block" strawman is probably the wrong call;
User
If we were to fork pcb, could we make all the additions from .zeo in pcb? .zeo was inspired by pcb in the first place
Assistant· claude-opus-4-8
Short answer: yes — every .zeo addition is expressible in a Zener fork, and Zener is actually a better base to add them to than .zeo was. But there's one reframing that matters: .zeo's additions are really two separate things, and only one of them is "add a feature to pcb."
The split that matters
.zeo's value was in two layers:
Forward expression — the language constructs + the typed entities they produce (constrain block, NetConstraints, Group, Sheet, board/connection).
Roundtrip machinery — the World + op-log + stable-UUID entities + decompiler that made those entities survive edits.
Layer 1 ports to pcb cleanly. Layer 2 is not a thing you "add to pcb" at all — it's the reverse-patcher + KiCad-as-truth + identity-map we already scoped as our own build, and we'd build it regardless of which DSL we forked. So .zeo's first-class-entity design becomes guidance for what to promote to first-class IR (and store in KiCad) so our separately-built roundtrip has stable anchors — not code we copy.
One architectural caveat (cosmetic)
.zeo used indented block syntax: constrain VCC:, group X:, board "x":. Zener is Starlark, and you can't add new block grammar without forking the starlark-rust parser (not worth it). So these all become function/record calls instead of blocks:
Not usable for this. It's a dev-preview wrapping only PCB tracks/arcs/vias — zero schematic API. You correctly guessed we may not need it; with a DSL-on-KiCad approach we don't touch it at all.
zeo-python (kipy)
The real workhorse. Research confirms it can read ~95% of schematic state (symbols, pins w/ transformed positions, wires, labels, nets, buses, sheets, properties) and write everything needed (create/move/delete symbols, wires, labels, power, junctions, net-class assignment), with transactional commits. This is what makes a DSL-on-KiCad roundtrip feasible without rebuilding the editor.
The central architectural decision
There are two fundamentally different ways to introduce the DSL:
Strategy A — DSL/World is the truth, KiCad becomes a view (zeo1's bet). Architecturally "correct" and gives the cleanest roundtrip, but it means adopting zeo1's entire ECS + renderer and is effectively a product rewrite. Not shippable incrementally.
Strategy B — KiCad document stays the truth; DSL is a projection layer on top. You build a compiler (DSL → kipy mutations + auto-layout) and a decompiler (live KiCad state → DSL text, via kipy's read APIs), and diff the regenerated DSL. The agent edits DSL; user edits the canvas; both reconcile through the projection.
I'd strongly recommend Strategy B — it reuses the mature kipy API, ships incrementally alongside the existing agent, and doesn't bet the product on the zeo1 prototype.
The roundtrip — and the insight that makes it tractable
The hard requirement is your last sentence: user edits → reflected in the DSL → diffed so the agent tracks changes. The key design move that makes this feasible:
Keep geometry OUT of the canonical DSL. The DSL describes only the logical design (nets, pins, components, constraints, groups). Positions are derived by auto-placement and stored separately (like zeo1's .zeosch or Zener's # pcb:sch comments). Consequences:
DSL → view: compile logical intent, auto-place. Agent never sees coordinates. ✅ solves spatial awareness.
view → DSL: extract the connectivity graph from KiCad (kipy get_nets/get_net_items/symbols/values) and regenerate DSL. Because geometry isn't in the DSL, a user dragging a symbol produces no DSL diff (it's noise) — only topology changes (added part, new connection, changed value/footprint, new constraint) produce a diff. This turns "pixels ↔ DSL" into "netlist ↔ DSL," which is dramatically more stable and diffable.
Diffing: needs a deterministic canonical printer (zeo1's decompiler already sorts nets alphabetically and refs in natural order — we replicate that), plus ideally a semantic netlist diff (compare connectivity graphs, robust to cosmetic reordering). The agent consumes the semantic diff.
The honest tension here: deterministic full-regeneration destroys human-authored structure (comments, loops, module nesting) — confirmed in zeo1. For an agent-owned DSL artifact that's acceptable; if humans are meant to hand-maintain richly-structured DSL, you'd need in-place AST patching instead of regen, which is a much larger investment. This is a decision to make explicitly.
Constraints, groups, breakpoints
Constraints map naturally to a constrain <net>: block. zeo1 already implements impedance / max_trace_length / min_trace_width / length_matching and round-trips them — directly aligned with your ganesh/zeo-impedence-constraint branch. This is the most ready-to-go piece.
Groups / "what should be together on a sheet" is net-new in both bases. zeo1 has a Group ECS entity but DSL group declarations don't survive recompile; Zener expresses grouping structurally via Modules→sheets. You'll need group/breakpoint declarations that the auto-placer honors (place these refs on the same sheet/cluster) and that survive the roundtrip.
The genuinely new/risky work
Schematic auto-placement + auto-routing is the linchpin. If the agent stops doing geometry, the placer must be good. zeo1 has a real one (but on its own model); the current product only has the agent's ad-hoc Python. Porting/adapting a placer to drive kipy is probably the highest-risk, highest-value component.
Deterministic decompiler over kipy reads (KiCad → DSL), with stable ordering + semantic diff.
Group/breakpoint language + placement honoring + roundtrip.
Change-tracking loop: detect user edits (kipy commit hooks?), regenerate, diff, surface to agent.
Everything else (compiler → kipy mutations, library/symbol sourcing, constraints) leans on what already exists.
Before I go further and sketch a concrete phased plan + module layout, two decisions genuinely fork the design and I'd rather not guess:
.zen
python
for i in range(4):
Resistor(name="R{}".format(i), value="10k", P1=BUS, P2=GND)
The user deletes R3 on the canvas. There's no clean way to patch a for loop to mean "all but R3." Any structured abstraction (loops, def, module instantiation) can be invalidated by a canvas edit.
Proposed resolution — lowering-on-conflict. The reverse-patcher attempts minimal in-place edits. When a canvas change can be expressed against existing structure (change a value, rename a net, add a part to a flat list) it patches in place and structure is preserved everywhere. When it can't (the R3 case), the patcher expands only the smallest enclosing abstraction into explicit statements, applies the edit there, and leaves the rest of the file untouched. Determinism stays local; the agent can later re-fold a pattern back into a loop if it wants. I'd start flat (no loops/functions round-tripped) and add folding incrementally — comment/whitespace preservation via starlark-rust's codemap/AST is the achievable first milestone; abstraction-preserving folding is genuinely research-y.
This is the highest-risk part of the whole project and worth prototyping early to de-risk.
What we build, by component
Fork & embed Zener. Vendor the pcb-zen / pcb-zen-core / pcb-sch / pcb-eda / pcb-sexpr crates. Expose evaluate(.zen) → Schematic JSON as a Rust CLI/lib the C++ agent harness invokes (the repo already builds Rust via zeo-rust, so the toolchain exists). Excise the Diode hosted-API coupling and point symbol/footprint resolution at Zeo's bundled libraries/ KiCad libs instead of @kicad-* mirrors.
Netlist ⇄ KiCad bridge (kipy/Python). Two functions, reusing the existing Python-tool IPC execution path: apply(IR_delta) → kipy mutations, and extract() → IR from the live schematic. kipy already reads ~95% of state and writes everything needed, so this is wiring, not new editor capability.
Schematic placement service. This is load-bearing. Moving geometry off the agent means a deterministic placer must match today's quality. Repurpose the existing sch_add collision-slide and sch_connect_net A* logic as a service the compiler calls (not something the LLM reasons about). Zener's HierPlace is PCB-layout only — schematic placement is its own thing and largely net-new beyond what we salvage.
Netlist → .zen AST patcher (the reverse direction + lowering-on-conflict above).
Identity mapping. For incremental diffs and in-place patching to be stable, we need a durable correspondence between a Zener instance (hierarchical InstanceRef) and a KiCad symbol (KIID). Store the InstanceRef in a KiCad symbol field (or a sidecar map) so re-extraction lines up with prior DSL. Subtle but essential — if identity drifts, every diff is noise.
Language additions: constraints + groups. Zener has impedance/diff-pair/net-class metadata but no length-matching and grouping only via Modules. Add a length-match primitive and first-class group / breakpoint directives that (a) the placement service honors as "keep these on the same sheet/cluster" and (b) survive the roundtrip. This is where your ganesh/zeo-impedence-constraint work lands in the DSL.
Agent reprompt + tool swap. Replace sch_add / sch_connect_net with DSL tools (write_dsl, compile, read_diff); rewrite core.md / agent.md to instruct logical DSL authoring and forbid coordinate reasoning.
Suggested phasing (each ships value independently)
Phase 0 — Pivot spike: vendor pcb, get evaluate(.zen) → IR JSON building in-repo, drop Diode API, resolve symbols from Zeo's libs. Prove a tiny .zen compiles offline.
Phase 1 — DSL → view (one-way): IR → kipy apply + placement service + agent writes .zen. This alone fixes spatial awareness and is shippable.
Phase 2 — view → DSL (regenerate-only): kipy extract → IR → pcb import-style .zen generation + semantic diff. Agent can now track user edits (interim: structure not yet preserved).
Phase 4 — constraints + groups/breakpoints + length-match in the language and placer.
Things to keep on the risk register
Bidirectional structure preservation (Phase 3) is the hard research problem — de-risk early.
Placement-service quality must meet today's bar or schematics regress visually.
3-language pipeline (C++ harness → Rust Zener → Python kipy) — manageable but real seams.
Fork drift from upstream pcb once we add length-match/groups — maintenance cost.
zeo-rust is irrelevant to all of this; we can leave it untouched.
Want me to go deeper on any one of these next — e.g., prototype the Phase 0 pivot to confirm Zener compiles cleanly against Zeo's bundled libraries without the Diode API, or spec the IR ⇄ kipy delta protocol in detail? I'll hold off writing code until you point me at a starting phase.
Let me also record this direction so it carries across sessions:
RunERC
GetAllTransformedPinPositions
AssignNetToClass
Volume vs. difficulty: full kipy parity (16 functional areas, 206 messages) is large but boring. The DSL bridge needs only a focused ~20-30-method subset:
That's a few days of board.rs-pattern wrapping, not a rewrite.
The one thing you don't get for free: kipy's Python-side intelligence — sch_add's collision-sliding, sch_connect_net's A* routing — is Python logic, not protos. (Transformed-pin math is a proto command, so that's covered.) But under the DSL plan those heuristics become the deterministic placement service anyway, so reimplementing them in Rust is work you'd do regardless.
Why this is strategically better than I first framed it
We chose to fork Zener, which is Rust. If the KiCad bridge is also Rust (zeo-rust), the whole DSL → IR → KiCad pipeline is one Rust process — it eliminates the C++→Rust→Python seam I listed as a risk last turn. So building out zeo-rust's schematic subset isn't only about "mergeable upstream to KiCad" — it collapses the pipeline to a single language. That's a real second reason to prefer it.
kicad-ipc-rs verdict
It doesn't solve the actual gap. It's also board-only — its "100% coverage (59/59 commands)" means 100% of upstream KiCad's board API. The schematic half — the half you need — is just as unbuilt there, and you'd still have to graft Zeo's schematic protos onto someone else's abstraction. Its advantages (async-first, typed commit sessions, EditablePcbItem, zero-protobuf-for-consumers) are nicer ergonomics for the board half you don't need, and it's MIT/third-party, which cuts against your merge-back-to-KiCad goal.
Recommendation: stay with zeo-rust (GPL, KiCad-aligned, mergeable, and it collapses the pipeline to Rust), but steal kicad-ipc-rs's design ideas — specifically typed commit sessions and an EditableSchematicItem-style mutation layer — when you write the wrapper, since you're building it from scratch anyway.
One licensing note to keep on the radar: zeo-rust is GPL-3.0-or-later (it's literally KiCad's crate) and Zener/pcb is MIT. Combining them is fine — the linked result just becomes GPL — which matters only if any piece is meant to be redistributed separately. Not a blocker for an internal product pipeline.
Let me fold this refinement into the project memory:
only # pcb:sch <id> x= y= rot= comments (tooling-written) + separate KiCad layout file
comments
Two extension levers to keep in mind throughout: most metadata rides the generic builtin.add_property(...) channel (pure-Starlark stdlib, cheap), while anything that needs first-class structure in the pcb_sch::Schematic IR + roundtrip needs Rust core changes (expensive). I'll tag each gap with which it needs.
Gap analysis by your requirement
1. Separate boards (multi-board systems) — biggest gap
Today: Zener is fundamentally one board per build — a single [board] in pcb.toml, a single Board() call. There is no multi-board container and no cross-board net concept. Meanwhile the Zeo product already has a rich MBS layer (the protos expose GetCrossBoardNets, GetMultiBoardContainerInfo, MbsRules — min-power-pin, max-length, diff-pair, current, voltage — SyncCrossBoardNetsToPcb, multi-board netclass/library reports).
Extension needed (core): a top-level System/MultiBoard primitive that instantiates multiple boards and declares the nets crossing between them, plus MBS-rule declarations. Strawman:
Roundtrip: maps to the existing MBS proto surface — extraction is feasible since the product already models cross-board nets. This is the largest piece and arguably its own epic.
2. Separate sheets (schematic organization) — missing
Today: no sheet/page concept in the language. Module boundaries implicitly become KiCad sheets/groups; schematic="collapse"|"embed" is the only render control. The agent can't declare "put this on sheet 2," sheet titles, or sheet ordering — which is exactly what forces today's place-then-screenshot-then-adjust tool loops.
plus an optional sheet= arg on module/component instantiation. Roundtrip: clean — KiCad has real sheets; extraction reads the sheet tree. This is the highest value-per-effort item because it directly kills the spatial trial-and-error loop.
3. Groups of symbols together (breakpoints) — missing as a lightweight primitive
Today: the only grouping is "make it a Module" (heavyweight: needs io()/config()) or PCB Hint.near() (physical, not schematic). There's no "keep R1/R2/C1 clustered on the schematic" without a full module.
Extension needed: a lightweight Group(...)/cluster directive that the schematic auto-placer honors as a keep-together constraint and that survives roundtrip. Strawman:
Roundtrip: KiCad has groups → maps to a real KiCad group object (extractable). Schematic-side Hint-equivalents (near/left/above) for the schematic placer are a natural addition mirroring the existing PCB Hint. Level: group membership likely needs light core/IR support; keep-together hints can ride add_property.
Today, scattered across three places: net-level (Net(impedance=)), interface-level (DiffPair(impedance=)), and board-level (NetClass with SE/diff impedance, track width, gap). Missing entirely: length-matching (explicitly noted absent + the KiCad SWIG limitation on diff-pair dimensions), a clean net→netclass assignment from the schematic side, and per-group routing constraints (max length, layer restriction).
Extensions needed:
Length matching (the headline gap): match_length([USB_DP, USB_DM], tolerance="0.1mm") / MatchGroup(...). No KiCad-native home → needs a custom net property or sidecar for roundtrip. (core or property-channel)
Declarative net→netclass binding so the agent writes netclass(CLK, "50Ohm SE") instead of a separate AssignNetToClass tool call. (maps to AssignNetToClass proto — roundtrips cleanly)
First-class controlled-impedance ergonomics: today Net(impedance=Impedance(50)) exists but doesn't auto-bind to a matching netclass. Make declaring an impedance auto-select/assign the appropriate netclass from the stackup presets. This is directly your ganesh/zeo-impedence-constraint work expressed in the DSL.
Diff-pair as a top-level declaration (not only via interface), with width/gap.
This consolidation is what lets the agent declare impedance/length/diff-pair inline at net-declaration time rather than via pcb_setup/AssignNetToClass/screenshot loops.
5. "Declare everything" — which tool calls each extension removes
Worth stating explicitly for the Linear framing, since the point is reducing low-signal tool calls:
Tool loop today
Replaced by declaration
sch_add + collision feedback + screenshot
component decl + auto-placer
sch_connect_net + A* + verify
pin→net binding (already declarative)
sch_place_companions placement loop
Group / Sheet + module
sch_label
net naming (already) + netclass binding
sch_setup / pcb_setup
Board() / BoardConfig (already)
AssignNetToClass
declarative netclass() / Net(impedance=)
Stays as tools (genuine actions/queries, not declarations — and that's fine): screenshot, check_status, extract_datasheet/datasheet_query, generate_symbol/generate_footprint (they produce the artifacts the DSL references), component search/sourcing, run_simulation, ERC/DRC runs, annotate.
Proposed additions — summary
#
Addition
Level
Roundtrip home
Effort/risk
1
System/multi-board + cross-board nets + MBS rules
core
MBS protos (exist)
High — own epic
2
Sheet() + sheet= arg
core
KiCad sheets
Med — high value
3
Group() schematic cluster + schematic Hints
core+stdlib
KiCad groups / property
Med
4a
match_length() / MatchGroup
core/property
custom prop/sidecar
Med — no KiCad home
4b
declarative netclass() binding
stdlib→builtin
AssignNetToClass
Low
4c
impedance auto-binds to netclass
stdlib
KiCad netclass
Low–Med
4d
top-level DiffPair decl
stdlib
netclass + props
Low
Open design questions for Linear
Multi-board scope — is true MBS (cross-board nets, one system) in scope for v1, or do we ship single-board first and treat MBS as a later epic? (It's the heaviest item and largely independent.)
Sheet model — explicit Sheet() blocks vs. a sheet= annotation on instances vs. "sheets = top-level module boundaries." Which is the authoring model? This affects both the placer and roundtrip.
Constraint home for length-match/keep-together — KiCad has no native slot for these. Custom net/group properties (roundtrip through KiCad) vs. a sidecar file (cleaner DSL, but a second source of truth to reconcile)?
stdlib vs. core boundary — how much do we push through the add_property channel (fast, no Rust changes) vs. promote to first-class IR (needed for clean roundtrip and the semantic diff)? My lean: constraints via properties, structure (boards/sheets/groups) via core IR.
Starlark ergonomics for the agent — Zener is Starlark, not Python (no f-strings, etc.). Do we accept that, or add sugar? Minor but affects agent prompting.
Want me to turn this into draft Linear issues (one epic per gap with the strawman syntax + roundtrip notes), or go deeper on one area first — I'd suggest Sheets + Groups since that's the highest value-per-effort for killing the spatial tool loops?
schematic="collapse"|"embed"
adopt .zeo's answer: module = sheet.
Q3 (groups) → a first-class Group, distinct from sheets, scoped + nestable + property-bagged. .zeo's Group has members, scope: Schematic(SheetId) | Board(String), parent (nesting), and a properties map explicitly for "autorouter directives, placement constraints," with the rule "a component belongs to at most one group per scope." This is exactly the lightweight "keep these together" cluster we wanted — separate from the sheet/module hierarchy. It gives us a clean two-level model: Module=sheet (heavyweight, has io/config), Group=intra-sheet cluster (lightweight, just members + hints).
Q4/Q3-home (where length-match & keep-together live) → hybrid, and .zeo spells out the split. Its constrain <net>: block round-trips the text-expressible fields:
…while the non-text-expressible fields (diff_pair_partner, route_priority, exclude_layers) "round-trip through the .zeo cache" — i.e. a sidecar, not the source text. That's a direct answer to our "custom property vs sidecar" question: both — simple scalar constraints in the DSL text, positional/relational ones in a sidecar. And note the length-match design: nets don't reference a central match_length([...]) list; each net independently records a named length_match_group string. That's strictly better for our roundtrip than my list strawman — membership is local to each net, so there's no central list to reconstruct from KiCad. Adopt the named-group form.
Q1 (multi-board scope) → a concrete, simpler model than full MBS. .zeo uses board "name": include: [modules] + connection "name": type: direct, from: "board.connector", to: "board.connector". Boards are named collections of shared modules; connections explicitly link board connectors. It's lighter than the product's MBS protos (cross-board nets, MBS rules like max-length/current/voltage), but it proves the shape is tractable and gives us a starting syntax. It confirms multi-board can be deferred to its own epic without blocking the rest.
Q5 (stdlib vs core) → .zeo votes hard for "core/first-class for anything that must round-trip." This is the meta-lesson, and it comes with a cautionary tale: .zeo's DSL group/moduledeclarations are flattened by the compiler and do NOT round-trip — only the Group/Moduleentities (created in the store) survive. In other words, .zeo proved that leaving structure as second-class loses it on roundtrip. For our fork that means: promote Sheet/Group/length-match/constraints to first-class IR in pcb_sch::Schematic, not add_property strings — otherwise the semantic diff and structure-preservation we committed to won't have anything stable to anchor on.
The one place .zeo does not help us
We chose KiCad-as-truth + text-structure preservation. .zeo took the opposite roundtrip path: its World/entities are truth and it regenerates flat DSL destructively (comments/loops/grouping in source are lost). So .zeo answers all the data-model questions but explicitly punted on text preservation — the hard thing we signed up for. Its constrain/Group/Sheet entity designs are portable; its decompile-from-store mechanism is not.
Net recommendation for the Zener fork
Take these four .zeo designs essentially as-is, re-homed onto first-class Zener IR:
Named length-match groups (per-net string), not list primitives.
Module = sheet (drop the separate Sheet() idea); add only title/ordering control.
First-class Group for intra-sheet clustering, scoped + nestable + hint properties.
Defer multi-board to its own epic, using .zeo's board/connection shape as the starting point but reconciling against the product's richer MBS protos.
This collapses our open-questions list to essentially one real decision left: how much of the MBS feature set to target in multi-board v1. Want me to fold this into the Linear breakdown — i.e. rewrite the proposed-additions table with .zeo's resolved designs and mark #1–4 as "design settled, port from .zeo" and #5 as the open epic?
Consolidated constrain
extend net-property channel (the same path DiffPair→differential_impedance already uses in convert.rs)
stdlib fn → small core
Low–Med
net props / netclass (text)
Named length-match group
net property length_match_group + tolerance
stdlib
Low
custom net prop or sidecar (no KiCad-native home)
Diff-pair partner + diff-Z
extends existing DiffPair propagation
core (small)
Low
netclass + net props
Module = sheet (title/order)
already how Zener maps modules→sheets; add add_property("sheet_title"/order)
stdlib
Low
KiCad sheets (native)
First-class Group
new IR concept in pcb-sch + capture instance handles in convert.rs
core
Med
KiCad groups (native)
Multi-board (board/connection)
new top-level container; pcb-sch models one board today; pcb.toml single [board]
core, deep
High
product MBS protos (exist)
The first four are net-/module-property extensions riding mechanisms pcb already has — these are easy. Only Group (needs a new IR node) and multi-board (needs the single-board assumption broken in IR + build flow) require real surgery, and both have a known KiCad/MBS storage home for roundtrip.
Why pcb is a better host than .zeo for these
Because Zener has a Starlark stdlib and .zeo didn't, we get an incremental path .zeo never had: prototype each addition in pure .zen stdlib first (via the existing add_property channel — constrain(), length-match, Group() all work as library functions with zero Rust changes), validate the design and the agent ergonomics, then promote the ones that need stable roundtrip to first-class IR. .zeo had to hardcode everything into the grammar up front; in pcb we can de-risk in the stdlib and only pay the Rust cost where .zeo's lesson says we must (Group, length-match anchors, multi-board).
The one real "but"
.zeo's first-class-entity lesson warns us exactly where the cheap stdlib path fails: its DSL group/module declarations were left second-class and got flattened — they didn't round-trip. So for anything we want to survive a user's canvas edit, the stdlib prototype is fine for forward-only validation, but it must be promoted to first-class IR + given a real KiCad storage home before it's trusted in the roundtrip. That's the boundary: stdlib to prove the design, core IR to make it durable.
So: forking pcb lets us reproduce all of .zeo's design thinking, port the four settled designs (constrain/length-match/module=sheet/Group), and the only genuinely large items remain the two that were large in .zeo too — Group's IR node (medium) and multi-board (the epic).
Want me to sketch what the first-class IR additions to pcb-sch would look like (a Group node + net-constraint fields on Net), since that's the part that determines whether the roundtrip has anchors?