Skip to content

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.

feat: Implement OKX Agent Payments Protocol integration and service decomposition

fudjiac7dd418ccf55
diff --git a/prompts/gcp-credits/01-gcp-foundation.md b/prompts/gcp-credits/01-gcp-foundation.md
new file mode 100644
index 000000000..2d623909e
--- /dev/null
+++ b/prompts/gcp-credits/01-gcp-foundation.md
@@ -0,0 +1,96 @@
+# 01 — GCP Foundation: project, auth, quotas, Claude Code on Vertex
+
+## Mission
+
+We have ~$100k of Google Cloud credits expiring in ~2 months. This prompt sets up the GCP
+foundation everything else builds on: verified billing/credits, enabled APIs, service accounts,
+Claude enabled in Vertex Model Garden with quota headroom, credentials wired into Vercel, and
+Claude Code dev sessions routable through Vertex. Later prompts (02–08) depend on the outputs of
+this one. Do the work end to end — where a step genuinely requires the human (console-only terms
+acceptance), do everything around it, verify after, and list exactly what the owner must click.
+
+## Context
+
+- This repo (three.ws) already uses GCP in places: `api/_mcp3d/vertex-imagen.js` is a working
+ Vertex Imagen client with service-account JWT→OAuth exchange (env:
+ `GOOGLE_CLOUD_PROJECT`, `GOOGLE_CLOUD_LOCATION`, `GCP_SERVICE_ACCOUNT_JSON`), and
+ `workers/model-*/cloudbuild.yaml` deploy GPU workers to Cloud Run. `.gcloudignore` exists at
+ repo root. GCS buckets referenced: `three-ws-model-weights`, `three-ws-avatar-reconstructions`.
+- Deployment platform for `api/` is Vercel (use the `vercel` CLI; `vercel env ls` to inspect).
+- Claude models are served on Vertex AI as partner models under publisher `anthropic`, billed
+ through the GCP project. Current-generation model IDs on Vertex are the bare first-party IDs
+ (e.g. `claude-sonnet-4-6`, `claude-opus-4-8`); dated snapshots use `@` (e.g.
+ `claude-haiku-4-5@20251001` — note the repo's default model string is
+ `claude-haiku-4-5-20251001`, which must map to the `@` form on Vertex).
+
+## Tasks
+
+1. **CLI + auth.** Ensure `gcloud` is installed and authenticated (install if missing). Identify
+ the target project (check existing env/`vercel env ls`/`workers/deploy/*.sh` for a project ID
+ already in use; if ambiguous, list projects and pick the one holding the existing buckets).
+ Set it as default.
+2. **Credits & partner-model coverage (go/no-go).** Via `gcloud billing` (and the Cloud Billing
+ API), confirm: the active billing account, that credits are applied, remaining balance, and
+ expiry date. **Critical check:** determine whether the credit grant covers Vertex AI *partner
+ models* (Anthropic). Google-for-Startups credits do; some grants exclude third-party models.
+ If this cannot be confirmed programmatically, produce a precise console path + question for
+ the owner and continue with the rest of the setup (the check gates prompt 02's chain
+ inversion, not this prompt).
+3. **Enable APIs:** `aiplatform.googleapis.com`, `run.googleapis.com`,
+ `cloudbuild.googleapis.com`, `storage.googleapis.com`, `compute.googleapis.com`,
+ `bigquery.googleapis.com`, `cloudbilling.googleapis.com`, `monitoring.googleapis.com`.
+4. **Service accounts** (create only if no suitable one exists — check first):
+ - `vercel-inference@…` with `roles/aiplatform.user` — used by Vercel functions for
+ Vertex Claude + Imagen.
+ - Confirm the existing worker deploy flow's SA still works (used by
+ `workers/deploy/*.sh` / cloudbuild).
+ Mint a JSON key for the Vercel SA and set it in Vercel as `GCP_SERVICE_ACCOUNT_JSON`
+ (all environments), plus `GOOGLE_CLOUD_PROJECT` and `GOOGLE_CLOUD_LOCATION` (default
+ `us-central1`; also set `GOOGLE_CLOUD_LOCATION_CLAUDE=global` for the Claude global
+ endpoint). Never write the key into the repo.
+5. **Enable Claude in Model Garden.** Attempt via gcloud/API; Model Garden partner-model
+ enablement usually requires a one-time console acceptance — if so, give the owner the exact
+ console URL and model list to enable: `claude-haiku-4-5`, `claude-sonnet-4-6`,
+ `claude-opus-4-8`, `claude-fable-5` (if available), plus `claude-sonnet-5`.
+6. **Quota.** Check current Vertex quotas for those models (QPM/TPM per region). File quota
+ increase requests sized for production chat traffic (start: 300 QPM / 2M TPM on Haiku and
+ Sonnet tiers, region `global` and `us-central1`). Document what was requested and current
+ values.
+7. **Smoke test.** Once enablement is confirmed, verify with a raw call (no SDK needed):
+ `POST https://aiplatform.googleapis.com/v1/projects/{P}/locations/global/publishers/anthropic/models/claude-haiku-4-5@20251001:streamRawPredict`
+ with body `{"anthropic_version":"vertex-2023-10-16","max_tokens":64,"messages":[{"role":"user","content":"ping"}]}`
+ and an OAuth Bearer token from the Vercel SA key. A 200 with streamed content = pass. If
+ enablement is pending human console action, write this smoke test as
+ `scripts/gcp/vertex-smoke.mjs` (runnable, reading `GCP_SERVICE_ACCOUNT_JSON` from env) so it
+ can be run the moment enablement lands.
+8. **Claude Code on Vertex (dev spend → credits).** Create `scripts/gcp/claude-code-vertex.sh`
+ that exports `CLAUDE_CODE_USE_VERTEX=1`, `ANTHROPIC_VERTEX_PROJECT_ID=<project>`,
+ `CLOUD_ML_REGION=global`, and points ADC at a dev credential (document
+ `gcloud auth application-default login` as the auth step). Opt-in by `source`-ing — do NOT
+ set these globally in the devcontainer (sessions must be able to choose billing lane).
+ Document usage in the runbook.
+9. **Runbook.** Create `docs/gcp-credits.md`: project ID, billing account, credit balance +
+ expiry date, what's enabled, SA inventory, env vars set (names only, no values), quota state,
+ smoke-test instructions, and a "pending human actions" checklist. Later prompts append to
+ this file.
+
+## Acceptance criteria
+
+- [ ] `gcloud` authenticated against the right project; project ID recorded in the runbook.
+- [ ] Credit balance + expiry confirmed and recorded; partner-model coverage confirmed or
+ escalated with an exact console path.
+- [ ] All listed APIs enabled (verify with `gcloud services list --enabled`).
+- [ ] Vercel envs set: `GCP_SERVICE_ACCOUNT_JSON`, `GOOGLE_CLOUD_PROJECT`,
+ `GOOGLE_CLOUD_LOCATION`, `GOOGLE_CLOUD_LOCATION_CLAUDE` (verify `vercel env ls`).
+- [ ] `scripts/gcp/vertex-smoke.mjs` exists and passes (or is ready + blocked only on the
+ documented console enablement).
+- [ ] `scripts/gcp/claude-code-vertex.sh` exists and works when sourced.
+- [ ] `docs/gcp-credits.md` written.
+- [ ] No secret material anywhere in the working tree (`git diff` audited before commit).
+
+## Wrap-up
+
+Add a `data/changelog.json` entry only if something user-visible shipped (this prompt is
+infra — likely no entry). Commit with explicit paths (`scripts/gcp/`, `docs/gcp-credits.md`),
+push to `threews` and attempt `threeD` (known flaky mirror — report failure, don't block).
+Report: credit balance, expiry date, what's live, what's blocked on the owner.
diff --git a/prompts/gcp-credits/02-vertex-claude-provider.md b/prompts/gcp-credits/02-vertex-claude-provider.md
new file mode 100644
index 000000000..82e921b9b
--- /dev/null
+++ b/prompts/gcp-credits/02-vertex-claude-provider.md
@@ -0,0 +1,118 @@
+# 02 — Vertex Claude provider: route all platform LLM traffic through GCP credits
+
+## Mission
+
+Add Google Vertex AI as a first-class Claude provider across every LLM path in this codebase,
+behind env flags, with automatic fallthrough to the existing chain. When
+`VERTEX_CLAUDE_PRIMARY=1` is set, the platform's *default* brain becomes real Claude on Vertex
+(billed to our ~$100k GCP credits) instead of the current free-first Groq/OpenRouter/NIM
+scavenging — a product-quality upgrade paid for by Google. When the flag is off, behavior is
+byte-identical to today. No mocks, no partial wiring: streaming and non-streaming, every entry
+point.
+
+## Prerequisites (verify before starting; stop and report if missing)
+
+- Prompt 01 ran: Vercel envs `GCP_SERVICE_ACCOUNT_JSON`, `GOOGLE_CLOUD_PROJECT`,
+ `GOOGLE_CLOUD_LOCATION_CLAUDE` exist (`vercel env ls`), and `scripts/gcp/vertex-smoke.mjs`
+ passes (Claude enabled in Model Garden).
+
+## Context — the exact call surfaces (from prior code audit; re-verify line numbers)
+
+All text inference is **raw `fetch`** (no Anthropic SDK in the hot path). Four surfaces:
+
+1. **`api/_lib/llm.js`** — `llmComplete()`, the server-side one-shot completion helper used by
+ ~35 call sites (agent `talk`/delegation — which the MCP `agent_hire` tools bottom out in —
+ personas, x402 paid endpoints, crons, vision fallbacks). `anthropicProvider()` around line
+ 95 does a raw POST to `api.anthropic.com/v1/messages` with `x-api-key`. The chain is built
+ in `providerChain()` (~lines 145–207), currently free-first: NIM/BYOK/Groq/OpenRouter first,
+ paid Anthropic (`ANTHROPIC_MODEL = 'claude-haiku-4-5-20251001'`) and OpenAI as the tail.
+2. **`api/llm/anthropic.js`** — the streaming SSE proxy behind **every embedded avatar/agent
+ chat widget** (`POST /api/llm/anthropic?agent=<id>`). `MODELS` table (~lines 41–90) maps
+ Anthropic model IDs → `envKey: 'ANTHROPIC_API_KEY'`; `UPSTREAM_URL.anthropic` ~line 93.
+ Browser client (`src/runtime/providers.js` `AnthropicProvider`) only talks to this proxy —
+ zero client changes needed.
+3. **`api/chat.js`** — the main viewer/agent chat SSE endpoint with its own inline provider
+ ladder mirroring the above (7 providers incl. watsonx). Highest-volume endpoint.
+4. **`api/brain/chat.js`** — the `/brain` comparison page, the only SDK user
+ (`@ai-sdk/anthropic` via Vercel AI SDK).
+
+Reusable auth already in-repo: `api/_mcp3d/vertex-imagen.js` (~lines 55–217) implements
+service-account JWT→OAuth token exchange via `crypto.subtle` with caching + metadata-server
+fallback.
+
+## Vertex wire format (differences from first-party Anthropic API)
+
+- URL: `https://aiplatform.googleapis.com/v1/projects/{P}/locations/global/publishers/anthropic/models/{MODEL}:streamRawPredict`
+ (non-streaming: `:rawPredict`; regional endpoints prefix the host with `{region}-`).
+- Model ID goes **in the URL, not the body**. Body gains `"anthropic_version": "vertex-2023-10-16"`
+ and drops `"model"`.
+- Auth: `Authorization: Bearer <oauth token>` — no `x-api-key`, no `anthropic-version` header.
+- Model ID mapping: bare IDs pass through (`claude-sonnet-4-6`); dated first-party IDs convert
+ to `@` form (`claude-haiku-4-5-20251001` → `claude-haiku-4-5@20251001`). Write one shared
+ mapping helper; do not scatter string surgery.
+- SSE event shapes in the response are identical to first-party — existing parsers work.
+
+## Tasks
+
+1. **Extract shared GCP auth.** Pull the token-exchange logic out of
+ `api/_mcp3d/vertex-imagen.js` into `api/_lib/gcp-auth.js` (`getGcpAccessToken()` with
+ caching). Refactor `vertex-imagen.js` to use it. No behavior change to Imagen.
+2. **`api/_lib/vertex-claude.js`** — a provider module exporting the model-ID mapper and
+ `vertexAnthropicMessages(body, {stream})` returning the raw Response, using `gcp-auth.js`.
+ Config from env: `GOOGLE_CLOUD_PROJECT`, `GOOGLE_CLOUD_LOCATION_CLAUDE` (default `global`).
+3. **Flags** (document in `docs/gcp-credits.md`):
+ - `VERTEX_CLAUDE_ENABLED=1` — Vertex becomes an available Anthropic transport.
+ - `VERTEX_CLAUDE_PRIMARY=1` — chain inversion: Vertex Claude is tried **first** in
+ `providerChain()` (with a sensible default model, e.g. Sonnet for chat-grade calls, Haiku
+ for utility calls — follow each call site's existing model intent), before the free lanes.
+ - Both off → zero code path change (prove it: diff behavior in a local run).
+4. **Wire all four surfaces:**
+ - `llm.js`: add `vertexAnthropicProvider()`; insert into `providerChain()` per the flags.
+ On Vertex 429/5xx/quota errors, fall through to the rest of the chain exactly like any
+ other failed provider.
+ - `api/llm/anthropic.js`: when `VERTEX_CLAUDE_ENABLED=1`, route `provider: anthropic`
+ models through Vertex streaming (`streamRawPredict`), passing SSE through unchanged;
+ on failure fall back to first-party Anthropic if `ANTHROPIC_API_KEY` exists.
+ - `api/chat.js`: add the Vertex lane to the inline ladder under the same flags, mirroring
+ how the Anthropic lane sits today.
+ - `api/brain/chat.js`: use `@ai-sdk/google-vertex`'s Anthropic support (or a custom fetch
+ into the same provider module) so `/brain` can compare Vertex-served Claude too. If the
+ AI-SDK route fights you, a thin custom provider over `vertex-claude.js` is acceptable —
+ but it must actually work, not be stubbed.
+ - `api/_lib/chat-models.js`: catalog entries so Vertex-served models are selectable and
+ the routing brain knows about the transport (follow existing catalog conventions).
+5. **Attribution/telemetry.** Whatever per-request logging exists for provider selection must
+ record `vertex-anthropic` distinctly (so prompt 07's spend/usage reporting can attribute
+ traffic). If provider health tracking exists (`api/_lib/provider-health.js`), register the
+ new lane so circuit-breaking works.
+6. **Tests + smoke.**
+ - Unit-test the model-ID mapper and chain ordering under the four flag combinations
+ (framework: whatever `npm test` already runs — match existing test conventions).
+ - `scripts/gcp/vertex-llm-smoke.mjs`: hits a local `npm run dev` server on (a) `llmComplete`
+ via an API route that uses it, (b) `/api/llm/anthropic` streaming, (c) `/api/chat`
+ streaming — with flags on, asserting the response came from Vertex (via the telemetry
+ marker or a debug header you add).
+7. **Real-browser verification** (definition of done requires it): `npm run dev`, open an
+ embedded agent widget page and the main chat, send messages with `VERTEX_CLAUDE_ENABLED=1
+ VERTEX_CLAUDE_PRIMARY=1`, confirm streamed replies, no console errors, and Vertex attribution
+ in server logs. Then flip flags off and confirm today's behavior is intact.
+8. **Deploy config:** set both flags in Vercel **preview** env only. Production flip is the
+ owner's call (it changes the billing lane) — leave production flags unset and say so in
+ your report.
+
+## Guardrails
+
+- Fail-safe is non-negotiable: any Vertex error falls through to the existing chain. A GCP
+ outage must never break chat.
+- Don't touch the free-lane providers' logic or ordering relative to each other.
+- No new npm dependency for auth (reuse `gcp-auth.js`); `@ai-sdk/google-vertex` for
+ `/brain` only if it earns its keep.
+- Never log token contents or SA material.
+
+## Wrap-up
+
+Update `docs/gcp-credits.md` (flags, model mapping, rollback = unset flags). Changelog entry
+per CLAUDE.md rules — the *code* is infra, but if you flip preview to Claude-primary that's
+user-noticeable in previews only; use judgment. `npm test` green. Review `git diff` fully,
+commit explicit paths, push `threews` (+ attempt `threeD`). Report token/latency observations
+from the smoke runs and the exact env-flip needed to invert production.
diff --git a/prompts/gcp-credits/03-imagen-activation.md b/prompts/gcp-credits/03-imagen-activation.md
new file mode 100644
index 000000000..2133e54d4
--- /dev/null
+++ b/prompts/gcp-credits/03-imagen-activation.md
@@ -0,0 +1,75 @@
+# 03 — Activate the dormant Vertex Imagen lane
+
+## Mission
+
+The repo already contains a complete Vertex AI Imagen client that nobody turned on. Activate it
+so the image-generation legs of the forge pipeline bill to our GCP credits instead of NVIDIA
+NIM FLUX / Replicate, verify quality end to end, and keep automatic fallback intact. This is
+the smallest prompt in the pack — its value is in *verification*, not code volume. Do not stop
+at "env var set"; prove the pixels.
+
+## Prerequisites
+
+- Prompt 01 ran: `GCP_SERVICE_ACCOUNT_JSON`, `GOOGLE_CLOUD_PROJECT`, `GOOGLE_CLOUD_LOCATION`
+ set in Vercel (`vercel env ls`). If prompt 02 already ran, `api/_lib/gcp-auth.js` exists —
+ use it (see task 2).
+
+## Context (from prior code audit; re-verify)
+
+- `api/_mcp3d/vertex-imagen.js` — full Imagen client: SA JWT→OAuth exchange (~lines 55–217),
+ endpoint `https://{location}-aiplatform.googleapis.com/v1/projects/{P}/locations/{L}/publishers/google/models/{MODEL}:predict`,
+ env `VERTEX_IMAGEN_MODEL` / `VERTEX_IMAGEN_EDIT_MODEL`. Its header comment explicitly frames
+ it as the $100k-credit burner.
+- `api/_mcp3d/text-to-image.js` — provider selector: **prefers Vertex Imagen whenever
+ `GOOGLE_CLOUD_PROJECT` is set**, else NVIDIA NIM FLUX, else Replicate.
+- Consumers: `api/x402/forge.js` and the paid text→3D chain (Granite prompt director →
+ reference image → TRELLIS/Hunyuan3D reconstruction). The reference image drives 3D quality,
+ so image quality directly affects the paid product.
+
+## Tasks
+
+1. **Audit the dormant client.** Read `vertex-imagen.js` fully. Check the model IDs it defaults
+ to against currently-available Imagen models on Vertex (`gcloud ai models` / Model Garden —
+ Imagen versions rotate; older IDs 404). Update defaults if stale. Confirm the request shape
+ (aspect ratio, safety settings, person generation params) matches the current `:predict`
+ schema.
+2. **Deduplicate auth** if prompt 02 landed: refactor `vertex-imagen.js` onto
+ `api/_lib/gcp-auth.js`. If 02 hasn't run, leave auth in place (02 will extract it) — note
+ which order happened in your report.
+3. **Flag it like everything else in this program.** `GOOGLE_CLOUD_PROJECT` being set is too
+ blunt an activation switch (it's also needed for Vertex Claude and workers). Add
+ `VERTEX_IMAGEN_ENABLED=1` as the explicit gate in `text-to-image.js`'s selector, defaulting
+ to today's behavior when unset. Keep the fallback ladder (Imagen → NIM FLUX → Replicate) on
+ any error.
+4. **Telemetry.** Ensure whichever provider actually served an image is recorded (log line or
+ existing provider-health mechanism) so spend attribution and debugging work.
+5. **End-to-end verification (required):**
+ - Direct: script or curl the text-to-image path with the flag on; save an output image and
+ look at it (Read tool renders images) — confirm it's a real, on-prompt image.
+ - Pipeline: run the paid-lane forge chain locally (`npm run dev`, drive
+ `/api/forge` the way `mesh_forge` does per `mcp-server/src/tools/_studio-core.js`) with
+ Imagen active; confirm the reference image comes from Imagen (telemetry) and the resulting
+ GLB is sane.
+ - Quality gate: generate the same 3–4 prompts via Imagen and via the current FLUX lane;
+ compare side by side. If Imagen's output is clearly worse for this use case (stylized 3D
+ reference images), say so honestly in the report and recommend scope (e.g. Imagen for
+ seed/draft lanes only) — do not silently ship a quality regression on the paid lane.
+ - Fallback: break the Imagen call (bogus model ID locally), confirm clean fallthrough to
+ FLUX with no user-visible error.
+6. **Deploy:** set `VERTEX_IMAGEN_ENABLED=1` in Vercel preview; production only if the quality
+ gate passed cleanly — otherwise leave to the owner with your recommendation.
+
+## Acceptance criteria
+
+- [ ] Imagen model IDs verified current; client request shape verified against live API.
+- [ ] `VERTEX_IMAGEN_ENABLED` gate added; unset ⇒ byte-identical current behavior.
+- [ ] Real generated image inspected; paid-lane E2E run served by Imagen; fallback proven.
+- [ ] Quality comparison done and reported with an honest recommendation.
+- [ ] Provider attribution visible in logs.
+- [ ] `npm test` green; `git diff` reviewed.
+
+## Wrap-up
+
+Update `docs/gcp-credits.md` (flag, models, rollback). Changelog entry only if user-visible
+(likely not — infra swap). Commit explicit paths, push `threews` (+ attempt `threeD`). Report
+quality verdict + which env is live where.
diff --git a/prompts/gcp-credits/04-gpu-workers-deploy.md b/prompts/gcp-credits/04-gpu-workers-deploy.md
new file mode 100644
index 000000000..2479b1a47
--- /dev/null
+++ b/prompts/gcp-credits/04-gpu-workers-deploy.md
@@ -0,0 +1,103 @@
+# 04 — Deploy the GPU worker fleet to Cloud Run (self-hosted 3D stack)
+
+## Mission
+
+Deploy the already-written GPU model workers to Cloud Run on our GCP credits and flip the forge
+router's self-host backends live: TRELLIS (text/image→3D), Hunyuan3D, TripoSG/TripoSR, UniRig
+(auto-rigging), and text2motion. Outcome: the paid forge lane stops paying Replicate (≈100%
+margin during the credit window), the free lane stops being throttled by hosted NVIDIA NIM's
+rate limits, image→3D opens up on the free lane (hosted NIM preview rejects user images; our
+own TRELLIS accepts them), and prompt 05 gets a firehose for catalog seeding. Everything
+reverts by unsetting env URLs.
+
+## Prerequisites
+
+- Prompt 01 ran: project set, Cloud Run/Cloud Build/Storage APIs enabled, `gcloud` authed.
+- GPU quota: check `nvidia-l4` quota in the target region (`us-central1` unless the existing
+ buckets/scripts say otherwise). File an increase immediately if < 4 GPUs — it can take days;
+ deploy what fits now and document the pending ask.
+
+## Context (from prior code audit; re-verify everything against the tree)
+
+- Workers, each with `main.py` + `Dockerfile` + `cloudbuild.yaml` targeting Cloud Run L4
+ (`--gpu=1 --gpu-type=nvidia-l4`, min-instances 0):
+ `workers/model-trellis/` (TRELLIS-image-large), `workers/model-hunyuan3d/`,
+ `workers/model-triposg/`, `workers/model-triposr/`, `workers/unirig/` (VAST UniRig —
+ skeleton + skinning + ARKit-52 blendshapes; also `rig_glb.py`), `workers/model-text2motion/`.
+ Deploy helpers in `workers/deploy/*.sh`; docs in `workers/README.md`, `workers/deploy/README.md`.
+- Model weights staged in GCS bucket `three-ws-model-weights`; intermediate output to
+ `three-ws-avatar-reconstructions`. Durable public assets stay on Cloudflare R2 (`api/_lib/r2.js`)
+ — do not move asset storage to GCS.
+- Shared auth between Vercel and workers: bearer `GCP_RECONSTRUCTION_KEY`.
+- The router already has the code paths: `api/forge.js` (~2000 lines; lane routing) with
+ backends `trellis_selfhost`, `hunyuan3d`, `triposg`; health-aware routing + cold-start ETA in
+ `api/_lib/forge-lane-health.js` / `api/_lib/provider-health.js`; scale limits in
+ `api/_lib/forge-scale.js`. Rigging goes through `api/_providers/gcp.js`
+ (`GCP_RECONSTRUCTION_URL`, `/rig`) and `api/_lib/auto-rig.js`. Direct NIM-protocol path:
+ `api/nim-forge.js` (`NIM_TRELLIS_URL`/`MODEL_TRELLIS_URL`).
+- Env URLs the router reads (verify exact names in code): `MODEL_TRELLIS_URL`,
+ `GCP_HUNYUAN3D_URL`, `GCP_TRIPOSG_URL`, `GCP_RECONSTRUCTION_URL`, `GCP_TEXT2MOTION_URL`.
+
+## Tasks
+
+1. **Pre-flight per worker.** Read each worker's README/cloudbuild/deploy script. Confirm the
+ weights it expects exist in `three-ws-model-weights` (stage them if missing — the deploy
+ scripts or READMEs describe how). Fix anything stale (base image, CUDA version pins) —
+ these were written a while ago; a build that fails on today's Cloud Build gets fixed, not
+ skipped.
+2. **Deploy all six** via `gcloud builds submit` / the deploy scripts. Generate and set a strong
+ `GCP_RECONSTRUCTION_KEY` (Cloud Run env + Vercel env). Configuration decisions:
+ - Region: co-locate with the weights bucket.
+ - **min-instances 1 for `model-trellis` and `unirig`** during the credit window (cold-start
+ on L4 + model load is brutal; instances are ~free on credits). min-instances 0 for the
+ rest. Document per-service settings.
+ - Concurrency/timeouts per the worker READMEs; requests can run minutes — set Cloud Run
+ timeout ≥ 900s where the code expects it.
+3. **Health.** Curl each service's health endpoint directly, then confirm the platform's lane
+ health (`forge-lane-health.js` / provider-health) registers them once env URLs are set.
+4. **Wire Vercel env** (preview first): all five URL vars + `GCP_RECONSTRUCTION_KEY`. Confirm
+ `api/forge.js` routing actually selects self-host backends — read the routing logic; if
+ selection needs a flag or priority tweak to prefer self-host over Replicate/hosted-NIM,
+ make that change **behind `FORGE_SELFHOST_PRIMARY=1`** with fallthrough to today's ladder on
+ error, same fail-safe philosophy as the whole program.
+5. **End-to-end verification (all five paths, real requests, definition of done):**
+ - Text→3D free lane → self-hosted TRELLIS → GLB lands in R2, viewable via the viewer link.
+ - Image→3D with a real input image (the thing hosted NIM couldn't do) → GLB.
+ - Paid-lane `mesh_forge`-style chain (reference image → reconstruction) → GLB, with logs
+ proving **Replicate was not called**.
+ - Rig: send a generated GLB through `/rig` (UniRig) → animation-ready GLB; load it and
+ confirm the skeleton drives the canonical clips (`src/glb-canonicalize.js` path).
+ - text2motion: one text→motion generation → clip JSON.
+ Record latency (cold + warm) for each in the runbook.
+6. **Scale limits.** Revisit `forge-scale.js` ceilings that exist to protect the hosted-NIM
+ free allocation: with self-host primary, raise the free-lane hourly/global ceilings to what
+ the deployed GPU count sustains (compute it from measured per-asset latency; show the math).
+ Keep abuse/per-IP limits intact. Flag-gate the raised limits with the same
+ `FORGE_SELFHOST_PRIMARY` so revert restores today's ceilings.
+7. **Cost note.** Compute $/asset from measured latency × L4 Cloud Run pricing; write it into
+ `docs/gcp-credits.md` (prompt 08 needs it for the keep/kill decision at expiry).
+
+## Guardrails
+
+- Fallback ladder stays: self-host error → hosted NIM / Replicate / HF exactly as today.
+- Don't commit any Cloud Build artifacts or `api/` files mangled by tooling — beware the known
+ trap: `npx vercel build` overwrites `api/*.js` in place; check `head -1` of changed api files
+ for `__defProp` before committing.
+- R2 remains the asset store. GCS is weights/intermediates only.
+
+## Acceptance criteria
+
+- [ ] All six services deployed, healthy, and reachable with the bearer key.
+- [ ] All five E2E paths verified with real outputs (GLBs/clips inspected, not just 200s).
+- [ ] Replicate absent from paid-lane logs when `FORGE_SELFHOST_PRIMARY=1`.
+- [ ] Raised free-lane limits computed and flag-gated.
+- [ ] Latency + $/asset table in `docs/gcp-credits.md`; per-service Cloud Run config documented.
+- [ ] Flags/URLs unset ⇒ today's behavior (spot-check one path).
+- [ ] `npm test` green; `git diff` reviewed.
+
+## Wrap-up
+
+Changelog entry when this hits production (users notice: image→3D on free lane, faster/looser
+limits) — plain-language, per CLAUDE.md. Update `STRUCTURE.md` only if a new surface/dir landed.
+Commit explicit paths, push `threews` (+ attempt `threeD`). Report: what's live, GPU quota
+state, cost table, and the env flips for production.
diff --git a/prompts/gcp-credits/05-catalog-animation-seeding.md b/prompts/gcp-credits/05-catalog-animation-seeding.md
new file mode 100644
index 000000000..847339b27
--- /dev/null
+++ b/prompts/gcp-credits/05-catalog-animation-seeding.md
@@ -0,0 +1,99 @@
+# 05 — Bulk catalog & animation seeding on the self-hosted GPU fleet
+
+## Mission
+
+Use the self-hosted GPU lanes (prompt 04) to mass-produce durable platform content that outlives
+the credits: a much larger curated avatar catalog and a generative text→motion animation library
+listed in the marketplace. This is the "credits → permanent assets" play. Quality-gate
+everything — a catalog of 5,000 junk meshes is worse than today's catalog. Verify the browsing
+surfaces hold up at the new scale.
+
+## Prerequisites (stop and report if missing)
+
+- Prompt 04 live in at least preview: `MODEL_TRELLIS_URL` etc. set, self-host lanes healthy,
+ `FORGE_SELFHOST_PRIMARY` available. text2motion service deployed (`GCP_TEXT2MOTION_URL`).
+
+## Context (from prior code audit; re-verify)
+
+- **Seed cron exists:** `api/cron/forge-seed-cron.js` runs ~per-minute, generates real avatars
+ on the free NIM draft lane, attributes each to a fresh OG-username user, publishes to the
+ avatars table. Prompt library: `api/_lib/seed-prompts.js` (200+ prompts).
+- **Catalog surfaces:** `api/avatars/`, `/gallery`, `/dashboard/avatars`, curated GLBs in
+ `public/avatars/`.
+- **Animation marketplace:** `api/marketplace/animations.js` (creator-listed clips) with x402
+ download route `api/x402/animation-download.js`. The Mixamo library (2,800+ retargeted clips)
+ is already live at `/animations`, served from R2 (`animations/library/clips/*.json` +
+ `manifest.json`, endpoint `GET /api/animations/library`).
+- **Vision QA available:** `api/vision.js` / `api/_lib/vision.js` can describe a render — usable
+ as an automated quality gate.
+- Assets land in R2 via `api/_lib/r2.js` (`forge/…` prefixes); thumbnails already part of the
+ pipeline.
+
+## Tasks
+
+### A. Avatar catalog seeding (target: +3,000–5,000 *curated* avatars)
+
+1. **Upgrade the seed cron** to use the self-hosted lane when `FORGE_SELFHOST_PRIMARY=1`
+ (it should inherit this from prompt 04's routing — verify, don't assume) and make its
+ cadence/batch size env-tunable (`SEED_CRON_BATCH`, default = current behavior).
+2. **Expand `seed-prompts.js`** meaningfully: broaden coverage (professions, fantasy, sci-fi,
+ animals-as-props vs humanoids, styles) with attention to what makes good *rigged* avatars —
+ humanoid, front-facing, full-body. Keep prompts coin-neutral (no third-party crypto
+ references — commit gate).
+3. **Automated quality gate before publish:** render thumbnail → `api/vision.js` check
+ (humanoid? complete body? not a blob?) + mesh sanity (vertex count bounds, has texture).
+ Failing assets are not published (keep them in R2 under a `forge/rejected/` prefix with the
+ reason, for tuning). Track accept rate.
+4. **Rig the keepers:** run accepted avatars through UniRig so catalog entries are
+ animation-ready (that's the product bar — a catalog avatar that T-poses is half-built).
+ Verify a sample in the viewer with idle/walk clips playing.
+5. **Batch runner:** a resumable script `scripts/gcp/seed-avatars.mjs` (checkpoint file, safe
+ to re-run, parallelism tuned to deployed GPU count) for bulk runs beyond the cron cadence.
+ Run it for a first real batch (e.g. 500) end to end before scaling up; report accept rate
+ and $/accepted-asset, then continue to target if quality holds.
+
+### B. Animation library seeding (target: +500–1,000 curated motion clips)
+
+6. **Prompt set for text2motion:** build a motion prompt library (locomotion variants, emotes,
+ dances, combat, idles, interactions) — a data file, not hardcoded.
+7. **Batch generate → retarget → publish:** generate clips via `GCP_TEXT2MOTION_URL`, convert
+ to the canonical-skeleton clip JSON format the library uses (match the Mixamo library's
+ format exactly — inspect existing clips in R2/`public/animations/`), upload under a distinct
+ prefix (`animations/library/generated/…`), and update the manifest. QA gate: clip duration
+ sane, no NaN keyframes, plays on the default rig without foot-sliding disasters (spot-check
+ a sample visually in the viewer).
+8. **Marketplace listing:** list the generated set in `api/marketplace/animations.js` under a
+ platform creator identity, priced consistently with existing listings, downloadable via the
+ existing x402 route. Free tier: consider adding a rotating subset to the free library —
+ owner-visible decision; implement the mechanism, note the policy choice in the report.
+
+### C. Scale-proofing the surfaces
+
+9. With the catalog at 5–10× size: verify `/gallery`, `/dashboard/avatars`, `/animations`, and
+ the marketplace list endpoints paginate (not fetch-all), thumbnails lazy-load, and API
+ responses stay bounded. Fix what breaks — pagination, indexes on the avatars table, manifest
+ sharding if the animation manifest gets huge. Test at realistic counts, not 10 items.
+
+## Guardrails
+
+- Curation over volume. If accept rate is poor, stop scaling and tune prompts/gates first;
+ report honestly.
+- All batch spend is on self-host lanes (credits) — never let a bulk run fall through to
+ Replicate; assert the backend in the batch script and abort on fallthrough.
+- Cron changes must be no-ops when the new env vars are unset.
+
+## Acceptance criteria
+
+- [ ] Seed cron upgraded + env-tunable; quality gate live with measured accept rate.
+- [ ] First avatar batch published: rigged, animated in viewer, browsable in gallery.
+- [ ] Generated motion clips live in library + marketplace; sample visually verified.
+- [ ] Scale test at target counts passes on all four surfaces; fixes committed.
+- [ ] $/accepted-asset and accept-rate numbers in `docs/gcp-credits.md`.
+- [ ] `npm test` green; `git diff` reviewed (no `api/` esbuild-mangled files).
+
+## Wrap-up
+
+Changelog entries (users notice: bigger catalog, new generated-animations collection) —
+plain language. Update docs (`docs/gcp-credits.md`; marketplace/animations docs if they exist).
+Commit explicit paths, push `threews` (+ attempt `threeD`). Report: counts published, accept
+rates, spend, and remaining headroom.
diff --git a/prompts/gcp-credits/06-vanity-inventory.md b/prompts/gcp-credits/06-vanity-inventory.md
new file mode 100644
index 000000000..f925f1f87
--- /dev/null
+++ b/prompts/gcp-credits/06-vanity-inventory.md
@@ -0,0 +1,92 @@
+# 06 — Premium vanity-address inventory on spot CPU
+
+## Mission
+
+The platform's `vanity_grinder` MCP tool grinds Solana vanity addresses **in-process**, capped
+at 1.5M iterations, $0.05/call — so 4–5+ character prefixes are unreachable. Build a batch
+grinding pipeline on cheap GCP spot CPU (credits), an encrypted inventory store, and a
+"premium vanity" product tier that sells from inventory instantly. Durable, sellable asset;
+near-zero credit cost. This handles **private keys** — security is the hard part of this
+prompt, not the grinding.
+
+## Prerequisites
+
+- Prompt 01 ran (project, `gcloud`, Compute API enabled).
+
+## Context (from prior code audit; re-verify)
+
+- MCP tool: `mcp-server/src/tools/vanity-grinder.js`; grind routines
+ `mcp-server/src/lib/pump-vanity.js` (raw keypair) and `mcp-server/src/lib/mnemonic-vanity.js`
+ (BIP-39). `MAX_ITERATIONS_CAP` ≈ 1.5M with an up-front difficulty guard. Price env
+ `MCP_VANITY_PRICE_USD` ($0.05, x402 `exact` on Solana).
+- **A Rust implementation exists:** `crates/vanity-grinder/` (+ WASM build under
+ `src/solana/vanity/`). Rust grinds orders of magnitude faster than the JS loop — use it for
+ the batch pipeline.
+- x402 payment plumbing and USDC settlement already exist platform-wide (see other
+ `api/x402/*` endpoints for the pattern).
+- Study how the platform handles secrets/wallet keys today (search `api/_lib/` for encryption
+ patterns, KMS usage, env-key encryption) and match the strongest existing pattern; if none is
+ strong enough for stored private keys, use GCP KMS envelope encryption and justify it.
+
+## Tasks
+
+1. **Batch grinder job.** Package `crates/vanity-grinder` as a container (Cloud Run **Jobs**,
+ CPU-only, or a GCE spot MIG — pick per cost/simplicity and justify). Input: a target list of
+ prefixes/suffixes (case-sensitive and insensitive variants). Output: found keypairs written
+ **directly in encrypted form** (never plaintext at rest, never in logs — encrypt in-process
+ before any write). Compute a target list worth grinding: 3–4 char brandable prefixes
+ (`SOL…`, `PUMP…`, `AGNT…`, `MOON…`, common names), plus `pump`-suffix addresses if the
+ pump.fun mint flow can consume supplied keypairs (check the existing launcher plumbing —
+ generic mint-at-runtime plumbing is fine; do not hardcode third-party coin references).
+2. **Inventory store.** A table (follow the platform's existing DB conventions/migrations in
+ `api/_lib/migrations/`) holding: address (public), pattern, difficulty score, KMS-encrypted
+ secret payload, status (`available`/`reserved`/`sold`/`revealed`), price, timestamps,
+ purchaser identity. Decryption only at the moment of delivery.
+3. **Product surface:**
+ - Extend the `vanity_grinder` MCP tool (and/or a new `api/x402/vanity-premium.js` endpoint)
+ with an inventory tier: list available patterns + prices, purchase via x402 (price scaled
+ by difficulty — derive a curve from grind cost, e.g. $1–$50), deliver the key **once**,
+ mark `revealed`, and never serve it again. Keep the existing $0.05 live-grind tier
+ untouched.
+ - A browsable listing page/endpoint consistent with existing marketplace patterns so the
+ inventory is discoverable (wire navigation — no orphan pages).
+4. **Custody honesty (required product copy):** the platform generated these keys, so a buyer
+ must be told plainly: "this key was generated by three.ws; for high-value use, transfer
+ assets to a self-generated wallet or use it as a token mint address, not a treasury."
+ Put this in the delivery payload and the listing UI. Also implement post-delivery secret
+ destruction as an option (delete ciphertext after reveal + configurable retention),
+ defaulting to delete-after-reveal.
+5. **Run a real batch.** Grind an initial inventory (e.g. 100–300 addresses across the target
+ list) on spot instances. Record throughput (keys/sec/vCPU), $/address at each difficulty,
+ and load the inventory.
+6. **E2E verification:** buy one from inventory through the real x402 flow on a test wallet;
+ confirm single delivery, `revealed` state, ciphertext destruction, and that the address
+ works (sign a transaction with the delivered key on devnet or verify keypair→address
+ locally).
+7. **Security self-review** (write it up): threat model — DB dump (keys are KMS-encrypted),
+ log leakage (grep the pipeline for any secret logging), replay of delivery endpoint
+ (single-use enforced server-side), insider access (KMS IAM restricted to the delivery
+ service identity). Fix anything found.
+
+## Guardrails
+
+- Plaintext secrets: never at rest, never in logs, never in git, never in analytics.
+- The commit gate: address patterns and copy must not reference third-party crypto projects.
+ Brandable generic prefixes only; `$THREE`-related patterns welcome.
+- Spot instances get preempted — the grinder must checkpoint its target list and be re-runnable.
+
+## Acceptance criteria
+
+- [ ] Batch pipeline runs on spot CPU, resumable, secrets encrypted end to end.
+- [ ] Inventory table + migration; listing + purchase + one-time delivery wired via real x402.
+- [ ] Real purchase E2E test passed (devnet-verified key, single reveal, destruction).
+- [ ] Initial inventory loaded; throughput + $/address table in `docs/gcp-credits.md`.
+- [ ] Security review written into the PR/commit description or docs; issues fixed.
+- [ ] Existing $0.05 grind tier unchanged; `npm test` green; `git diff` reviewed.
+
+## Wrap-up
+
+Changelog entry (new premium vanity tier — user-visible feature). Doc: extend the MCP/tool docs
+where `vanity_grinder` is documented (check `docs/` and the tool description) and
+`docs/gcp-credits.md`. `data/pages.json` if a new public page landed. Commit explicit paths,
+push `threews` (+ attempt `threeD`). Report inventory size, price curve, and revenue potential.
diff --git a/prompts/gcp-credits/07-spend-observability.md b/prompts/gcp-credits/07-spend-observability.md
new file mode 100644
index 000000000..68a8becac
--- /dev/null
+++ b/prompts/gcp-credits/07-spend-observability.md
@@ -0,0 +1,80 @@
+# 07 — Spend observability & burn-rate control
+
+## Mission
+
+$100k over ~2 months is ~$1,600/day. We need to see the burn in real time, attribute it to each
+lane (Vertex Claude, Imagen, GPU workers, spot CPU), and get alerted before any lane runs away —
+especially the GPU fleet (a stuck min-instances service or a runaway batch can burn hundreds/day
+silently) and Vertex Claude if production gets flipped to primary. Build the dashboard + alerts
++ a kill-switch story. Also guard against the *opposite* failure: credits sitting unused because
+we're too timid.
+
+## Prerequisites
+
+- Prompt 01 ran (billing/monitoring APIs enabled, project set). Most useful after 02/03/04 so
+ there's real traffic to attribute, but the alerting scaffold can be built anytime.
+
+## Context
+
+- Billing export: enable BigQuery billing export (Cloud Billing → export) for line-item,
+ label-attributable cost data. Credit balance/expiry recorded in `docs/gcp-credits.md` (prompt 01).
+- App-side attribution: prompts 02–04 add provider/lane telemetry markers
+ (`vertex-anthropic`, Imagen provider, self-host forge backends,
+ `GCP_RECONSTRUCTION_KEY`-authed worker calls). Use those.
+- Existing platform surfaces for dashboards: check `api/insights/`, `api/admin/` (if present),
+ and how existing internal dashboards are built/authed before inventing a new pattern.
+
+## Tasks
+
+1. **Billing export → BigQuery.** Enable it (console step if needed — document exactly).
+ Write `scripts/gcp/burn-report.mjs` that queries the billing dataset for: total credit spend
+ to date, spend by service (Vertex AI, Cloud Run, Compute, Storage, BigQuery), spend by label
+ (label the resources — Cloud Run services, SA, etc. — so lanes are attributable), daily burn
+ rate, and **projected exhaustion date vs credit expiry date**. Human-readable output.
+2. **Resource labeling.** Ensure every credit-consuming resource created in prompts 02–06
+ carries a consistent label (e.g. `program=gcp-credits`, `lane=vertex-claude|imagen|forge-gpu|vanity`).
+ Retro-label existing ones. This is what makes attribution work — don't skip it.
+3. **Budgets & alerts.** Create GCP Budget alerts (Cloud Billing Budgets API): overall program
+ budget with alerts at 25/50/75/90%, plus per-service thresholds where possible. Route alerts
+ somewhere the team sees them — reuse the platform's existing notification path if there is
+ one (the changelog pushes to a Telegram channel via `TELEGRAM_BOT_TOKEN` /
+ `TELEGRAM_CHANGELOG_CHAT_ID` — consider a separate ops chat, don't spam the holder channel).
+ Implement the webhook/handler that turns a budget pub/sub notification into a team ping.
+4. **App-side spend dashboard.** An internal (auth-gated — match existing admin auth) page/endpoint
+ that shows, from app telemetry: requests/tokens per lane per day, Vertex Claude token spend
+ estimate, forge generations per backend, and cross-references the BigQuery burn number.
+ Wire it into existing internal navigation — no orphan page. Design all states (loading/empty/error)
+ per CLAUDE.md.
+5. **Runaway kill-switches (document + implement the mechanism):**
+ - Vertex Claude: the `VERTEX_CLAUDE_PRIMARY` flag (prompt 02) — unset to fall back to free
+ lanes instantly. Verify it's a true kill switch (no deploy needed — env flip + effect).
+ - GPU workers: `gcloud run services update … --min-instances 0` and the
+ `FORGE_SELFHOST_PRIMARY` flag (prompt 04). Script it: `scripts/gcp/emergency-stop.sh` that
+ drops all worker min-instances to 0 and prints the flags to unset.
+ - Spot batch jobs: documented stop command.
+6. **Under-utilization guard.** The report should also flag if projected spend at current burn
+ will leave >30% of credits unused at expiry — with a prompt to scale up (more seed batches,
+ flip production to Vertex primary, bigger vanity runs). Wasting credits is a failure mode too.
+7. **Cron the report.** Daily burn report to the ops channel (reuse the platform's cron pattern
+ in `api/cron/` or a scheduled GCP job). Include days-of-runway and unused-credit projection.
+
+## Acceptance criteria
+
+- [ ] BigQuery billing export live; `scripts/gcp/burn-report.mjs` produces attributed spend +
+ projection vs expiry.
+- [ ] All program resources labeled; attribution verified in the report.
+- [ ] Budget alerts at 25/50/75/90% routed to a team channel; alert handler tested (trigger a
+ test notification).
+- [ ] Internal spend dashboard live, auth-gated, wired into nav, all states designed.
+- [ ] `scripts/gcp/emergency-stop.sh` works (dry-run verified); kill-switch flags confirmed as
+ no-deploy env flips.
+- [ ] Under-utilization guard implemented; daily report cron scheduled.
+- [ ] `npm test` green; `git diff` reviewed.
+
+## Wrap-up
+
+Update `docs/gcp-credits.md` with the ops section (dashboards, alert thresholds, kill-switch
+commands, how to read the burn report). Changelog only if the internal dashboard counts as
+user-visible (it's admin — likely not). Commit explicit paths, push `threews` (+ attempt
+`threeD`). Report current burn rate, projected exhaustion vs expiry, and whether we're on
+track to use the credits fully.
diff --git a/prompts/gcp-credits/08-expiry-revert-runbook.md b/prompts/gcp-credits/08-expiry-revert-runbook.md
new file mode 100644
index 000000000..06b974136
--- /dev/null
+++ b/prompts/gcp-credits/08-expiry-revert-runbook.md
@@ -0,0 +1,73 @@
+# 08 — Expiry revert & keep/kill decision runbook
+
+## Mission
+
+The credits expire in ~2 months. This prompt makes expiry a non-event: produce a single,
+tested runbook that reverts every credit-funded reroute back to the pre-program state by
+flipping env vars (never migrating code), plus a data-driven keep/kill recommendation for each
+lane based on the spend/usage numbers gathered along the way. Run this near the end of the
+window — but write it now so the revert path is proven, not improvised under a dead-credits
+fire drill.
+
+## Prerequisites
+
+- Prompts 01–07 (or whichever shipped). Reads `docs/gcp-credits.md` for all flags, URLs, and
+ cost tables, and the burn report from prompt 07.
+
+## Context — the flags/vars each lane reverts by (verify against what actually shipped)
+
+- Vertex Claude: `VERTEX_CLAUDE_PRIMARY`, `VERTEX_CLAUDE_ENABLED` (prompt 02).
+- Imagen: `VERTEX_IMAGEN_ENABLED` (prompt 03).
+- Forge GPU: `FORGE_SELFHOST_PRIMARY` + `MODEL_TRELLIS_URL` / `GCP_HUNYUAN3D_URL` /
+ `GCP_TRIPOSG_URL` / `GCP_RECONSTRUCTION_URL` / `GCP_TEXT2MOTION_URL`; Cloud Run min-instances
+ (prompt 04).
+- Vanity: batch pipeline is one-shot; inventory persists (prompt 06) — sells down naturally.
+- Observability: budget alerts, dashboards (prompt 07).
+- Claude Code dev: `scripts/gcp/claude-code-vertex.sh` (just stop sourcing it).
+
+## Tasks
+
+1. **Revert script + runbook.** `scripts/gcp/revert-to-free.sh` (idempotent, dry-run flag) that:
+ unsets/turns off every primary flag so all lanes fall back to their pre-program providers
+ (free LLM lanes, hosted NIM/Replicate forge, NIM FLUX imagen), drops all Cloud Run worker
+ min-instances to 0, and prints a checklist of Vercel env changes to apply (with the exact
+ `vercel env rm/add` commands). Document in a new `docs/gcp-credits-revert.md` (or a section
+ of the main doc) as a step-by-step a tired human can follow at 2am.
+2. **Prove the revert.** In preview: flip everything to program-on, confirm lanes use GCP;
+ run the revert; confirm every feature still works on the free/original providers with no
+ user-visible breakage. This is the whole point — a revert that hasn't been run is not done.
+3. **Data-driven keep/kill table.** For each lane, pull actual spend (prompt 07 report) and
+ usage, and recommend post-expiry disposition:
+ - **Vertex Claude:** keep on Vertex (paid, if quality/cost beat first-party Anthropic) vs
+ revert to free lanes vs first-party Anthropic — with the token-cost comparison.
+ - **Forge paid lane:** the GPU self-host made it ~100% margin on credits; post-expiry L4
+ Cloud Run costs real money. Compute the per-asset cost vs the $0.25/$0.45 price — is it
+ profitable to keep self-hosting, or revert to Replicate/hosted-NIM? Show the math.
+ - **Imagen / seed cron / text2motion / vanity:** keep, pause, or one-shot-done.
+ Each recommendation cites numbers, not vibes.
+4. **Preserve the durable assets.** Confirm everything meant to outlive the credits is on R2 and
+ independent of GCP: the seeded avatar catalog, generated animation library, vanity inventory,
+ any BigQuery-derived snapshots baked to static. Nothing user-facing may depend on a
+ GCP resource that dies with the credits — audit and list any that do, with a fix.
+5. **Weights/artifacts cleanup plan.** Document what to delete at expiry (GCS weights buckets,
+ Cloud Run services, spot images) to stop any post-credit billing, and what to keep. Do NOT
+ delete anything now — just the documented plan + a `scripts/gcp/teardown.sh` (dry-run
+ default) for the owner to run when they decide.
+6. **Final report to owner.** A one-page summary: total credits used, per-lane spend, what
+ shipped that's permanent, keep/kill recommendations with the cost math, and the exact
+ env-flip list for the day-of revert.
+
+## Acceptance criteria
+
+- [ ] `scripts/gcp/revert-to-free.sh` exists, idempotent, dry-run tested.
+- [ ] Full revert executed in preview and every feature verified working on original providers.
+- [ ] Keep/kill table with real spend/usage numbers and cost math per lane.
+- [ ] Durable-asset audit: nothing user-facing depends on a dying GCP resource (or fixes filed).
+- [ ] `scripts/gcp/teardown.sh` (dry-run default) + deletion plan documented.
+- [ ] Owner one-pager written into `docs/gcp-credits.md`.
+- [ ] `npm test` green; `git diff` reviewed.
+
+## Wrap-up
+
+No changelog needed (internal). Commit explicit paths, push `threews` (+ attempt `threeD`).
+Report the keep/kill recommendations and confirm the revert path is proven, not theoretical.
diff --git a/prompts/gcp-credits/README.md b/prompts/gcp-credits/README.md
new file mode 100644
index 000000000..2b9151bf9
--- /dev/null
+++ b/prompts/gcp-credits/README.md
@@ -0,0 +1,35 @@
+# GCP $100k Credit Program — Prompt Pack
+
+Run each prompt in a **fresh Claude Code chat**, in order. Each is self-contained and ends with
+verification + commit/push. Do not skip verification sections — a prompt is only done when its
+acceptance criteria all pass.
+
+## Run order & dependencies
+
+| # | File | Depends on | Can run in parallel with |
+|---|------|-----------|---------------------------|
+| 1 | `01-gcp-foundation.md` | — | — (run first, alone) |
+| 2 | `02-vertex-claude-provider.md` | 01 | 03, 04 |
+| 3 | `03-imagen-activation.md` | 01 | 02, 04 |
+| 4 | `04-gpu-workers-deploy.md` | 01 | 02, 03 |
+| 5 | `05-catalog-animation-seeding.md` | 04 | 06, 07 |
+| 6 | `06-vanity-inventory.md` | 01 | 05, 07 |
+| 7 | `07-spend-observability.md` | 01 (best after 02–04) | 05, 06 |
+| 8 | `08-expiry-revert-runbook.md` | all of the above | — (run last) |
+
+## Ground rules baked into every prompt
+
+- **Everything behind env flags.** Credits expire in ~2 months; every reroute must revert by
+ flipping env vars, never by migrating code back.
+- **No mocks, no placeholders, no half-wiring** (CLAUDE.md rules apply in full).
+- **Fail-safe chains.** Vertex/GCP lanes slot into existing provider chains as preferred lanes
+ with automatic fallthrough to the current providers on error — a GCP outage must never take
+ down a feature that works today.
+- **Never commit secrets.** Service-account JSON goes into Vercel env / local `.env` only.
+- Push to both remotes (`threeD` may fail — surface it, don't block; it's a known-broken mirror).
+
+## Budget targets (for context, not hard caps)
+
+- Claude on Vertex (dev + production chain inversion): $40–60k
+- GPU fleet (Cloud Run L4: TRELLIS/Hunyuan3D/UniRig/TripoSG/text2motion): $15–25k
+- Imagen: $3–5k · Vanity/observability/misc: ~$5k · Reserve: remainder
diff --git a/prompts/okx-ai/00-CONTEXT.md b/prompts/okx-ai/00-CONTEXT.md
new file mode 100644
index 000000000..d135f8034
--- /dev/null
+++ b/prompts/okx-ai/00-CONTEXT.md
@@ -0,0 +1,111 @@
+# OKX.AI Launch — Shared Context (read this FIRST, every prompt requires it)
+
+You are working on getting **three.ws listed and selling on OKX.AI**, OKX's on-chain agent
+marketplace (agents hire agents; payments settle on X Layer). This file is the single source
+of truth for facts every work order depends on. Do not re-derive these; do not contradict them.
+
+## Where we stand (verified on-chain 2026-07-06)
+
+- We registered an ASP (Agent Service Provider) agent: **#2632 "three.ws 3D Studio"**.
+- **It was REJECTED** on 2026-07-04. Exact rejection reason from OKX's email:
+ > "your A2MCP service has not been integrated with the OKX Agent Payments Protocol standard.
+ > Please complete the integration, then resubmit your listing application through your Agent
+ > conversation interface."
+- On-chain state: `approvalDisplayStatus: 5` ("Listing rejected"), `status: 2` ("not listed"), `soldCount: 0`.
+
+## Hard facts (verified via onchainos CLI)
+
+| Fact | Value |
+|---|---|
+| Our agent ID | `#2632` |
+| Agent name | `three.ws 3D Studio` |
+| Owner wallet (X Layer) | `0x75d00a2713565171f33216e5aa2a375e076ecf69` |
+| Communication address | `0xfaBDeadF019267576a155E166110eDdA8BeE9729` |
+| Agent key UUID | `8848356c-f4a5-418a-a189-6a6ad72c8fdc` |
+| Marketplace chain | X Layer, chainId **196** (`eip155:196`) |
+| Marketplace fee token | `0x779ded0c9e1022225f8e0630b35a9b54be713736` (verify symbol/decimals in 01) |
+| Login email | `[email protected]` (email OTP; the human running the chat reads the code) |
+| CLI | `onchainos` v4.2.0+ at `~/.local/bin/onchainos` |
+
+## Our existing code (the thing being fixed)
+
+- **A2MCP endpoint**: [api/mcp-3d.js](../../api/mcp-3d.js) — MCP server for the 3D studio, prices
+ tool batches via `priceBatch` + `studioX402Amount` ([api/_mcp3d/pricing.js](../../api/_mcp3d/pricing.js)).
+- **402 challenge builder**: `paymentRequirements()` in [api/_lib/x402-spec.js](../../api/_lib/x402-spec.js)
+ — emits x402 v2 `accepts` entries for **Solana / Base / BSC / Arbitrum via Coinbase/PayAI/CDP
+ facilitators. There is NO X Layer entry and NO OKX facilitator entry. This is the exact
+ reason we were rejected.**
+- Payment helpers: [api/_mcp/payments.js](../../api/_mcp/payments.js) (`send402`, `sendX402Error`),
+ settlement via `settlePayment` in x402-spec.js.
+- The MCP tools themselves (mesh generation, rigging, retargeting) work and are deployed —
+ the rejection is ONLY about the payment rail.
+
+## Client-side protocol knowledge already in this repo
+
+`.claude/skills/okx-agent-payments-protocol/` documents how OKX agents PAY (the buyer side):
+- 402 with `PAYMENT-REQUIRED` header = base64 JSON `{x402Version: 2, resource, accepts: [...]}`.
+- Schemes: `exact` (EIP-3009 or Permit2), `upto` (requires `accepts[].extra.facilitatorAddress`),
+ `aggr_deferred` (TEE session cert), plus `WWW-Authenticate: Payment` charge/session channels.
+- Buyers pay via `onchainos payment pay --payload '<raw 402>'` → returns `authorization_header`
+ to replay. Settlement is facilitator-mediated.
+This tells us the wire shapes OKX buyers can sign. The SELLER-side contract (which facilitator
+verifies/settles, exact required fields) is what prompt 01 pins down.
+
+## Competitive intelligence (live marketplace pull, 2026-07-06)
+
+- **3D category is EMPTY.** Query "3D model avatar rendering game asset" → 1 result, a novelty
+ trading-card generator. No text→3D, no rigging, no avatars. We would be first and only.
+- **The winning pattern** — "Onchain Data Explorer", **174 sales** (most-sold agent found):
+ ~19 tiny, sharply-scoped A2MCP endpoints, micro-priced ($0.000015–$0.000075 per call).
+ Granular + cheap + composable + free discovery endpoints.
+- **The losing pattern** — "TO1 Intelligence": 100+ services sprayed at $0.25 → 0 sales.
+- Everything that sells is **A2MCP fixed-price**. A2A "negotiated" listings ≈ 0 sales.
+- Creative/media: 2 agents total, both 2D, both 0 sales. Prices $0.5–$1.0.
+
+## Session preflight (run at the start of EVERY work order)
+
+```bash
+export PATH="$HOME/.local/bin:$PATH"
+onchainos --version # if missing: install per .claude/skills/okx-agentic-wallet/_shared/preflight.md
+onchainos wallet status
+```
+If not logged in: `onchainos wallet login [email protected] --locale en_US`, then ask the human
+for the 6-digit OTP from that inbox and run `onchainos wallet verify <otp>`. Never guess codes.
+
+## Operating rules that BIND every work order
+
+1. **CLAUDE.md governs.** Read `/workspaces/three.ws/CLAUDE.md` in full. No mocks, no fake
+ data, no TODOs, no stubs, no "good enough".
+2. **Commit gate / owner approval:** CLAUDE.md requires owner approval before committing
+ content referencing crypto projects other than $THREE. **The owner has explicitly
+ authorized this OKX work stream** (these prompt files ARE the owner's directive): OKX,
+ OKX.AI, X Layer, chain 196, the marketplace fee token address, OKB, and the OKX Agent
+ Payments Protocol may be referenced in code, docs, and commits for this work. Anything
+ OUTSIDE that scope (other coins, other projects) still requires asking first.
+3. **Real money, real rails.** The owner will fund wallets on request. When funds are needed,
+ compute the exact amount + address + chain + token, present it, and pause for funding.
+ Never simulate a payment where a real one is specified.
+4. **Concurrent agents share this worktree.** Stage explicit paths only (never `git add -A`),
+ re-check `git status` before committing.
+5. **Push to BOTH remotes** (`git push threeD main` && `git push threews main`). Known issue:
+ threeD may fail "Repository not found" — report it, don't block on it.
+6. **`npx vercel build` trap:** it overwrites `api/*.js` in place. If you ran it, check
+ `head -1` of changed api files for `__defProp` before committing; recover with
+ `git restore -- api/ public/`.
+7. **Do not deactivate/delete agent #2632.** All listing changes go through `update` +
+ re-activate (resubmission), preserving the agent ID.
+8. **Progress log:** append a dated entry to `prompts/okx-ai/PROGRESS.md` when you finish
+ (create it if absent): what you did, what you verified, what's blocked, what's next.
+ The next work order's chat has no memory of yours — this file is the handoff.
+
+## Work-order sequence
+
+| # | File | Depends on |
+|---|---|---|
+| 01 | `01-protocol-research.md` — pin down the seller-side OKX payments spec | — |
+| 02 | `02-payments-integration.md` — implement OKX rail on our endpoint | 01 |
+| 03 | `03-service-decomposition.md` — split into micro-priced A2MCP services | 02 |
+| 04 | `04-e2e-real-payment-test.md` — pay ourselves for real, verify settlement | 02, 03 |
+| 05 | `05-relisting-resubmission.md` — update #2632 + resubmit for review | 04 |
+| 06 | `06-agent-pfp-wedge.md` — the "avatars for OKX agents" flagship service | 02 (parallel ok) |
+| 07 | `07-final-audit-and-watch.md` — full audit, docs closure, approval watch | all |
diff --git a/prompts/okx-ai/01-protocol-research.md b/prompts/okx-ai/01-protocol-research.md
new file mode 100644
index 000000000..adca11276
--- /dev/null
+++ b/prompts/okx-ai/01-protocol-research.md
@@ -0,0 +1,106 @@
+# Work Order 01 — Pin down the OKX Agent Payments Protocol SELLER-side spec
+
+Read `prompts/okx-ai/00-CONTEXT.md` first. Then read `/workspaces/three.ws/CLAUDE.md`. Both bind you.
+
+## Mission
+
+Our listing was rejected because our A2MCP endpoint doesn't speak the OKX Agent Payments
+Protocol. Before we write a line of integration code, we need the **exact seller-side
+contract**, from primary sources — not inference. Your deliverable is a spec document that
+Work Order 02 can implement against without opening a browser.
+
+**Do not guess. Every claim in the spec must cite where it came from** (URL, repo file, CLI
+output, or a captured wire payload). If two sources disagree, capture both and flag it.
+
+## What must be answered (the spec is incomplete until every row is filled)
+
+| # | Question |
+|---|---|
+| 1 | Exact 402 challenge shape OKX's listing validator accepts from an A2MCP seller: header (`PAYMENT-REQUIRED`? `WWW-Authenticate: Payment`?), body, required fields per `accepts[]` entry. |
+| 2 | Which scheme(s) a seller must offer: `exact`? `upto`? `aggr_deferred`? Is one mandatory for listing approval? |
+| 3 | The fee token at `0x779ded0c9e1022225f8e0630b35a9b54be713736` on X Layer: symbol, decimals, is it EIP-3009 capable or Permit2-only? (Read the contract on the X Layer explorer — https://www.oklink.com/xlayer — and cite the contract page.) |
+| 4 | OKX facilitator: verify/settle endpoint URLs, request/response shapes, auth requirements (API key? none?), and the `extra.facilitatorAddress` value for `upto` if applicable. |
+| 5 | The official OKX Payment SDK the rejection email refers to: package name (npm? GitHub?), version, what it does for the seller (challenge building? verification? settlement?), license. Evaluate per CLAUDE.md "Open source first" — we prefer adopting their SDK over hand-rolling, if it's usable in Vercel functions. |
+| 6 | How the payment interacts with MCP transport: does OKX expect HTTP-level 402 on the MCP endpoint URL, or MCP-level PaymentRequired structuredContent, or both? (Our endpoint currently does MCP-level via `_meta` — see api/mcp-3d.js.) |
+| 7 | How listing review validates the endpoint: does the validator call the endpoint? What does it send, what must it see? Any registered-endpoint URL format constraints? |
+| 8 | Settlement finality: how does the seller confirm it was actually paid before doing the work (verify response? on-chain check? `PAYMENT-RESPONSE` header contract)? |
+
+## How to get answers (do ALL of these, in this order)
+
+### A. Reverse-engineer a LIVE approved seller (highest-value evidence)
+
+An approved A2MCP seller's wire behavior is, by definition, what passes review.
+
+1. Session preflight (00-CONTEXT). Then find approved A2MCP sellers with real endpoints:
+ ```bash
+ onchainos agent search --query "health check API service data" --status active
+ onchainos agent service-list --agent-id 2087 # XBubbleAI — has a $0.000001 Health Check A2MCP service
+ onchainos agent service-list --agent-id 2023 # Onchain Data Explorer — 174 sales, 19 A2MCP services
+ ```
+2. `curl -i` each endpoint with no payment. Capture the full 402 response — status, every
+ header, body. Decode `PAYMENT-REQUIRED` (base64 → JSON). Save every capture verbatim into
+ the spec's appendix.
+3. **Pay one for real.** XBubbleAI's Health Check costs $0.000001 — effectively free evidence.
+ Run the buyer flow end to end: `onchainos payment pay --payload '<raw 402>'`, replay with
+ the returned header, capture the success response including any `PAYMENT-RESPONSE` header.
+ This gives us a complete, real request/response pair for both legs. If wallet lacks the
+ dust + gas, compute what's needed and ask the owner to fund (00-CONTEXT rule 3).
+4. Diff at least TWO approved sellers' 402 challenges. Fields present in both = required.
+ Fields differing = optional. Record the matrix.
+
+### B. Primary documentation
+
+1. `gh repo view okx/onchainos-skills`; clone/read it — the seller-side docs or examples may
+ live next to the CLI. Also `onchainos payment --help` and every subcommand's `--help`.
+2. OKX Developer Portal: https://web3.okx.com/onchain-os/dev-portal — find the Agent Payments
+ Protocol / Payment SDK docs. WebFetch the relevant pages; quote exact field tables.
+3. Search GitHub org `okx` for payment SDK repos (`gh search repos --owner okx payment`,
+ also npm: `npm search okx payment`, check `@okx-dex/…`, `@okxweb3/…` scopes).
+4. x402 baseline: https://x402.org — note where OKX's dialect EXTENDS or DIVERGES from
+ vanilla x402 v2 (that delta is exactly what our existing code doesn't emit).
+
+### C. Interrogate our own client-side skills
+
+`.claude/skills/okx-agent-payments-protocol/` + `references/*.md` describe what OKX buyers
+can sign. Anything a buyer CAN'T sign, a seller must not require. Extract constraints
+(e.g. `upto` requires `extra.facilitatorAddress`; `exact`+EIP-3009 requires `extra.name`).
+
+## Deliverable
+
+Write **`specs/okx-agent-payments.md`** (specs/ is our load-bearing-contract directory — match
+neighboring specs' structure):
+
+1. **Seller contract** — exact challenge our endpoint must emit (concrete JSON example with
+ OUR values: X Layer 196, fee token, our payTo `0x75d0…cf69`), verify/settle call contract,
+ paid-replay handling, `PAYMENT-RESPONSE` emission.
+2. **Answer table** — all 8 questions above, each with its citation.
+3. **SDK decision** — adopt OKX's SDK vs. extend our `api/_lib/x402-spec.js`, with rationale
+ per CLAUDE.md Open-source-first rules (weekly downloads / maintenance / license / Vercel
+ compatibility all checked, not assumed).
+4. **Gap analysis** — field-by-field diff: what `paymentRequirements()` in
+ `api/_lib/x402-spec.js` emits today vs. what OKX requires. This is 02's work list.
+5. **Appendix** — raw captures: every 402 challenge captured, the paid Health Check
+ request/response pair, CLI outputs. Verbatim, labeled, dated.
+
+## Definition of done
+
+- [ ] All 8 questions answered with citations; unknowns explicitly marked UNRESOLVED with
+ what was tried (an honest UNRESOLVED beats a confident guess — 02 will treat any
+ UNRESOLVED row as a blocker to raise, not a detail to improvise)
+- [ ] At least one real 402 challenge from an approved seller captured verbatim
+- [ ] At least one real micro-payment executed and both legs captured (or funding requested
+ and the exact blocker documented)
+- [ ] `specs/okx-agent-payments.md` written; every code sample real, every link live
+- [ ] `data/changelog.json`: no entry (internal research — per CLAUDE.md, internal work gets none)
+- [ ] `prompts/okx-ai/PROGRESS.md` appended: findings summary, unresolved items, green-light
+ status for Work Order 02
+- [ ] Committed (explicit paths: `specs/okx-agent-payments.md`, `prompts/okx-ai/PROGRESS.md`)
+ and pushed to both remotes (threeD failure = report, not block)
+
+## Anti-laziness gates
+
+- "The docs probably say X" is not a citation. Fetch it or mark UNRESOLVED.
+- Do not write the spec from the client-side skill files alone — they describe the buyer.
+ The live-seller captures (section A) are mandatory, not optional color.
+- If the dev portal requires an account/login you can't complete, say exactly what's needed
+ from the owner and continue with every other source in parallel.
diff --git a/prompts/okx-ai/02-payments-integration.md b/prompts/okx-ai/02-payments-integration.md
new file mode 100644
index 000000000..a4c9207f3
--- /dev/null
+++ b/prompts/okx-ai/02-payments-integration.md
@@ -0,0 +1,98 @@
+# Work Order 02 — Integrate the OKX Agent Payments Protocol into our A2MCP endpoint
+
+Read `prompts/okx-ai/00-CONTEXT.md`, then `specs/okx-agent-payments.md` (produced by Work
+Order 01 — if it doesn't exist or has UNRESOLVED rows in the seller contract, STOP and tell
+the owner to run/finish 01 first). Read `/workspaces/three.ws/CLAUDE.md`. All three bind you.
+
+## Mission
+
+Make our A2MCP endpoint a **first-class OKX Agent Payments Protocol seller**: an OKX agent
+following the standard buyer flow (`onchainos payment pay`) can discover the price, pay on
+X Layer in the marketplace fee token, and get the tool result — with real verification and
+real settlement on our side. This unblocks the #2632 relisting.
+
+This is an ADDITION, not a replacement: our existing rails (Solana/Base/BSC via
+Coinbase/PayAI facilitators) keep working for existing customers. One challenge, multiple
+`accepts` entries; the OKX/X Layer entry added per the spec.
+
+## Scope of change (read all of these files before editing any)
+
+- `api/_lib/x402-spec.js` — `paymentRequirements()` gains the X Layer/OKX entry (or an
+ OKX-specific builder if the dialect diverges too far to share one). `settlePayment` /
+ verify flow gains the OKX facilitator route, selected by the network of the presented payment.
+- `api/_mcp/payments.js` — `send402` / challenge emission updated per spec (header vs body,
+ HTTP-level vs MCP-level — implement exactly what 01 determined the validator needs; if it
+ needs both, emit both).
+- `api/mcp-3d.js` — wire through; per-tool pricing via `studioX402Amount` stays authoritative.
+- If 01's SDK decision was "adopt OKX's SDK": add it (pinned `^x.y.0`), wrap it behind our
+ existing seams (`paymentRequirements`, `settlePayment`) so callers don't change. If "extend
+ our own": implement the facilitator client in `api/_lib/` following the existing
+ facilitator-client patterns in x402-spec.js.
+- Config: new env vars (facilitator URL, X Layer payTo, token address, any API key) go
+ through the existing `env` pattern in `api/_lib/`. Document each in the deployment steps.
+ Never hardcode secrets. `payTo` on X Layer = owner wallet `0x75d0…cf69` unless the owner
+ says otherwise.
+
+## Requirements (each one is checked in 04 and 07 — cutting one WILL surface)
+
+1. **Challenge**: unpaid call to the endpoint returns the OKX-valid 402 exactly per spec —
+ X Layer `eip155:196`, fee token, correct decimals-scaled amounts from our real per-tool
+ pricing, our payTo, all required `extra` fields.
+2. **Verification before work**: a presented payment is verified with the OKX facilitator
+ BEFORE tool execution, mirroring how `x402Ctx.verified` gates execution today. Invalid /
+ underpaid / expired → correct error + fresh challenge, and the tool does NOT run.
+3. **Settlement after success**: settle only after the tool succeeds (same
+ pay-only-on-success semantics mcp-3d.js has today). Settlement failure after work
+ delivered → log + surface per existing `sendX402Error` pattern; emit `PAYMENT-RESPONSE`
+ per spec.
+4. **Multi-rail coexistence**: paying via an existing rail (e.g. Base USDC through CDP) still
+ works — prove it with the existing tests.
+5. **Free lane intact**: `getting_started`, discovery batches (initialize / tools/list /
+ ping) stay free, per the current allFree/discovery logic.
+6. **Amounts are consistent**: advertised amount == verified amount == settled amount, all
+ derived from `priceBatch`. One source of truth, as today.
+
+## Testing (real, not theatrical)
+
+- **Unit**: challenge-shape tests asserting every spec-required field, byte-exact header
+ names, correct base-unit scaling for the fee token's actual decimals. Extend the existing
+ test suite (`tests/`) following its patterns; `npm test` green.
+- **Local integration**: run the endpoint locally (`vercel dev` or the project's dev route
+ harness — check package.json scripts), `curl -i` it unpaid, decode the challenge, and
+ validate it against the spec's concrete example field-by-field. Paste the capture in your
+ report.
+- **Buyer's-eye check**: feed the captured challenge to `onchainos payment pay --payload`
+ with a logged-in session. It must ACCEPT the challenge and produce an authorization header
+ (whether you then replay is 04's job — but the CLI rejecting our challenge = our bug; fix
+ it now). Requires session preflight per 00-CONTEXT.
+- Deploy to preview (`npx vercel` — NOT `vercel build`; see 00-CONTEXT trap #6), re-run the
+ unpaid-challenge check against the deployed URL.
+
+## Definition of done
+
+- [ ] All 6 requirements implemented; no TODOs, no stubs, no commented-out code
+- [ ] `npm test` green including new tests; test output pasted in your report
+- [ ] Local + preview-deploy challenge captures pasted and field-validated against spec
+- [ ] `onchainos payment pay` accepts our challenge (output pasted)
+- [ ] Env vars documented; owner told exactly what to set in `vercel env` if anything new
+- [ ] Docs: update `specs/okx-agent-payments.md` with an "Implementation" section mapping
+ spec → code (file:line); update `docs/api-reference.md` if the public endpoint
+ contract changed
+- [ ] `data/changelog.json` entry (tags: `feature`,`infra`; holder-readable: e.g. "3D Studio
+ tools can now be paid on X Layer via the OKX Agent Payments Protocol")
+- [ ] `prompts/okx-ai/PROGRESS.md` appended: what changed, captures, what 04 must verify
+- [ ] `git diff` self-reviewed line-by-line; committed (explicit paths) + pushed to both
+ remotes (threeD failure = report, not block)
+
+## Anti-laziness gates
+
+- Getting the 402 to *look* right is half the job. Verify + settle against the real OKX
+ facilitator is the other half — no `if (network === XLAYER) return {verified:true}`.
+ If the facilitator can't be exercised without a funded buyer, implement fully, prove the
+ request is well-formed (capture the facilitator's actual error response to an unfunded/
+ unsigned attempt), and hand the funded run to 04 explicitly in PROGRESS.md.
+- Don't fork a parallel payment stack. Extend the seams the codebase already has. If the
+ OKX dialect genuinely can't share `paymentRequirements()`, write down why in the spec's
+ Implementation section before diverging.
+- Every constant (chainId, token address, facilitator URL) traced to the spec, which traces
+ to a citation. No constants from memory.
diff --git a/prompts/okx-ai/03-service-decomposition.md b/prompts/okx-ai/03-service-decomposition.md
new file mode 100644
index 000000000..19b4afd9d
--- /dev/null
+++ b/prompts/okx-ai/03-service-decomposition.md
@@ -0,0 +1,99 @@
+# Work Order 03 — Decompose the 3D Studio into micro-priced A2MCP services
+
+Read `prompts/okx-ai/00-CONTEXT.md`, `specs/okx-agent-payments.md`, and
+`prompts/okx-ai/PROGRESS.md` (02 must be done — OKX rail live on the endpoint). Read
+`/workspaces/three.ws/CLAUDE.md`. All bind you.
+
+## Mission
+
+The marketplace evidence is unambiguous: the top seller (174 sales) wins with **many tiny,
+sharply-named, individually-priced A2MCP endpoints + free discovery**; the mega-catalog
+seller (100+ services, one price) has zero. Our current listing is one mega-endpoint.
+Restructure our offering into discrete services — each with its own URL, price, and
+one-sentence-clear purpose — while keeping ONE implementation underneath.
+
+## Target service catalog
+
+Each row becomes: a distinct routable endpoint URL + a service entry for the #2632 listing
+(the listing update itself is Work Order 05 — you build and document; 05 lists).
+
+| Service | Backing capability (verify each in code first) | Price target |
+|---|---|---|
+| 3D Health & Catalog | free discovery: live status + machine-readable service index | free |
+| Text → 3D Model (GLB) | free NIM/TRELLIS lane (`forge_free` path) | $0.01 |
+| Text → 3D Model (Pro) | quality-tier generation (`mesh_forge` chain) | $0.30 |
+| Image → 3D Model | image lane of mesh generation | $0.30 |
+| Auto-Rig a GLB | rig pipeline (`rig_mesh`: skeleton + skinning, humanoid gate) | $0.25 |
+| Text → Rigged Avatar | full chain (`forge_avatar`) | $0.50 |
+| Animation Retarget | clip retargeting onto arbitrary humanoid rigs | $0.10 |
+| Pose Seed | `get_pose_seed` | $0.02 |
+| FBX Export (rig-preserving) | export path (Unity/Unreal-ready) | $0.10 |
+
+Before building: open the MCP server code and confirm what each service maps to. If a row
+has no real backing capability, CUT THE ROW and record why in PROGRESS.md — never ship a
+service whose backend doesn't exist (CLAUDE.md hard rule). If a capability exists that isn't
+listed here and fits the pattern, add it. Sanity-check prices against unit cost (GPU lane
+cost per call — check the worker/proxy code) so no service sells below cost; adjust and
+record the math.
+
+## Architecture requirements
+
+1. **One implementation, many fronts.** Routes like `/api/okx/3d/<service>` (follow existing
+ `api/` routing conventions — read vercel.json and neighboring routes first) that map onto
+ the existing MCP tool implementations. No logic duplication: thin routing + per-service
+ pricing over the same engine mcp-3d.js uses.
+2. **Per-service 402.** Each paid endpoint advertises ITS OWN price (via 02's OKX challenge
+ builder) — one service, one price, no batch ambiguity. The paid replay executes exactly
+ that service.
+3. **Free lane is a real product.** Health returns live subsystem status (real checks against
+ the actual GPU/proxy lanes, not `{ok:true}` hardcoded); Catalog returns the full service
+ index — names, descriptions, prices, endpoint URLs, input schemas — generated FROM the
+ catalog source-of-truth, so it can never drift from the listing.
+4. **Catalog as data.** One module (e.g. `api/_lib/okx-catalog.js`) defines the catalog:
+ name, 2-part description (① capability ② what the caller must provide — OKX's required
+ format, ≤200 display-width chars each part), price string, endpoint URL, input schema.
+ Endpoints, the free catalog service, tests, AND Work Order 05's listing update all read
+ from this one module.
+5. **Async jobs handled honestly.** Generation can take minutes. Follow the pay→job→poll
+ pattern the existing forge endpoints use (status/preview polling free, per our listing
+ description promise: "you pay only after a job succeeds; discovery, status, preview free").
+ Verify how the existing pipeline sequences payment vs job completion and keep that
+ contract.
+
+## Testing (every service, no sampling)
+
+- Unit tests: catalog integrity (every entry has all fields, prices parse, descriptions
+ within length limits measured in East-Asian display width per the OKX rule), route→tool
+ mapping, per-service 402 amounts.
+- Integration, per service: unpaid call → correct 402 with correct price; paid path → real
+ output (run the cheap/free lanes for real; for expensive GPU lanes run at least one real
+ generation and verify the returned GLB parses — three.js loader or existing test utils).
+- Free lane: health reflects a real dependency check; catalog validates against the catalog
+ module 1:1.
+- `npm test` green. Deploy to preview, re-verify one paid 402 + the full free lane against
+ the deployed URLs.
+
+## Definition of done
+
+- [ ] Catalog module = single source of truth; all endpoints live on preview; zero stubs
+- [ ] Every service backed by a verified-real capability; cut/added rows documented
+- [ ] Per-service integration test evidence pasted (curl captures) in PROGRESS.md
+- [ ] `npm test` green, output pasted
+- [ ] Docs: `docs/okx-marketplace.md` — what each service does, pricing, one runnable curl
+ example per service (real URLs); linked from `docs/start-here.md`; `STRUCTURE.md` row
+ added for the new surface
+- [ ] `data/changelog.json` entry (tags: `feature`; e.g. "3D generation, rigging, and export
+ now available as individually-priced services for AI agents")
+- [ ] `prompts/okx-ai/PROGRESS.md` appended incl. the FINAL catalog table (names, 2-part
+ descriptions, prices, URLs) that 05 will submit verbatim
+- [ ] Self-reviewed diff; committed (explicit paths) + pushed to both remotes
+
+## Anti-laziness gates
+
+- "The route exists and returns 402" is not done — the PAID path must produce the real
+ artifact for every service you ship.
+- Don't skip the display-width validation on descriptions (CJK=2, ASCII=1). OKX rejects
+ over-length listings; catching it at review costs a week — 05 depends on these strings
+ being submittable as-is.
+- If GPU-lane funding/credits block a real generation test, run every lane that IS free,
+ document exactly which paid lane needs what, and ask the owner — don't mark the row done.
diff --git a/prompts/okx-ai/04-e2e-real-payment-test.md b/prompts/okx-ai/04-e2e-real-payment-test.md
new file mode 100644
index 000000000..e85f2576f
--- /dev/null
+++ b/prompts/okx-ai/04-e2e-real-payment-test.md
@@ -0,0 +1,90 @@
+# Work Order 04 — End-to-end REAL payment test (we pay ourselves and verify settlement)
+
+Read `prompts/okx-ai/00-CONTEXT.md`, `specs/okx-agent-payments.md`, and
+`prompts/okx-ai/PROGRESS.md` (02 + 03 must be done). Read `/workspaces/three.ws/CLAUDE.md`.
+
+## Mission
+
+Before resubmitting the listing, prove the whole machine with real money: act as an OKX
+buyer agent, pay our own endpoint through the OKX Agent Payments Protocol on X Layer,
+receive the artifact, and confirm settlement landed in our wallet on-chain. If OKX's
+reviewer does exactly this and anything breaks, we get rejected again — so we do it first,
+against production, and we do not stop at the first green result.
+
+**The owner has explicitly committed to funding wallets for this. Compute what you need,
+present the funding request, and wait — do not simulate instead.**
+
+## Phase 1 — Funding plan
+
+1. Session preflight (00-CONTEXT). Identify the buyer wallet the CLI signs with
+ (`onchainos wallet status`; the TEE account's X Layer address — surface it).
+2. Compute required funds and present ONE consolidated funding request to the owner:
+ - Fee token (`0x779d…3736`) for: cheapest service ($0.01), one mid service, the flagship
+ Text→Rigged Avatar ($0.50), ×2 for retries + margin.
+ - Gas (OKB on X Layer) if the chosen scheme requires buyer-side gas — the spec says
+ whether the facilitator sponsors gas (Permit2/EIP-3009 paths usually do); cite it.
+ - Exact addresses, chain, token contract, amounts. Wait for the owner's confirmation.
+3. Verify funds arrived on-chain before proceeding (balance query via CLI or X Layer RPC).
+
+## Phase 2 — The gauntlet (production endpoints, real payments)
+
+Run each numbered case; capture EVERYTHING (commands, headers, decoded challenges, tx
+hashes) into `prompts/okx-ai/e2e-evidence/` as you go:
+
+1. **Free lane**: health + catalog endpoints — correct, live data, no payment demanded.
+2. **Cheapest paid service** ($0.01 Text→3D): unpaid call → 402; `onchainos payment pay`
+ → authorization header; replay → job runs → real GLB delivered. Download the GLB,
+ verify it parses and has geometry (not zero-byte, not an error JSON saved as .glb).
+3. **Flagship** ($0.50 Text→Rigged Avatar): same flow; verify the GLB additionally contains
+ a skeleton + skinned mesh (bones present, skin weights non-empty — use the repo's
+ existing GLB inspection utils from the rig/retarget test suite).
+4. **Settlement verification (the part everyone skips — do not skip):** for each payment,
+ find the settlement tx on X Layer (explorer/RPC), confirm the fee token transfer to OUR
+ payTo `0x75d0…cf69` for the exact advertised amount, and confirm any `PAYMENT-RESPONSE`
+ header matches the on-chain reality. Record tx hashes.
+5. **Adversarial cases** (all against production, all must fail SAFELY — tool must not run,
+ error must be actionable, a fresh challenge must be offered where applicable):
+ a. Replay the same authorization header twice → second attempt rejected (no double-spend
+ of one payment, no free second job).
+ b. Tampered amount: pay the $0.01 challenge, attempt replay against the $0.50 service.
+ c. Expired/stale challenge (wait out `maxTimeoutSeconds` or mint a stale one) → rejected
+ with fresh challenge.
+ d. Garbage payment header → clean 4xx, no crash, no tool execution.
+6. **Failure refund/no-charge semantics:** force a failing job (invalid input that passes
+ payment but fails generation — e.g. rig a non-humanoid prop through the humanoid-gated
+ lane). Verify our pay-only-on-success promise holds mechanically: either the payment is
+ not settled, or the documented refund path executes. Whatever the code actually does,
+ confirm it matches what our listing/docs PROMISE — a mismatch is a release blocker: fix
+ the code or fix the promise (and its docs) before proceeding.
+7. **Legacy rails regression:** one paid call over an existing rail (Base/Solana per
+ existing test rig) still works.
+
+## Phase 3 — Fix loop
+
+Any failure: diagnose root cause, fix (code per 02/03 conventions), redeploy, re-run the
+FULL failed case plus cases 2 and 5a (regression floor). Repeat until the entire gauntlet
+passes in one clean sequence. Log each iteration in PROGRESS.md — iterations are evidence
+of rigor, not embarrassment.
+
+## Definition of done
+
+- [ ] Entire gauntlet green in one final clean run; evidence directory complete (add to
+ .gitignore if artifacts are large; summarize + link hashes in PROGRESS.md either way)
+- [ ] At least 3 real settlements on X Layer with tx hashes recorded, amounts matching
+ advertised prices exactly
+- [ ] All 4 adversarial cases fail safely (evidence captured)
+- [ ] Pay-only-on-success promise verified mechanically or promise corrected everywhere
+- [ ] Any code fixes committed per repo rules + pushed to both remotes
+- [ ] `docs/okx-marketplace.md` updated with a "verified behavior" section: settlement
+ timing, refund semantics, replay protection — stated from evidence, not intention
+- [ ] `data/changelog.json`: only if user-visible behavior changed in the fix loop
+- [ ] `prompts/okx-ai/PROGRESS.md` appended: gauntlet table (case → result → evidence
+ pointer), remaining risks, explicit GO/NO-GO for Work Order 05
+
+## Anti-laziness gates
+
+- No case is "covered by" another case. Run all of them, individually, against production.
+- A 200 response is not success — success is the artifact being real (GLB parses, skeleton
+ present) AND the money being on-chain in our wallet.
+- If you cannot verify settlement on-chain, the test is not passed. Find the tx or find
+ the bug.
diff --git a/prompts/okx-ai/05-relisting-resubmission.md b/prompts/okx-ai/05-relisting-resubmission.md
new file mode 100644
index 000000000..c84b476fa
--- /dev/null
+++ b/prompts/okx-ai/05-relisting-resubmission.md
@@ -0,0 +1,81 @@
+# Work Order 05 — Update agent #2632 and resubmit the listing
+
+Read `prompts/okx-ai/00-CONTEXT.md` and `prompts/okx-ai/PROGRESS.md` end to end. **Hard
+gate: 04 must show an explicit GO.** If there is no GO from 04, stop and say so. Read
+`/workspaces/three.ws/CLAUDE.md`.
+
+## Mission
+
+Resubmit "three.ws 3D Studio" (#2632) with the decomposed service catalog and the now-real
+OKX payment rail. This is the shot that reverses the rejection — treat the submission
+itself as a product: every string a reviewer reads, every endpoint they probe, must be
+exact. **Update the existing agent #2632 — never deactivate, never re-create; the ID, its
+wallet binding, and its history are assets.**
+
+## Step 1 — Pre-submission verification sweep
+
+You are the reviewer for an hour. Against PRODUCTION:
+
+1. Every endpoint in 03's final catalog: unpaid `curl -i` → OKX-valid 402 (or free content
+ for the free lane). Any drift from what 03/04 recorded = stop and fix first.
+2. Diff every service's name/description/price/URL between the catalog module
+ (`api/_lib/okx-catalog.js`), the live free catalog endpoint, and the table you're about
+ to submit. Must be identical — three copies, zero drift.
+3. Validate every description against OKX limits (2-part format; each part ≤200 chars in
+ East-Asian display width, CJK=2/ASCII=1; no links/tech-stack/example-prompts inside
+ service descriptions — those rules are in `.claude/skills/okx-agent-identity/references/invariants.md`,
+ which read in full before this step, along with `references/update.md`).
+4. Agent-level profile: keep the existing description unless evidence says it hurt review
+ (do not silently rewrite identity copy); profile photo URL must be the existing OKX CDN
+ asset (`https://static.okx.com/cdn/.../49eab781-....png`) — OKX rejects non-CDN links.
+
+## Step 2 — The update flow (interactive — human in the loop)
+
+Session preflight per 00-CONTEXT (login = [email protected]; the human relays the OTP).
+
+Follow the okx-agent-identity update flow **exactly** (`.claude/skills/okx-agent-identity/`
+SKILL.md + references/update.md): fetch current state via `agent get-agents --agent-ids 2632`
+first; build the `--service` JSON with per-service `operation` deltas (`create` for new
+entries, `update`/`delete` with `id` for existing ones — pull existing service ids via
+`agent service-list --agent-id 2632`); `serviceType: "A2MCP"`, `fee` as plain quoted number
+string, `endpoint` = the per-service production URL; run the validate-listing QA; render the
+diff card and get the human's explicit confirm before the write. The skill's confirmation
+gates exist for a reason — an on-chain write is irreversible; do not shortcut them even
+though this is "our own" agent.
+
+## Step 3 — Resubmit for review
+
+Per the rejection email, resubmission happens through the agent flow: after the update
+lands, run the activate step (`--preferred-language en-US` is required — see invariants.md
+flag gotchas). Confirm the CLI/backend response shows the listing entered review
+(approval status moves off "Listing rejected" to pending/in-review). Capture the exact
+before/after approval-status values.
+
+## Step 4 — Record + set the watch
+
+- PROGRESS.md: submitted catalog (verbatim), tx/CLI outputs, timestamp, approval status
+ after submission, and the daily check command:
+ `onchainos agent get-my-agents` (or `get-agents --agent-ids 2632`).
+- `data/changelog.json`: no entry yet — the changelog entry ships when the listing is
+ APPROVED (07 owns that), not when submitted.
+
+## Definition of done
+
+- [ ] Pre-submission sweep: every catalog endpoint verified live + three-way string diff clean
+- [ ] Update executed through the skill's full flow (pre-fetch, deltas by service id,
+ validate, human-confirmed diff card) — no bypassed gates
+- [ ] Resubmission confirmed: approval status captured before + after, listing is in review
+- [ ] Nothing was deactivated/deleted; agent is still #2632
+- [ ] PROGRESS.md appended with the full submission record
+- [ ] Any incidental fixes committed (explicit paths) + pushed to both remotes
+
+## Anti-laziness gates
+
+- Do not paraphrase, trim, or "improve" 03's final descriptions during entry — submit the
+ validated strings byte-for-byte. If entry-time validation rejects one, fix it in the
+ catalog module FIRST, redeploy, re-verify the free catalog endpoint, then resubmit — the
+ three copies must never diverge, even for one review cycle.
+- If the CLI or backend errors mid-update, read
+ `.claude/skills/okx-agent-identity/references/errors.md` and resolve properly — never
+ retry-loop a business error, never leave the listing half-updated without recording
+ exactly which services landed.
diff --git a/prompts/okx-ai/06-agent-pfp-wedge.md b/prompts/okx-ai/06-agent-pfp-wedge.md
new file mode 100644
index 000000000..1d1082cf5
--- /dev/null
+++ b/prompts/okx-ai/06-agent-pfp-wedge.md
@@ -0,0 +1,92 @@
+# Work Order 06 — "Agent Identity Studio": 3D avatars for OKX.AI agents themselves
+
+Read `prompts/okx-ai/00-CONTEXT.md`, `prompts/okx-ai/PROGRESS.md` (02 must be done; runs in
+parallel with 04/05 otherwise), and `/workspaces/three.ws/CLAUDE.md`.
+
+## Mission
+
+The sharpest wedge on OKX.AI: **our customers are the other agents on the platform.** Every
+registered agent has a `profilePicture`, and OKX's own identity flow includes a set-avatar
+step (`onchainos agent upload` + update). Almost all current agents use flat generated
+images. We sell them a distinctive 3D identity: text/brand brief → 3D avatar → posed,
+lit, high-res renders sized for the OKX CDN avatar slot — plus the underlying rigged GLB
+so their identity works anywhere in 3D (three.ws scenes, games, metaverse embeds).
+
+This is a product, not a listing blurb. Build it end to end.
+
+## Product definition
+
+**Service: "Agent Identity Studio"** — one A2MCP service (joins the 03 catalog):
+
+- **Input** (JSON): agent name, personality/brand description, style hints (optional),
+ reference image URL (optional).
+- **Pipeline** (all capabilities already exist in this codebase — wire, don't rebuild):
+ 1. Brief → avatar prompt (existing prompt-shaping used by the avatar lane).
+ 2. `forge_avatar`-equivalent chain: mesh generation + humanoid auto-rig.
+ 3. Pose + frame: 3-5 distinct poses from the pose/clip library (rigged, retargeted),
+ rendered against clean backdrops — headshot crop for the PFP slot + full-body shot.
+ Rendering: check what already exists for server-side GLB rendering (screenshot workers,
+ preview pipelines) before adding anything new. Real renders of THEIR avatar — never
+ stock/template output.
+ 4. Deliverables: PNG set (PFP-cropped square + full-body), the rigged GLB, and a three.ws
+ viewer link (existing viewer URL pattern).
+- **Price**: single flat price. Anchor: flagship avatar is $0.50 (03); this bundles
+ generation + rig + renders → $1.00–$2.00. Confirm unit cost math (GPU lane cost per call)
+ and record it; must clear cost with margin.
+- **Job pattern**: async job + free status/preview polling, same contract as 03 services.
+
+## Requirements
+
+1. **Wired into the 03 architecture**: entry in the catalog module, own endpoint URL, own
+ OKX 402, tests alongside the other services — not a parallel one-off.
+2. **Output quality is the product.** Generate at least 3 full pipeline runs from genuinely
+ different briefs (e.g. a finance data agent, a creative/art agent, a trading bot).
+ Inspect every deliverable: PFP reads clearly at 128×128 (OKX list size), full-body is
+ coherent, GLB is rigged (skeleton + skin weights verified with the repo's GLB inspection
+ utils). If any output is mediocre — fix the pipeline (prompt shaping, pose choice,
+ framing, lighting) and rerun. CLAUDE.md: "would someone screenshot this?" is the bar.
+3. **Dogfood publicly**: run OUR agent's own brief through it and (via the okx-agent-identity
+ upload/update flow, with the human confirming the on-chain write) set #2632's profile
+ photo to the result. Our listing's face becomes our portfolio piece. Coordinate with 05:
+ if 05 hasn't submitted yet, hand the asset to 05 via PROGRESS.md instead of racing it
+ with a second update; if 05 already submitted and the listing is mid-review, do NOT touch
+ the listing — record the asset and defer the swap to 07 (post-approval).
+4. **Showcase page on three.ws**: a gallery page (following existing page/site conventions +
+ design tokens) showing the demo identities — each with renders + embedded 3D viewer.
+ This is the `link` target for the changelog entry and the proof-of-quality URL the
+ listing description can reference. Register it in `data/pages.json`.
+
+## Testing
+
+- Full 03-style integration: unpaid 402 → pay (real, X Layer, per 04's runbook — request
+ funding if the wallet is dry) → job → all three deliverable types verified real.
+- Edge cases: brief in Chinese (half the marketplace is zh — output must not degrade),
+ absurdly long brief (truncate/handle honestly), reference image 404 (clean actionable
+ error, no charge settled for undeliverable work — consistent with 04's verified
+ pay-only-on-success semantics).
+- `npm test` green; preview deploy verified.
+
+## Definition of done
+
+- [ ] Service live on preview + production, in catalog module, tested paid E2E with a real
+ X Layer payment
+- [ ] 3+ demo identities generated, inspected, iterated to genuinely excellent
+- [ ] #2632's own avatar produced (set live, or handed off per requirement 3's coordination
+ rule — recorded either way)
+- [ ] Showcase page live, in `data/pages.json`, linked from the site's nav per existing
+ conventions
+- [ ] Docs: service section added to `docs/okx-marketplace.md` with a runnable example
+- [ ] `data/changelog.json` entry (tags: `feature`; link: the showcase page path)
+- [ ] PROGRESS.md appended (incl. unit-cost math, price decision, demo asset URLs, and the
+ catalog delta for 05/07 to fold into the listing)
+- [ ] Self-reviewed diff; committed (explicit paths) + pushed to both remotes
+
+## Anti-laziness gates
+
+- The demo briefs must be REAL runs of the full pipeline, saved with their inputs — not
+ cherry-picked outputs from manual retries you can't reproduce. If it took prompt-shaping
+ fixes to get quality reliably, those fixes live in code now.
+- Renders at final crop size are the acceptance test — a beautiful 1024px render that turns
+ to mud at 128px fails requirement 2.
+- "GLB is rigged" means you verified bones + weights programmatically, not that the
+ generator lane usually rigs things.
diff --git a/prompts/okx-ai/07-final-audit-and-watch.md b/prompts/okx-ai/07-final-audit-and-watch.md
new file mode 100644
index 000000000..15ba7d463
--- /dev/null
+++ b/prompts/okx-ai/07-final-audit-and-watch.md
@@ -0,0 +1,86 @@
+# Work Order 07 — Final audit, docs closure, approval watch, first-sale readiness
+
+Read `prompts/okx-ai/00-CONTEXT.md` and ALL of `prompts/okx-ai/PROGRESS.md`. 01–05 must be
+complete (06 ideally too). Read `/workspaces/three.ws/CLAUDE.md`.
+
+## Mission
+
+Close the loop: independently audit everything shipped in this work stream, close every
+docs/changelog gap, watch the resubmission through review, and make sure the day we get
+approved is the day we're ready to sell — not the day we start scrambling.
+
+## Part 1 — Independent adversarial audit
+
+Trust nothing in PROGRESS.md until re-verified. Sample-run the critical path yourself,
+against production, TODAY:
+
+1. Unpaid 402 on the cheapest and flagship endpoints → still spec-valid (challenges drift
+ when unrelated deploys touch shared code).
+2. One real paid call end to end incl. on-chain settlement check (04's runbook; request
+ funding if dry).
+3. Replay-protection spot check (04 case 5a) — still rejects.
+4. Free lane: health honest, catalog 1:1 with the catalog module and with the submitted
+ listing (pull the live listing: `onchainos agent service-list --agent-id 2632`).
+5. Run the repo's completionist audit (the completionist agent) over every file this work
+ stream touched (derive from PROGRESS.md + `git log --since` the stream's start). Fix
+ everything it finds: no TODOs, no dead paths, no half-wired states, no stray scratch
+ files, repo root clean.
+6. `npm test` green; `npm run build:pages` green (validates changelog entries).
+
+## Part 2 — Docs closure sweep
+
+Per CLAUDE.md's Documentation section, verify each layer exists and is CORRECT (read them
+as a zero-context outsider):
+
+- [ ] `specs/okx-agent-payments.md` — matches implemented reality, incl. every 04 fix
+- [ ] `docs/okx-marketplace.md` — every service documented, every curl example actually
+ runs (run them), linked from `docs/start-here.md`
+- [ ] `STRUCTURE.md` — rows for the new surface(s)
+- [ ] `data/pages.json` — any new pages registered (06's showcase)
+- [ ] `data/changelog.json` — entries from 02/03/06 present + well-formed; stale claims
+ corrected (docs that promise what 04 disproved are release blockers)
+- [ ] README(s) in any new package/worker directories created by this stream
+
+## Part 3 — Approval watch + launch runbook
+
+1. Check current approval status (`onchainos agent get-agents --agent-ids 2632`).
+2. Write `prompts/okx-ai/RUNBOOK.md` — the operator's guide for the human + future agents:
+ - Daily status-check one-liner; how to read approval states (approvalDisplayStatus map).
+ - **If APPROVED**: activation confirmation; the launch checklist — changelog entry
+ announcing the listing (tags: `feature`; this is THE holder-visible moment), Telegram
+ changelog push per repo process, set 06's avatar live if deferred, verify the listing
+ renders correctly in the marketplace UI (search for us as a buyer would:
+ `onchainos agent search --query "3D avatar rigging GLB"` — confirm we appear, cells
+ read well, prices right).
+ - **If REJECTED again**: capture the exact remark (`approvalRemark` + email), append to
+ PROGRESS.md, map the stated reason to the responsible work order, fix, re-run 05.
+ - **First-sale ops**: how to see sales/feedback (`soldCount`, `feedback-list`), how
+ revenue arrives (payTo wallet, from 04's evidence), where errors surface
+ (existing error-reporting path from api/_mcp/payments.js), what to monitor daily.
+3. If the platform exposes review timing/messaging via the task/chat surface, note in the
+ RUNBOOK how the human triggers the check (the okx-task-watch flow exists for live
+ monitoring — reference it as the tool for the human to invoke, don't leave a daemon).
+
+## Part 4 — Memory
+
+Write/update the agent-memory file for this work stream (per the memory system in the
+system prompt) so future sessions don't re-derive: agent #2632 state, what shipped, where
+evidence lives, RUNBOOK location, current watch status. Update `MEMORY.md` index.
+
+## Definition of done
+
+- [ ] Part 1 audit run with evidence pasted; every finding fixed, not filed
+- [ ] Part 2 checklist fully green (each item verified, not assumed)
+- [ ] RUNBOOK.md written and complete enough that a zero-context operator could run launch
+ day from it alone
+- [ ] Approval status checked and recorded; if already decided, the corresponding RUNBOOK
+ branch EXECUTED (launch checklist or rejection loop), not just written
+- [ ] Memory file written; PROGRESS.md closed out with final state of the whole stream
+- [ ] All changes committed (explicit paths) + pushed to both remotes
+
+## Anti-laziness gates
+
+- This audit exists BECAUSE the prior work orders claimed done. Re-verify with fresh eyes;
+ every "verified in 04" claim you re-test and confirm, say so; every one you can't
+ reproduce is a defect to fix now.
+- Do not write the RUNBOOK from imagination — every command in it must be one you ran.
diff --git a/prompts/okx-ai/README.md b/prompts/okx-ai/README.md
new file mode 100644
index 000000000..1e7094b91
--- /dev/null
+++ b/prompts/okx-ai/README.md
@@ -0,0 +1,38 @@
+# OKX.AI Launch — Work Orders
+
+Sequenced, self-contained prompts to take "three.ws 3D Studio" (agent #2632) from
+**rejected listing** to **approved, selling, best-in-category ASP** on OKX.AI. Each file is
+designed to be pasted/run in a fresh chat; each starts by reading `00-CONTEXT.md` (shared
+facts) and ends by appending to `PROGRESS.md` (the cross-chat handoff log).
+
+## Why this exists
+
+- Listing #2632 was rejected 2026-07-04: our A2MCP endpoint doesn't implement the OKX Agent
+ Payments Protocol (we emit x402 for Solana/Base/BSC rails, no X Layer/OKX rail).
+- Live marketplace pull (2026-07-06) shows the 3D category is EMPTY and the winning seller
+ pattern is many micro-priced A2MCP endpoints + free discovery. Big opportunity, clear
+ playbook.
+
+## Run order
+
+| Order | File | What it does | Needs human for |
+|---|---|---|---|
+| 1 | `01-protocol-research.md` | Pin the seller-side payments spec from primary sources + live captures | OTP login; maybe dust funding |
+| 2 | `02-payments-integration.md` | Implement the OKX rail on our endpoint, tested | possibly `vercel env` values |
+| 3 | `03-service-decomposition.md` | Split into micro-priced services + free catalog | — |
+| 4 | `04-e2e-real-payment-test.md` | Pay ourselves for real; settlement + adversarial gauntlet | **wallet funding**, OTP |
+| 5 | `05-relisting-resubmission.md` | Update #2632 + resubmit for review | OTP; confirm on-chain writes |
+| 6 | `06-agent-pfp-wedge.md` | "Agent Identity Studio" — avatars for OKX agents (parallel after 02) | funding for test buys |
+| 7 | `07-final-audit-and-watch.md` | Adversarial re-audit, docs closure, approval watch, launch runbook | OTP |
+
+Strict chain: 01 → 02 → 03 → 04 → 05 → 07. 06 can run any time after 02.
+
+## Ground rules baked into every order
+
+- CLAUDE.md governs: no mocks, no stubs, no "good enough"; real APIs, real payments, docs
+ ship with the feature.
+- Owner has pre-authorized OKX/X Layer/fee-token references for commits in this stream
+ (details in `00-CONTEXT.md` rule 2).
+- Real money on request: work orders compute exact funding needs and pause for the owner.
+- Never deactivate/delete agent #2632 — all changes via update + re-activate.
+- `PROGRESS.md` is the only memory between chats. Write it like the next agent knows nothing.