Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
chore(prompts): retire the simulation-ready campaign now that all eight tasks shipped
nirholase51f641866c4
diff --git a/prompts/README.md b/prompts/README.mdindex 063a5abe6..b27640019 100644--- a/prompts/README.md+++ b/prompts/README.md@@ -67,7 +67,7 @@ state measured on 2026-09-01; trust the directory, never this table.| `production-100-` | The run-to-100% campaign: a master index sequencing every open work order toward a mechanically checkable "production ready, roadmap complete" end state, a standing ship-readiness order, closeout orders for residuals no other campaign owned (stranded custodial funds, master-key hygiene, verdict tuning), and the batched owner-action list. Its map was re-measured against code and production on 2026-09-01; start there. || `quality-bar-` | The GCP-credit quality campaign. Six open orders (fleet scale, PBR materials, forge UX, design system, mobile, avatar likeness); the reference pipeline, flagship lane, viewers and eval harness shipped. || `roadmap-` | Five runnable orders for existing surfaces (generation suite, creation consolidation, parametric avatar editor, developer resources, native home-screen widgets), plus the strategy layer ([the playbook](../docs/internal/fable-playbook.md)) that decides what to run next and [the reuse map](finish/roadmap-REUSE-MAP.md) for license-vetted OSS. |-| `simulation-ready-` | The physics-grade asset campaign: turning generated 3D into assets a rigid-body simulator can consume unedited (metric scale, watertightness, mass and inertia, a collision proxy), signed into the provenance credential and filterable by a buying agent. Its context file carries the frontier bet, the scored candidate table it beat, and the measured kernel evidence (20 live assets graded; 2 of 20 usable as-is, 0 of 10 from our own lanes). Awaiting its architect pass. |+| `simulation-ready-` | The physics-grade asset campaign: turning generated 3D into assets a rigid-body simulator can consume unedited (metric scale, watertightness, mass and inertia, a collision proxy), signed into the provenance credential and filterable by a buying agent. Its context file carries the frontier bet, the scored candidate table it beat, and the measured kernel evidence (20 live assets graded; 2 of 20 usable as-is, 0 of 10 from our own lanes). Retired 2026-09-03: the architect pass ran and all 8 of its build tasks shipped, so both files are gone and the surface is documented in [docs/sim-readiness.md](../docs/sim-readiness.md) and its `STRUCTURE.md` row. || `store-submissions-` | Listing three.ws MCP tools across the Claude and OpenAI marketplaces and the MCP registries. All 21 numbered orders shipped; [the closeout](finish/store-submissions-01-submission-closeout.md) owns the remaining code gaps and the human submission steps. || `swarm-100-` | The "100% production ready, roadmap complete" goal decomposed into fully independent, single-task orders (per-route browser audits, per-batch api/cron/docs audits, per-worker and per-SDK audits, repo-wide sweeps, and one order per README-roadmap slice). Any file runs standalone in a fresh chat and depends on no index (157 left on 2026-09-01: 151 route audits, 4 sweeps, 1 roadmap slice). |diff --git a/prompts/finish/production-100-00-INDEX.md b/prompts/finish/production-100-00-INDEX.mdindex b9e820b21..07b5ac750 100644--- a/prompts/finish/production-100-00-INDEX.md+++ b/prompts/finish/production-100-00-INDEX.md@@ -97,7 +97,7 @@ run in parallel, H waits on owner gates, I is anytime, J is the parallel swarm.| [../roadmap/native-widgets.md](roadmap-native-widgets.md) | All four tasks built. The card endpoint, the Android widget and the Windows manifest are live in production (verified 2026-09-03); task 4's WidgetKit extension, Mac app and iOS target are in `apple/` and guarded by `npm run check:apple-widget`. What is left is not code: signing and shipping the two Apple binaries needs row 17, and an in-board Windows check needs a Windows 11 machine. || [../gcp-credits/05-catalog-animation-seeding.md](gcp-credits-05-catalog-animation-seeding.md) | Partial: the catalog seed runs at scale (56,898 avatars); the generated motion library has 0 clips. || Materialize (retired 2026-09-02) | Shipped: the print engine, quote and catalog, checkout on both lanes, fulfillment adapters and the operator console, on-chain certificates, the fabrication gate, docs and `specs/PRINT_PIPELINE.md`. Evidence in [materialize-PROGRESS.md](materialize-PROGRESS.md). |-| [../simulation-ready/01-architecture.md](simulation-ready-01-architecture.md) | Kernel, spec and schema exist; 0.5 of 8 build tasks done. |+| Simulation readiness (retired 2026-09-03) | Shipped: all 8 build tasks. Versioned grader, applied schema and store, the free `grade_sim_readiness` MCP tool and `GET /api/sim-readiness` over one shared handler, grading on the forge write path, the signed `simReadiness` field in provenance v2 (v1 credentials still verify), the badge and details panel on `/m/:id` and `/viewer`, and `docs/sim-readiness.md`. || Trading trio (see [../roadmap/00-README.md](roadmap-00-README.md)) | Three plans, largely absorbed by shipped surfaces; every commit touching them is gated. |Strategy for what to run next inside E: [the Fable playbook](../../docs/internal/fable-playbook.md).diff --git a/prompts/finish/simulation-ready-00-CONTEXT.md b/prompts/finish/simulation-ready-00-CONTEXT.mddeleted file mode 100644index d87f94b92..000000000--- a/prompts/finish/simulation-ready-00-CONTEXT.md+++ /dev/null@@ -1,193 +0,0 @@-# simulation-ready/: shared facts for the physics-grade asset campaign--The frontier bet produced by [../masters/09-the-frontier.md](../masters/09-the-frontier.md) on-2026-08-13. Read this file first; every work order in this pack assumes it. Nothing here is a-status claim to trust: re-derive with the commands in "Measured starting state" before you act.-------## The bet, in one sentence--**Generative 3D produces pictures of things; embodied AI needs things.** three.ws already-generates, rigs, textures and provenance-signs 3D assets at scale on its own GPU fleet. Almost-none of that output, and almost none of the world's 3D asset supply, can be dropped into a-rigid-body simulator and behave correctly. The bet is to close that gap mechanically: grade-every asset for simulation readiness, repair what can be repaired, anchor it to real-world-units, publish the mass properties and a collision proxy alongside the GLB, and sign the whole-thing into the existing provenance credential so a robot-learning pipeline can consume it-without a human in the loop.--## The user and the moment--A robot-learning engineer is assembling a training scene. They need forty household props with-correct scale, mass, inertia and collision geometry so a policy trained in simulation transfers-to the real arm. Today they either buy a curated library, spend a week in Blender closing holes-and guessing masses, or accept a domain gap they cannot measure. They arrive at three.ws from a-search for simulation-ready assets or from an agent calling our MCP server mid-pipeline, type-what they need, and get back a GLB whose report says watertight, 0.31 m tall, 0.42 kg at-polypropylene density, inertia tensor attached, convex hull attached, credential signed. "It-worked" means they never open a mesh editor and the numbers survive their own audit.--The second user is the agent itself. The same report is what makes an asset machine-buyable:-an autonomous pipeline can filter on `verdict == "simulation_ready"` before it spends anything,-which no asset marketplace currently lets it do.--## The capability intersection this joins--Three live surfaces that have never met (see [../../STRUCTURE.md](../../STRUCTURE.md)):--1. **Generative 3D on our own fleet** (Forge lanes, auto-rigging worker, catalog quality gate).-2. **Verifiable 3D provenance** (`specs/PROVENANCE_3D.md`, ed25519 credential, Solana anchor).-3. **The x402 economy** (self-facilitator, the 480k-endpoint datapoint fabric pattern, Receipt- Vault), which is what turns a graded asset into something an agent can buy mid-run.--The world made this possible only recently: text-to-3D crossed usable quality in 2026,-generated-world reinforcement learning was shown to transfer to real hardware (EmbodiedGen V2-reports simulation success 9.7% to 79.8% and real-robot task success 21.7% to 75.0%), and x402-gave machines a payment rail (Solana carrying the majority of agent payment volume, protocol-governance under the Linux Foundation since April 2026). Each existed separately a year ago.-Nobody hosts the bridge.--## Measured starting state (2026-08-13, measured, not remembered)--```bash-node scripts/sim-readiness-probe.mjs --limit 10 --out tasks/sim-readiness/probe-$(date +%F).json-npx vitest run tests/sim-readiness.test.js-grep -rniE "urdf|mujoco|watertight|inertia" STRUCTURE.md docs/ specs/ # expect: only this campaign-```--| Fact | Value | How it was read |-|---|---|---|-| Assets graded | 20 real GLBs pulled live from production | `scripts/sim-readiness-probe.mjs --limit 10` |-| Our own Forge output that is simulation ready | **0 of 10** | probe summary, `forge` row |-| Human-authored CC0 output that is simulation ready | **2 of 10** | probe summary, `authored` row |-| Forge assets sound in geometry, blocked only on units | 3 of 10 (`needs_scale`) | same |-| Dominant blocker, our lanes | `scale_normalized` (8 of 10), every mesh fitted to a unit box | same |-| Dominant blocker, authored lanes | `open_surface` (7 of 10) | same |-| Median grade time, fetch included | ~1.6 s per asset | probe row `ms` |-| Prior art in this repo | none | the grep above |--The evidence file for that run is [../../tasks/sim-readiness/probe-2026-08-13.json](../../tasks/sim-readiness/probe-2026-08-13.json).--## The proven kernel--The riskiest assumption was: *an arbitrary generated GLB can be graded for simulation readiness-deterministically, in process, with no human input and no model call.* It holds.--- [../../api/_lib/sim-readiness.js](../../api/_lib/sim-readiness.js) grades a GLB into one of- four verdicts (`simulation_ready`, `needs_scale`, `needs_repair`, `unusable`) with the- blockers named. It computes volume, centroid and the unit-density inertia tensor by- divergence-theorem tetrahedron accumulation, checks edge manifoldness and winding consistency- over position-welded topology, reads world-space extents in meters per the glTF unit- convention, detects the generator unit-box normalization signature, and builds a convex hull- proxy with a convexity ratio. It reads Draco and meshopt compressed input.-- [../../tests/sim-readiness.test.js](../../tests/sim-readiness.test.js) pins the math against- closed forms: a cube of side s at unit density must return V = s³ and I = s⁵/6, and it does to- float32 accessor precision. Open surfaces, flipped winding, node transforms and non-GLB input- each have a case.-- [../../scripts/sim-readiness-probe.mjs](../../scripts/sim-readiness-probe.mjs) runs it against- live production assets. No fixtures, no cache.--What the numbers proved beyond the assumption: the control group discriminates. A CC0 cleaner-bottle graded `simulation_ready` at 0.32 m tall, 2.98 kg at water density, convexity 0.898,-which is what that object physically is. The grader is measuring, not pattern matching.--## v1: the deliberately cut vertical slice--One complete user-visible slice, not all layers half-done.--**In:** grading every new Forge creation at write time and storing the report; a public free-`GET /api/sim-readiness?src=<glb>` that returns the report for any https GLB, matching the-existing free `GET /api/provenance?src=` shape; the verdict badge and the numbers on-`/m/:id` and the viewer; the `sim_readiness` field inside the provenance credential so the-grade is signed rather than merely asserted; one MCP tool (`grade_sim_readiness`, free) on the-3D Studio server so an agent can ask before it buys.--**Out of v1, on purpose:** automatic repair of open surfaces, scale inference from the prompt-or from a reference object, URDF/USD/MJCF export, collision decomposition beyond a single convex-hull, and any paid endpoint. Each is a later slice and each is worth more once the grade exists.-Repair is the obvious second slice: `needs_scale` is 3 of 10 of our output and the cheapest fix-on the board.--## What this compounds into--Every asset three.ws has ever generated gains a machine-readable physical description. That-upgrades the catalog quality gate (a physics grade is a harder quality signal than triangle-count), the provenance credential (signed physical claims, not just lineage), the x402 fabric-(a filterable, machine-buyable asset market), the Object Library, and any future robotics or-world-model surface. It is infrastructure, not a leaf.-------## Work orders--| # | Order | State |-|---|---|---|-| 01 | [The simulation-readiness grade, v1](simulation-ready-01-architecture.md) | designed, ready to build |-------## The candidate table (all scored, 1 to 5 per axis)--Pull = who wants it tomorrow. Window = why now and why nobody has. Fit = machinery reused.-Kernel = provable in one session. Compound = does it strengthen everything after it.--| # | Candidate (capability intersection) | Pull | Window | Fit | Kernel | Compound | Verdict |-|---|---|---|---|---|---|---|---|-| 1 | **Simulation-ready asset lane** (generative 3D × provenance × x402) | 5 | 5 | 4 | 5 | 5 | **CHOSEN** |-| 2 | Bidirectional 3D under the MCP Apps extension: click the model, it calls a tool back (Spatial MCP × MCP distribution) | 4 | 5 | 5 | 2 | 4 | runner-up 1 |-| 3 | Signed provenance on every MCP tool result, C2PA for agent output (provenance × MCP) | 4 | 4 | 4 | 4 | 5 | runner-up 2 |-| 4 | Living agent body inside Claude via MCP Apps (embodiment × MCP), today ChatGPT only | 3 | 4 | 5 | 2 | 2 | port, not a bet |-| 5 | Asset-level x402 fabric: every catalog asset its own paid endpoint (catalog × datapoint fabric) | 3 | 3 | 5 | 4 | 3 | folds into 1 |-| 6 | Sign to your agent and it signs back (ASL recognition × gesture vocabulary × embodiment) | 3 | 3 | 5 | 3 | 2 | leaf, delightful |-| 7 | Buy a garment from inside an assistant (Fits × x402 × MCP) | 3 | 3 | 4 | 2 | 3 | spend-gated kernel |-| 8 | Rig Doctor as an interactive in-assistant repair loop (Rig Doctor × MCP Apps) | 3 | 4 | 5 | 2 | 2 | narrow |-| 9 | Shared AR scene as a multi-agent workspace (AR Studio rooms × agent shell) | 2 | 3 | 4 | 3 | 3 | no clear buyer |-| 10 | Choreographer exposed as an MCP motion tool (motion library × MCP) | 2 | 2 | 5 | 4 | 2 | leaf |-| 11 | Economy sonification as a live paid feed (Agent Symphony × datapoint fabric) | 2 | 2 | 4 | 4 | 1 | leaf |-| 12 | Robot policy playground inside world.three.ws (multiplayer world × 1) | 4 | 4 | 2 | 1 | 4 | needs 1 to exist first |--Killed on the stated rules: none required a new paid external API, none breaches a CLAUDE.md-gate, and none duplicates [../backlog/](../backlog/) or [../roadmap/](../roadmap/), both of-which were swept (the backlog is entirely money-rail and hosting durability; the roadmap is-generation suite, creation consolidation, parametric avatar editor, developer resources and the-pump.fun trading track). Candidate 12 was demoted for kernel provability, not ambition.--## Runners-up and their trigger conditions--- **Candidate 2 (bidirectional 3D under MCP Apps).** Becomes the right choice the moment a host- we ship on renders MCP Apps resources for a server we control and we can observe the round- trip. Our MCP servers currently advertise protocol `2025-06-18` and expose the widget only- through the OpenAI Apps SDK path (`_meta["openai/outputTemplate"]`,- `ui://widget/three-studio-model.html` in `api/_mcp-studio/component.js`). The official- extension keys on `_meta.ui.resourceUri` with a JSON-RPC bridge over postMessage. Adopting it- is a contained change and worth doing regardless of this bet; it was not chosen because the- load-bearing uncertainty is host-side and cannot be settled from this repo in one session.-- **Candidate 3 (signed provenance on MCP tool results).** Becomes the right choice as soon as a- second party asks how to verify a tool result we produced, or the first time a downstream- agent is burned by a tampered artifact. It also becomes nearly free once this bet ships, since- the grade is already being folded into the credential.--## Never blocked--| Blocker | Do this |-|---|---|-| The grader disagrees with a well-known asset | Trust the closed forms first: `tests/sim-readiness.test.js` pins the math. Add the asset as a case before changing any threshold. |-| An asset is Draco or meshopt compressed | Already handled; `draco3dgltf` and `meshoptimizer` are registered dependencies of the shared IO. A decode failure is a real finding, not a reason to skip the asset. |-| Real-world scale cannot be inferred | Report `needs_scale` and stop. Never fabricate a size. Scale inference is a later slice with its own evidence bar. |-| A skinned or animated mesh comes through | It is graded at bind pose and the report says so (`skinned_geometry_graded_at_bind_pose`). Do not silently grade a posed mesh as a rigid body. |-| The forge gallery is empty or the probe cannot reach production | Point the probe at a local server with `--base http://localhost:3000`, or grade a single asset with `--url`. |-| Someone proposes shipping a fabricated mass or a guessed density | Refuse. The report carries unit-density inertia so a caller multiplies by a density they choose; that is the whole point. |--## Retire this file when the campaign is done (required)--This file is shared context rather than a single order, so it outlives the-prompts that cite it. Delete it in the commit that closes the LAST prompt of-this campaign, once nothing else in `prompts/finish/` references it:-- grep -rl 'simulation-ready-00-CONTEXT' prompts/finish/- git rm prompts/finish/simulation-ready-00-CONTEXT.md--While any sibling prompt of this campaign is still on disk, leave this file in-place and keep it accurate instead. The shrinking directory is the only signal-to the next agent that a campaign is closed.diff --git a/prompts/finish/simulation-ready-01-architecture.md b/prompts/finish/simulation-ready-01-architecture.mddeleted file mode 100644index 2a286b42a..000000000--- a/prompts/finish/simulation-ready-01-architecture.md+++ /dev/null@@ -1,222 +0,0 @@-# 01. Architecture: the simulation-readiness grade, v1--**How to run this:** paste this whole file into a fresh Claude Code chat opened in-`/workspaces/three.ws`. Read [00-CONTEXT.md](simulation-ready-00-CONTEXT.md) first; this file assumes it and does-not repeat the bet. Produced by the architect pass on 2026-08-13 from the frontier HANDOFF.--## Binding operating clause--Finish 100%. Never end with a question or an unexecuted plan. All CLAUDE.md hard rules apply: no-mocks, no fake data, no TODOs, no em-dash or en-dash, explicit-path commits, pushes and deploys-owner-gated. Every architectural decision in this file is already made; if you disagree with one,-implement it and say so in your report rather than stopping to relitigate it.--**Nothing in this file is a status claim to trust.** Step 0 below re-measures.-------## Step 0: re-derive the current state--```bash-npx vitest run tests/sim-readiness.test.js # the kernel: expect 6/6-node -e "import('./api/_lib/sim-readiness.js').then(m=>console.log(Object.keys(m)))"-npm run db:status # MUST read the draft below as pending-ls specs/SIM_READINESS.md api/_lib/migrations/20260813180000_sim_readiness_grades.sql-grep -rn "sim.readiness\|sim_readiness" api/ src/ pages/ --include=*.js -l # what is already wired-curl -s "https://three.ws/api/provenance?src=https://three.ws/avatars/cesium-man.glb" | head -c 300-```--`npm run db:status` could not be run by the architect pass: this worktree's `.env` carries no-`DATABASE_URL` and `gcloud` is not installed in the container, so the draft migration was written-and deliberately left unapplied without a live pending-check. **Run it before you touch the-schema, and read its full output**: `npm run db:migrate` applies every pending migration in-`api/_lib/migrations/`, not only this one.--## Contracts (already committed, do not redesign)--| Artifact | Path | Status |-|---|---|---|-| The grade contract | [../../specs/SIM_READINESS.md](../../specs/SIM_READINESS.md) | committed |-| Storage schema | [../../api/_lib/migrations/20260813180000_sim_readiness_grades.sql](../../api/_lib/migrations/20260813180000_sim_readiness_grades.sql) | committed, **not applied** |-| The grader | [../../api/_lib/sim-readiness.js](../../api/_lib/sim-readiness.js) | live, 6/6 tests |-| Kernel evidence | [../../tasks/sim-readiness/probe-2026-08-13.json](../../tasks/sim-readiness/probe-2026-08-13.json) | 20 live assets |--### API shape--`GET /api/sim-readiness?src=<https glb url>` or `?hash=<64-hex sha256>`--Mirrors [`api/provenance.js`](../../api/provenance.js) exactly: same `wrap`/`cors` boundary, same-`GET,OPTIONS`, no auth, no payment, no coin surface, thin wrapper over the MCP tool handler so the-two can never disagree.--| Case | Status | Body |-|---|---|---|-| Graded (fresh or cached) | 200 | `{ cached, gradedAt, ...report }` per the spec |-| `?hash=` never graded | 404 | `{ error: "not graded" }` (never fetches bytes) |-| Missing/malformed `src` and `hash` | 400 | `{ error: "…" }` |-| `src` not https, or a blocked host | 400 | `{ error: "src must be a public https URL" }` |-| Asset over the byte cap | 413 | `{ error: "asset exceeds 64 MB" }` |-| Upstream fetch failed | 502 | `{ error: "could not fetch the asset", status }` |-| Not binary glTF 2.0 | 200 | `{ readable: false, verdict: "unreadable", blockers: ["unreadable_glb"] }` |--Caching: `cache-control: public, max-age=60, s-maxage=300` on a hit, `no-store` on every error.-A grade for fixed bytes is immutable, so the only thing that expires it is a grader version bump.--Rate bucket: the same one `/api/provenance` uses. Grading is 100× the cost of a hash lookup, so-`?src=` on an ungraded asset is the expensive path and must share the forge-class bucket, not the-free-read bucket. Reuse the existing limiter; do not invent a second one.--MCP: one free tool, `grade_sim_readiness`, registered in `api/_mcp3d/tools/` following the exact-shape of `verify_provenance` in [`api/_mcp3d/tools/provenance.js`](../../api/_mcp3d/tools/provenance.js)-(`annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true }`,-`inputSchema` with `glb_url` and `hash`, report returned as `structuredContent`). Free, so it ships-on both stores. Zero coin surface, like `verify_provenance`.-------## Data flow, hop by hop--Every hop names a real source. There are no `TBD` hops.--**A. Grading our own output (the write path)**--1. A forge lane finishes and `materializeCreation` in [`api/_lib/forge-store.js`](../../api/_lib/forge-store.js) copies the GLB into R2 and writes the `forge_creations` row (`glb_key`, `glb_url`, `size_bytes`).-2. Same function, immediately after: read the GLB bytes it already holds, compute `sha256`, call `gradeSimReadiness(buf)`.-3. Upsert `sim_readiness_grades` keyed by `glb_sha256`, carrying `creation_id`, `grader_version`, `grade_ms`, and the full report.-4. Failure at step 2 or 3 never fails the generation. The creation is returned to the user either way; an ungraded asset simply has no row.--**B. Grading anything else (the read path)**--1. `GET /api/sim-readiness?src=…` → SSRF guard and https check (reuse the guard `anchor_provenance` already uses; do not write a second one).-2. Fetch the bytes with the 64 MB cap.-3. `sha256` → look up `sim_readiness_grades`. Hit at the current `grader_version` → return it with `cached: true`, no grading.-4. Miss → `gradeSimReadiness(buf)` → upsert → return with `cached: false`.-5. `?hash=` skips hops 1, 2 and 4 entirely: a pure lookup, 404 on miss.--**C. Signing the grade (the trust path)**--1. `anchor_provenance` already fetches the GLB and computes `glbSha256`.-2. Look up (or compute) the grade for that hash.-3. Pass the signed subset from [`specs/SIM_READINESS.md`](../../specs/SIM_READINESS.md#in-the-content-credential) into `buildCredential` as `simReadiness`.-4. `buildCredential` gains one optional field and the credential version becomes `threews.provenance.3d.v2`, per that spec's own additive-field rule. **Old v1 credentials must keep verifying unchanged**; `decideVerdict` selects behaviour by `version` and is the file to read before touching this.--**D. Rendering it (the surface path)**--1. `/m/:id` and `/viewer?src=` already call `GET /api/provenance` for the verify badge. They gain a second call to `GET /api/sim-readiness` on the same asset.-2. The verdict renders as a badge beside the provenance badge; the numbers render in a details panel.--**E. Agent consumption**--1. An assistant calls `grade_sim_readiness` with a `glb_url` from anywhere (ours or not).-2. It receives the report as `structuredContent` and can gate on `verdict` before spending anything.-------## Failure modes, every hop--| Hop | Slow | Down | Garbage | Nothing |-|---|---|---|---|---|-| R2 / CDN fetch (B2) | 15 s timeout, then 502 with the elapsed time in the log | 502 `could not fetch the asset`; nothing is cached | Not glTF → 200 with `readable: false`, `unreadable_glb`. This is a valid grade, not an error. | 0-byte body → `unreadable_glb` |-| Draco / meshopt decode | Bounded by the byte cap | Decoder module missing → `unreadable_glb` with the decode error. Never a silent skip. | Corrupt stream → same | n/a |-| `gradeSimReadiness` | Hull construction dominates; 85 k triangles measured at 3.0 s. Cap input at 64 MB and grade in-process. | Cannot be down (pure, in-process) | Never throws by contract; returns `unreadable` | Zero triangles → `verdict: "unusable"`, `no_triangles` |-| Postgres upsert (A3, B4) | Fire-and-forget on the write path; the creation never waits on it | Grade is still returned to the caller, just uncached. Log and continue. | Constraint violation → log, return the computed grade | Miss on read is the normal cold case, not an error |-| Forge write path (A) | Grading adds ~1.5 s median to a generation that already takes tens of seconds | Grading failure must never fail a generation. Wrap it, log it, return the creation. | n/a | An ungraded creation renders the `ungraded` UI state |-| Credential signing (C) | n/a | Missing issuer key already returns a coded error; unchanged | A grade that cannot be computed omits `simReadiness` rather than signing a null | Unanchored assets keep working exactly as today |-| Viewer fetch (D) | Badge shows its loading state; never blocks the model render | Badge shows `ungraded`, not an error toast | Malformed JSON → treat as ungraded | 404 → `ungraded` |--**Every UI state the Designer must build** (this list is inherited verbatim):--1. **Loading**: grade requested, not back. Skeleton, never a spinner. Must not shift the model layout.-2. **`simulation_ready`**: the affirmative badge. The one state worth screenshotting.-3. **`needs_scale`**: sound geometry, unknown units. Must read as "nearly there", not as failure, and must say what to multiply by.-4. **`needs_repair`**: names the blockers in human language ("the surface has 111 open edges"), and must visually suppress the mass numbers so nobody quotes them.-5. **`unusable`**: terse and final.-6. **`ungraded`**: no row for these bytes. Offers the grade action; never reads as an error.-7. **`unreadable`**: not a valid GLB. Distinct from `unusable`.-8. **Error**: the fetch itself failed. Actionable and retryable.-9. **Overflow**: a report with many blockers and warnings must not blow the panel out.-10. **Details expanded**: the full numbers: inertia tensor, hull, topology counts. Copyable as JSON, because the robotics user's next move is pasting it into their own pipeline.-------## Scale envelope--Measured, from [the probe run](../../tasks/sim-readiness/probe-2026-08-13.json), n = 20 real assets, 73 MB total.--| Quantity | Measured |-|---|---|-| Grade latency, fetch included | min 184 ms, median 1551 ms, max 4840 ms |-| Cost per geometry | ~72 ms per 1 000 triangles |-| Largest asset graded | 85 718 triangles, 1.2 MB, 3 015 ms |-| Report size | ~1.7 KB of JSON per asset |--| Volume | Behaviour |-|---|---|-| 10 users | Every asset graded inline on the forge write path. No queue. Nothing to tune. |-| 1 000 users | Still inline. At ~1.5 s per grade against generations that take tens of seconds, grading is under 5% of the lane's wall clock. The read path is cache-dominated: a repeat `?src=` is a hash lookup. |-| 100 000 users | Grading moves off the request path into a worker fed by the existing forge completion path, and the free `?src=` endpoint grades at most N concurrently with the rest queued behind a 202. Backfilling the existing catalog is a cron over `where grader_version <> $current`, which is exactly why that index exists. |--Hard limits to implement in v1: **64 MB byte cap** (already in the probe), **20 000 hull sample points**-(already in the grader), **15 s fetch timeout**. Pagination is not needed in v1: nothing lists grades-yet. When a browse surface lands it paginates on `idx_sim_readiness_verdict`.--Caching: grades are immutable for fixed bytes and a fixed grader, so the DB row IS the cache and the-CDN layer only needs the short `s-maxage` above. No second cache tier in v1.-------## The build plan--Each task is one commit with explicit paths. Ordered by risk: the task most likely to invalidate the-design comes first.--| # | Task | Files | Why it is at this position |-|---|---|---|---|-| 1 | Version the grader. Export `SIM_READINESS_VERSION = 'threews.sim.readiness.v1'` and include it as `grader` on every report. Update the spec's example only if the shape drifts. | [`api/_lib/sim-readiness.js`](../../api/_lib/sim-readiness.js), [`tests/sim-readiness.test.js`](../../tests/sim-readiness.test.js) | Everything downstream stores and signs this string. Getting it wrong later means a migration of signed data. |-| 2 | Apply the schema. Read `npm run db:status` in full first, then `npm run db:migrate`. Add the store module with `getGrade(sha256)` / `putGrade(row)`. | [`api/_lib/migrations/20260813180000_sim_readiness_grades.sql`](../../api/_lib/migrations/20260813180000_sim_readiness_grades.sql), new `api/_lib/sim-readiness-store.js` | The riskiest irreversible step. If the promoted-column choice is wrong, it is far cheaper to learn now than after the endpoint ships. |-| 3 | The MCP tool `grade_sim_readiness`, free, with the SSRF guard, byte cap and fetch timeout. | new `api/_mcp3d/tools/sim-readiness.js`, plus its registration | The handler the REST route wraps. Building it first means the two cannot disagree. |-| 4 | The free REST route, a thin wrapper over task 3's handler. | new `api/sim-readiness.js` (filesystem-routed, no `vercel.json` entry needed) | Mechanical once 3 exists. |-| 5 | Grade on the forge write path, wrapped so a grading failure never fails a generation. | [`api/_lib/forge-store.js`](../../api/_lib/forge-store.js) | Needs 2 and 3. Turns the lane from on-demand into a growing corpus. |-| 6 | The credential extension: `simReadiness` in `buildCredential`, version bump to `threews.provenance.3d.v2`, v1 credentials still verifying. | [`api/_lib/provenance-3d.js`](../../api/_lib/provenance-3d.js), [`api/_mcp3d/tools/provenance.js`](../../api/_mcp3d/tools/provenance.js), [`specs/PROVENANCE_3D.md`](../../specs/PROVENANCE_3D.md), [`tests/provenance-3d.test.js`](../../tests/provenance-3d.test.js) | Touches signed bytes, so it lands only once the grade shape is settled by 1 to 5. |-| 7 | The viewer and `/m/:id` badge plus details panel, all ten states. | [`public/viewer.html`](../../public/viewer.html), the `/m/:id` page module | The Designer stage owns the polish; this task owns reachability. |-| 8 | Docs and changelog: `docs/sim-readiness.md` linked from `docs/start-here.md`, a `STRUCTURE.md` row, a `data/changelog.json` entry, `data/pages.json` if a page lands. | as listed | The Storyteller stage's input, but the entry is mandatory per CLAUDE.md. |--## Second-order effects (the Integrator's list)--- **Catalog quality gate**: a physics verdict is a harder signal than triangle count. The gate should be able to read it.-- **Object Library**: 8 of 10 CC0 assets grade `needs_repair`. Grading the library is a cron over an existing R2 manifest and immediately makes the library filterable.-- **Rig Doctor**: the same file, two questions ("will it animate?" and "will it simulate?"). They belong on the same page.-- **Spatial MCP**: a spatial payload could carry the verdict alongside its affordances, which is what makes a returned scene physically usable.-- **x402 datapoint fabric**: a graded asset is a filterable, machine-buyable asset. This is the compounding step, and it is a later slice, not v1.-- **Search and Atlas**: `verdict` becomes a facet the moment a browse surface exists.-- **Solana first**: nothing in v1 moves value. The credential anchor already on Solana is the only chain touchpoint and it is unchanged.--## Never blocked--| Blocker | Do this |-|---|---|-| `DATABASE_URL` missing locally | It is not in this worktree's `.env` and `gcloud` is absent from this container. Get it from the Cloud Run service per the CLAUDE.md playbook on a machine that has `gcloud`, or build tasks 1, 3 and 4 first (they need no DB) and land 2 and 5 when the DB is reachable. Never mock the store. |-| `npm run db:status` shows other agents' pending migrations | Read them. If they are unrelated and safe, applying them is normal (that is what the command does). If any looks destructive, stop at that one and report it; do not apply blind. |-| The credential version bump feels risky | It is the smallest correct change: `decideVerdict` selects by `version`, and `tests/provenance-3d.test.js` must gain a case proving a v1 credential still verifies. Do not add the field without the bump. |-| Grading slows a generation noticeably | It is ~5% of the lane's wall clock. If a specific lane proves otherwise, move grading behind the existing completion path rather than dropping it. |-| An asset grades differently on a re-run | It must not: sampling is fixed-stride and the math is deterministic. A genuine non-determinism is a bug in the grader and blocks the lane; root-cause it. |-| Someone proposes storing the grade on `forge_creations` | Rejected in the schema header, with the reason. A grade is a property of bytes; the same bytes appear on four surfaces. |--## Retire this prompt when it is done (required)--1. Verify every Definition of done line against actual command output in front- of you. Never claim a line you did not verify.-2. Record the outcome in this campaign's PROGRESS or INDEX file if it has one.-3. Commit with explicit paths and a subject that describes the diff (house- style: type(scope): what changed and why a reader cares), and delete this- prompt file in that same commit:-- git rm prompts/finish/simulation-ready-01-architecture.md-- A finished order left on disk reads as open work to the next agent, so the- shrinking directory is the campaign's progress ledger.--If a line genuinely cannot pass inside this session (an external party must-respond, or an owner-gated action is the final step), finish everything else,-leave this file in place, and state exactly which line remains and who owns it.-Never delete this file on a partial.