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.

docs(sweep): refresh event-readiness, ops and ux-flow docs plus the tasks index

nirholas1e11493b9202
diff --git a/docs/agent-skills.md b/docs/agent-skills.md
index 9c7fa9165..b4b288f65 100644
--- a/docs/agent-skills.md
+++ b/docs/agent-skills.md
@@ -51,9 +51,10 @@ Skills load automatically; invoke one directly with `/generate-3d-model`,
### b) Dropped into a project
-Copy (or symlink) any skill folder into a project's `.claude/skills/` — this repo
-does exactly that, symlinking every folder from `.agents/skills/` into
-[`.claude/skills/`](../.claude/skills/):
+Copy (or symlink) any skill folder into a project's `.claude/skills/`. This repo
+does exactly that: on every `npm install`,
+[`scripts/setup-claude-skills.mjs`](../scripts/setup-claude-skills.mjs) symlinks
+every folder from `.agents/skills/` into the gitignored `.claude/skills/`:
```bash
cp -r .agents/skills/generate-3d-model ~/my-project/.claude/skills/
diff --git a/docs/event-readiness/01-play-first-impression.md b/docs/event-readiness/01-play-first-impression.md
index 055d7d5a1..789c26d1f 100644
--- a/docs/event-readiness/01-play-first-impression.md
+++ b/docs/event-readiness/01-play-first-impression.md
@@ -19,7 +19,7 @@ https://three.ws/play?coin=FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump&name=thr
## What to audit (walk it as a first-time visitor, in a real browser via `npm run dev`)
-1. **The blank-screen window.** Time from navigation to first meaningful paint of the world. Anything over a couple of seconds of dead screen needs a designed loading state: skeleton or branded loader with real progress (assets actually loading), never a fake timer.
+1. **The blank-screen window.** Time from navigation to first meaningful paint of the world. Anything over a couple of seconds of dead screen needs a designed loading state: skeleton or branded loader with real progress (assets actually loading), never a fake timer. Note `pages/play.html` already ships an inline boot watchdog: while the loading card is up, a failed same-origin script/stylesheet, an uncaught boot error, or 45s of silence swaps the spinner for a real error card with a retry, and it deliberately ignores blocked optional extras and flaky WebSocket reconnects (scope in `docs/play-boot-performance.md`). Build on that path; do not duplicate it.
2. **Query-string identity.** The coin name, symbol, and image from the URL must be visibly used: page title, HUD, world signage. Verify the `image` param (an /api/img proxy URL) renders everywhere it should and has a fallback if the IPFS fetch fails.
3. **Intro/onboarding flow.** Run it fresh (clear localStorage). Is it skippable? Does it explain movement, chat, and the economy in under 30 seconds? Does it re-appear when it should not?
4. **HUD polish.** Every button: hover, active, focus states. Panel open/close transitions (opacity + transform, no pops). Consistent spacing and typography with the existing design tokens (`docs/DESIGN-TOKENS.md`).
diff --git a/docs/event-readiness/03-play-performance.md b/docs/event-readiness/03-play-performance.md
index cd0b1c98d..a124f616a 100644
--- a/docs/event-readiness/03-play-performance.md
+++ b/docs/event-readiness/03-play-performance.md
@@ -4,8 +4,8 @@ The world must load fast on event wifi and hold 60fps on a mid-range laptop. Mea
## Where the weight lives
-- Main world: `src/game/coincommunities.js` (4k+ lines; check what it imports eagerly vs lazily)
-- Population and props: `src/game/ambient-crowd.js`, `src/game/world-objects.js`, `src/game/terrain.js`, `src/game/build-voxels.js`
+- Main world: `src/game/coincommunities.js` (5k+ lines; check what it imports eagerly vs lazily)
+- Population and props: `src/game/ambient-crowd.js`, `src/game/world-objects.js`, `src/game/terrain.js`, `src/game/build-voxels.js`, `src/game/static-batch.js`
- Shaders and environment: `src/game/water-shader.js`, `src/game/day-night.js`, `src/game/world-env.js`
- Avatar pipeline: `src/game/boot-avatar.js`, `src/glb-canonicalize.js`, `src/animation-retarget.js`
diff --git a/docs/ops/gcp-logs.md b/docs/ops/gcp-logs.md
index 9370b0ba9..a7af718e4 100644
--- a/docs/ops/gcp-logs.md
+++ b/docs/ops/gcp-logs.md
@@ -43,14 +43,21 @@ payload at all (severity comes from the HTTP status).
npm run triage:gcp # human report, last hour
npm run triage:gcp -- --since 6h # wider window
npm run triage:gcp -- --json # machine-readable, what agents consume
+npm run triage:gcp:deep # everything: logs + version, TLS, fleet,
+ # pages, crons, DB, wallets
```
+`--deep` layers nine read-only probes (each wrapping an existing standalone
+audit) on top of the log sweep, so one command answers "what's wrong with
+three.ws?" across the whole surface instead of only what happened to log.
+`--skip <id,id>` drops individual probes.
+
One run merges three signals:
1. **`/api/healthz`** subsystem roll-up (database, cache, rate limiter,
Helius, the Solana RPC lane tier, x402 ring, x402 settle rate, forge
- generation, world, sniper, the OKX chat bot, x402 config): the platform
- self-reports most degradations.
+ generation, agent index freshness, world, sniper, the OKX chat bot,
+ x402 config): the platform self-reports most degradations.
2. **WARNING+ app logs across every service**, fingerprinted (ids, numbers,
addresses, and URLs collapsed) so repeats group into one finding.
3. **Request logs**: 5xx grouped per route, 429 noted.
@@ -71,7 +78,8 @@ script and document it in the runbook; the monitor stops flagging it from
then on.
Exit codes make it schedulable: `0` healthy or noise-only, `1` actionable
-findings (so `npm run triage:gcp || <alert>` works in any loop).
+findings, `2` usage error (so `npm run triage:gcp || <alert>` works in any
+loop).
## Running it continuously
diff --git a/docs/ops/payment-outcomes.md b/docs/ops/payment-outcomes.md
index c99f7cc36..9a47054bb 100644
--- a/docs/ops/payment-outcomes.md
+++ b/docs/ops/payment-outcomes.md
@@ -49,6 +49,15 @@ top fault signatures. This is the same object `/api/healthz` consumes; it is
included here so the board is complete without a second request. Its triage
map lives in [production-log-triage.md](production-log-triage.md).
+The ring log is reason-blind for refusals that arrive over HTTP (they all read
+as `http_5xx`), so the sensor reconciles status-only 5xx faults against the
+facilitator's own book (`x402_self_facilitator_log.reject_reason`) for the same
+window and names the dominant cause in `ring_settle.metrics.cause`:
+`sponsor_floor` (the Solana accept was withdrawn under the SOL floor),
+`fee_governor` (deliberate spend pacing, a budget problem, not a rail fault),
+or `rail` (genuine settle faults). `governorSkips` is carried even on a healthy
+rate so a wallet sliding toward its budget shows up before the rate does.
+
### `sponsor` (live RPC + `x402_self_facilitator_log`)
The fee wallet that pays every settle's SOL fee:
@@ -110,7 +119,8 @@ the floor, `sponsorKnownBelowFloor()` makes `buildRequirements()` withdraw the
Solana accept from every 402 challenge, so the Solana-only ring never attempts a
payment and there is nothing to reject. Settlements collapse while rail faults
stay flat. The settle sensor reports that as `cause: sponsor_floor` (distinct
-from `rail`) in `ring_settle.metrics`; the accepts are checkable directly:
+from `fee_governor` and `rail`) in `ring_settle.metrics`; the accepts are
+checkable directly:
```sh
curl -s https://three.ws/api/x402/three-intel | jq '.accepts[].network'
diff --git a/docs/ux-flows/01-onboarding-creation.md b/docs/ux-flows/01-onboarding-creation.md
index 05b219675..df9569862 100644
--- a/docs/ux-flows/01-onboarding-creation.md
+++ b/docs/ux-flows/01-onboarding-creation.md
@@ -90,24 +90,25 @@
---
### Agent Creation Wizard — `/create-agent`
-- **Source:** `pages/create-agent.html` + `src/create-agent.js` (imports `src/api.js`, `src/account.js`, `src/agents/guest-agent.js`, `src/create-agent-draft.js`, `src/shared/log.js`, `src/shared/glb-magic.js`)
+- **Source:** `pages/create-agent.html` + `src/create-agent.js` (imports `src/api.js`, `src/account.js`, `src/agents/guest-agent.js`, `src/create-agent-draft.js`, `src/voice/voice-setup.js`, `src/agents/persona-interview.js`, `src/analytics.js`, `src/shared/log.js`, `src/shared/glb-magic.js`)
- **Entry point:** Nav/landing CTA, marketplace "create your own" links, the `/create` intent hub, and the `/agent/new` 301 (see routing notes). Avatar surfaces hand off with `?avatar_id=&avatar_glb=&avatar_name=` (`applyAvatarHandoff` pre-seeds the model step).
-- **Prerequisites / gates:** **Try-first: anyone can build all five steps signed out.** `boot()` calls `getMe()` but only records `state.authed`; there is no auth gate on the form. The one place an account is required is the ship step: `submit()` with no session saves the draft and redirects to `/login?next=/create-agent`; `boot()` restores the draft on return and drops the user on Review ("Welcome back, <name> is ready. Ship it below."). Each agent gets a wallet at create. No $THREE gate.
+- **Prerequisites / gates:** **Try-first: anyone can build all six steps signed out.** `boot()` calls `getMe()` but only records `state.authed`; there is no auth gate on the form. The one place an account is required is the ship step: `submit()` with no session saves the draft and redirects to `/login?next=/create-agent`; `boot()` restores the draft on return and drops the user on Review ("Welcome back, <name> is ready. Ship it below."). Each agent gets a wallet at create. No $THREE gate.
- **Steps (N):**
1. Land; `boot()` resolves auth. Signed out, the ship CTA relabels to "Sign in to ship <name> →" and a "no account needed to build" note (`#build-free-note`) unhides. A fresh guest draft (see below) or a guest-companion claim (`peekGuestAgent()` carries the companion's name in) can prefill the form.
2. **Step 0 (Basics).** Enter name (required, ≤60), description (≤280), and tags (≤8, Enter/comma to add). (optional) Use the **"Build it for me"** AI box: type a one-line brief (or a chip / "✦ Surprise me") → POST `/api/agents/suggest-spec` → the returned spec fills the whole wizard and jumps to Review. Guests can generate too; the guest rate limit maps a 429 to a sign-in nudge. Click "Next" → validates name present.
3. **Step 1 — Model.** Choose a body via one of four tabs: **Starter** (4 shipped GLBs: Vern/CZ/Saga/Boss with `model-viewer` previews), **Library** (your owned avatars, paginated via `GET /api/avatars`, filtered to avatar/creature categories), **Upload** (drag-drop `.glb` ≤16 MB, validated by GLB magic), or **Add later** (must tick the `#f-skip-ack` confirm box → default starter assigned at create). Selected model renders in the live preview. Click "Next" → requires a starter/upload/library pick or acknowledged skip.
4. **Step 2 — Skills.** Five core skills (greet/present-model/validate-model/remember/think) are locked on; toggle optional skills (wave/dance/pump-fun/explain-gltf/web-search). Click "Next".
- 5. **Step 3 — Personality.** Pick category (14 marketplace categories), greeting (≤200), profile/system prompt (≤2000), voice (browser/custom). Click "Next" (soft tip if publishing without category+prompt).
- 6. **Step 4 (Review).** Editable summary grid (each row jumps back to its step). Toggle "Publish to marketplace" (`#f-publish`, default on). Click "Create" (or "Sign in to ship…" when signed out, which round-trips through `/login` and resumes here).
- 7. `submit()`: (a) resolves the body to a real owned avatar — `saveRemoteGlbToAccount` for starter URL or uploaded file (with upload % progress), library = connect directly, none = assign default starter; (b) POST `/api/agents` (name, description, skills, avatar_id, meta with greeting/voice/tags); (c) if publish opted-in AND category+prompt present → POST `/api/marketplace/agents/:id/publish`.
- 8. Success panel: "<name> is ready", 3D preview if public, and buttons: **Go live** (`/agent/<id>/wallet#activate`, primary; claims the on-chain welcome grant), Fund wallet (`/agent/<id>/wallet#deposit`), Open (`/agent/<id>`), Edit (`/agent/<id>/edit`), and Widget Studio (`/studio?model=<avatar_model_url>`).
+ 5. **Step 3 — Personality.** Pick category (14 marketplace categories), greeting (≤200), and profile/system prompt (≤2000). (optional) Run the **onboarding interview** (`#interview-*`): answer any of the shared `INTERVIEW_QUESTIONS` in your own words → POST `/api/persona/interview` runs them through the platform LLM chain and writes the extracted paragraph into the profile field (editable), with tone tags rendered as chips; the structured result (traits, tone tags, vocabulary, answer provenance) rides in state until the agent exists. Click "Next" (soft tip if publishing without category+prompt).
+ 6. **Step 4 — Voice.** Pick **Built-in voice** or **Clone your voice** (`data-voice` buttons). Choosing custom mounts `VoiceSetup` in `bind:'later'` mode: record or upload a short sample (validated in-browser, with inline BYOK ElevenLabs key entry via `PATCH /api/user/provider-keys`); the sample is held in memory and bound after create. Click "Next".
+ 7. **Step 5 (Review).** Editable summary grid (each row jumps back to its step). Toggle "Publish to marketplace" (`#f-publish`, default on). Click "Create" (or "Sign in to ship…" when signed out, which round-trips through `/login` and resumes here).
+ 8. `submit()`: (a) resolves the body to a real owned avatar — `saveRemoteGlbToAccount` for starter URL or uploaded file (with upload % progress), library = connect directly, none = assign default starter; (b) POST `/api/agents` (name, description, skills, avatar_id, meta with greeting/voice/tags); (c) if a custom voice sample is held → `voiceSetup.bindTo(agent.id)` clones it onto the new agent (non-fatal: a failure becomes a soft warning); (d) if publish opted-in AND category+prompt present → POST `/api/marketplace/agents/:id/publish`; (e) if the interview produced a result → POST `/api/agents/:id/persona/save` persists the structured persona with interview provenance (also best-effort).
+ 9. Success panel: "<name> is ready", 3D preview if public, and buttons: **Go live** (`/agent/<id>/wallet#activate`, primary; claims the on-chain welcome grant), Fund wallet (`/agent/<id>/wallet#deposit`), Open (`/agent/<id>`), Edit (`/agent/<id>/edit`), Widget Studio (`/studio?model=<avatar_model_url>`), and Give it a voice (`/voice`).
- **Guest draft autosave:** every input change debounce-saves (600 ms) to `localStorage['threews:create-agent:draft']` once the form has real content, with a `beforeunload` flush; drafts expire after 7 days (`src/create-agent-draft.js`). A returning guest resumes on the exact saved step with "Resumed your saved draft. [Start fresh]". A picked upload `File` cannot survive navigation: the draft marks it lost, downgrades the model to "Add later", and asks the user to re-attach on the model step. Creation stops the autosave so a shipped agent never resurrects as a draft.
-- **Decision points / branches:** signed-in ship vs signed-out login round-trip (draft preserved); AI-generated spec vs manual form; model tab (starter/library/upload/skip); publish on/off and whether publish prerequisites are met (publishes vs creates private with a soft warning); name conflict (409 → bounce to Step 0 to rename); resume draft vs "Start fresh"; per-step jump-back via stepper pips and review "Edit" buttons.
-- **External calls / dependencies:** `getMe()` (account.js); `POST /api/agents/suggest-spec` (AI spec generator); `GET /api/avatars` (library tab); `saveRemoteGlbToAccount` (account.js → presign + R2 upload + commit); `POST /api/agents`; `POST /api/marketplace/agents/:id/publish`.
+- **Decision points / branches:** signed-in ship vs signed-out login round-trip (draft preserved); AI-generated spec vs manual form; model tab (starter/library/upload/skip); interviewed persona vs hand-typed prompt (a fresh AI-spec fill resets the interview so a new concept never inherits the previous voice); built-in voice vs cloned sample; publish on/off and whether publish prerequisites are met (publishes vs creates private with a soft warning); name conflict (409 → bounce to Step 0 to rename); resume draft vs "Start fresh"; per-step jump-back via stepper pips and review "Edit" buttons.
+- **External calls / dependencies:** `getMe()` (account.js); `POST /api/agents/suggest-spec` (AI spec generator); `POST /api/persona/interview` (interview extraction); `GET /api/avatars` (library tab); `saveRemoteGlbToAccount` (account.js → presign + R2 upload + commit); `POST /api/agents`; `POST /api/agents/:id/voice/clone` (via `VoiceSetup.bindTo`) + `PATCH /api/user/provider-keys` (BYOK key); `POST /api/marketplace/agents/:id/publish`; `POST /api/agents/:id/persona/save`.
- **Success state:** A real agent with its own wallet/on-chain identity, a guaranteed 3D body, optionally listed on the marketplace; success card links to go-live/fund/view/edit/embed.
-- **Empty / error states:** Library tab has loading / error (with "Try again") / empty (no character models) states; per-step inline validation via `#foot-msg`; 409 name conflict bounces back; guest generate 429 → "That's the guest generation limit. Sign in to keep going, or fill the form in by hand."; publish failure is non-fatal (soft warning, agent still created); submit failure re-enables the form with an error message; lost upload on draft resume → re-attach prompt.
-- **Step count:** 6 required (Basics → Model → Skills → Personality → Review → Create) + ~4 optional (AI spec generate, tags, optional skills/customizing voice, sign-in round-trip when starting signed out).
+- **Empty / error states:** Library tab has loading / error (with "Try again") / empty (no character models) states; per-step inline validation via `#foot-msg`; 409 name conflict bounces back; guest generate 429 → "That's the guest generation limit. Sign in to keep going, or fill the form in by hand."; publish, voice-bind, and persona-save failures are non-fatal (soft warning, agent still created); submit failure re-enables the form with an error message; lost upload on draft resume → re-attach prompt.
+- **Step count:** 7 required (Basics → Model → Skills → Personality → Voice → Review → Create) + ~4 optional (AI spec generate, onboarding interview, tags/optional skills, sign-in round-trip when starting signed out).
---
@@ -136,7 +137,7 @@
- **Steps (N):**
1. Land; inline boot fetches `/api/config` to pick platform vs BYOK mode and dynamically imports the capture UI + pipeline.
2. (optional, BYOK only) **api-key step:** pick provider (Meshy/Tripo), paste key (>8 chars), submit → `storeByokKey` → advance to capture.
- 3. **capture step:** capture or upload a **frontal** photo (required) via camera overlay (`selfie-capture.js`, with face-oval guidance) or file upload; optionally add **left/right** angle photos (fidelity boost). Each added frontal photo is quality-assessed on-device (`src/selfie-refine.js` `assessPhoto`), surfacing `#quality-notice` warnings (blurry / drawing / no face) before the user waits out a full build. The page also cross-links `/image-to-3d` for object (non-face) photos.
+ 3. **capture step:** capture or upload a **frontal** photo (required) via camera overlay (`selfie-capture.js`, with face-oval guidance) or file upload; optionally add **left/right** angle photos (fidelity boost). The live shutter gate and the still-photo check now judge frames through one shared threshold module (`src/selfie-gates.js`), and a blocked shutter surfaces the grader's retake reason in the capture UI (poor lighting, off-angle) instead of silently refusing to fire. Each added frontal photo is also quality-assessed on-device (`src/selfie-refine.js` `assessPhoto`), surfacing `#quality-notice` warnings (blurry / drawing / no face) before the user waits out a full build. The page also cross-links `/image-to-3d` for object (non-face) photos.
4. Click "Build my avatar" (`#submit-btn`) → dispatches `selfie:submit`. Pipeline downscales photos (≤1024px JPEG), runs a local MediaPipe face check, then dispatches `selfie:preview` (shows the user's own photo on a placeholder).
5. POST `/api/avatars/reconstruct` `{ name, photos[], visibility: 'private', params:{bodyType,style}, optional provider_key/provider_name }` → `{ jobId }`. Stashes `selfie:pendingJobId` in sessionStorage (for resume across login). Dispatches `selfie:building` → shows the **building** step (and requests Notification permission).
6. `pollUntilDone` polls `GET /api/avatars/regenerate-status?jobId=...` (1.5s first, then 3s w/ backoff, 8–10 min timeout), dispatching `selfie:progress` labels (mesh → geometry → rigging → finishing).
@@ -162,9 +163,9 @@
4. (optional) Type a direction prompt in `#prompt-input` to steer the render.
5. Click "Generate". `uploadAudio` requests `POST /api/avatar/presign-audio` (declaring `bytes`, capped at 64 MB) and PUTs the file to R2. A failed presign is reported as an error: there is no data-URI fallback, since `video-generate` only accepts an https three.ws-hosted `audio_url`.
6. `POST /api/avatar/video-generate` `{ image_url, audio_url, avatar_id, prompt }` returns `{ job_id }`.
- 7. `pollJob` polls `GET /api/avatar/video-status?job_id=…` every 5 s with a 20-minute deadline, surfacing the worker's percentage in the progress label. Transient non-2xx and network errors are swallowed and retried until the deadline.
+ 7. `pollJob` polls `GET /api/avatar/video-status?job_id=…` every 5 s with a 20-minute deadline. The status endpoint reports `progress` plus the worker's planned `segments` count and measured `audio_seconds`, so the label names the work ("Rendering N clips… X%", one 3.72 s clip per segment) instead of a bare percent. Transient non-2xx and network errors are swallowed and retried until the deadline.
8. On `status: 'done'`: the returned `video_url` loads into the result `<video>` with a Download link and a "Make another" button that resets to idle.
-- **Decision points / branches:** signed-in vs redirect to login; owned avatars vs the default-avatar fallback; public (CDN URL) vs private (signed-URL resolve) avatar; presigned R2 upload vs data-URI fallback; prompt vs no prompt; done vs failed vs 20-minute timeout; `402 free_trial_used` retargets the retry button to "Upgrade plan" pointing at `/dashboard`.
+- **Decision points / branches:** signed-in vs redirect to login; owned avatars vs the default-avatar fallback; public (CDN URL) vs private (signed-URL resolve) avatar; presign success vs presign failure (413 too-large / 429 rate-limit / generic, each with its own message; no data-URI fallback exists); prompt vs no prompt; done vs failed vs 20-minute timeout; `402 free_trial_used` retargets the retry button to "Upgrade plan" pointing at `/dashboard`.
- **External calls / dependencies:** `GET /api/auth/me`; `GET /api/avatars`; `GET /api/avatars/:id` (signed GLB URL); `POST /api/avatar/presign-audio` + R2 PUT; `POST /api/avatar/video-generate`; `GET /api/avatar/video-status`. Rendering runs on the talking-head worker, not in the browser.
- **Success state:** A downloadable lip-synced talking-head clip of the user's own avatar, playable in-page, with a one-click path to generate another.
- **Empty / error states:** No avatars falls back to the default thumbnail rather than an empty strip. An avatar whose model cannot be resolved toasts "Could not load this avatar's 3D model. Pick another one." and leaves Generate disabled. Audio upload failure, job-start failure, worker failure, and the 20-minute timeout each render in `#error-area` with a retry that returns to idle. Free-trial exhaustion swaps retry for an upgrade link.
@@ -247,7 +248,7 @@
6. On success: stores `{ voiceId, name, status }` in `localStorage`, shows the **done** state ("<name> cloned successfully"), re-renders the library + playground voice list.
7. (optional) "Try in playground" (`#btnTryPlayground`): pick a voice, type text, click "Speak" → POST `/api/tts/eleven` `{ voiceId, text }` to synthesize and play. "Play sample" on a library card does the same with a canned line. "Record another" loops back.
- **Decision points / branches:** record vs re-record; clone success vs failure (mic denied, recording too short, network error, server HTTP error); playground speak vs library sample playback; delete voice from library.
-- **External calls / dependencies:** `POST /api/tts/eleven-clone` (clone); `POST /api/tts/eleven` (TTS playback/sample). ElevenLabs via the server proxy. Browser `getUserMedia` / `MediaRecorder` / Web Audio.
+- **External calls / dependencies:** `POST /api/tts/eleven-clone` (clone); `POST /api/tts/eleven` (TTS playback/sample). ElevenLabs via the server proxy. There is no free platform TTS lane: each clip is billed to the caller's own ElevenLabs key (BYOK, sent as `x-eleven-key` or saved via provider keys) or metered against the prepaid credit wallet, with an R2 cache absorbing repeats; the `x-tts-billing` response header reports which lane served the call, and the playground surfaces the per-clip cost. Browser `getUserMedia` / `MediaRecorder` / Web Audio.
- **Success state:** A cloned voice ID saved to the local library, immediately usable in the in-page TTS playground (and selectable elsewhere for agent speech).
- **Empty / error states:** Library empty state ("No cloned voices yet"); status banner (`setStatus`) for mic-denied, recorder-init failure, too-short clip, network/HTTP clone errors, name-required; playground/sample buttons surface synth errors inline.
- **Step count:** 4 required (record → stop → name → clone) + ~3 optional (cycle script, re-record, playground speak/sample).
diff --git a/docs/ux-flows/08-coin-launch-wallets.md b/docs/ux-flows/08-coin-launch-wallets.md
index 4fb0e57ca..4ebc58c73 100644
--- a/docs/ux-flows/08-coin-launch-wallets.md
+++ b/docs/ux-flows/08-coin-launch-wallets.md
@@ -180,8 +180,8 @@ real Solana/EVM RPC, pump.fun, and x402 — no mocks.
- **Prerequisites / gates:** Read-only wallet view is open. Autonomous SOL sends run through `/api/agent/send-sol` (optional `?token=` shared secret → `x-avatar-token` header). A server-side IBM Granite Guardian governance check can block a send.
- **Steps (N):**
1. Boot configures the avatar iframe (`?id=`/`?handle=`/`?model=`, transparent bg, overlay mode) and posts a `v1.avatar.hello`; queued speech/gestures flush on `v1.avatar.ready` (or a 5s resilience timeout).
- 2. `refreshWallet()` → `GET /api/agent/wallet` → renders balance (SOL + USD), network badge, short address + explorer link.
- 3. A "Fund your wallet" hint appears when the live balance can't cover a $1 send + fee buffer; user can copy the deposit address.
+ 2. `refreshWallet()` → `GET /api/agent/wallet` → renders balance (SOL + USD), network badge, short address + explorer link. The API reports an unreadable balance as `balanceAvailable: false` instead of failing the response, so an RPC blip shows "balance unavailable" while the address + explorer link survive.
+ 3. A "Fund your wallet" hint appears when the live balance can't cover a $1 send + fee buffer; user can copy the deposit address. An unknown balance never triggers the hint (unreachable RPC ≠ empty wallet).
4. User chats; `ask()` streams an assistant reply, the avatar speaks/gestures, and the model may emit actions.
5. On a `sendSol` action → a payment card renders ("Signing & broadcasting…"); `POST /api/agent/send-sol` with `{ usd, to? }`.
6. On success → card flips to "Confirmed on-chain" with SOL amount, recipient, and a Solscan signature link; the avatar celebrates and the wallet refreshes.
@@ -189,7 +189,7 @@ real Solana/EVM RPC, pump.fun, and x402 — no mocks.
- **Decision points / branches:** avatar-source param (id/handle/model); send governance allowed vs blocked; send success vs fail; optional shared-secret token.
- **External calls / dependencies:** `/api/agent/wallet`, `/api/agent/send-sol`, the chat/stream endpoint, `/avatar-embed.html`; Solscan (links). Real on-chain SOL transfer on success.
- **Success state:** "Confirmed on-chain" payment card with signature link; avatar verbal + gesture confirmation.
-- **Empty / error states:** "wallet offline" balance fallback; fund-hint / low-balance states; payment-failed card + toast + avatar "didn't go through"; governance-blocked chip.
+- **Empty / error states:** "balance unavailable" chip (with fund hint suppressed) when the RPC is unreachable; fund-hint / low-balance states; payment-failed card + toast + avatar "didn't go through"; governance-blocked chip.
- **Step count:** 6 required (+1 optional)
---
diff --git a/docs/ux-flows/09-x402-agent-commerce.md b/docs/ux-flows/09-x402-agent-commerce.md
index d1496da1e..81c56f455 100644
--- a/docs/ux-flows/09-x402-agent-commerce.md
+++ b/docs/ux-flows/09-x402-agent-commerce.md
@@ -198,7 +198,7 @@ choreographed two-agent narrative driven by Server-Sent Events.
### Forever (etch a message into Bitcoin) — `/forever`
- **Source:** `public/forever.html` + `public/forever.js`; backend `api/forever/inscribe.js` (creates a real OrdinalsBot Taproot text inscription on Bitcoin **mainnet**) + `api/forever/status.js` (polling).
- **Entry point:** Compose a message → pay Bitcoin → it's inscribed onto a single satoshi, permanently. NOT an x402/USDC flow — payment is native BTC to a generated charge address (Lightning invoice offered too).
-- **Prerequisites / gates:** No auth. Message 1–1500 bytes UTF-8. Optional Taproot (`bc1p…`) receive address (else platform vault `BTC_INSCRIPTION_RECEIVE_ADDRESS`). Fee rate 3/8/20/50 sats/vB. **User must hold BTC in their own wallet** — a confirm dialog shows the estimated cost before the order is created.
+- **Prerequisites / gates:** Creating an order requires a signed-in session or a valid API bearer token (`POST /api/forever/inscribe` answers 401 otherwise), and both endpoints carry a per-IP rate ceiling (429). Message 1-1500 bytes UTF-8. Optional Taproot (`bc1p...`) receive address, verified with a full bech32m checksum so a mistyped address gets a precise 400 instead of an opaque upstream error (else platform vault `BTC_INSCRIPTION_RECEIVE_ADDRESS`). Fee rate 3/8/20/50 sats/vB. **User must hold BTC in their own wallet**: a confirm dialog shows the estimated cost before the order is created.
- **Steps (6 required + 6 optional):**
1. Type the message (live char + byte counters; orange warning > 1500 bytes).
2. (optional) Enter a Taproot receive address.
@@ -208,7 +208,7 @@ choreographed two-agent narrative driven by Server-Sent Events.
6. Pay view: QR (BIP-21), amount, pay-to/Lightning/receive/order-id rows, "Open in wallet" / "View on mempool" / "Cancel". User sends BTC from their own wallet.
7. Auto-poll `GET /api/forever/status?id=<orderId>` every 6s → `waiting-payment → payment-received → inscribing → inscribed`. Once a reveal txid exists the response also carries `inscription.onchain` (confirmed, confirmations, block height and time) read keyless from Blockstream Esplora, so finality depth comes from the chain rather than from OrdinalsBot's order state; an Esplora outage degrades that field to `null` instead of failing the poll.
8. On `inscribed` → **win view**: large message, Inscription link (ordinals.com), reveal-tx link (mempool.space), receive address, "Bitcoin mainnet"; share to X / copy permalink / inscribe another.
-- **Decision points / branches:** empty / > 1500 bytes / invalid Taproot / invalid fee rate → inline errors; confirm-dialog cancel → stays in compose; order-create `502/503` → "Inscription failed. Try again."; status `failed` → OrdinalsBot contact note; reload mid-payment → `resumeIfAny()` restores the pay view + resumes polling.
+- **Decision points / branches:** empty / > 1500 bytes / invalid Taproot / invalid fee rate → inline errors; signed-out → the server's 401 copy surfaces in the error banner; confirm-dialog cancel → stays in compose; order-create `502/503` → "Inscription failed. Try again."; status `failed` → OrdinalsBot contact note; status `404` (the order id no longer resolves upstream) → polling stops, the saved order is cleared, and the page returns to compose with a nothing-was-charged explanation; reload mid-payment → `resumeIfAny()` restores the pay view + resumes polling (unless the saved order 404s, which takes the same retire path).
- **External calls / dependencies:** `/api/forever/inscribe` + `/api/forever/status` → **OrdinalsBot** (`api.ordinalsbot.com`, Bitcoin mainnet Taproot inscription), Blockstream Esplora (`api/_lib/esplora.js`, keyless reveal-tx confirmations, fail-soft), CoinGecko (USD, best-effort), QR server, mempool.space + ordinals.com for verification.
- **Success state:** win view with permanent inscription + reveal-tx links + share buttons.
- **Empty / error states:** compose validation errors; inscribe failure banner; pay-view polling states; order `failed` message with support info.
@@ -337,4 +337,4 @@ choreographed two-agent narrative driven by Server-Sent Events.
- **Forever** is the only **non-x402** payment in the cluster: native Bitcoin (or Lightning) to an OrdinalsBot charge address, inscribing a real Taproot text inscription on Bitcoin mainnet.
- **Adjacent economy surfaces (2026-08-01, not yet traced as full sections):** `/economy-lab` (Runway Lab, a live digital twin of the x402 payment rail; backend `api/x402/runway-lab.js`), `/pay-simulator` (Spend Policy Simulator: dry-run an agent spending policy against real x402 prices), `/flow` (Money Flow Map, see `docs/money-flow-map.md`), `/play/solver` (see `docs/economy-solver.md`), and `/conversions`.
- **Inline handlers are gone:** every HTML response in this cluster ships a CSP whose `script-src` lists SHA-256 hashes of the inline scripts in the bytes actually sent, so no page here may carry an `onclick=`/`onerror=` attribute (not even inside a template literal). The card markup these flows render declares intent with `data-fallback`, `data-action="reload"` or `data-stop-propagation` and `public/inline-behaviors.js` delegates it; `scripts/audit-inline-handlers.mjs` fails the build if one comes back.
-- **Source coverage:** all 17 routes located and traced from real source. `/tutor` resolves to `public/tutor.html` + `public/tutor.js` (served statically; no explicit vite map entry needed). No source was missing.
+- **Source coverage:** all 19 routes located and traced from real source. `/tutor` resolves to `public/tutor.html` + `public/tutor.js` (served statically; no explicit vite map entry needed). No source was missing.