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.

Date 2026-05-29
Status Implementation brief, doc-only, code/API cost 0
Decision SOT docs/w21b-wave4-fp-spatial-reference-plan-20260529
A-0 artifact /private/tmp/w21b_wave4_a0_20260529_194729

0. Locked Decision

Selected path: Hybrid. Path-S is not discarded: it is the cheap deterministic structure path where the coordinate validator passes. Path-V is not a fallback-only afterthought: it is the shot-conditioned projection / audit path and the main fallback when coordinates are weak.
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

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.

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.

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

  1. Run Path-S layout plan on active target FPs. Text LLM only.
  2. Render deterministic SVG previews. No image model.
  3. Run shot-conditioned projection for representative selected BGs. Computed path first, VLM fallback within cap.
  4. Emit summary JSON and side-by-side HTML: layout JSON, SVG preview, projection grid, evidence, conflict flags.

4.2 BG canary sequence

  1. Only after dry-run passes, force background prompt/render for active BG subset.
  2. Compare against v10/v11 baseline with active-only gallery.
  3. Reject if BG ignores scaffold/grid, loses place richness, or relies on detailed FP art to recover layout.
Cost gate. Path-S layout and SVG preview are cheap. VLM projection and BG image canary are bounded and announced before execution. If the VLM cap must exceed the agreed bound, stop and discuss.

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

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.