Skip to the talk

Lightning talk · 90 seconds

Teaching a language model to draw schematics

I ripped out the library that kept lying to me and built an engine that tells the truth.

  1. The problem

    The library kept lying to me

    mckicad is an MCP server that lets a language model design KiCad schematics on its own. For a long time it stood on kicad-sch-api — and that library kept returning wrong answers.

    Global labels: dropped silently. Custom library pins: empty lists. When the layer you build on returns confident nonsense, nothing downstream can be trusted. So I did the reckless thing and ripped it out.

  2. The engine

    A parser that round-trips clean

    The heart is sexp_tree — a full S-expression parser and serializer for KiCad's native format. Parse it, mutate it, write it back, byte-for-byte identical.

    On top sits SchDocument: load a schematic and ask it real questions. Where is every pin. What net is this wire on. Which labels actually connect. Answers from the file itself, not a guess.

  3. Autowire

    It routes around itself

    Place the components; autowire pulls the nets for you — with real collision detection, so wires route around each other instead of bridging into shorts.

    It clamps stub lengths when they would overlap, offsets labels so they don't collide, and tracks power-wire stubs as obstacles. The messy part of drawing a schematic, done carefully.

  4. It checks its own work

    One call, zero ambiguity

    run_schematic_erc runs the full electrical rules check and reports back: zero errors — or exactly what's wrong, and where.

    The engine grades its own homework, so the model gets a hard signal instead of a hopeful vibe.

  5. The proof

    It drew Timbre

    It generated the phase-1 bench schematic for Timbre, a Cypress PSoC-based synthesizer. Zero ERC errors.

    A language model, placing parts and pulling nets, for real hardware headed to a bench. That's the whole point.

1,900 lines of workaround code, deleted
“Replaced by an engine that just tells the truth.”