# Deterministic candidate drawings and editable blockout

Codex / Marley OA1 subagent `toolchain` / GPT-6.1 Sol. R01, 17 October 2026.
Observed main: `d88c6658de0439be2256b546e37bac03718b5ed6`.

This is an executable design-candidate pipeline for Split Complex and Terrace
Midrise. It reuses the merged PR #51 **schema v2 and `contract.analyse` R01.2**.
It does not create a second dimension schema or change the existing tools.

The original `draw_svg.generate` produces every plan, elevation and section.
Its original level-schedule CSV is preserved; a wrapper-only presentation
adapter wraps the masses column and sizes the schedule SVG canvas to the row
count, avoiding the upstream fixed-height table's overflow on 31 levels. No
numeric value is changed. The PDF combines those SVGs as vector pages through
PyMuPDF. Numeric labels govern; the print scale depends on the viewer settings.

## Rebuild

From the repository root with Python 3.12 and the dependencies in
`requirements.txt`:

```sh
RUN=docs/crown-key-production/R02/production-run/R01
python "$RUN/tooling/build_candidates.py" "$RUN/split/BUILDING_DIMENSIONS.json" --out "$RUN/split/derived" --cameras "$RUN/split/CAMERA_SCHEDULE.json"
python "$RUN/tooling/build_candidates.py" "$RUN/terrace/BUILDING_DIMENSIONS.json" --out "$RUN/terrace/derived" --cameras "$RUN/terrace/CAMERAS.json"
```

`--cameras` is optional. Without a schedule, three exterior orthographic views
(front-left, front-right and rear-right) are generated. The schedule is a JSON list, or an object with a `cameras`/`views`
list. Entries name `id`, `location_m`, `target_m`, optionally `lens_mm`,
`sensor_width_mm`, `projection`, `orthographic_width_m`, `resolution_px`.
Positions use the **asset-local** metric frame, not surveyed map coordinates.

The source cache is a read-only mirror of the exact current upstream scripts,
schema and sample. `source-cache/SOURCES.json` gives source path, Git blob SHA,
SHA-256 and observed main. The wrapper restores `contract.ROOT` to this checkout
at runtime only so source paths retain the upstream relative-path semantics.
It prefers the canonical checkout's `tools/contracts/` when that directory is
available. A download packet without `source-cache` requires the full repository
at the observed main SHA; it is not a ZIP-alone authoring environment. Set
`CROWN_KEY_REPO_ROOT=/path/to/lost-souls` when replaying a copied script elsewhere.
The canonical contract/drawing source hashes are checked against
`source-cache/SOURCES.json` before importing them; a newer or altered upstream
requires review of a new tooling revision.
On regeneration, only outputs listed in the prior builder manifest and still
matching their recorded hashes are replaced. A hand-edited output causes a
refusal; unrelated files are preserved. Removed views/sheets cannot silently
remain in the current generated packet.

## Outputs

| Output | Actual content |
|---|---|
| `drawings/*.svg` and drawing manifest | Existing generator; level-schedule wrapping/canvas adapter only; contract hash and revision stamped |
| `drawings/CLEAN_PLAN_*.svg`, `CLEAN_PLAN_INDEX.json` | Larger keyed overview/room footprint plans from the same derived polygons; actual low furniture proxies included; short numeric opening keys link to the separate schedule |
| `*_DRAWING_SET.pdf` | Exact SVG sheets, vector PDF; no redrawn geometry |
| `*.obj`, `*.mtl` | Editable named closed-prism components and neutral material slots |
| `ANALYSIS.json` | Full unchanged upstream derivation, missing values and assumptions |
| `GEOMETRY_CHECKS.json` | Fallback mesh closure/volume, center opening rays, center threshold support and duplicate top-area checks |
| `OPENINGS_DERIVED.csv` | Actual generated opening dimensions and computed passability |
| `neutral-views/*.png`, `SAVED_CAMERAS.json` | CPU z-buffer renders from this exact OBJ geometry; saved camera basis, projection and hashes |
| `ISSUE_GATE.json` | Existing gate result, intentionally refused for a candidate contract under `docs/` |
| `REBUILD_BLENDER.sh` | Replay command for the original merged Blender exporter in a real checkout |
| `MANIFEST.json` | Every generated file's size/hash plus tool/dependency/input provenance |

