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: remove completed production-audit work-order pack
fudjia4fd955c6ef06
diff --git a/prompts/production-audit-2026-07-09/01-deploy-production.md b/prompts/production-audit-2026-07-09/01-deploy-production.mddeleted file mode 100644index e8496a2b8..000000000--- a/prompts/production-audit-2026-07-09/01-deploy-production.md+++ /dev/null@@ -1,107 +0,0 @@-# 01 — Ship the 34 undeployed commits (including the /app + /chat routing fix)--## Mission--Production is running a Cloud Run revision built 2026-07-08 02:28 UTC. HEAD on `main` is-2026-07-09 20:21 UTC — 34 commits ahead, all already merged, all already passing local build-checks. Deploy them. This single action fixes the majority of what the 2026-07-09 production-audit found broken, including three of the highest-traffic routes on the site.--## Why this is first--Nothing in the other 8 prompts is worth doing before this ships, because:--1. **`/app` and `/chat` are currently infinite-redirect-looping for every real visitor.** This- was root-caused and fixed during the audit (see `server/index.mjs` — a `hasMatches()`- evaluator was added and wired into the three route-matching passes that previously ignored- Vercel's `has` route conditions, which caused `/app`, `/chat`, and `/agents/:id` to always- match bot-only OG rules meant to be gated to social-preview crawlers). That fix is committed- but not deployed.-2. **`/minted`, `/creations`, `/vault` currently 404 live** even though their `.html` files- exist in `dist/` right now and pass every static build check — they were never shipped.-3. Every other prompt in this pack ends with "verify against production" — that verification is- only meaningful once production actually matches `main`.--## What's in the gap (representative, not exhaustive — `git log` is authoritative)--- `feat(bnb-vault): vault UI (/vault)` — browse, buy, unlock, view-- `feat: add quest markers and NPCs for job interactions`-- `feat: implement economy UI with store and bank functionalities`-- `fix(tokenized-3d): unwrap /api/v1 gateway envelope in the /minted gallery`-- `fix(liquidations): resolve coin-id links for the /coins liquidations strip`-- `feat(liquidation-collector): standalone futures liquidation service`-- `feat(market-data): DeFiLlama yield-pool API`-- `feat(viewer): keyboard-accessible canvas + low-power auto-degrade`-- `feat(tour-builder): Sperax preset — guided tour of USDs`-- the `server/index.mjs` `hasMatches()` routing fix described above-- 25 more — run `git log --oneline <last-deployed-sha>..HEAD` to get the full list (see below- for how to find the last-deployed sha).--## Tasks--1. **Confirm the deployed revision and the gap.**- ```bash- gcloud run services describe three-ws-api --region us-central1 \- --format='value(status.latestReadyRevisionName,status.traffic[0].revisionName)'- gcloud run revisions describe <revision-name> --region us-central1 \- --format='value(metadata.creationTimestamp)'- git log --oneline --since="<that timestamp>" | wc -l- ```- Confirm the count is in the neighborhood of 34 and skim `git log --oneline` for anything that- looks unfinished, WIP, or explicitly marked do-not-deploy. If everything on `main` looks- intentional and merged (it should — this is normal trunk-based flow per root `CLAUDE.md`),- proceed.--2. **Sanity-check the build before shipping.**- ```bash- npm run build- npm run check:dist- ```- Confirm `dist/minted.html` (or wherever the minted gallery page actually lives — check- `data/pages.json` for the real path), `dist/creations.html`, and `dist/vault.html` exist and- are non-empty. If `check:dist` fails, stop and fix the failure — do not deploy a broken build.--3. **Deploy.**- ```bash- npm run deploy:gcp- ```- This runs `gcloud builds submit --config server/cloudbuild.yaml --region us-central1- --project aerial-vehicle-466722-p5`. Watch the build log to completion; do not background it- and walk away, since this is the highest-blast-radius action in this entire prompt pack (it's- a production deploy of 34 commits at once).--4. **Verify the specific regressions the audit named, against the live site:**- - `curl -sI https://three.ws/app` — must return a real page (200/no redirect loop), not a- 302 back to `/app`.- - `curl -sI https://three.ws/chat` — must resolve, not 301-loop through `/app`.- - Load `https://three.ws/agents/<a-real-agent-id>` in a browser (pick any id from- `/api/agents` or the `/agents` list) — must render the agent detail page, not redirect to- the `/agents` list.- - Confirm bot traffic still reaches the OG handlers (the fix must not have broken the thing- it was gating): `curl -sI -A "facebookexternalhit/1.1" https://three.ws/app` should still- route to the OG handler's response, not the app shell.- - `curl -sI https://three.ws/minted` , `/creations` , `/vault` — must all return 200, not 404.--5. **Spot-check 3–5 more items from the "in the gap" list above** against production (e.g. load- `/vault`, check the store/bank UI mentioned in the economy-UI commit, hit the new DeFiLlama- yield-pool endpoint) to confirm the deploy actually picked up the full commit range, not a- stale cache.--## Verification (must all pass before reporting done)--- [ ] `gcloud run services describe three-ws-api` shows a `latestReadyRevisionName` created- **after** this deploy, receiving 100% traffic.-- [ ] `/app` and `/chat` resolve without redirect loops for a plain (non-bot) UA.-- [ ] `/agents/<id>` serves the real detail page.-- [ ] `/minted`, `/creations`, `/vault` all return 200 live.-- [ ] Bot UA still reaches the OG-preview handlers on `/app`.-- [ ] No new errors introduced — spot-check `/api/healthz` for any subsystem that flipped from- healthy to degraded/down as a result of this deploy (should be none; this is a code-only- deploy, no env/infra change).--## Do not--- Do not cherry-pick a subset of the 34 commits — deploy `main` as-is. If something on `main`- turns out to be broken, fix it forward with a new commit; do not deploy a stale sha.-- Do not skip step 4's bot-UA check — the whole point of the routing fix is that it must satisfy- *both* plain visitors and bots at once.diff --git a/prompts/production-audit-2026-07-09/02-homepage-thumbnail-orb.md b/prompts/production-audit-2026-07-09/02-homepage-thumbnail-orb.mddeleted file mode 100644index a04acde25..000000000--- a/prompts/production-audit-2026-07-09/02-homepage-thumbnail-orb.md+++ /dev/null@@ -1,72 +0,0 @@-# 02 — Fix homepage gallery thumbnails blocked by Opaque Response Blocking--## Mission--Five `*.r2.dev/thumb/*.png` requests on the homepage (`/`) are blocked by Chrome's Opaque-Response Blocking (`net::ERR_BLOCKED_BY_ORB`) — the browser refuses to render them cross-origin-because the response's declared `Content-Type` doesn't match what's actually served. Every-visitor to the homepage sees broken/missing thumbnails in the forge gallery strip. Fix the-`Content-Type` at the source so Chrome trusts the response, and verify against production.--## Context (from the audit's static trace — re-verify against the live tree, it may have moved)--- The homepage forge-gallery strip is driven by `src/home-forge.js` — thumbnails are set via- `img.src = job.preview_image_url` (around line 486) and `job.preview_image_url` resolves to an- R2-hosted PNG (`*.r2.dev/thumb/...`).-- R2 uploads go through `api/_lib/r2.js`: `putObject({ key, body, contentType })` (server-side- upload — the likely path for generated thumbnails) and `presignUpload({ key, contentType })`- (browser-direct signed PUT). Both explicitly set `ContentType` in the S3 `PutObjectCommand` —- so the bug is almost certainly in the **caller** passing a wrong/missing `contentType` for- thumbnail PNGs, not in `r2.js` itself.-- Trace where thumbnail PNGs for forge jobs actually get written to R2 — search the forge- pipeline (`api/forge.js`, `api/_lib/forge-store.js`, and whatever renders the PNG — check- `api/_lib/render-glb.js` and any `api/_lib/*bake*`/`*thumbnail*` helper) for the `putObject`- or `presignUpload` call that writes the `thumb/` key, and confirm what `contentType` value it- passes. Common failure modes to check for: a hardcoded/wrong MIME string, a `contentType`- derived from the wrong source file (e.g. copying the GLB's `model/gltf-binary` instead of the- thumbnail's own type), or a presigned-upload path where the browser's actual `fetch(url, {put})`- doesn't send a `Content-Type` header matching what was signed (R2/S3 requires the signed and- sent headers to match or the object gets stored without the intended metadata).-- Confirm live: `curl -sI https://<bucket>.r2.dev/thumb/<a-real-key>.png` — check the- `content-type` response header. It should read `image/png` (or `image/webp` if that's the- actual format — `src/home-forge.js` comments mention thumbnails are stored as WebP for size;- if so the URL should reflect `.webp` and the content-type must say `image/webp`, not `.png`- with a mismatched type).--## Tasks--1. **Find the exact write path.** Grep the forge pipeline for every `putObject(` /- `presignUpload(` call that touches a `thumb/` R2 key. Read the contentType value each one- passes.-2. **Reproduce.** Pull a live thumbnail URL from `https://three.ws/` (view source or the- `/api/forge/*` job list) and `curl -sI` it. Confirm the `content-type` header is wrong or- missing — that's the smoking gun before you change anything.-3. **Fix the content-type at the write site** so it matches the actual bytes being stored- (`image/png` or `image/webp`, matched to what the encoder actually produces). If the format- is genuinely WebP but the key/URL says `.png`, prefer fixing the extension too so the- filename and content-type agree (avoids a second ORB-adjacent trust issue).-4. **Backfill existing objects if needed.** If existing R2 objects already have the wrong- `Content-Type` stored (S3 `Content-Type` is set at write time and doesn't retroactively fix- itself), either: (a) accept that only new thumbnails are fixed and old ones self-heal as jobs- regenerate, or (b) if the volume is small and a re-`putObject` with a `CopyObjectCommand` +- corrected `ContentType` is cheap, do a one-off backfill script in `scripts/` (not committed to- the root — see repo hygiene rules) for the affected keys. Default to (a) unless the audit or a- quick R2 listing shows this is a small, boundable set.-5. **Verify against production** (see below) before reporting done.--## Verification (must all pass)--- [ ] `curl -sI` on a freshly generated thumbnail's R2 URL shows the correct `content-type`.-- [ ] Load `https://three.ws/` in a real Chromium browser (or `scripts/page-audit.mjs` scoped- to `/`), open DevTools console/network — zero `ERR_BLOCKED_BY_ORB` entries for- `*.r2.dev/thumb/*`.-- [ ] The homepage forge gallery strip visibly renders thumbnail images, not broken-image icons- or blank tiles.-- [ ] No regression to the GLB/model side of the same pipeline (models still load; you only- touched the thumbnail image content-type).--## Do not--- Do not route thumbnails through `api/img.js` (the IPFS/cross-origin image proxy used- elsewhere) as a workaround — these are first-party R2 assets; fixing the `Content-Type` at- the source is the correct, permanent fix, not a proxy indirection.diff --git a/prompts/production-audit-2026-07-09/03-oracle-ipfs-image-proxy.md b/prompts/production-audit-2026-07-09/03-oracle-ipfs-image-proxy.mddeleted file mode 100644index bf2e983fb..000000000--- a/prompts/production-audit-2026-07-09/03-oracle-ipfs-image-proxy.md+++ /dev/null@@ -1,78 +0,0 @@-# 03 — Route /oracle's NFT/token images through the existing IPFS proxy--## Mission--`/oracle` is the worst page in the 2026-07-09 crawl: 25 console/network errors, all the same-`net::ERR_BLOCKED_BY_ORB` block, thrown against public IPFS gateways (`ipfs.io`,-`gateway.pinata.cloud`) that the page hot-links directly for token/NFT art. Neither gateway-sends CORS/content-type headers browsers trust for cross-origin `<img>` loads, so every piece of-art on the page fails.--**The fix already exists in this codebase and is already used elsewhere** — `api/img.js` is a-same-origin image proxy with IPFS multi-gateway fallback, SSRF-hardened fetch, and a-deterministic on-brand SVG placeholder on total failure (so the loader never sees a broken-image, ever — see the file's own header comment for the full design). `src/radar.js` already-uses it (`/api/img?url=${encodeURIComponent(coin.image_uri)}&seed=...`) with an `error` listener-that falls back to the seed-only placeholder URL. `/oracle`'s image rendering — currently in-`src/oracle.js` (and check `src/oracle-graph.js`, `src/oracle-tape.js`,-`src/game/oracle-ribbon.js` for any other place `/oracle` renders token art) — does not go-through this proxy. This is almost certainly a "the proxy shipped after `/oracle` was built"-gap, not a design decision.--## Context--- **Reference implementation to copy the pattern from:** `src/radar.js` — search it for- `/api/img?url=` (three call sites at time of audit: ~lines 651, 781, 1195). Each sets- `img.src` to the proxied URL and wires an `error` listener that falls back to the seed-only- placeholder variant, so a proxy failure still degrades to *a* rendered image, never nothing.-- **The proxy itself:** `api/img.js`. Read its header comment in full before touching call- sites — it explains why it exists, its IPFS gateway fallback list, SSRF hardening, byte cap,- and placeholder behavior. You should not need to modify `api/img.js` for this prompt; this is- purely a client-side "route existing image URLs through the existing proxy" change. If you- find `/oracle`'s image needs (e.g. a specific aspect ratio, a batch-resolve pattern) aren't- served by `api/img.js` as-is, that's worth flagging, but the default assumption is it already- covers this case — `pump-visualizer.html`, `pump-live.html`, `coin-intel.html`, and- `agents-directory.js` all already lean on it for the same class of problem (token/NFT art from- arbitrary IPFS/CDN sources).-- **Where `/oracle` currently gets its image URLs:** find every place `src/oracle*.js` or- `src/game/oracle-ribbon.js` sets an `<img>` `src` or a CSS `background-image` from token/NFT- metadata. `src/erc8004/resolver.js` has the canonical IPFS-gateway-URL-resolution logic- (`IPFS_GATEWAYS`, `ipfs://` → `https://` conversion) — if `/oracle` is calling into that- resolver directly and rendering the raw resolved URL, that's the exact place to intercept and- wrap with `/api/img?url=`.--## Tasks--1. **Enumerate every image render site on `/oracle`.** Grep `src/oracle.js`,- `src/oracle-graph.js`, `src/oracle-tape.js`, `src/game/oracle-ribbon.js`, and- `pages/oracle.html` for `<img`, `.src =`, `background-image`, or calls into- `src/erc8004/resolver.js`'s IPFS-resolution helpers.-2. **Wrap each one** with the same pattern `src/radar.js` uses: build the URL as- `/api/img?url=${encodeURIComponent(rawUrl)}&seed=${encodeURIComponent(someStableSeed)}`, and- attach an `error` listener that falls back to `/api/img?seed=...` (proxy-only placeholder,- no upstream URL) so a genuinely dead source still resolves to *something* rather than a- broken-image icon.-3. **Pick a stable seed** per token/NFT (mint address, token id, or whatever unique identifier- `/oracle`'s data model already has) — this matches the existing pattern's cache-busting /- placeholder-uniqueness behavior and keeps repeat views of the same asset visually consistent.-4. **Verify against production** before reporting done.--## Verification (must all pass)--- [ ] Load `https://three.ws/oracle` in a real Chromium browser (or `scripts/page-audit.mjs`- scoped to `/oracle`) — zero `ERR_BLOCKED_BY_ORB` / CORS errors in console or network tab.-- [ ] Every token/NFT card that previously showed a broken image now shows either the real art- (proxied) or the on-brand placeholder (never a native broken-image icon).-- [ ] Spot-check the network tab: image requests now hit `three.ws/api/img?...`, not- `ipfs.io`/`gateway.pinata.cloud` directly.-- [ ] No regression to any non-image `/oracle` functionality (this change is scoped to `<img>`- src wiring only).--## Do not--- Do not build a second, parallel IPFS proxy — `api/img.js` already exists precisely to solve- this class of bug and is the platform's established pattern (per root `CLAUDE.md`: read- before you write, use existing patterns).-- Do not hardcode a single IPFS gateway as a "fix" (e.g. swapping `ipfs.io` for `dweb.link`- directly in the client) — that just relocates the same CORS/ORB failure mode to a different- upstream. Route through the same-origin proxy.diff --git a/prompts/production-audit-2026-07-09/04-meshopt-decoder-crash.md b/prompts/production-audit-2026-07-09/04-meshopt-decoder-crash.mddeleted file mode 100644index 2e4ea943a..000000000--- a/prompts/production-audit-2026-07-09/04-meshopt-decoder-crash.md+++ /dev/null@@ -1,94 +0,0 @@-# 04 — Wire the Meshopt decoder on the 7 pages that crash loading it--## Mission--`THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files` is thrown-on 7 pages: `/cosmos`, `/minted`, `/creations`, `/vault`, `/agenc/embodied`, `/pitch`,-`/lipsync/mic`. Every server-baked avatar (the `/api/avatars/<id>/glb` lane and Forge output)-emits `EXT_meshopt_compression`; any viewer that doesn't register a Meshopt decoder before its-first load throws instead of rendering. **The fix already exists and is already used correctly-on ~25 other pages** (`pages/forge.html`, `pages/marketplace.html`, `pages/home.html`, etc. all-include it) — this is a "these 7 pages shipped without it" gap, not a missing capability.--## Context — three distinct call patterns exist in this codebase; match the right one per page--1. **`<model-viewer>` custom element, static script tag** — the common case. The shared fix is- `public/model-viewer-meshopt.js`: a classic (non-module) script that sets- `model-viewer`'s static `meshoptDecoderLocation` the instant the element is defined, racing- and winning against an eager `<model-viewer>` that starts loading in the same microtask.- Read its header comment in full — timing is the entire point of the file (a deferred module- that runs after model-viewer's own module script loses the race).- **Fix:** add `<script src="/model-viewer-meshopt.js"></script>` to the page, anywhere in the- document — it works as a classic parser-executed script regardless of position because- `model-viewer.min.js` is always loaded as `type="module"` (deferred), so a classic script- anywhere in the HTML runs first. Copy the exact pattern from `pages/forge.html` (search it- for `model-viewer-meshopt.js`).- **Applies to:** `pages/cosmos.html`, `pages/minted.html`, `pages/creations.html`,- `pages/vault.html`, `pages/pitch.html` — confirm each currently loads `<model-viewer>` via- `https://ajax.googleapis.com/ajax/libs/model-viewer/...` or similar and is currently missing- the meshopt include (grep each file for `model-viewer-meshopt` to confirm the gap before- editing).--2. **`<model-viewer>` loaded dynamically at runtime by a shared embed module.**- `/agenc/embodied` renders via `<three-ws-agent>`, a custom element defined in- `public/agenc/embed.js`. That file's `ensureModelViewer()` injects the model-viewer CDN- script (`https://cdn.jsdelivr.net/npm/@google/model-viewer@.../model-viewer.min.js`) into- `document.head` on first connect — there is no static `<script>` tag in `embodied.html` to- attach a sibling classic script next to, and `embed.js` is also the public embed snippet- third parties paste onto their own sites (see the file's own usage doc comment), so a page's- own preemptive workaround wouldn't help those. **Fix inside `ensureModelViewer()` itself:**- apply the same `meshoptDecoderLocation` assignment (and the same `customElements.define()`- interception, since the CDN script is injected async and may still race an already-connected- `<three-ws-agent>` element) directly in `public/agenc/embed.js`, so every consumer of- `<three-ws-agent>` — the `/agenc/embodied` page and any third-party embedder — gets it for- free with no per-page include needed. Reuse `public/model-viewer-meshopt.js`'s logic rather- than reimplementing it differently; consider having `embed.js` load that file, or inlining- the same three-step (synchronous / define-intercept / whenDefined-fallback) pattern directly.--3. **Raw `THREE.GLTFLoader` in an inline module script — no `<model-viewer>` at all.**- `/lipsync/mic` (`public/demos/lipsync-mic.html`) imports `GLTFLoader` directly from- `three/addons/loaders/GLTFLoader.js` and calls `new GLTFLoader()` (search the file for- `const loader = new GLTFLoader()`). This needs the *other* existing pattern used elsewhere in- the codebase for raw-loader consumers: `loader.setMeshoptDecoder(decoder)` with a decoder- sourced the same way `walk-sdk/src/internal/meshopt.js` (`getMeshoptDecoder()`) or- `page-agent-sdk/src/stage.js` already do — a lazy dynamic- `import('three/addons/libs/meshopt_decoder.module.js')` resolving `MeshoptDecoder`, called- once before `loader.loadAsync(...)`. Wire it the same way `apps-sdk/embodiment/embodiment-stage.js`- does (`getDecoders()` → `loader.setMeshoptDecoder(meshoptDecoder)`), scoped to what- `lipsync-mic.html`'s inline script actually needs (it likely only needs Meshopt, not- Draco/KTX2 — check what GLBs `/lipsync/mic` actually loads before adding decoders it doesn't- need).--## Tasks--1. Confirm the gap on each of the 7 pages (grep for `model-viewer-meshopt` / `setMeshoptDecoder`- — absence confirms the bug before you touch anything).-2. Apply pattern 1 to `cosmos.html`, `minted.html`, `creations.html`, `vault.html`, `pitch.html`.-3. Apply pattern 2 inside `public/agenc/embed.js`'s `ensureModelViewer()`.-4. Apply pattern 3 to `public/demos/lipsync-mic.html`'s inline GLTFLoader setup.-5. Verify each of the 7 pages against a **compressed** GLB specifically — an uncompressed GLB- won't reproduce the crash even if the decoder is still missing, so don't trust a clean- console alone; confirm the model that was actually flagged in the crawl is the one you test- with (server-baked avatars and Forge output are Meshopt-compressed by default).--## Verification (must all pass, per page, in a real browser)--- [ ] `/cosmos` — no `setMeshoptDecoder` error in console; the model that previously failed now- renders.-- [ ] `/minted` — same.-- [ ] `/creations` — same.-- [ ] `/vault` — same.-- [ ] `/agenc/embodied` — same, **and** spot-check that `public/agenc/embed.js`'s fix doesn't- regress the standalone `<three-ws-agent>` embed snippet on a throwaway test page (paste- the embed's own documented usage example into a scratch HTML file and confirm it still- loads).-- [ ] `/pitch` — same.-- [ ] `/lipsync/mic` — same; also confirm the mic-driven viseme/lipsync feature itself still- works end to end (this page's core function, unrelated to the decoder fix — don't let a- decoder change silently break the loader's callback wiring).--## Do not--- Do not write a fourth, novel meshopt-wiring pattern — this codebase already has two- (the `<model-viewer>` classic-script bootstrap, and the raw-`GLTFLoader` `getMeshoptDecoder()`- helper). Every page here fits one of the two; use the matching one.diff --git a/prompts/production-audit-2026-07-09/05-cors-proxy-jupiter-ufo.md b/prompts/production-audit-2026-07-09/05-cors-proxy-jupiter-ufo.mddeleted file mode 100644index 79b4cffe8..000000000--- a/prompts/production-audit-2026-07-09/05-cors-proxy-jupiter-ufo.md+++ /dev/null@@ -1,106 +0,0 @@-# 05 — Fix two pages calling third-party APIs directly from the browser--## Mission--Two unrelated pages call third-party APIs client-side and get CORS-blocked:--- **`/three-live`** fetches `api.jup.ag/price/v2` directly from the browser. Jupiter doesn't- send CORS headers for browser calls, so the SOL/USD price feed silently fails (caught by an- empty `.catch(() => {})`, so it fails quietly rather than loudly — that's why it shipped- unnoticed).-- **`/play/ufo`** calls `flappin-ufo.vercel.app/api/leaderboard`, which both CORS-blocks and- 404s on its own root. **Confirmed independently during this audit pass:**- `curl -o /dev/null -w '%{http_code}' https://flappin-ufo.vercel.app` → `404`, and- `.../api/leaderboard` → `404`. This is not a transient outage — the embedded game's Vercel- deployment is gone.--These are unrelated bugs; fix them independently.--## Part A — `/three-live` Jupiter price call--### Context--- The client-side fetch lives in `pages/three-live.html` — search for- `fetch('https://api.jup.ag/price/v2...`. It seeds `_solUsd`, a local variable used to value- trades that only supply a `sol_amount` (no USD amount) in the live trade feed.-- The server already has a canonical, cached SOL/USD price source for exactly this purpose:- `api/_lib/sol-price.js` exports `solPriceUsd()` — four independent free providers tried in- order with 60s cooldown-on-failure via `src/shared/failover-fetch.js`, 60s TTL cache. It's- already used by `api/_lib/economy-ledger.js`, `api/agent/wallet.js`, `api/agent/send-sol.js`,- `api/agent-economy/status.js`, `api/pay/deal.js` and others for ledger/accounting-grade SOL- valuations — this is the platform's one shared implementation, not a one-off.-- There is **no existing public GET endpoint** that just returns this value as JSON — every- current caller is server-side Node code importing the function directly. You have two- reasonable options; pick based on what you find:- 1. **Reuse `api/crypto/token.js`** (the free, keyless `/api/crypto/token?address=<mint>`- market-snapshot endpoint, part of the public Crypto Data API — see its header comment) with- the wrapped-SOL mint (`So11111111111111111111111111111111111111112`) and read- `priceUsd` from the response. **Verify this actually resolves a sane price for SOL before- committing to it** — `api/crypto/token.js` sources from DexScreener pair data, and SOL is- usually the *quote* currency in a pair rather than the base, so confirm DexScreener returns- a direct SOL/USD read for the wSOL mint and not `null`/an unrelated pair. Test with- `curl 'https://three.ws/api/crypto/token?address=So11111111111111111111111111111111111111112'`- against production (or a local dev server) before wiring the client to it.- 2. **If that doesn't resolve cleanly**, add a minimal, free, cached passthrough — e.g.- `GET /api/crypto/sol-price` — that calls `solPriceUsd()` from `api/_lib/sol-price.js` and- returns `{ priceUsd, ts }`. Follow the plain-handler pattern (`cors`, `wrap`, `error`/`json`- from `../_lib/http.js`, per-IP rate limit from `../_lib/rate-limit.js`) used by every other- `api/crypto/*.js` free endpoint — model it on `api/crypto/symbol.js` or `api/crypto/token.js`- for exact structure. This is the smaller, more certain fix if option 1 doesn't pan out.--### Task--Replace the direct `fetch('https://api.jup.ag/price/v2...')` call in `pages/three-live.html`-with a same-origin call to whichever of the two above you land on. Keep the existing-`AbortSignal.timeout(5000)` and silent-catch behavior (this is a non-critical price seed, not a-page-blocking dependency) — only the URL and response-shape parsing change.--### Verification--- [ ] Load `https://three.ws/three-live` in a real browser — no CORS error in console for the- price fetch.-- [ ] `_solUsd` (or whatever the seeded variable is now) ends up populated with a plausible SOL- price (check via a breakpoint or a temporary `console.log` you remove before committing).-- [ ] Trades in the live feed that only carry `sol_amount` still show a correct USD value.--## Part B — `/play/ufo` embed--### Context--`pages/play/ufo.html` full-screen-`<iframe>`s `https://flappin-ufo.vercel.app` and separately-polls `https://flappin-ufo.vercel.app/api/leaderboard` (search the file for `LEADERBOARD_URL`)-every 15s for the wallet-address leaderboard panel. Both the iframe's root and the leaderboard-API 404 live right now — this is not a CORS-only problem, the deployment itself is gone. There-is no `flappin-ufo` source in this repo (checked — not a workspace package, not a sibling-directory); it was an external/side deployment that has been decommissioned.--### Task--Since the upstream is confirmed dead (not flaky, not CORS-only — a 404 on its own root), do not-ship a CORS proxy for a deployment that no longer serves the game itself; that would still leave-visitors staring at a blank iframe. Retire the broken embed:--1. Confirm there is no newer canonical URL for the game (check if `flappin-ufo` was renamed or- redeployed elsewhere — search recent commit history / `git log --all --oneline -- '*ufo*'`- for context on where this came from before assuming it's permanently gone).-2. If genuinely gone: replace the full-screen iframe with a designed empty/retired state on- `/play/ufo` (per root `CLAUDE.md`'s "every state is designed" rule — not a blank white iframe)- that explains the demo is no longer available and links back to `/play` (or whatever the- current games/demos hub is — check `/play`'s index for siblings). Remove the dead- `LEADERBOARD_URL` polling entirely rather than leaving it to fail silently every 15s.-3. Update `data/pages.json` if `/play/ufo`'s description promises a live game that no longer- exists — either mark it retired or adjust the copy to match reality. Check `/play`'s own- listing/nav for a card linking to `/play/ufo` and update or remove that link so no other page- points at a now-retired demo.-4. If you instead find evidence during step 1 that this was meant to stay alive (e.g. a very- recent commit referencing it, or an owner note), stop and flag it rather than guessing —- this is the one call in this pack that's genuinely ambiguous without more context (is this- side project still owned/maintained by anyone here?).--### Verification--- [ ] `/play/ufo` no longer embeds a 404ing iframe or polls a dead leaderboard endpoint.-- [ ] The page's new state is designed, not blank — matches root `CLAUDE.md`'s empty-state bar.-- [ ] No other page/nav link still promises a live game at a dead URL.-- [ ] `data/pages.json` description for `/play/ufo` (if kept) matches the page's actual current- state.diff --git a/prompts/production-audit-2026-07-09/06-js-module-bugs.md b/prompts/production-audit-2026-07-09/06-js-module-bugs.mddeleted file mode 100644index 36349e6d5..000000000--- a/prompts/production-audit-2026-07-09/06-js-module-bugs.md+++ /dev/null@@ -1,129 +0,0 @@-# 06 — Two real JS bugs, independent of the deploy lag--## Mission--Two pages are broken by genuine JS bugs — not caching, not a routing issue, not a CORS problem.-Both have precise, already-identified root causes; fix them directly.--## Part A — `/vanity/verify`: `Failed to resolve module specifier "bs58"`--### Root cause--`public/vanity/verify/index.html` is registered as a Vite build entry (`vite.config.js`, search-`'vanity-verify':`), but its inline `<script type="module">` imports-`verifyVanityReceipt` from `/src/solana/vanity/verifiable-grind.js` and `openSealedText` from-`/src/solana/vanity/sealed-envelope.js` — both loaded via an absolute `/src/...` runtime URL-path, not bundled by Vite. This is a known, intentional pattern in this codebase: see the-`copy-src-to-dist` Vite plugin in `vite.config.js` (its comment: *"Several static pages-(dashboard, vanity-wallet, …) import ESM directly from `/src/*.js`. Vite's dev server serves-these from the project root, but production needs them under dist/"*) — it copies raw,-**unbundled** `src/` into `dist/src/` verbatim so the literal `/src/...` URL resolves in-production the same way it does in Vite's dev server.--That works fine for first-party relative imports. It breaks the moment the unbundled file-imports a **bare npm specifier** — and `verifiable-grind.js` / `sealed-envelope.js` both do:-`import bs58 from 'bs58'`, plus `@noble/curves/ed25519.js`, `@noble/hashes/sha256`,-`@noble/hashes/hmac`, `@noble/hashes/hkdf`, `@noble/hashes/utils`. A raw browser ES module has-no way to resolve a bare specifier like `'bs58'` without an import map — Vite's dev server-resolves it on the fly (that's the "dev server serves these" half of the comment), but plain-static hosting in production cannot, hence the console error and the page never rendering.--### The fix — already an established pattern in this repo, copy it exactly--`public/404.html` and `public/500.html` hit this identical problem for a different bare-specifier (`@three-ws/agent-ui`) and solved it with a browser import map pointing the bare name-at its esm.sh ESM build. Copy that pattern verbatim. In `public/404.html` / `public/500.html`,-search for `<script type="importmap">` — note the explanatory comment above it-(*"Resolve the bare @three-ws/agent-ui specifier without a bundler (this file is served verbatim-from public/). esm.sh ships the package's ESM build and resolves its peer deps transitively."*).--Add an equivalent import map to `public/vanity/verify/index.html`'s `<head>`, before the module-script that needs it, mapping every bare specifier `verifiable-grind.js` and-`sealed-envelope.js` actually import:--```html-<script type="importmap">-{- "imports": {- "bs58": "https://esm.sh/[email protected]",- "@noble/curves/ed25519.js": "https://esm.sh/@noble/curves@1/ed25519.js",- "@noble/hashes/sha256": "https://esm.sh/@noble/hashes@1/sha256",- "@noble/hashes/hmac": "https://esm.sh/@noble/hashes@1/hmac",- "@noble/hashes/hkdf": "https://esm.sh/@noble/hashes@1/hkdf",- "@noble/hashes/utils": "https://esm.sh/@noble/hashes@1/utils"- }-}-</script>-```--Pin the `bs58` version to whatever `package.json`'s `"bs58": "^6.0.0"` actually resolves to-locally (`npm ls bs58`) so the CDN build matches the version this code was written/tested-against. Check `package.json` for the installed `@noble/curves` and `@noble/hashes` versions the-same way and pin those exactly too — do not leave `@1` floating if the repo pins a specific-minor/patch elsewhere.--### Tasks--1. Confirm the exact bare specifiers both files import (`grep '^import' src/solana/vanity/verifiable-grind.js src/solana/vanity/sealed-envelope.js`).-2. Confirm installed versions (`npm ls bs58 @noble/curves @noble/hashes`).-3. Add the import map to `public/vanity/verify/index.html`, versions pinned to match.-4. Check whether any **other** page also loads `verifiable-grind.js` or `sealed-envelope.js` via- this same unbundled `/src/...` pattern (grep `pages/*.html public/*.html` for those two- filenames) — if so it needs the identical import map, not a copy-pasted divergent one.--### Verification--- [ ] `npm run build && npm run check:dist` passes.-- [ ] Load `https://three.ws/vanity/verify` (or the local `dist/` build) in a real browser —- no `Failed to resolve module specifier` error in console.-- [ ] Paste a real vanity receipt (or use whatever test fixture the page/tests already use —- check `scripts/verify-vanity-receipt.mjs` / `tests/src/eth-vanity-server-verify.test.js`- for a known-good sample) and confirm the verify flow actually runs end to end: pinned-key- fetch, checks render, verdict renders.--## Part B — `/temporary`: `Cannot use 'import.meta' outside a module`--### Root cause--Precisely identified: `pages/temporary.html` line 1477 loads the shared x402 payment widget as-a **classic** script — `<script src="/x402.js" defer></script>` — but `public/x402.js` uses-`import.meta.url` twice (dynamic `import(new URL('./risk-ack.js', import.meta.url).href)` and-`new URL(import.meta.url).origin`). `import.meta` is a syntax error outside a module context, so-this throws at parse time on `/temporary` specifically.--Confirmed this is an isolated mistake, not a systemic issue: `/x402.js` is loaded on 7 pages-total, and **6 of the other 7 all correctly use `type="module"`**-(`pages/unstoppable.html`, `public/tutor.html`, `pages/club.html`, `public/bazaar.html`,-`public/x402-stripe.html`, `public/siwx-test.html`). `pages/temporary.html` is the one outlier.--### Fix--In `pages/temporary.html`, change:-```html-<script src="/x402.js" defer></script>-```-to:-```html-<script type="module" src="/x402.js"></script>-```-(drop `defer` — module scripts are deferred by default, matching the exact tag used on all 6-other pages; adding both is redundant, not wrong, but match the established pattern exactly).--### Verification--- [ ] Load `https://three.ws/temporary` in a real browser — no `import.meta` syntax error in- console.-- [ ] The x402 payment widget actually initializes on `/temporary` (check whatever visible- affordance it renders — a pay button, a balance widget, whatever the other 6 pages show)- rather than just silently not-crashing.-- [ ] The page's core feature (avatar walk/drive controls — this is the "Drive Your Avatar"- page) is unaffected; this change only touches one unrelated `<script>` tag's loading mode.--## Do not--- Do not remove or "simplify away" the `import.meta` usage in `public/x402.js` to work around- the classic-script constraint — `import.meta.url` is the correct, standard way to resolve a- same-directory sibling module URL; the bug is the loading mode on one page, not the shared- script.-- Do not add a blanket import map with every npm dependency "just in case" — only add the- specific bare specifiers `verifiable-grind.js`/`sealed-envelope.js` actually import.diff --git a/prompts/production-audit-2026-07-09/09-polish-sweep.md b/prompts/production-audit-2026-07-09/09-polish-sweep.mddeleted file mode 100644index 705932cd8..000000000--- a/prompts/production-audit-2026-07-09/09-polish-sweep.md+++ /dev/null@@ -1,156 +0,0 @@-# 09 — Polish sweep: cosmetic header fix + config-gap 503s + stub-link spot-check--## Mission--Four lower-severity findings from the 2026-07-09 crawl. Three have a concrete, bounded fix;-one is genuinely "watch, don't touch" and should stay that way. Run this last, ideally after-prompt 01 has shipped, so re-checks reflect live production rather than a stale deploy.--## A. Permissions-Policy `bluetooth` — cosmetic, one-line, site-wide--### Root cause (confirmed)--`vercel.json` line 188, the global default header block applied to every route-(`"src": "/(.*)"`), sets:-```-"permissions-policy": "accelerometer=(), autoplay=(self), bluetooth=(), camera=(), display-capture=(), encrypted-media=(self), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), midi=(), payment=(self), serial=(), usb=(), xr-spatial-tracking=(self)"-```-Chrome does not recognize `bluetooth` as a valid Permissions-Policy feature name and logs-`Unrecognized feature: 'bluetooth'.` on every page load — hence 302 pages flagged in the crawl-(essentially every page, since this is the site-wide default). This is pure cosmetic console-noise; no actual permission behavior changes either way since Chrome ignores the unrecognized-directive.--### Fix--Remove `bluetooth=()` from the `permissions-policy` value on line 188 of `vercel.json`. Leave-every other directive untouched. Remember root `CLAUDE.md`: `vercel.json` is a **live config-file** consumed directly by `server/index.mjs` (route table + headers), not a Vercel leftover —-editing it is correct here, and the change needs `npm run deploy:gcp` to take effect (bundle-with prompt 01's deploy if that hasn't shipped yet, or ship standalone).--### Verification--- [ ] `curl -sI https://three.ws/` (post-deploy) shows `permissions-policy` without `bluetooth=()`.-- [ ] DevTools console on any page no longer logs the "Unrecognized feature: 'bluetooth'" warning.--## B. `/api/agent/wallet` 503 — has a documented, scripted fix--### Root cause (confirmed)--`api/agent/wallet.js` returns its 503 with the exact remedy already in the error message:-*"avatar wallet is not configured — set `AVATAR_WALLET_SECRET` (run-`scripts/gen-avatar-wallet.mjs`)"*. The script already exists in the repo.--### Fix--1. Run `node scripts/gen-avatar-wallet.mjs` (read it first — confirm it just generates a keypair- and prints the values rather than doing anything destructive; it should be a pure keygen- utility given the error message's phrasing).-2. Set `AVATAR_WALLET_SECRET` on the Cloud Run service env with the generated value.-3. This is a **new** wallet with zero balance — check what `api/agent/wallet.js` actually needs- funded (if anything) for its endpoints to work end-to-end, not just to stop 503ing. If it- needs SOL/USDC to be useful (vs. just needing to exist to unblock read-only calls), fund it- minimally or flag the funding need explicitly rather than declaring this fixed on a technicality.--### Verification--- [ ] `curl -fsS https://three.ws/api/healthz` — this subsystem no longer reports the- `AVATAR_WALLET_SECRET`-unset 503.-- [ ] A real call to whatever `/api/agent/wallet` endpoint exists succeeds (not just health-check- green).--## C. `/api/agent-wallet-bridge` 503 — same family, different var--### Root cause (confirmed)--`api/agent-wallet-bridge.js`'s `agentSigner()` rejects with `"agent wallet not configured on the-server"` when `PAYER_SECRET` (aliased from `env.A2A_PAYER_SOLANA_SECRET`) is unset. This is the-**same role** already listed in `api/_lib/solana-signers.js`'s `SIGNER_SPECS` as `a2a-payer`-(`env: A2A_PAYER_SOLANA_SECRET`, fallback `A2A_PAYER_SOLANA_PRIVATE_KEY`, `minSol: 0.02`,-purpose: *"co-signs SPL TransferChecked for agent-to-agent mandate settlements"*).--### Fix--1. Run `scripts/audit-service-wallets.mjs` (same tool as prompt 08) against real deploy env — it- already checks this exact signer role by name (`a2a-payer` — confirm the spec is in its- `SIGNERS` list; if the script's inline copy of `SIGNER_SPECS` predates this role, add it there- too so future audits catch it).-2. If genuinely absent and no existing funded wallet needs recovering, generate + fund a fresh- keypair for this role (apply the same "check for existing funds before regenerating" caution- as prompt 08 — this is real-money-adjacent, same class of risk).-3. Set `A2A_PAYER_SOLANA_SECRET` on the Cloud Run env.--### Verification--- [ ] `/api/healthz` no longer reports this subsystem as unavailable.-- [ ] `scripts/audit-service-wallets.mjs` shows `a2a-payer` passing its pubkey-match and- SOL-floor checks.--## D. `/api/community/worlds` 503 — likely owner-blocked, verify before attempting--### Root cause (confirmed)--`api/community/worlds.js` (and `api/_lib/coin-communities.js`) requires `CC_API_KEY` — a-third-party CoinCommunities API credential — and is not set. Unlike B/C above, this is not a-platform-controlled Solana wallet you can generate; it's an external service credential.--### Task--1. Confirm whether the platform already has a CoinCommunities account/API key somewhere- (`.env`, a password manager reference, prior commits/docs mentioning CoinCommunities- onboarding) before assuming this needs a brand-new signup.-2. If a key exists but isn't wired into the Cloud Run env, wire it — same pattern as B/C.-3. If no key exists, this needs an owner-level signup decision (new third-party account,- possibly billing) — **stop and report this explicitly rather than attempting a workaround**.- Do not stub, mock, or fake the CoinCommunities integration to silence the 503 — that violates- the no-mocks rule in root `CLAUDE.md` and would hide a real missing capability.--### Verification (only if a key was actually wired)--- [ ] `/api/healthz` no longer reports `cc_unconfigured` for this subsystem.-- [ ] A real `/api/community/worlds` call returns live CoinCommunities data.--## E. Stub links (`href="#"`) — spot-check only, likely by design--### Context (confirmed, not blindly flagged)--100 `href="#"` links across the crawl, worst offenders `agent-edit.html` (×11 at last count,-audit said ×14 — recount, the number may have shifted) and `create-agent.html` (×4). Sampled in-`agent-edit.html`: every one carries an `id` (`preview-view-link`, `mind-fullscreen-link`,-`embed-open`, `wallet-explorer`, `publish-view`, etc.) — the standard "placeholder href, JS sets-the real target once data loads" pattern (e.g. an agent's on-chain explorer link can't be known-until the agent's wallet address is fetched). This is very likely correct by design, matching-the audit's own read ("mostly JS-driven tab/menu buttons").--### Task--Do **not** bulk-fix these. Spot-check a representative sample (start with `agent-edit.html`'s-`wallet-explorer`, `preview-view-link`, and `embed-open`):--1. Confirm each has a corresponding `document.getElementById('<id>').href = ...` (or equivalent)- assignment somewhere in the page's script that actually fires under normal use (not dead- code, not gated behind a condition that never becomes true).-2. Load the actual page, exercise the flow that should populate each link, and confirm the- `href` updates away from `#` and the link actually navigates somewhere real when clicked.-3. If you find one that's genuinely dead (JS never sets it, or sets it to another `#`), fix that- specific instance. If you find the pattern holds for all sampled links, leave the rest alone- — flag the total count as confirmed-by-design in your report rather than mass-editing.--## F. HTTP 429s and the remaining 503 — watch, don't fix blind--Per the audit itself: the 161× 429s (`/api/oracle/*`, `/api/skills`, `/api/clash/state`,-`/api/three/access`, `/api/marketplace/analytics`, `/api/forge-gallery`) are most likely the-audit crawler's own 8-way concurrency tripping a shared per-IP rate limit, not a real-user-facing-bug. Do not touch rate-limit configuration based on this alone. If you want confidence either-way, check `/api/healthz` or real traffic logs (not the crawler's own run) for the same routes-before concluding anything needs to change. Report what you find; only act if real traffic shows-the same pattern.--## Verification summary for this whole prompt--- [ ] A, B, C fixed and verified per their own sections.-- [ ] D resolved if a key was findable, otherwise explicitly reported as owner-blocked (not- silently skipped, not faked).-- [ ] E spot-checked with a clear verdict (confirmed-by-design, or a specific dead link fixed).-- [ ] F explicitly left alone unless real (non-crawler) traffic evidence says otherwise.diff --git a/prompts/production-audit-2026-07-09/README.md b/prompts/production-audit-2026-07-09/README.mddeleted file mode 100644index 805e77943..000000000--- a/prompts/production-audit-2026-07-09/README.md+++ /dev/null@@ -1,51 +0,0 @@-# Production Audit 2026-07-09 — Prompt Pack--Source: full production sweep (static code audits + live check of all 303 catalog routes +-real-Chromium crawl of every page) run 2026-07-09, post-Vercel→Cloud Run migration. 305 pages-crawled, 74 console/network errors, 935 warnings, 34 commits sitting undeployed.--Run each prompt in a **fresh Claude Code chat**. Each is self-contained and ends with-verification + commit (push per the repo's normal git rules — `threews` only, see root-`CLAUDE.md`). Do not skip verification — a prompt is only done when its acceptance criteria-pass against the **live** site, not just locally.--## Run order & dependencies--| # | File | Depends on | Can run in parallel with |-|---|------|-----------|---------------------------|-| 1 | `01-deploy-production.md` | — | — **run this first, alone** |-| 2 | `02-homepage-thumbnail-orb.md` | — | 03, 04, 05, 06 |-| 3 | `03-oracle-ipfs-image-proxy.md` | — | 02, 04, 05, 06 |-| 4 | `04-meshopt-decoder-crash.md` | — | 02, 03, 05, 06 |-| 5 | `05-cors-proxy-jupiter-ufo.md` | — | 02, 03, 04, 06 |-| 6 | `06-js-module-bugs.md` | — | 02, 03, 04, 05 |-| 7 | `07-world-admin-hardening.md` | 01 (deploy ships nothing here; independent, but owner must run the secret-minting step) | any |-| 8 | `08-x402-sponsor-cosign.md` | — (owner-supplied secret) | any |-| 9 | `09-polish-sweep.md` | 01–06 ideally deployed first so the crawl re-check is clean | last |--Prompts 2–6 all touch client-side code with no shared files — genuinely parallel. Run 01 first-by itself since it ships 34 commits including the `/app` and `/chat` routing fix that is-otherwise silently sitting undeployed; every other prompt's "verify against production" step is-more trustworthy once 01 has shipped.--## Ground rules baked into every prompt--- **No mocks, no placeholders, no half-wiring** (root `CLAUDE.md` rules apply in full).-- **Verify against the live behavior**, not just a green test suite — this audit was itself- found by a real-Chromium crawl; re-run the equivalent check (`npm run audit:pages` /- `scripts/page-audit.mjs` against the affected path, or a manual browser check) before- claiming a prompt done.-- **Deploy is `npm run deploy:gcp`** (builds frontend + submits to Cloud Run via- `server/cloudbuild.yaml`). Run `npm run build` first if you changed frontend-only files and- need to sanity-check `dist/` locally.-- Every fix here is a **bug fix**, not a redesign — match existing patterns in the surrounding- code (see each prompt's "Context" section for the exact file/pattern to follow).-- Append a `data/changelog.json` entry for anything user-visible per the root `CLAUDE.md`- changelog rules — tag `fix`.--## Source--Audit artifact: `scripts/page-audit.mjs` (Chromium, desktop, concurrency 8) ·-`scripts/verify-routes.mjs --base=https://three.ws --all` ·-`npm run audit:mcp` / `audit:handlers` / `audit:hidden-guard` / `audit:x402-catalog` /-`audit:tokens` · `scripts/audit-links.mjs` · `/api/healthz` · `git log`.