---
name: forgecad-reconstruction-benchmark
description: Solve ForgeCAD CAD reconstruction benchmark or RL episodes in a prepared workspace by rebuilding a visible reference asset as readable parametric ForgeCAD in the fixed submission path, using visual and geometric self-checks while respecting sandbox limits.
forgecad-public: true
---

# ForgeCAD Reconstruction Benchmark

Use this skill inside a prepared ForgeCAD reconstruction benchmark workspace.
The task is to rebuild the supplied CAD reference as editable ForgeCAD source,
not to wrap, embed, or copy the source asset.

This is a benchmark adaptation of `forgecad-3d-reconstruction`: same evidence
and coarse-to-fine reconstruction loop, but with a fixed output path, strict
submission rules, and a short wall-clock budget.

## Workspace Contract

Read these first:

- `AGENTS.md`
- `task/instructions.md`
- this skill
- `agent-home/.agents/skills/forgecad/SKILL.md` for API guidance

Useful companion skills:

- `forgecad-3d-reconstruction` for the general reconstruction workflow
- `forgecad-render-inspect` for interpreting inspection bundles
- `forgecad-make-a-model` only for general model quality patterns; do not use
  its date-based file-placement workflow in benchmark workspaces

Common files:

- reference asset: `task/reference/*`
- final answer: `submission/main.forge.js` unless `task/task.json` says otherwise
- local ForgeCAD wrapper: `./bin/forgecad`
- scratch outputs: `outputs/`

Stay inside the prepared workspace. Use the local wrappers instead of global
ForgeCAD commands.

## Non-Negotiables

- Final deliverable is readable parametric ForgeCAD source at the required
  submission path.
- The reference asset is evidence only. The final source must not call
  `importMesh`, `importStep`, `readFile`, `readFileSync`, or equivalent asset
  embedding tricks.
- Do not leave `compareWith(...)`, external reference paths, base64 payloads, or
  debug probes in the final submission.
- Do not spend the whole budget inspecting. A runnable first candidate is more
  valuable than a perfect investigation with no model.
- Use only allowed local tools. Do not rely on web search, broad home-directory
  access, subagents, or remote services.

## Budget-Aware Workflow

1. Orient quickly.
   Read `task/instructions.md`, locate the reference file, and inspect the
   starter submission. Run the starter once so syntax or runtime problems are
   obvious before you edit.

   ```bash
   ./bin/forgecad run submission/main.forge.js
   ```

2. Inspect only the highest-value evidence.
   Get dimensions, volume, object count, and at least one visual or sectional
   clue when the renderer is available. If a reference command fails or stalls,
   continue from task instructions, filename, starter code, and mechanical
   inference.

   ```bash
   ./bin/forgecad ls task/reference/<asset> --quality live --long
   ./bin/forgecad render 3d task/reference/<asset> outputs/reference.png --camera iso --edges thin --size 900
   ./bin/forgecad inspect sections sample task/reference/<asset> outputs/reference-sections --count 5 --size 700
   ./bin/forgecad inspect section task/reference/<asset> --plane yz --offset 0 --ray width:-50,0:50,0 --size 700
   ```

   For 3MF references, the `forgecad run` output includes a source structure
   table with stable `3mf:build:...:object:...` refs, automatic item names,
   per-item bounding boxes, and triangle counts. Treat that table as part of
   the evidence: the final model may be one part or many parts, but you should
   account for every substantial 3MF item in the reconstruction brief.

   Use `inspect section` when you need an exact local measurement. It writes a
   unique probe directory with `result.json`; later you can replay that probe
   against the candidate with `./bin/forgecad inspect replay <result.json>
   --source submission/main.forge.js`.
   For 3MF references, the `forgecad run` output includes a source structure
   table with stable `3mf:build:...:object:...` refs, automatic item names,
   per-item bounding boxes, and triangle counts. Treat that table as part of
   the evidence: the final model may be one part or many parts, but you should
   account for every substantial 3MF item in the reconstruction brief.

3. Write a short Reconstruction Brief in your notes or `outputs/brief.md`.
   Capture identity, bbox, major primitive families, symmetry, holes/cutouts,
   likely manufacturing intent, and the first modeling plan. Keep it short.

4. Edit the submission early.
   Build a coarse candidate that matches bbox, orientation, and main masses
   before adding details. Prefer simple analytic primitives, sketches, booleans,
   revolves, patterns, and blueprint-first dimensions over vertex chasing.

5. Self-check and iterate.
   Use command success, rendered views, details, and section slices as the main
   feedback. Improve in this order: bbox and origin, main silhouette, large
   holes/cutouts, ribs/bosses, edge treatments, then small details.

   ```bash
   ./bin/forgecad run submission/main.forge.js
   ./bin/forgecad render 3d submission/main.forge.js outputs/submission.png --camera iso --edges thin --size 900
   ./bin/forgecad render section submission/main.forge.js outputs/submission-section.svg --plane XZ --offset 0
   ```

   For closer comparison, render corresponding reference and candidate views or
   slices into `outputs/` and inspect the images/files side by side:

   ```bash
   ./bin/forgecad render 3d task/reference/<asset> outputs/reference.png --camera iso --edges thin --size 900
   ./bin/forgecad inspect sections sample task/reference/<asset> outputs/reference-sections --count 5 --size 700
   ```

6. Final cleanup.
   Re-run the candidate and inspect the most useful final views or sections.
   Remove temporary imports, `compareWith`, debug-only geometry, scratch paths,
   and comments that describe abandoned attempts. Leave the best source at the
   required submission path.

Optimize real geometry and design intent. A clean parametric approximation that
captures the object is preferable to an unreadable mesh mimic.

## Done Criteria

Before exit:

- `./bin/forgecad run submission/main.forge.js` succeeds.
- Final render or section evidence has been checked after the final meaningful
  edit.
- The required submission file contains no banned import/read/embed path.
- The model is recognizable against the reference from the main views.
