kicad monkey v2026.11.30
On This Page (7)

Complete Contract & Schema Catalog

This page indexes every machine-verifiable wire contract across kicad-monkey and kicad-cruncher: the 30 TypeSpec core schemas (Tier A), the 11 FabView schemas + geom.a0 (Tier C), and the KiCad Cruncher CLI config & output schemas (Tiers B & D).

tip

On the built documentation site, backticked .tsp and .json schema filenames below link directly to the raw published contract files.


1. kicad-monkey TypeSpec Core (8 Modules, 30 Schemas)

All 8 modules are imported by main.tsp under src/tsp/kicad_monkey/ and compiled into contracts/generated/schema/*.json with $schema = "https://json-schema.org/draft/2020-12/schema" and sealed objects (unevaluatedProperties: {not: {}}).

Module Summary

.tsp ModuleCompiled Schemas (Count)Wire Identity (schema or type + version)Key Payload ContentsExplicit Negative Assertions (Deliberately Omitted)
sexpr-a0.tspScanRequest.json, ScanResult.json, BuildRequest.json, BuildResult.json (4)kicad_monkey.sexpr_scan.{request,result} (a0), kicad_monkey.sexpr_build.{request,result} (a0)Selector (heads, paths, min_depth, max_depth, prune_heads), FormSpan (decimal-string uint64 byte offsets & line/col), generic Node AST (list/atom/quoted/integer/float), Diagnostic (lex/tree/build).Does not carry raw source file bytes (referenced out-of-band), formatting/indentation policy, or KiCad domain semantics (layers, nets, units).
footprint-a0.tspFootprintReadRequest.json, FootprintReadResult.json, FootprintEditRequest.json, FootprintEditResult.json (4)kicad_monkey.footprint_{read,edit}.{request,result} (a0)Footprint name, FootprintProperty list (name, value), targeted property mutation requests, changed flag, and byte-preserving edit results.Does not serialize full padstack/graphic AST trees or 3D model binaries; edits target a single footprint property without rewriting untouched S-expression forms.
symbol-library-a0.tspSymbolLibraryReadRequest.json, SymbolLibraryReadResult.json, SymbolLibraryEditRequest.json, SymbolLibraryEditResult.json (4)kicad_monkey.symbol_library_{read,edit}.{request,result} (a0)SymbolSummary entries and SymbolBooleanField (in_bom, on_board) targeted lossless boolean-field edits.Does not flatten inherited extends parent geometry, expand schematic instance overrides, or edit arbitrary symbol properties; operates strictly on library-level declarations and in_bom / on_board flags.
plotter-ir-a0.tspFootprintPlotRequest.json, FootprintPlotResult.json, FootprintPlotDocument.json, BoardPlotRequest.json, BoardPlotResult.json, BoardPlotDocument.json, SymbolPlotRequest.json, SymbolPlotResult.json, SymbolPlotDocument.json (9)Request/Result: kicad_monkey.{footprint,board,symbol}_plot.{request,result} (a0); Documents: schema: "kicad.plotter_ir.a0", source_kind: "MOD" | "PCB" | "SYM"Whole-nanometre (unit: "nm", y_axis: "down") display lists with 14 canonical PlotterOperation variants (ThickSegment, ArcThreePoint, Circle, Rect, PlotPoly, BezierCurve, Text, PlotImage, FlashPadCircle/Oval/Rect/RoundRect/Custom/Trapez) plus board StartBlock/EndBlock ownership scopes and embedded kicad.render_cache.v1 text strokes/polygons.Does not encode CSS/theme palettes, viewport sizing, SVG DOM ids, or electrical netlists. Footprint and symbol producer documents forbid board-only via roles and cached text polygons where cache-free canonical output is required.
schematic-plot-a0.tspSchematicPlotRequest.json, SchematicPlotResult.json, SchematicPlotDocument.json (3)Request/Result: kicad_monkey.schematic_plot.{request,result} (a0); Document: schema: "kicad.plotter_ir.a0", source_kind: "SCH"SchematicPlotCanvas, SchematicPlotTitleBlock, SchematicWorksheetMode, SchematicTextVariable overrides, SchematicDefaultLineWidthNm (≥ 84_700 nm), and 23 typed Schematic*PlotRecord kinds (sheet_header, wire, bus, bus_entry, junction, no_connect, label, global_label, hierarchical_label, netclass_flag, text, text_box, graphic_*, rule_area, image, table, symbol_instance, symbol_overplot, sheet).Does not perform filesystem discovery (worksheets, fonts, and project variables arrive explicitly), does not carry PCB layers arrays on schematic segments, and does not compute electrical net equivalence (that belongs to CompiledSchematicGraph).
compiled-schematic-graph-a0.tspCompiledSchematicGraph.json (1)schema: "kicad_monkey.compiled_schematic_graph.a0", type: "sch.compiled_schematic_graph", $id: "urn:wavenumber:schema:kicad_monkey.compiled_schematic_graph:a0"Variant-neutral hierarchical schematic connectivity across 10 canonical collections with deterministic UUIDv7 identities and review-safe graphical artifact links (see deep dive below).Does not embed rendered SVG/Plotter IR geometry, PCB footprints/placements, or variant-filtered BOM rows; bare SVG id strings are explicitly not authoritative identities across reused hierarchical sheets.
source-bundle-a0.tspSourceBundleManifest.json (1)schema: "kicad_monkey.source_bundle_manifest.a0", type: "kicad_monkey.source_bundle_manifest", $id: "urn:wavenumber:schema:kicad_monkey.source_bundle_manifest:a0"Inventory of schematic/project source files (SourceKind: project, schematic, symbol_library, symbol_table, worksheet, other) with SourceSlot indices and CanonicalUint64Decimal source_bytes lengths.Deliberately never inlines raw file text or binary payloads into JSON (and carries no SHA-256 hashes); bytes travel out-of-band indexed by SourceSlot.
font-text-a0.tspFontBundleManifest.json, FontResolutionRequest.json, ShapingRecord.json, OutlineVector.json (4)kicad_monkey.{font_bundle,font_resolution_request,shaping_record,outline_vector}.a0Slot-indexed font container inventory (FontBundleEntry, SHA-256, StableTextId, FontVariationCoordinate), font-selection requests, HarfBuzz-compatible ShapingRecord (ShapingInput, ShapedGlyph, TextDirection, ShapingClusterLevel), and cubic/quadratic OutlineVector glyph paths (MoveTo/LineTo/QuadTo/CurveTo/Close).Does not inline .ttf/.otf/.woff2 font bytes in JSON, does not carry OS-specific filesystem font paths as authoritative identity, and leaves polygon tessellation / stroke expansion to consumers.

Deep Dive: CompiledSchematicGraph (compiled-schematic-graph-a0.tsp)

CompiledSchematicGraph.json (kicad_monkey.compiled_schematic_graph.a0) is the source-neutral electrical and hierarchy backbone shared by kcr design, k3 design, and downstream viewers. It organizes a compiled schematic hierarchy into 10 collections:

  1. unit_definitions (sch.unit_definition)
  2. page_definitions (sch.page_definition)
  3. unit_occurrences (sch.unit_occurrence)
  4. page_occurrences (sch.page_occurrence)
  5. hierarchy_occurrences (sch.hierarchy_occurrence)
  6. component_occurrences (sch.component_occurrence)
  7. local_net_occurrences (sch.local_net_occurrence)
  8. terminal_occurrences (sch.terminal_occurrence)
  9. hierarchy_terminal_bindings (sch.hierarchy_terminal_binding)
  10. graphical_artifact_links (sch.graphical_artifact_link)

Every node receives a deterministic UUIDv7 identity derived from the design scope and hierarchical path, and every link to a rendered drawing uses the three-part review-safe identity tuple:

text
(page_occurrence_ref, artifact_key, element_id)

For schematic SVGs and Plotter IR scenes, artifact_key is "sch.dwg_scene". Because KiCad reuses the same .kicad_sch file across multiple hierarchical sheet instances, a bare SVG element_id can legitimately repeat across pages; only the full (page_occurrence_ref, artifact_key, element_id) tuple uniquely identifies a realized graphical object.

Deep Dive: kicad.plotter_ir.a0 (plotter-ir-a0.tsp & schematic-plot-a0.tsp)

All four Plotter IR document schemas (FootprintPlotDocument.json, BoardPlotDocument.json, SymbolPlotDocument.json, SchematicPlotDocument.json) share the same wire contract identity schema: "kicad.plotter_ir.a0" and coordinate frame (unit: "nm", y_axis: "down"), discriminated by source_kind:

When text is pre-realized into vector outlines or Hershey/Newstroke centerlines, TextOperation embeds a kicad.render_cache.v1 block (render_cache) carrying exact nanometre polylines or polygon rings so downstream SVG/canvas renderers match kicad-cli without shipping a local font stack.


2. Vendored FabView & Analytic Geometry Contracts (Tier C — Python msgspec)

kicad_monkey.fab_view_contracts.generated and kicad_monkey.geom.generated embed 12 compiled Draft 2020-12 JSON Schemas shared with the Wavenumber Data Models / Altium Monkey contract lineage (no local .tsp source lives in cad/kicad_monkey; Rust kicad-monkey-fab uses its own handwritten serde model FabViewData):

Embedded Schema IDPython Entry Point / RoleScope
kicad_monkey.fab_view.a0FabView.to_json() → bytes, FabView.from_json() / JsonFabView.from_file()Complete normalized fabrication board view in whole nanometres (+Y up): board metadata, layer stackup, outer profile + interior cutouts, per-layer lands/strokes/areas/clears/routs, plated/NPTH holes & routed slots, components, padstacks, nets, and BOM rows.
kicad_monkey.fab_diagnostics.a0FabOutput.diagnosticsStructured severity (info/warning/error), code, layer/component context, and human-readable fabrication diagnostics.
kicad_monkey.fab_context_options.a0Fab.from_pcb(...) / pcb.fab(...)Project context, active assembly variant, parameter overrides, and deterministic timestamp pinning.
kicad_monkey.fab_view_request_options.a0fab.view(...)Geometry mode (plotted/nominal), copy/panel expansion, variant policy, and edge-cutout folding options.
kicad_monkey.fab_gerber_options.a0fab.to_gerbers(...)Gerber X2/X1 toggles, datum/aux-origin offset, layer selection, dual-key extension overrides, virtual layers, and profile_cutouts.
kicad_monkey.fab_nc_drill_options.a0fab.to_nc_drill(...)Excellon NC Drill units/precision, origin shift, G85 routed slots, PTH/NPTH and blind/buried span splitting.
kicad_monkey.fab_ipc2581_options.a0fab.to_ipc2581(...)IPC-2581 Rev B .cvg options, document layers, BOM/AVL toggles, and virtual DOCUMENT/ASSEMBLY layers.
kicad_monkey.fab_odbpp_options.a0Shared lineage option contractODB++ option struct carried from the shared FabView schema bundle (KiCad Monkey's active manufacturing writers emit Gerber, NC Drill, IPC-2581B, SVG, and Micro-STEP).
kicad_monkey.fab_svg_options.a0fab.to_svg(...), fab.to_layer_svgs(...)Composite and per-layer analytic SVG options, colors, mirroring, padding, clipping, and virtual overlays.
kicad_monkey.fab_pnp_options.a0fab.to_pnp(...)Pick-and-Place centroid export options, units, origin mode, and panel copy policy.
kicad_monkey.fab_bom_options.a0fab.to_bom(...)Grouped BOM rules, $Name field templates, description joiners, and panel copy counts.
urn:dm:schema:geom.a0kicad_monkey.geom.generatedSigned 64-bit integer (coordinate_int64) analytic 2D geometry primitives: points, rings, straight segments, circular arcs (center- and radius-authored), SVG-2 elliptical arcs, quadratic/cubic Beziers, and affine transforms.
note

Coordinate sign convention difference: Plotter IR (kicad.plotter_ir.a0) uses KiCad's native +Y down nanometre space to match screen and SVG coordinates directly. FabView (kicad_monkey.fab_view.a0) uses mathematical +Y up nanometre space to match Gerber, Excellon, IPC-2581B, and CAD STEP geometry cleanly.


3. KiCad Cruncher CLI Config & Output Schemas (Tiers B & D)

kicad-cruncher (kcr and k3) validates its configuration files and machine-readable output manifests against the schemas below:

Schema FileSchema ID ($id / schema)TierProducer / ConsumerPurpose
pcb_svg_config.a0.schema.jsonpcb_svg_config.a0.schema.json (kicad_cruncher.pcb_svg.config.a0)Tier B (TypeSpec)kcr pcb-svg / k3 pcb-svg (<stem>.pcb.svg.config / pcb.svg.config)Multi-view PCB SVG presets, physical/board-domain/virtual layer selection, 3D HLR, colors, and themes.
bom_pnp_config.a0.schema.jsonbom_pnp_config.a0.schema.json (kicad_cruncher.bom.config.a0)Tier Dkcr bom, kcr pnp, kcr jlc / k3 bom, k3 pnp, k3 jlc (bom.config)Column templates, grouping keys, DNP filtering, JLC LCSC mapping, and PnP rotation/origin rules.
pcb_layer_step_config.a0.schema.jsonpcb_layer_step_config.a0.schema.json (kicad_cruncher.pcb_layer_step.config.a0)Tier Dkcr pcb-layer-step / k3 pcb-layer-step (pcb-layer-step.jsonc)Per-layer Micro-STEP extrusion thicknesses, Z offsets, outline/cutout/drill-cut modes, and colors.
pcb_clean_config.a0.schema.jsonkicad_cruncher.pcb.clean.config.a0Tier Dkcr pcb clean / vdoc cleanupDocumentation-layer include/exclude globs (F.Fab, B.Fab, User.*), reference/value field visibility, and user-layer name reset rules.
design_review_manifest.d0.schema.jsonkicad_cruncher.design_review_manifest.d0 (predecessors: design_review_manifest.a0.schema.json, design_review_manifest.b0.schema.json)Tier Dkcr design / k3 designTop-level manifest for deterministic design-review bundles (review_summary.json, compilation.json, bom.csv, notes.json, schematic SVGs + .layout.json, and pcb/ artifacts).
toon_manifest.a0.schema.jsonkicad_cruncher.toon_manifest.a0Tier Dkcr toon / k3 toonOutput manifest indexing top/bottom shaded board illustrations, active variants, solder-mask themes, and resolved 3D STEP sources.
toon_timings.a0.schema.jsonkicad_cruncher.toon_timings.a0Tier Dkcr toon --timings / k3 toon --timingsPer-stage timing breakdown (parse, STEP HLR, SVG projection, cache hits) for performance diagnostics.
library_extraction_bundle.a0.schema.jsonkicad_cruncher.library_extraction_bundle.a0Tier Dkcr lib-extract, kcr project-lib, kcr megamaidStructured inventory of extracted project-local .kicad_sym symbols, .pretty footprints, and embedded 3D/font assets.
source_relink.a0.schema.jsonkicad_cruncher.source_relink.a0Tier Dkcr project-libAudit report recording every library nickname rewrite across .kicad_sch, .kicad_pcb, sym-lib-table, and fp-lib-table.
kicad_plotter_ir_a0.schema.jsonkicad_plotter_ir_a0.schema.json (kicad.plotter_ir.a0)Tier DCore Plotter IR legacy / aggregate validatorUmbrella handwritten Draft 2020-12 schema for kicad.plotter_ir.a0 documents (superseded for codegen by the typed Tier A schemas in plotter-ir-a0.tsp and schematic-plot-a0.tsp).
pcb_svg_enrichment_a0.schema.jsonurn:kicad-monkey:schema:pcb_svg_enrichment_a0 (kicad_monkey.pcb.svg.enrichment.a0)Tier DEnriched PCB SVGsEmbedded <metadata id="pcb-enrichment-a0"> JSON payload (see Fab & Enriched SVG Formats).
schematic_svg_enrichment_a0.schema.jsonschematic_svg_enrichment_a0.schema.json (kicad_monkey.schematic.svg.enrichment.a0)Tier DEnriched Schematic SVGsEmbedded <metadata id="schematic-enrichment-a0"> JSON payload with view_indexes, design, and optional compiled_schematic_graph_view (see Fab & Enriched SVG Formats).
(Code-only JSONC)kicad_cruncher.fab_config.a0, kicad_cruncher.vdoc_config.a0Tier D (code-only)kcr fab / k3 fab (fab.jsonc), kcr vdoc / k3 vdoc (vdoc.jsonc)Validated directly by handwritten config loaders in Python and Rust rather than a standalone .schema.json file.

kicad-monkey v2026.11.30·Docs updated 2026.12.01 15:43 UTC (fd9b75b)