Source: docs/superpowers/plans/2026-08-10-measurement-scene-state.md · Plain text

Measurement-Complete Scene State Implementation Plan

For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (- [ ]) syntax for tracking.

Goal: Build a directly runnable sparse-view scene-state training and evaluation project with fixed measurements, matched learned controls, safe Replica/Hypersim data tools, and mechanism diagnostics.

Architecture: Calibrated context images are unprojected into a typed dense voxel state. A parameter-free volume renderer composes all primary outputs; learned-head controls reuse the same state encoder. A versioned manifest isolates dataset-specific camera and file conventions.

Tech Stack: Python 3.11, PyTorch 2.7+ cu128, NumPy, Pillow, h5py, PyYAML, requests, pytest, Ruff, and uv.

Global Constraints


Task 1: Typed data and camera contracts

Files: - Create: src/mcss/types.py - Create: src/mcss/geometry.py - Test: tests/test_types.py - Test: tests/test_geometry.py

Interfaces: - Produces: Cameras, SceneBatch, SceneState, pixel_grid, generate_rays, project_world, intersect_aabb, and make_voxel_centers.

Task 2: Fixed measurement program

Files: - Create: src/mcss/measurements.py - Test: tests/test_measurements.py

Interfaces: - Consumes: SceneState, Cameras, generate_rays, and intersect_aabb. - Produces: FixedMeasurementRenderer.forward(state, cameras, measurements=None) returning channel-first rgb, depth, normal, point, visibility, and uncertainty tensors.

Task 3: Scene-state encoder and matched controls

Files: - Create: src/mcss/model/encoder2d.py - Create: src/mcss/model/state_encoder.py - Create: src/mcss/model/system.py - Create: src/mcss/model/controls.py - Test: tests/test_model.py

Interfaces: - Produces: UnprojectiveStateEncoder, MeasurementCompleteSystem, LearnedHeadsControl, FreeDecoderControl, and build_model(config).

Task 4: Synthetic and manifest datasets

Files: - Create: src/mcss/data/synthetic.py - Create: src/mcss/data/manifest.py - Create: src/mcss/data/collate.py - Test: tests/test_data.py

Interfaces: - Produces: SyntheticSceneDataset, ManifestSceneDataset, write_manifest, validate_manifest, and collate_scene_batches.

Task 5: Replica and Hypersim tools

Files: - Create: src/mcss/data/download.py - Create: src/mcss/data/replica.py - Create: src/mcss/data/hypersim.py - Test: tests/test_download.py - Test: tests/test_real_adapters.py

Interfaces: - Produces: resumable download_replica, range-based download_hypersim_subset, prepare_replica, and prepare_hypersim.

Task 6: Losses, metrics, and mechanism diagnostics

Files: - Create: src/mcss/losses.py - Create: src/mcss/metrics.py - Create: src/mcss/diagnostics.py - Test: tests/test_objectives.py - Test: tests/test_diagnostics.py

Interfaces: - Produces: MeasurementLoss, MetricAccumulator, measurement_generalization_matrix, cross_context_consistency, intervention_specificity, query_equivariance, and no_bypass_audit.

Task 7: Training, evaluation, and CLI

Files: - Create: src/mcss/config.py - Create: src/mcss/engine.py - Create: src/mcss/cli.py - Create: configs/synthetic_smoke.yaml - Create: configs/hypersim_pilot.yaml - Create: configs/replica_pilot.yaml - Test: tests/test_config.py - Test: tests/test_cli_smoke.py

Interfaces: - Produces: load_config, Trainer, Evaluator, and CLI commands train, evaluate, diagnose, download, and prepare.

Task 8: Reproducible handoff and verification

Files: - Create: README.md - Create: docs/DATASETS.md - Create: docs/PROTOCOL.md - Create: scripts/setup.ps1 - Create: scripts/smoke.ps1

Interfaces: - Documents exact setup, smoke, download, preparation, training, evaluation, and matched-control commands with output locations.