Deterministic Spatial Verification & Pre-Construction Planning Engine
PlanProof bridges the gap between decorative interior layouts and physical pre-construction reality. It pairs the multimodal capabilities of Meta AI with a deterministic local spatial geometry verifier and a joinery panel cut-sheet optimizer.
Interior layouts frequently encounter costly physical clashes on installation day:
- Door & Clearance Clashes: Wardrobe doors swing into the arc of the entrance door or collide with nightstands and ceiling fixtures.
- Hidden Utilities: Custom cabinetry is planned over room switchboards, thermostat panels, or AC isolators, requiring emergency rewiring or on-site joinery alterations.
- Ergonomic & Egress Shortfalls: Desks lack sufficient rear clearance to pull out a chair comfortably, or furniture encroaches on the primary 0.80 m entrance walk route.
- Thermal & Lighting Discomfort: Beds placed directly in the concentrated airflow path of split air conditioners, or computer monitors positioned with direct rear window glare.
- Aperture Delivery Failures: Large solid furniture units arrive on site only to discover they cannot physically pass through the door frame upright.
- Joinery Fabrication Guesswork: Hand sketches rarely account for standard sheet nesting, saw kerf allowance, or veneer grain matching, leading to unexpected sheet counts and material miscalculations.
PlanProof enforces a strict separation between generative AI proposals and physical validation:
- AI Proposes: Meta AI models analyze room photos, transcribe spoken instructions, and propose layout changes or auto-repair mutations.
- Deterministic Geometry Evaluates: A local, deterministic mathematical engine audits every proposed layout against 11 spatial, ergonomic, and utility rules. If a rule fails, the exact clearance shortfall is flagged. No AI model is permitted to overrule physical geometry.
flowchart LR
A[π Step 1: Room & Plan] -->|Room Setup & Scale Calibration| B[π Step 2: Wall Fixtures & 3D Layout]
B -->|Meta Muse Spark 1.3 + Deterministic Verifier| C[π± Step 3: Spatial Audit & Cut Maps]
C -->|8x4 ft Plywood Guillotine Nesting| D[π Master Procurement Dossier]
PlanProof operates as a lightweight, full-stack TypeScript application with a strict single-provider AI architecture:
planproof/
βββ src/ # Vite + React 19 Frontend
β βββ components/ # UI Modals & Views
β β βββ SceneView.tsx # 3D Three.js room visualization & dynamic wall cutaway
β β βββ PlanView.tsx # 2D architectural top-down floorplan view
β β βββ ScaleCalibrationModal.tsx # Room reference scale calibration (doors, tiles, switchboards)
β β βββ FloorPlanScannerModal.tsx # 2D floorplan photo analysis via Meta SAM 3.1
β β βββ WallScannerModal.tsx # Wall fixture detection via Meta SAM 3.1
β β βββ MultiObjectImportModal.tsx# Photo furniture segmentation via Meta SAM 3.1
β β βββ PlywoodOptimizerModal.tsx # 8x4 ft plywood nesting, kerf spacing & cut maps
β β βββ ArPreviewModal.tsx # Mobile device-orientation 360Β° camera pass-through
β β βββ VerifiableAgentDrawer.tsx # Self-healing layout loop via Meta Muse Spark 1.3
β β βββ ObjectInspector.tsx # Item dimensions, GLB loader, and provenance badges
β β βββ ProofModal.tsx # Pre-construction procurement dossier & export
β βββ lib/ # Deterministic Verification & Math Engines
β βββ model.ts # Scene model, 11 spatial verification checks, autoFix
β βββ plywoodOptimizer.ts # 2D guillotine bin packing & panel decomposition
β βββ referenceCalibration.ts # Perspective-aware scale estimation & margin calculations
β βββ procurementModel.ts # Master procurement schedule & material take-offs
β βββ units.ts # Conversions between metres (m), centimetres (cm), and feet (ft)
βββ server/ # Express Node.js Backend API (Port 8787)
β βββ app.ts # REST endpoints (/api/interpret, /api/vision/*, /api/voice/*)
β βββ config.ts # Strict Meta-only configuration loader
β βββ providers/
β β βββ meta.ts # Official Meta AI client (Muse Spark 1.3, SAM 3.1, Voice, Image)
β βββ vision.ts # Vision processing pipeline & schema validation
β βββ usageTracker.ts # Per-model rate limiting & token telemetry
βββ scripts/ # Developer tooling & smoke test suite
βββ check-archive-secrets.ts # Pre-commit & archive secret protection gate
βββ smoke-meta.ts # Reproducible Meta API model verification runner
PlanProof interfaces exclusively with official Meta AI endpoints. Verification statuses reflect reproducible, evidence-based testing:
| Capability | Model | Model ID | Status | Evidence / Notes |
|---|---|---|---|---|
| Spatial Reasoning | Meta Muse Spark 1.3 | muse-spark-1.3 |
Live verified by successful structured API request | Verified via live API request returning HTTP 200 and schema-validated structured action payload. |
| Vision & Segmentation | Meta SAM 3.1 | sam-3.1 |
Pending meaningful live result verification | Endpoint integration complete (wire payload validated); pending live smoke test returning verified non-zero object bounding boxes. |
| Speech Transcription | Meta Muse Voice Transcribe 1.0 | muse-voice-transcribe-1.0 |
Pending meaningful live result verification | Multipart ASR endpoint integration complete; pending live smoke test returning verified speech transcript text. |
| Concept Visualization | Meta Muse Image 1.0 | muse-image-1.0 |
Pending meaningful live result verification | Wire payload and generation endpoint integration complete; pending verified live image generation run. |
- Dual Visualizer: Real-time synchronization between north-up 2D architectural plan view and interactive 3D perspective view.
- Dynamic Wall Cutaway: Far walls remain solid; near walls cut away based on camera angle so furniture and wall utilities are never obscured.
- Parametric Catalogue: Curated procedural materials for flooring (tile, wood, marble, terrazzo), wall colors, electrical utilities, lighting, and furniture.
-
Two-Point Photo Ruler: Calibrate metric pixels-per-meter on imported 2D floorplans or wall photos using known physical references:
- Interior door frame height (2100 mm) or width (900 mm)
- Modular electrical switchboard plates (8-module 250 mm, 4-module 150 mm)
- Standard floor tile edges (600 Γ 600 mm)
- Standard A4 documentation sheet (297 mm)
- Physical tape measure marks
-
Perspective Margin: Explicitly flags all image-derived scale estimates with an honest uncertainty margin (
$\pm 10%$ ) until physically confirmed with an on-site laser distance meter.
Every scene mutation is audited in real time against strict geometric rules:
| # | Check Name | Rule & Metric | Purpose |
|---|---|---|---|
| 1 | Door Swing Arc | Radial polygon sweep vs furniture footprints | Prevents entrance door collisions with nearby furniture |
| 2 | Primary Walkway | Continuous unobstructed 0.80 m corridor | Ensures accessible egress from door into room |
| 3 | Solid Overlap | 2D/3D bounding volume intersections | Prevents physical collisions between solid objects |
| 4 | Room Boundary | Strict containment within outer room footprint | Prevents objects from protruding through walls |
| 5 | Switchboard Access |
|
Prevents tall wardrobes or headboards from blocking switches |
| 6 | Desk Power Reach | Study desk within |
Convenience planning guideline to avoid trailing extension cords |
| 7 | Ceiling Fan Envelope |
|
Prevents tall bunk beds or wardrobe crowns from blade conflicts |
| 8 | Window Daylight Glare | Desk monitor back-to-window angle |
Reduces direct sunlight reflections on computer screens |
| 9 | Chair Clearance |
|
Ensures adequate room to pull out and occupy an office chair |
| 10 | AC Cold Draft | Split AC direct discharge |
Improves thermal comfort by avoiding direct cold air dumping |
| 11 | Doorway Delivery | Item |
Validates whether assembled furniture can physically enter the room |
- Natural language instructions ("Move the wardrobe away from the door") are interpreted by Meta Muse Spark 1.3 into structured actions.
- The proposed layout is immediately evaluated by the local geometry engine. If the change creates new conflicts or fails spatial rules, it is rejected, preserving the existing scene without silent fallback.
- Panel Decomposition: Automatically breaks down custom millwork items (wardrobes, desks, beds with explicit recipes) into individual carcass gables, shelves, doors, and back plies. Ready-made retail items (chairs, lamps, rugs) are preserved as finished goods.
- 2D Guillotine Bin Packing: Packs panels onto standard 2440 Γ 1220 mm (8Γ4 ft) plywood sheets with 3 mm saw kerf and configurable carcass thickness (12, 16, 18, 25 mm).
- Grain Direction Alignment: Enforces vertical grain constraints on exterior gables and doors.
- Export Formats: Interactive SVG cut maps and exportable Bill of Materials (BOM) CSV.
- Generates a consolidated 8-page pre-construction dossier: Executive Summary, Room Measurements, Shopping List, Flooring Take-Off, Wall Finishes, Carpentry Schedule, Master Checklist, and Spatial Audit.
- Available for in-browser screen review, CSV data export, structured JSON export, or multi-page PDF printing.
- Node.js (v18.0.0 or v20.0.0+ recommended)
- npm (v9.0.0+)
Clone the repository and install dependencies using npm ci:
git clone https://github.com/mohamad-shafeez/planproof.git
cd planproof
npm ciCopy the sample environment file to .env:
cp .env.example .envOpen .env and set your Meta API key:
PORT=8787
PLANPROOF_PROVIDER=meta
META_API_KEY=your_meta_api_key_here
META_BASE_URL=https://api.meta.ai/v1
META_MODEL=muse-spark-1.3
META_VISION_MODEL=sam-3.1
META_VOICE_MODEL=muse-voice-transcribe-1.0
META_IMAGE_MODEL=muse-image-1.0
# Optional Sketchfab API token for 3D model search
SKETCHFAB_API_TOKEN=Security Note: Never commit
.envor paste real credentials into.env.example..envis strictly gitignored. All AI capabilities run server-side; credentials are never exposed to the client bundle.
npm run dev- Express Backend:
http://127.0.0.1:8787 - Vite Client UI:
http://127.0.0.1:5173
PlanProof enforces strict automated quality gates prior to release:
# 1. Secret Protection & Release Integrity Gate
npm run check:archive
# 2. Automated Test Suite (Vitest)
npx vitest run
# 3. Linter (Oxlint)
npm run lint
# 4. TypeScript & Vite Production Build
npm run build- Test Suite: 30 test files passed (184 tests passed, 0 failures)
- Linter: 0 warnings, 0 errors across 92 files
- Build: Client bundle and server compilation passed cleanly
- Security Check: 0 tracked secrets,
.env.exampleverified with safe placeholders
The smoke test suite (scripts/smoke-meta.ts) validates model integration contracts without relying on private fixtures:
# Run local dry run (validates payloads and shapes without network calls)
npx tsx scripts/smoke-meta.ts all --dry-run
# Test Muse Spark 1.3 live spatial command interpretation
npx tsx scripts/smoke-meta.ts spark
# Test SAM 3.1 with a developer-provided wall photo
npx tsx scripts/smoke-meta.ts sam --image /path/to/wall-photo.jpg --concept switchboard
# Test Voice Transcribe with a developer-provided speech recording
# (Recording must be mono 16-bit PCM WAV at 16000 or 24000 Hz)
npx tsx scripts/smoke-meta.ts voice --audio /path/to/speech.wav
# Test Muse Image 1.0 concept visualization
npx tsx scripts/smoke-meta.ts imageA synthetic sample room layout is bundled at public/demo-project.json:
- Purpose: Allows instant testing of 2D/3D rendering, the 11 spatial checks, the plywood nesting algorithm, and procurement dossier generation without configuring an API key.
- Limitations: The demo project represents a synthetic bedroom test case with deliberate clearance constraints (e.g., doorway swing proximity) to demonstrate deterministic conflict detection.
- Visual Estimates vs. Physical Measurement: All dimensions extracted from photographs or 2D floor plans are
ESTIMATEDplanning approximations subject to camera perspective, lens distortion, and user alignment. Physical on-site verification with a calibrated laser tape measure is required before cutting materials or placing orders. - Advisory Doorway Clearance: The doorway aperture check verifies the minimum bounding cross-section against the door frame with a 20 mm handling margin. It does not model tight stairwells, elevator turns, or complex multi-axis rotations.
- Planning Tool, Not Structural Engineering: PlanProof detects geometric, ergonomic, and utility placement conflicts. It is not a licensed structural engineering certifier or municipal building code compliance tool.
- Custom Millwork vs. Retail Goods: Only custom cabinetry items with explicit construction recipes decompose into plywood cut maps; standard retail furniture items (chairs, sofas, beds, rugs) are tracked as finished goods.
- AR Mode: AR preview provides 360Β° device-orientation camera pass-through and WebXR viewing on supported devices; it is not a hardware-tracked 6DoF SLAM system.
- See ATTRIBUTION.md for open-source library licenses, procedural asset specifications, and third-party API policies.
- The repository software license will be designated by the repository owner prior to public distribution.