W21B Wave 4 Hybrid Spatial Reference Implementation Brief
A-0 dual-path evidence selected a Hybrid path: Path-S produces a simple deterministic coordinate / SVG scaffold where valid, and Path-V provides shot-conditioned camera projection, audit, and fallback. This brief converts that decision into implementation phases.
0. Locked Decision
| A-0 target | Path-S result | Path-V result | Implementation consequence |
|---|---|---|---|
fp_l05_main |
Valid coordinate scaffold. | Coherent shot-conditioned grid; uncertainty was sensible. | Use Path-S structure and Path-V projection/audit. |
fp_l04_stairs |
Valid coordinate scaffold. | Coherent shot-conditioned grid. | Use Path-S structure and Path-V projection/audit. |
fp_l09_main |
One near-full overlap validator error. | Coherent retail view and density evidence. | Use Path-V fallback for projection; keep Path-S prompt calibration optional. |
0.1 Non-negotiables
- No scenario-specific production logic. L05/L09/L04 stay in docs, fixtures, and canary evidence only.
- No regex / substring heuristic as semantic SOT. IDs, enums, schemas, coordinates, and LLM/VLM structured fields are the contracts.
- No detailed pretty FP art. The scaffold is simple boxes, lines, icons, and metadata sidecars.
- No destructive asset cleanup. Stale ImageAsset / PNG history remains preserved.
- No BG or scene image canary until coordinate scaffold and shot-conditioned projection artifacts pass their evidence gates.
1. Current Touchpoints
| Area | Current state | Hybrid use |
|---|---|---|
floor_plan_prompt |
Produces FP prompt, numbered elements, camera recommendations. v7 Rule 11 exists in current wave-4 worktree. | Input data for Path-S layout planner and Path-V camera request probes. |
base_location_dossier |
Provides base marker inventory and layer decisions. | Exact-ID source for coordinate planner validation and VLM evidence joins. |
floor_plan_semantic_readback |
Existing Phase A VLM semantic gate / provider in working tree. | Keep as Path-V audit foundation; extend or wrap for shot-conditioned projection rather than replacing it. |
shot_aware_bg_render_plan |
Chooses per-BG reference mode / camera plan and already carries selected background planning context. | Projection trigger boundary: camera-view grid is generated after selected-shot camera/look-at is known here. |
background_prompt |
Consumes FP numbered elements, camera recommendation, overlay payload, and world rules. | Later consumes scaffold / projection sidecar / place-density tags instead of inferring layout from detailed FP art. |
2. Phase Plan
2.1 Phase A — Path-S coordinate scaffold
Add a coordinate layout plan that turns FP metadata into simple validated geometry. This is a data contract, not a rendered image contract.
| Patch unit | Implementation | Tests |
|---|---|---|
| A1 layout prompt/provider | New prompt pack and provider for floor_plan_layout_plan. Output layout JSON with grid, element rects, render flags, place tags, density, and metadata-only list. |
Pack load, schema shape, strict required fields, invalid marker rejection. |
| A2 validator | Pure validator: exact-ID join to dossier, bounds, duplicate markers, impossible overlaps, cap enforcement, transient exclusion. | Out-of-bounds, duplicate, unknown marker, overlap, cap, metadata-only cases. |
| A3 checkpoint step | Register floor_plan_layout_plan as active opt-in step after dossier / semantic readback and before projection consumers. |
Step catalog / manifest count, disabled not_applicable, synthetic fixture path, no external call when disabled. |
2.2 Phase B — deterministic SVG scaffold renderer
Render validated layout JSON into simple SVG and optional raster. It must be byte-stable and API-free. It is not a place-richness illustration.
- Draw boxes, lines, doors, windows, and minimal fixture icons.
- Render each
render_on_plan=truemarker once. - Expose metadata-only elements in sidecar/debug tables, not SVG clutter.
- Output:
floor_plan_svg, optionalfloor_plan_svg_raster, and HTML review artifact.
2.3 Phase C — shot-conditioned projection sidecar
Generate camera_view_grid_10x10 only after selected-shot camera/look-at is known.
Projection is not an FP-level generic property.
| Mode | When used | Authority |
|---|---|---|
| Computed Path-S projection | Layout JSON validator passes and camera/look-at can be mapped to trusted coordinates. | Element presence and screen-cell position. |
| Path-V VLM projection | Path-S invalid, coordinate confidence low, or visual/place-density evidence is needed. | Shot-conditioned visibility, density, fixture-group semantics, fallback projection. |
| Hybrid review | Computed and VLM projections differ by more than one screen cell or conflict on presence. | Flag needs_review; do not silently pick. |
{
"bg_id": "LxxByy",
"fp_id": "fp_x",
"selected_shot_id": "Sxx_Shotyy",
"projection_timing": "after_selected_shot_camera_decision",
"coordinate_sot_source": "path_s_layout_json|path_v_vlm_readback|hybrid",
"projection_source": "computed_from_layout|vlm_derived|hybrid",
"camera_request_source": "shot_aware_bg_render_plan|floor_plan_prompt_camera_recommendation",
"camera_view_grid_10x10": [[{"markers": [], "summary": "", "confidence": 0.0}]],
"visible_elements": [],
"place_context": {}
}
2.4 Phase D — BG adapter consumption
Background prompt/render should consume the scaffold and projection sidecar instead of asking image T2I to infer detailed FP layout from a pretty plan.
- Add background prompt pack version only after A/B/C artifacts are stable.
- Prompt receives simple scaffold summary, shot-conditioned grid, and place-density tags.
- FP/SVG image attachment is optional support, not the sole layout SOT.
- BG visual canary stays active-only; no stale asset cleanup.
3. Commit Plan
| Commit | Owner | Files / area | Exit gate |
|---|---|---|---|
| A | Claude main, Codex review | floor_plan_layout_plan prompt/provider/schema/validator/step |
Deterministic schema + validator tests green. No real API by default. |
| B | Claude main, Codex review | SVG renderer + HTML preview helper | Byte-stable SVG tests and visual debug artifact. |
| C | Claude main, Codex review | Shot-conditioned projection sidecar, computed + VLM fallback/audit | Projection timing, source stamping, cap guard, no FP-level grid leakage. |
| D | Claude main, Codex review | Background prompt adapter / pack and active-only canary runner | BG consumes scaffold/grid/place tags; no detailed FP art dependency. |
| E | Codex + Claude | Canary artifact review and docs closure | User visual acceptance or scoped follow-up backlog. |
4. Canary Plan
4.1 Dry-run sequence
- Run Path-S layout plan on active target FPs. Text LLM only.
- Render deterministic SVG previews. No image model.
- Run shot-conditioned projection for representative selected BGs. Computed path first, VLM fallback within cap.
- Emit summary JSON and side-by-side HTML: layout JSON, SVG preview, projection grid, evidence, conflict flags.
4.2 BG canary sequence
- Only after dry-run passes, force background prompt/render for active BG subset.
- Compare against v10/v11 baseline with active-only gallery.
- Reject if BG ignores scaffold/grid, loses place richness, or relies on detailed FP art to recover layout.
5. Acceptance
| Layer | Acceptance signal | Not accepted as proof |
|---|---|---|
| Path-S layout | Valid coordinates on simple/medium FPs; invalid richer cases route to VLM fallback instead of blocking. | Broad test counts or pretty SVG. |
| SVG scaffold | Simple readable boxes/lines, marker exact-ID fidelity, no transient clutter. | Detailed furnished illustration. |
| Projection | Per-selected-shot grid with visible elements, source stamp, confidence, evidence, and fallback/audit flags. | Generic FP-level grid detached from shot camera. |
| BG consumption | BG plate follows scaffold/grid and retains place richness through structured tags and prompt language. | BG merely looks better while ignoring the sidecar. |
5.1 Stop conditions
- Path-S requires scenario-specific literals to pass validator.
- Path-V returns evidence-poor grids below confidence threshold on simple probes.
- Projection is attempted before selected-shot camera/look-at is available.
- BG adapter reintroduces detailed FP art dependency.
- Implementation needs destructive asset deletion or manual per-row active edits.
6. Work Split
| Role | Primary responsibility |
|---|---|
| Claude | Main production implementation, prompt packs, runners, focused tests, and result artifact generation. |
| Codex | Direction lock, lightweight deterministic test review, code cross-review, acceptance judgement, user-facing closure. |
| User | Visual/intent acceptance for SVG/grid/BG outputs and final path tradeoffs. |