Files
make-cad/docs/skill/references/workflows/step-reconstruction.md
T
NiJingzhe 0b95ad0765 skill: a router with read sets, unattended as a mode, pages that load in one batch
The skill entry is rebuilt around how an agent reads: SKILL.md is a 94-line router whose route
table gives the batch to read for each workflow; the first batch is 488-881 compiled lines
(was a median of 1,493). Long workflows are split into role pages (single-part 1157 -> outline
+ role pages, drawing-reconstruction 586 -> outline + stage pages); ql-playbook and
notebook-runtime are split by job. Every workflow has Read now / Read when / Unattended mode,
and discipline/operating-modes.md says what replaces each gate when nobody can answer.
New: scan-reconstruction workflow, core-rules.md (rule IDs), parallel-read blocks for
claudecode, zcode, opencode and codex.

docs/skill-design.md is the contract; skillbuild --check enforces it (src/simplecadapi/skill/lint.py,
opt in through [lint] in skillproj.toml).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-01 01:18:39 +08:00

9.1 KiB

Workflow: STEP Reconstruction

Rebuild an editable SimpleCAD model from an existing STEP file, with evidence gathering, feature-tree inference, candidate construction, and tiered acceptance.

Goal and scope

Use when the deliverable is an editable/replayable model reproducing a target .step/.stp. Not for read-only questions about a STEP file — those stay in domains/step-inspection.md without reconstruction.

Read now (one parallel batch)

File Why
workflows/step-reconstruction.md this page: steps, gates, failure routes
domains/step-inspection.md inspection primitives, comparison ladder, acceptance hierarchy
inspect/brep-reverse-engineering.md normative: read completely before any inspection or comparison

Read when

When File
the fidelity, scope or acceptance asked for is unclear beyond step 1 domains/requirement-refinement.md
step 3: inferring feature families and provenance rows docs/guides/reconstruction-agent-strategy.md
the run is a controlled reconstruction trial docs/guides/reconstruction-agent-test-prompt.md
step 4: building the candidate workflows/single-part-modeling.md, domains/part-modeling.md
authoring or editing the candidate source discipline/feature-tree-convention.md, docs/guides/notebook-runtime.md
splitting the candidate into cells discipline/notebook-cell-design.md
constraints represent the evidence domains/sketch-and-features.md
the target has several components domains/assembly-and-product.md, workflows/assembly-product-build.md
re-exporting for comparison or delivery domains/export-and-translation.md
a comparison fails or a feature is falsified discipline/failure-and-repair.md
the source is a mesh, point cloud or photos, not a STEP workflows/scan-reconstruction.md

Unattended mode

Interactive gate Unattended replacement
Step 1: ask what fidelity (exact transcription vs functional equivalence), which components, what acceptance means Record each as an assumption in the ledger; default to the strictest acceptance the hierarchy allows (topology identity) and the whole file in scope
The target STEP, or a component of it, is missing or unreadable Record the blocker in the report; reconstruct only what the readable evidence supports; never invent the target
Reconstruction tooling absent (for example the drawing extra) Report the missing capability, do the strongest work without it, say which parts it supports
Step 7: a structurally different but visually close stop Allowed only with the recorded evidence the hierarchy demands (no better feature order exists or the SDK lacks the operation); the report states the acceptance tier reached
A person looks at comparison renders Look yourself: name the views (render_step_comparison_rpath), what you looked for, quote the observation; strict BREP comparison still decides
A second reviewer of the verdict Fresh-context checklist pass quoting observations (subagent if offered); otherwise the report says the review was not independent
Same comparison failure twice for the same cause Change the feature hypothesis or redefine the check in the report (discipline/failure-and-repair.md)
Closing message to the person report.md with the acceptance tier, iteration rows, unrecovered regions, reproduce commands (discipline/operating-modes.md)

Task decomposition

goal: candidate model accepted against the target STEP
primary_domain: step-inspection
required_domains:
  - requirement-refinement
  - step-inspection
  - part-modeling
optional_domains:
  - sketch-and-features
  - assembly-and-product     # multi-component targets
  - export-and-translation   # re-export for comparison or delivery
artifacts:
  - target evidence notes (summaries, entity descriptors, sections)
  - feature-tree hypothesis with provenance rows
  - candidate source and replayed model
  - comparison evidence and acceptance verdict
