# DesignIR Pipeline This directory owns the STEP reconstruction and distillation boundary: ```text teacher STEP -> deterministic private evidence extraction -> reconstruction agent authors DesignIR 2.0 -> isolated compiler rebuilds STEP without teacher access -> acceptance agent compares teacher and rebuilt STEP -> deterministic publisher promotes repeated validated experience ``` ## Security boundary | Component | Teacher STEP | Private evidence | DesignIR | Rebuilt STEP | | --- | --- | --- | --- | --- | | Ingestion service | read | write | no | no | | Reconstruction agent | denied | read | write | request compilation | | Isolated compiler | denied | no | read | write | | Acceptance agent | read | read | read | read | | Publisher | denied | aggregate only | schema only | reports only | The reconstruction environment must remain functional after the teacher STEP is removed. `scripts/designir_pipeline.py anti-cheat` rejects source STEP references, imported B-Reps, embedded meshes, topology references, and generator source that calls STEP import APIs. ## Data layout The operator-facing layout has only three directories: ```text designir-pipeline/ input/ drop source STEP/STP files here runs/ all private process artifacts output/library.json verified experience consumed at runtime ``` `input/` and `runs/` are ignored by Git. Only the deterministic result in `output/` is versioned. The pipeline creates these private run directories as needed: | Local path | Purpose | | --- | --- | | `runs/evidence/` | Deterministic evidence extracted from source STEP. | | `runs/designir/` | DesignIR authored by Reconstruction Agent. | | `runs/rebuilt/` | STEP rebuilt without access to source STEP. | | `runs/acceptance/` | Independent geometry and editability reports. | | `runs/review/` | Sanitized semantic batches and untrusted drafts. | | `runs/quarantine/` | Failures and unsupported feature vocabulary. | The shallow directory structure is for usability, not authorization. Agent and compiler access is enforced by their contracts and by anti-cheat checks. ## DesignIR 2.0 The executable contract is documented by `contracts/designir-2.0.schema.json`. It describes coordinate systems, datums, parameters, expressions, sketches, constraints, features, patterns, attachments, construction stages, edit interfaces, and validation contracts. It never contains teacher geometry. The initial compiler deliberately supports a small, honest vocabulary through both Build123d and SimpleCADAPI adapters: - `extrude_circle` - `extrude_rectangle` - `add_cylinder` - `through_hole` - `polar_hole_pattern` Unsupported geometry is quarantined with explicit missing capabilities instead of embedding the source B-Rep. The SimpleCADAPI adapter also emits its replayable `*.simplecad.model.json` operation graph beside the STEP. DesignIR remains the backend-neutral source of truth. ## Agents - `agents/reconstruction-agent.md`: Agent A authors DesignIR from private evidence and promoted methods, then requests an isolated rebuild. - `agents/acceptance-agent.md`: Agent B independently checks geometry and parameter perturbations against the teacher. Neither agent publishes experience. `config/promotion-policy.json` is evaluated by deterministic code after several independent cases pass. ## Commands Drop files into `input/`, then use the CAD Python environment: ```bash scripts/cad-experience extract-folder scripts/cad-experience prepare # The semantic distiller writes runs/review/experience-draft.json. scripts/cad-experience publish \ --draft runs/review/experience-draft.json scripts/cad-experience audit output/library.json ../text-to-cad/.venv/bin/python scripts/designir_pipeline.py validate part.designir.json ../text-to-cad/.venv/bin/python scripts/designir_pipeline.py compile \ part.designir.json --output rebuilt.step ../text-to-cad/.venv/bin/python scripts/designir_pipeline.py isolated-rebuild \ part.designir.json --output rebuilt.step --backend simplecadapi ../text-to-cad/.venv/bin/python scripts/designir_pipeline.py accept \ --teacher teacher.step --designir part.designir.json \ --rebuilt rebuilt.step --report acceptance.json ```