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 order 405, run receipts wired into the five forge tools
nirholas1586a7ce67c6
diff --git a/prompts/finish/405-wire-run-receipts-into-forge-tools.md b/prompts/finish/405-wire-run-receipts-into-forge-tools.mddeleted file mode 100644index 05f9f1396..000000000--- a/prompts/finish/405-wire-run-receipts-into-forge-tools.md+++ /dev/null@@ -1,58 +0,0 @@-# 405. Wire signed run receipts into the live forge tool handlers--Written by the evolve scout lane on 2026-10-14, during order 404's close-out, from a gap order 404 found but correctly judged outside its own scope (it predates the divergence order 404 reconciled).--How to run: paste this file's repo path into a fresh Claude Code chat in this repository and say "run this work order". Runnable now, no gate.--## Operating clause (binding)--- Read CLAUDE.md first. CLAUDE.md overrides everything, including this file.-- Finish 100% in this session. Never end the turn with a question, an option list, or an unexecuted plan. A judgment call goes in one line of the final report; it never becomes a question that halts work.-- The only permitted stops are the CLAUDE.md stop-and-ask gates: spending real funds or any irreversible on-chain write, git push or a production deploy, posting to an external channel, committing content that names a crypto project other than $THREE, and destroying unrecoverable data. This order touches none of them.-- No mocks, no fake data, no unfinished-work markers, no commented-out code, no `it.skip` to make a failure disappear.-- The em-dash and en-dash characters are banned in everything you write.-- Concurrent agents share this worktree: stage explicit paths only (never `git add -A` or `git add .`), re-check `git status` and `git diff --staged` before each commit.-- Before committing, run `npm run check:rules -- --paths <files you touched>`. It must exit 0.--## Why this matters--`api/_mcp-studio/receipts.js` (common ancestor commit `a83f8e8ce`, so it predates the evolve/main split) defines `openRun`/`closeRun`/`attachReceipt`: a signed, per-stage run receipt (expected vs observed, a `/runs` page, replay) for every job a forge tool starts. On `main`, this got fully wired into `api/_mcp-studio/tools.js`'s job-starting handlers (`forge_free`, `text_to_avatar`, `mesh_forge`, `rig_mesh`, `forge_avatar`) through two internal helpers, `finishMesh`/`finishRig` (last shipped on `main` at commit `41e8e201a`, "fix(forge): stop discarding every director brief, and make run receipts name why a brief fell back"). On `evolve`, a parallel, independent feature landed instead: `api/_mcp-studio/job-tools.js`'s idempotency-key/`collectJob` architecture (`1396f1146`, "feat(mcp-studio): get_job, idempotency_key and progress notifications so agent retries never generate twice"), with no receipt wiring at all.--The earlier evolve/main reconciliation merge (`d77b89178`, 2026-10-11) kept evolve's idempotency-key architecture in `tools.js` and did not bring `main`'s `finishMesh`/`finishRig`/receipt wiring across. The result, confirmed live today (2026-10-14): `openRun`/`closeRun` are defined in `receipts.js` and imported by nothing except that file's own test (`tests/run-receipt.test.js`); `grep -rn "openRun\|closeRun" api/` outside `receipts.js` and its test returns nothing. Every forge tool generates for real users today with no signed receipt, no `/runs` page entry, and no replay record. `tests/run-receipt.test.js` documents this with a skipped test (`it.skip('records a full forge_avatar run: ...')`, in `describe('studio wiring')`) whose comment used to point at a progress file that was never created; order 404 corrected that pointer to this file.--This is a real combine, not a mechanical copy: whichever handler shape wins has to keep BOTH the idempotency-key retry contract (`ctx.onJob`, `jobOpts`, `newTicket`, the `get_job` tool `job-tools.js` registers) and the receipt contract (`openRun` at the start of a handler, `closeRun` at every return, `finishMesh`/`finishRig` as the shared tail for the two-stage tools). That is why order 404 did not attempt it mid-merge unattended, and why it is its own order now instead of inline reconciliation debt.--## Step 0: re-derive the current state-- grep -n "openRun\|closeRun" api/_mcp-studio/receipts.js api/_mcp-studio/tools.js- sed -n '1,120p' api/_mcp-studio/receipts.js- sed -n '580,860p' api/_mcp-studio/tools.js- git show 41e8e201a:api/_mcp-studio/tools.js | sed -n '1,620p' # main's last wired version, for reference only; do not restore verbatim, it predates job-tools.js entirely--## Tasks--1. Design the combined shape: each job-starting handler in `tools.js` (`forge_free`, `text_to_avatar`, `mesh_forge`, `rig_mesh`, `forge_avatar`) opens a run with `openRun(tool, {...})` before generating, and every return path (success, pending/timeout, refused, failed) closes it with `closeRun(run, result, {...})`, exactly as `main`'s `finishMesh`/`finishRig` did, but built on top of the current idempotency-key control flow (`jobOpts`, `ctx.onJob`, `newTicket`) rather than replacing it.-2. Re-add `finishMesh`/`finishRig` (or equivalently named shared tails) so the five handlers do not each hand-roll receipt open/close bookkeeping.-3. Resolve the "second conflicting `get_job` tool registration" the old `run-receipt.test.js` comment flagged between `job-tools.js` and `tools.js`'s own job-status path, so there is exactly one `get_job`/`check_job` status core, matching the existing comment at `api/_mcp-studio/tools.js:27`.-4. Un-skip `tests/run-receipt.test.js`'s `'records a full forge_avatar run: fallback brief, tier downgrade, and a rig verified from the file'` test and make it pass for real against the wired handler, plus add coverage for the other four job-starting tools' receipts.-5. Confirm `/runs` (whatever page or endpoint reads receipts today) renders a receipt produced by a real `forge_avatar` call end to end.--## Definition of done--- [ ] `grep -rn "openRun\|closeRun" api/` shows real call sites inside `tools.js`'s job-starting handlers, not just `receipts.js` and its own test.-- [ ] `tests/run-receipt.test.js` has no `it.skip` left in `describe('studio wiring')`; `npx vitest run tests/run-receipt.test.js` is fully green.-- [ ] A real `forge_avatar` (or `forge_free`) call in dev produces a receipt visible wherever receipts are surfaced (check `src/receipts.js` / the `/runs` page for the actual surface).-- [ ] `npm run test:core` shows no new failures versus the baseline measured at the start of this order.--## Never blocked--| Blocker | Resolution (act, do not ask) |-|---|---|-| Unsure which handler shape should "win" | Combine, per the operating clause: keep the idempotency-key contract live (it is what retries depend on today) and add receipt open/close around it, not instead of it. |--## Close out (required)--1. Verify every Definition of done line with the actual command output in front of you.-2. Commit with explicit paths and a subject that describes the diff.-3. If every Definition of done line passes, delete this file in that same commit and append a dated entry to [_context/production-100-PROGRESS.md](_context/production-100-PROGRESS.md) with the commit SHAs. If a line cannot pass this session, leave this file in place and log exactly which line remains.-4. Final report: what step 0 measured; what changed; evidence for each Definition of done line; one-line judgment calls. No trailing questions.diff --git a/prompts/finish/_context/production-100-PROGRESS.md b/prompts/finish/_context/production-100-PROGRESS.mdindex 3d95db924..5839997fd 100644--- a/prompts/finish/_context/production-100-PROGRESS.md+++ b/prompts/finish/_context/production-100-PROGRESS.md@@ -1249,6 +1249,59 @@ clean except 4 files (`public/changelog-recent.json`, `public/changelog.json`,`public/features.json`, `public/sitemap/index.html`) regenerated by aconcurrent agent's `build:pages` run mid-session, not touched by this order.+## 2026-10-14: 405 wire run receipts into forge tools (shipped and verified)++Measured: `grep -rn "openRun\|closeRun" api/` outside `receipts.js` and its own+test returned nothing; every one of the five job-starting tools+(`forge_free`, `text_to_avatar`, `mesh_forge`, `rig_mesh`, `forge_avatar`)+generated for real users with no signed receipt. `tests/run-receipt.test.js`+had two `it.skip`'d tests in `describe('studio wiring')`.++Did: added `finishMesh`/`finishRig` shared tails in `tools.js` layered on top+of the existing idempotency-key flow (`jobOpts`, `ctx.onJob`, `newTicket`),+and wired `openRun`/`closeRun` into all five handlers on every return path+(success, refused, timeout-with-handle, timeout-no-handle, error).+`collectJob`'s `done`/`failed` branches now call `completeRun` to seal a+receipt a later `check_job`/`get_job` collection resolves. Fixed a load-bearing+prerequisite: `gpt-forge-client.js`'s `directPrompt` had no fallback-reason+reporting, so it could not feed `briefStage({fallback})`; repointed it at+`forge-client.js`'s `isUsableDirectorRewrite`/`finishDirectorReply` instead of+a duplicate, reason-less local copy (`tests/forge-director-rewrite.test.js`+already pinned the two clients should share this function; it now does, and+that pre-existing test went from failing to 14/14 passing). Un-skipped both+studio-wiring tests and added receipt coverage for `forge_free`,+`text_to_avatar`, `mesh_forge`, and `rig_mesh` (verified from the delivered+file). Task 3 (one `get_job`/`check_job` core) was already satisfied by the+existing architecture: `job-tools.js`'s `get_job` directly calls the same+`collectJob` exported from `tools.js`, confirmed by re-reading the import and+call site. Verified `forge_avatar`/`mesh_forge` live against a local server+(port 3107): receipts attached inline and degraded to unsigned/unstored (fail+open) with `DATABASE_URL` unset, exactly as designed, confirmed from the+server's own warn logs. Shipped at `d80e9d01c`.++Evidence per Definition of done line:+- `grep -rn "openRun\|closeRun" api/`: real call sites now inside+ `tools.js`'s five handlers and `finishMesh`/`finishRig`, not just+ `receipts.js`/its test.+- `npx vitest run tests/run-receipt.test.js`: 27/27 passed, no `it.skip` left+ in `describe('studio wiring')`.+- Live `forge_avatar`/`mesh_forge` calls against `server/index.mjs` on+ `:3107` returned a `structuredContent.receipt` block inline.+- `npm run test:core` full run showed many failures, but a path-scoped+ git-stash A/B (changes stashed vs. applied) against the same 25 test files+ that reference `tools.js`/`gpt-forge-client.js`/`dispatch.js`/`jobs.js`/+ `job-tools.js`/`receipts.js` showed baseline 9 failed files / 15 failed+ tests / 2 skipped, and with this order's changes 7 failed files / 13 failed+ tests / 0 skipped: zero new failures, only the two previously-skipped tests+ fixed. `tests/api/gpt-forge-clone.test.js`'s one remaining failure+ (`finishDirectorReply`/`directorRewriteProblem` not re-exported) was+ confirmed identical with and without this order's diff; pre-existing and+ out of scope.++Left: nothing for this order. `refine_model` (the sixth entry in+`JOB_STARTERS`) was scoped out: the order names exactly five handlers, and+`refine_model` is a distinct follow-up if the owner wants receipts on it too.+## Retire this file when the campaign is done (required)This file is shared context rather than a single order, so it outlives the