validation_gates:
  - replay succeeds in a fresh process
  - STEP roundtrip of the candidate validates
  - acceptance follows the hierarchy (topology identity > float drift > justified stop)
repair_routes:
  - comparison fails -> step-inspection (localize) then part-modeling (fix feature)
  - global similarity but locally falsified feature -> change the feature hypothesis

Steps

  1. Refine the requirement: what fidelity is required (exact transcription vs functional equivalence), which components are in scope, what acceptance means here. Unattended: record each as an assumption; default to topology identity over the whole file.

  2. Inventory the target economically (domains/step-inspection.md): inspect_step_rsummary (with include_parameter_groups=True once), entity descriptors for specific hypotheses, compact boundaries/sections. Persist large arrays to files, not conversation context. Read references/inspect/brep-reverse-engineering.md completely first.

  3. Infer feature families from carrier and section behavior (references/docs/guides/reconstruction-agent-strategy.md):

    shared axis + rotational sections       -> revolve
    stable translated profile               -> extrude
    profile transported along a path        -> sweep
    ordered changing section family         -> loft
    verified equal angular/linear units     -> one unit + pattern
    several local signatures                -> ordered mixed feature tree
    

    Record a provenance row per region: observed boundary, adjacent-carrier evidence, proposed operation, direction/axis, confidence, and the check that could falsify it. A loop on a final planar face may be a later hole or pocket, not part of the base profile.

  4. Build the candidate via single-part-modeling.md (block structure per discipline/feature-tree-convention.md; sketch tier when constraints represent the evidence (domains/sketch-and-features.md), direct geometry tier for non-planar or exact transcription, annotated profile=geometry honestly). Overshoot through-cut tools; validate one representative feature before patterning.

  5. Replay in a fresh process: export_model_json → replay_model_json; then validate_step_roundtrip_rdescriptor on the candidate's STEP export.

  6. Compare and iterate (domains/step-inspection.md): compare_global_properties_rdescriptor → scoped compare_boundary_distance_rdescriptor (≤200 samples, face-id scoped) → compare_material_rdescriptor(include_components=True) for strict proof → compare_steps_rbrepcomparison for the exact gate. Use track_section_contours_rdescriptor when section topology (birth/death/split/merge) is the open question, fit_face_analytic_rdescriptor to test carrier families, render_step_comparison_rpath for shared-view visual evidence. After a failed strict comparison, group causes with BRepComparison.to_error_summary(), fix related groups together, rerun a fresh cycle. Unattended: look at the renders yourself and quote what you saw; the same failure twice changes the hypothesis.

  7. Accept per the hierarchy (domains/step-inspection.md): topology identity is the endpoint; float-level serialization drift is acceptable; a structurally different but visually close stop requires recorded evidence that no better feature order exists or the SDK lacks the operation. Unattended: the report names the acceptance tier reached.

Validation gates

  • One compact iteration row per attempt: hypothesis, changed parameters, replay/roundtrip status, diagnostic deltas, strongest proof attempted.
  • Preserve the best valid candidate; repeated non-improvement changes the feature hypothesis instead of blind parameter tuning.
  • Global similarity never overrides a locally falsified feature.

Failure routes

  • No affordable evidence for a region → record the gap; do not invent geometry and call it recovered.
  • Candidate structurally different → re-open the feature-tree hypothesis before accepting a visual-close stop.
  • Reconstruction tooling absent (for example the drawing extra, which simplecadapi.inspect.drawing needs, is not installed) → report the missing capability rather than degrading silently. Unattended: the report names the capability and what it would have covered.

Deliverables

Candidate source path, replay evidence, comparison evidence with verdict and its acceptance tier, provenance rows, and explicitly unrecovered regions. Unattended: these go in report.md (discipline/operating-modes.md).

Required reading before authoring or editing any part source in this workflow: discipline/feature-tree-convention.md — the block-structured sketch → basic body op → bool → modifier convention, its mandatory boundary comments, and the sketch/geometry/primitive tier rules. Every part source is a marimo notebook, one block per cell (references/docs/guides/notebook-runtime.md): run it with sca run, and load its product from verification scripts with simplecadapi.runtime.run_notebook(...).