The primary PDF contains clean keyed plans, elevations, sections and the level
schedule. Raw all-level upstream cut plans remain a separate **SVG technical
audit appendix**, because their long inline labels can overlap in densely
furnished rooms; they are not the primary build drawings. The clean supplements
preserve geometry and use separate keyed tables;
furniture/fixture silhouettes remain proposed footprints, not accepted playable
clearance. They do not invent a route, door swing or furnished capsule sweep.

The OBJ frame is metres, X right, Y rear, **front -Y**, Z up. OBJ itself has no
standard unit declaration; these are source numbers and must be configured in
the importer. It is not the Blender/glTF unit-tested handoff. Named objects
start `WALL_<mass>`, `SLAB_<mass>_<level>`, `ROOF_<mass>`, `GLZ_<opening>` and
`CORE_<id>`. MTL slots `wall`, `slab`, `solid`, `core`, `glass` are neutral preview
materials; proposed production PBR definitions live in the material team's pack.

## Exact geometry and bounded limitations

The fallback reads the **same derived footprints, mitred wall rings, slabs,
core holes, opening cut bands and glazing bands** as the shared drawings and
Blender exporter. It triangulates simple polygons and subtracts convex triangles
to retain real holes. It refuses degenerate or untriangulatable geometry. It
does not fit rectangles to curved footprints or fill an omitted element.

It emits disjoint closed prisms, with coincident internal side faces between
adjacent pieces. This makes the design mesh editable; it is not a cleaned final
runtime mesh. Reservations, interfaces and orientation text are recorded in the
contract/analysis, not converted into blocking geometry. Neutral render glass
is opaque and blue to expose the actual glazing boundary. The renderer has no
furnishing, environmental lighting or placed exterior context.

Center ray and floor-support probes are useful geometry checks but cover less
than the original Blender exporter's capsule-width checks. They do not prove a
complete playable route, upper-floor lift operation, navigation, collision,
LOD/HLOD, performance, material import or interoperability. No Blender
round-trip was run. No `.blend` or `.glb` is claimed here. The installed runtime
has Python 3.12.14, no Blender executable and no `bpy`; the recorded replay is
**not executed**.

`contract_scope: production` is the existing schema's design-input category,
not acceptance. These values remain proposed, source/placement approvals stay
null, and the existing issue gate refuses the docs-path inputs. Every output
remains **PROPOSED DESIGN CANDIDATE / NOT ENGINE VERIFIED**. Creator visual
review, shared scale reconciliation and actual engine evidence remain separate.

## Verification actually performed

The unchanged mapped R02 sample was run locally as a preflight smoke case before
the clean-plan presentation adapter: upstream analysis COMPLETE; 8 original
SVG/PDF sheets; 61 closed-prism OBJ components; 3 neutral views; fallback geometry
checks PASS. The asymmetric orientation fixture also passed (147 closed
components, real glazed window, core slab holes, no duplicate floors). Repeated
preflight runs were byte-identical. Final candidate results are in each
asset's `derived/GEOMETRY_CHECKS.json` and `MANIFEST.json`, not inferred from the
sample. PDFs are reopened, their pages rendered and visually inspected. The
final complete input/output manifest is checked after the last regeneration.
Final counts and source/manifests/PDF hashes are in `VALIDATION.json`.

Read-only stdlib CI verification (no image/PDF dependencies):

```sh
python "$RUN/tooling/verify_outputs.py" --hash-only "$RUN/split/derived" "$RUN/terrace/derived"
```

Omit `--hash-only` for the full local PDF/PNG parsing checks (PyMuPDF/Pillow are
then required). Hash-only verifies exact files, bytes and hashes, OBJ topology
indices/counts/extents and SVG XML. It does not claim a visual PDF/PNG review.
