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.

fix(x402): stop the loop calling five of our own endpoints wrong

nirholasf7c7c7220496
diff --git a/.agents/skills/embed-three-ws-avatar/SKILL.md b/.agents/skills/embed-three-ws-avatar/SKILL.md
index 533997832..5ccbabd23 100644
--- a/.agents/skills/embed-three-ws-avatar/SKILL.md
+++ b/.agents/skills/embed-three-ws-avatar/SKILL.md
@@ -27,7 +27,7 @@ the three.ws CDN with `access-control-allow-origin: *`, so it loads from any ori
></script>
<agent-3d
- body="https://cdn.three.ws/forge/anon/YOUR_MODEL.glb"
+ body="https://three.ws/cdn/forge/anon/YOUR_MODEL.glb"
mode="section"
kiosk
poster="/images/avatar-poster.webp"
@@ -56,7 +56,7 @@ data:
## Getting a GLB for `body`
Any humanoid GLB URL works. Models generated on three.ws come back on persistent
-`https://cdn.three.ws/forge/...` URLs you can use directly in `body` with no
+`https://three.ws/cdn/forge/...` URLs you can use directly in `body` with no
re-hosting (self-hosting also works if you want control):
- Generate from text or a reference image: the `create-3d-avatar` skill (rigged,
diff --git a/.env.example b/.env.example
index 7b81c17c7..d6d02c9bd 100644
--- a/.env.example
+++ b/.env.example
@@ -15,7 +15,9 @@ S3_ACCESS_KEY_ID=
S3_SECRET_ACCESS_KEY=
S3_BUCKET=3d-agent-avatars
# Public CDN base URL for the bucket (custom domain or provider default)
-S3_PUBLIC_DOMAIN=https://cdn.three.ws
+S3_PUBLIC_DOMAIN=https://pub-<hash>.r2.dev
+# Public asset URLs are published as https://three.ws/cdn/<r2-key> (api/cdn-object.js),
+# not as the bucket origin above: that origin is rate-limited and CORS-restricted.
# Upstash Redis — REQUIRED in production for x402 payment idempotency (USE-15).
# Without these, every /api/x402/* endpoint exits with code 1 on cold-start (500).
diff --git a/README.md b/README.md
index ef7afa40d..9592ba4a3 100644
--- a/README.md
+++ b/README.md
@@ -9104,7 +9104,7 @@ The simplest possible setup — one script tag, one element, zero build step.
</head>
<body>
<script type="module" src="https://three.ws/agent-3d/1.5.2/agent-3d.js"></script>
- <agent-3d body="https://cdn.three.ws/models/sample-avatar.glb"></agent-3d>
+ <agent-3d body="https://three.ws/cdn/models/sample-avatar.glb"></agent-3d>
</body>
</html>
```
@@ -9121,7 +9121,7 @@ Add `brain=` and `instructions=` to turn the viewer into a conversational agent.
<script type="module" src="https://three.ws/agent-3d/1.5.2/agent-3d.js"></script>
<agent-3d
- body="https://cdn.three.ws/models/sample-avatar.glb"
+ body="https://three.ws/cdn/models/sample-avatar.glb"
brain="claude-sonnet-4-6"
name="Aria"
instructions="You are Aria, a friendly AI guide. Be warm, concise, and occasionally playful.
@@ -9144,7 +9144,7 @@ Pin the agent to a corner of the page so it persists as users scroll.
<script type="module" src="https://three.ws/agent-3d/1.5.2/agent-3d.js"></script>
<agent-3d
- body="https://cdn.three.ws/models/sample-avatar.glb"
+ body="https://three.ws/cdn/models/sample-avatar.glb"
brain="claude-sonnet-4-6"
instructions="You are a helpful product assistant. Answer questions about our features."
mode="floating"
@@ -9281,7 +9281,7 @@ For anything beyond a quick one-liner, define the agent in a manifest file and r
"stt": { "provider": "browser", "language": "en-US" }
},
"memory": { "mode": "local" },
- "skills": [{ "uri": "https://cdn.three.ws/skills/wave/" }]
+ "skills": [{ "uri": "https://three.ws/cdn/skills/wave/" }]
}
```
@@ -11018,7 +11018,11 @@ S3_ENDPOINT=https://...
S3_ACCESS_KEY_ID=...
S3_SECRET_ACCESS_KEY=...
S3_BUCKET=3d-agent-avatars
-S3_PUBLIC_DOMAIN=https://cdn.three.ws # CDN base URL for public model URLs
+S3_PUBLIC_DOMAIN=https://pub-<hash>.r2.dev # bucket's public origin (R2 dev domain)
+# Public model URLs are served through the first-party CDN instead of that
+# origin: https://three.ws/cdn/<r2-key> (api/cdn-object.js). The r2.dev domain is
+# Cloudflare rate-limited and answers CORS with an exact-origin allowlist, so
+# prefer /cdn/ in anything user- or developer-facing.
# Redis (rate limiting)
UPSTASH_REDIS_REST_URL=...
@@ -11230,7 +11234,7 @@ Please **do not** file public GitHub issues for vulnerabilities. Disclosure runs
The current threat model and hardening notes live in [specs/SECURITY.md](specs/SECURITY.md) and [docs/security.md](docs/security.md). The [Security Hardening](#security-hardening) section above summarises the in-tree controls.
-In-scope: this repository and its deployed surfaces (`three.ws`, `cdn.three.ws`, `*.three.ws`). Out-of-scope: third-party services we integrate with (Google Cloud, Neon, Cloudflare R2, Upstash, Privy, Anthropic, ElevenLabs, pump.fun) — please report directly to them.
+In-scope: this repository and its deployed surfaces (`three.ws` including the `/cdn/` asset route, and `*.three.ws`). Out-of-scope: third-party services we integrate with (Google Cloud, Neon, Cloudflare R2, Upstash, Privy, Anthropic, ElevenLabs, pump.fun) — please report directly to them.
---
diff --git a/api/_lib/service-catalog/services/embody.js b/api/_lib/service-catalog/services/embody.js
index 6daac035f..abf2cc482 100644
--- a/api/_lib/service-catalog/services/embody.js
+++ b/api/_lib/service-catalog/services/embody.js
@@ -47,8 +47,8 @@ export default {
// persona id, its GLB + viewer/profile URLs, and the paste-anywhere embed tag.
outputExample: {
agent_id: 'aaaaaaaa-bbbb-4ccc-8ddd-eeeeeeeeeeee',
- glb_url: 'https://cdn.three.ws/personas/nova-scout/rigged.glb',
- viewer_url: 'https://three.ws/viewer?src=https%3A%2F%2Fcdn.three.ws%2Fpersonas%2Fnova-scout%2Frigged.glb',
+ glb_url: 'https://three.ws/cdn/personas/nova-scout/rigged.glb',
+ viewer_url: 'https://three.ws/viewer?src=https%3A%2F%2Fthree.ws%2Fcdn%2Fpersonas%2Fnova-scout%2Frigged.glb',
profile_url: 'https://three.ws/embed/persona?persona=aaaaaaaa-bbbb-4ccc-8ddd-eeeeeeeeeeee&state=idle',
embed_html: '<iframe src="https://three.ws/embed/persona?persona=aaaaaaaa-bbbb-4ccc-8ddd-eeeeeeeeeeee&state=idle" width="360" height="480" loading="lazy" style="border:0;border-radius:12px;max-width:100%" allow="autoplay; fullscreen; xr-spatial-tracking" allowfullscreen sandbox="allow-scripts allow-same-origin allow-popups"></iframe>',
reload_url: 'https://three.ws/api/mcp3d/persona?id=aaaaaaaa-bbbb-4ccc-8ddd-eeeeeeeeeeee',
diff --git a/api/_lib/service-catalog/services/mint-to-mesh-batch.js b/api/_lib/service-catalog/services/mint-to-mesh-batch.js
index dcfd437c2..b95f955c1 100644
--- a/api/_lib/service-catalog/services/mint-to-mesh-batch.js
+++ b/api/_lib/service-catalog/services/mint-to-mesh-batch.js
@@ -53,7 +53,7 @@ export default {
name: 'three.ws',
symbol: 'THREE',
color: '#7c5cff',
- imageUrl: 'https://cdn.three.ws/tokens/three.png',
+ imageUrl: 'https://three.ws/cdn/tokens/three.png',
hasImage: true,
},
glb: { mimeType: 'model/gltf-binary', bytes: 18432, base64: 'Z2xURgIAAAA…' },
diff --git a/api/_lib/service-catalog/services/mint-to-mesh.js b/api/_lib/service-catalog/services/mint-to-mesh.js
index fde57c3fd..8b74b666e 100644
--- a/api/_lib/service-catalog/services/mint-to-mesh.js
+++ b/api/_lib/service-catalog/services/mint-to-mesh.js
@@ -47,7 +47,7 @@ export default {
name: 'three.ws',
symbol: 'THREE',
color: '#7c5cff',
- imageUrl: 'https://cdn.three.ws/tokens/three.png',
+ imageUrl: 'https://three.ws/cdn/tokens/three.png',
hasImage: true,
},
glb: {
diff --git a/api/_lib/service-catalog/services/pipeline.js b/api/_lib/service-catalog/services/pipeline.js
index 1b7f6bde6..6cc975c19 100644
--- a/api/_lib/service-catalog/services/pipeline.js
+++ b/api/_lib/service-catalog/services/pipeline.js
@@ -76,7 +76,7 @@ export default {
poll_url: '/api/forge?job=f1.eyJwIjoicGlwZWxpbmUifQ.sig',
price_usdc: '0.15',
stages: [
- { id: 'generate', status: 'done', output_url: 'https://cdn.three.ws/forge/example/model.glb' },
+ { id: 'generate', status: 'done', output_url: 'https://three.ws/cdn/forge/example/model.glb' },
{ id: 'rig', status: 'running', output_url: null },
],
},
diff --git a/api/_lib/service-catalog/services/remix-asset.js b/api/_lib/service-catalog/services/remix-asset.js
index 326c1c71b..ad49556f5 100644
--- a/api/_lib/service-catalog/services/remix-asset.js
+++ b/api/_lib/service-catalog/services/remix-asset.js
@@ -51,8 +51,8 @@ export default {
outputExample: {
ok: true,
remix: {
- glbUrl: 'https://cdn.three.ws/forge/example-remix/model.glb',
- viewerUrl: 'https://three.ws/viewer?src=https%3A%2F%2Fcdn.three.ws%2Fforge%2Fexample-remix%2Fmodel.glb',
+ glbUrl: 'https://three.ws/cdn/forge/example-remix/model.glb',
+ viewerUrl: 'https://three.ws/viewer?src=https%3A%2F%2Fthree.ws%2Fcdn%2Fforge%2Fexample-remix%2Fmodel.glb',
creationId: '11111111-2222-4333-8444-555555555555',
prompt: 'a low-poly fox, but make it metallic',
instruction: 'make it metallic',
diff --git a/api/_lib/x402/autonomous-registry.js b/api/_lib/x402/autonomous-registry.js
index 93784cb55..fbf75202d 100644
--- a/api/_lib/x402/autonomous-registry.js
+++ b/api/_lib/x402/autonomous-registry.js
@@ -1164,9 +1164,13 @@ const SELF_ENDPOINTS = [
{
id: 'cosmetic-purchase-test',
name: 'Cosmetic Purchase Health Check',
- path: '/api/x402/cosmetic-purchase',
- method: 'POST',
- body: { item: 'canary_test', quantity: 1, _health_check: true },
+ // GET with the real query contract (?id=&account=): the endpoint is a
+ // GET-only paidEndpoint reading req.query, so the POST body this canary
+ // sent could never satisfy it and every run answered 400 id_required
+ // (38 in 24h). `id` is a real catalogue item from /api/cosmetics/catalog.
+ path: '/api/x402/cosmetic-purchase?id=hat-baseball&account=canary-health-check',
+ method: 'GET',
+ body: null,
cooldown_s: 1800,
priority: 40,
pipeline: 'health',
@@ -1190,10 +1194,13 @@ const SELF_ENDPOINTS = [
{
id: 'health-token-intel',
name: 'Health: token-intel',
- path: '/api/x402/token-intel',
- method: 'POST',
- // Canary: well-known USDC mint — stable, always has data.
- body: { mint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', network: 'mainnet' },
+ // GET with the mint in the query string: api/x402/token-intel.js is a
+ // GET-only paidEndpoint, so the POST this canary used to send was
+ // answered 405 on every run (109 in 24h) and the canary never once
+ // checked the endpoint it is named for.
+ path: '/api/x402/token-intel?mint=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
+ method: 'GET',
+ body: null,
cooldown_s: 600,
priority: 55,
pipeline: 'health',
@@ -1300,7 +1307,10 @@ const SELF_ENDPOINTS = [
{
id: 'health-agent-reputation',
name: 'Health: agent-reputation',
- path: '/api/x402/agent-reputation',
+ // GET mode requires ?subject=. Without it every run answered 400
+ // missing_subject (90 in 24h) and the canary proved nothing. The subject
+ // is the platform's own $THREE mint, which always resolves.
+ path: '/api/x402/agent-reputation?subject=FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump',
method: 'GET',
body: null,
cooldown_s: 600,
@@ -1521,7 +1531,10 @@ const SELF_ENDPOINTS = [
name: 'Health: symbol-availability',
path: '/api/x402/symbol-availability',
method: 'POST',
- body: { symbol: 'HEALTH' },
+ // The batch mode takes `symbols` (array). The singular `symbol` this
+ // canary sent failed the contract on every run: 400 missing_symbols,
+ // 71 in 24h.
+ body: { symbols: ['HEALTH'] },
cooldown_s: 900,
priority: 40,
pipeline: 'health',
diff --git a/api/v1/ai/image.js b/api/v1/ai/image.js
index b54b52c0a..1c86a3b46 100644
--- a/api/v1/ai/image.js
+++ b/api/v1/ai/image.js
@@ -84,7 +84,7 @@ const INPUT_SCHEMA = {
};
const OUTPUT_EXAMPLE = {
- url: 'https://cdn.three.ws/forge/refs/6f1c0c2e-2a4d-4b6e-9b1a-3c5d7e9f0a1b.jpg',
+ url: 'https://three.ws/cdn/forge/refs/6f1c0c2e-2a4d-4b6e-9b1a-3c5d7e9f0a1b.jpg',
provider: 'nvidia-nim',
model: 'black-forest-labs/flux.1-schnell',
width: 1024,
diff --git a/api/wk.js b/api/wk.js
index ef9556ede..609e3670a 100644
--- a/api/wk.js
+++ b/api/wk.js
@@ -911,7 +911,7 @@ const REST_OUTPUT_EXAMPLES = Object.freeze({
'/api/x402/pipeline-rig': {
stage: 'rig',
input_url: 'https://three.ws/avatars/mannequin.glb',
- output_url: 'https://cdn.three.ws/x402-pipeline/rig/abc123.glb',
+ output_url: 'https://three.ws/cdn/x402-pipeline/rig/abc123.glb',
bytes: 1940112,
persisted: true,
rig_type: 'biped',
@@ -919,7 +919,7 @@ const REST_OUTPUT_EXAMPLES = Object.freeze({
'/api/x402/pipeline-remesh': {
stage: 'remesh',
input_url: 'https://three.ws/avatars/mannequin.glb',
- output_url: 'https://cdn.three.ws/x402-pipeline/remesh/abc123.glb',
+ output_url: 'https://three.ws/cdn/x402-pipeline/remesh/abc123.glb',
bytes: 812044,
persisted: true,
remesh_mode: 'quad',
@@ -931,7 +931,7 @@ const REST_OUTPUT_EXAMPLES = Object.freeze({
'/api/x402/pipeline-gameready': {
stage: 'gameready',
input_url: 'https://three.ws/avatars/mannequin.glb',
- output_url: 'https://cdn.three.ws/x402-pipeline/gameready/abc123.glb',
+ output_url: 'https://three.ws/cdn/x402-pipeline/gameready/abc123.glb',
bytes: 640220,
persisted: true,
topology: 'quad',
@@ -943,7 +943,7 @@ const REST_OUTPUT_EXAMPLES = Object.freeze({
'/api/x402/pipeline-stylize': {
stage: 'stylize',
input_url: 'https://three.ws/avatars/mannequin.glb',
- output_url: 'https://cdn.three.ws/x402-pipeline/stylize/abc123.glb',
+ output_url: 'https://three.ws/cdn/x402-pipeline/stylize/abc123.glb',
bytes: 512880,
persisted: true,
style: 'voxel',
@@ -953,7 +953,7 @@ const REST_OUTPUT_EXAMPLES = Object.freeze({
'/api/x402/pipeline-rembg': {
stage: 'rembg',
input_url: 'https://three.ws/avatars/thumbs/default.png',
- output_url: 'https://cdn.three.ws/x402-pipeline/rembg/abc123.png',
+ output_url: 'https://three.ws/cdn/x402-pipeline/rembg/abc123.png',
bytes: 284112,
persisted: true,
model: 'rmbg2',
@@ -1462,7 +1462,7 @@ const MCP_TOOL_OUTPUT_SUMMARIES = Object.freeze({
mint: 'M1ntExamp1eDoNotUse1111111111111111111111111',
explorer_asset_url: 'https://core.metaplex.com/explorer/M1ntExamp1eDoNotUse1111111111111111111111111?env=devnet',
explorer_tx_url: 'https://explorer.solana.com/tx/5synthetictransactionsignature111111111111111111111111111111111111111111111111111111?cluster=devnet',
- viewer_url: 'https://three.ws/viewer?src=https%3A%2F%2Fcdn.three.ws%2Favatars%2Fmidnight-robot.glb',
+ viewer_url: 'https://three.ws/viewer?src=https%3A%2F%2Fthree.ws%2Fcdn%2Favatars%2Fmidnight-robot.glb',
royalty: { percent: 5, requested_basis_points: 500, cap_basis_points: 1000, capped: false },
},
// Mirrors handleAnchor()'s structuredContent in api/_mcp3d/tools/provenance.js.
diff --git a/api/x402/agent-bouncer.js b/api/x402/agent-bouncer.js
index 4f8420e1a..b1b639ecf 100644
--- a/api/x402/agent-bouncer.js
+++ b/api/x402/agent-bouncer.js
@@ -116,15 +116,21 @@ const OUTPUT_EXAMPLE = {
const OUTPUT_SCHEMA = {
$schema: 'https://json-schema.org/draft/2020-12/schema',
type: 'object',
- required: ['ok', 'admitted', 'banned', 'tier', 'agent_id', 'reputation'],
+ required: ['ok', 'exists', 'admitted', 'banned', 'tier', 'agent_id', 'reputation'],
properties: {
ok: { type: 'boolean', const: true },
+ exists: {
+ type: 'boolean',
+ description:
+ 'false when no agent is registered under this id. The call still returns a verdict (never admitted, tier "unknown", reputation null) rather than an error, so a buyer vetting an unknown counterparty gets the answer they paid for.',
+ },
admitted: { type: 'boolean', description: 'true when the agent clears the policy and is not banned.' },
banned: { type: 'boolean', description: 'true when the agent’s wallet is on the Club ban list.' },
tier: {
type: 'string',
- enum: ['newcomer', 'regular', 'trusted', 'vip', 'banned'],
- description: 'Door tier earned from the agent’s Solana track record.',
+ enum: ['unknown', 'newcomer', 'regular', 'trusted', 'vip', 'banned'],
+ description:
+ 'Door tier earned from the agent’s Solana track record. "unknown" means no agent is registered under this id.',
},
reason: { type: ['string', 'null'], description: 'Primary reason when refused; null when admitted.' },
reasons: { type: 'array', items: { type: 'string' } },
@@ -133,7 +139,7 @@ const OUTPUT_SCHEMA = {
name: { type: ['string', 'null'] },
wallet_address: { type: ['string', 'null'] },
visits: { type: 'integer', minimum: 0, description: 'Prior settled club tips by this agent’s wallet.' },
- reputation: { type: 'object' },
+ reputation: { type: ['object', 'null'], description: 'null when exists is false.' },
policy: { type: 'object' },
fetchedAt: { type: 'string', format: 'date-time' },
},
@@ -211,9 +217,42 @@ export default paidEndpoint({
allowNewcomers: q.allow_newcomers === undefined ? true : q.allow_newcomers !== 'false',
};
- const verdict = await vetSolanaAgent({ agentId, policy });
+ // An identifier with no registered agent behind it is a real, useful
+ // answer for a door check ("no record, do not admit"), not an error. It
+ // used to 404, which meant a buyer who had already paid $0.01 to vet an
+ // unknown counterparty got an error instead of the verdict they bought,
+ // and the ring canary (RING_CANARY_UUID, documented in ring-catalog.js as
+ // returning "a truthful newcomer / not verified verdict rather than 404")
+ // failed 31 times a day. Nothing is fabricated: every reputation field is
+ // null/zero and `exists: false` says plainly that we hold no record.
+ let verdict;
+ try {
+ verdict = await vetSolanaAgent({ agentId, policy });
+ } catch (err) {
+ if (err?.code !== 'agent_not_found') throw err;
+ return {
+ ok: true,
+ exists: false,
+ // Never admitted: allow_newcomers covers a REGISTERED agent with no
+ // track record, not an id we cannot resolve at all.
+ admitted: false,
+ banned: false,
+ tier: 'unknown',
+ reason: 'no agent registered under this id',
+ reasons: ['no agent registered under this id'],
+ newcomer: true,
+ agent_id: agentId,
+ name: null,
+ wallet_address: null,
+ visits: 0,
+ reputation: null,
+ policy,
+ fetchedAt: new Date().toISOString(),
+ };
+ }
return {
+ exists: true,
ok: true,
admitted: verdict.admitted,
banned: verdict.banned,
diff --git a/api/x402/pipeline-gameready.js b/api/x402/pipeline-gameready.js
index 6c89bfcd3..2f963eaa6 100644
--- a/api/x402/pipeline-gameready.js
+++ b/api/x402/pipeline-gameready.js
@@ -106,7 +106,7 @@ export const BAZAAR = {
example: {
stage: 'gameready',
input_url: 'https://three.ws/avatars/mannequin.glb',
- output_url: 'https://cdn.three.ws/x402-pipeline/gameready/abc123.glb',
+ output_url: 'https://three.ws/cdn/x402-pipeline/gameready/abc123.glb',
bytes: 640_220,
persisted: true,
topology: 'quad',
diff --git a/api/x402/pipeline-rembg.js b/api/x402/pipeline-rembg.js
index b98b40f1b..cba3a5d05 100644
--- a/api/x402/pipeline-rembg.js
+++ b/api/x402/pipeline-rembg.js
@@ -80,7 +80,7 @@ export const BAZAAR = {
example: {
stage: 'rembg',
input_url: 'https://three.ws/avatars/thumbs/default.png',
- output_url: 'https://cdn.three.ws/x402-pipeline/rembg/abc123.png',
+ output_url: 'https://three.ws/cdn/x402-pipeline/rembg/abc123.png',
bytes: 284_112,
persisted: true,
model: 'rmbg2',
diff --git a/api/x402/pipeline-remesh.js b/api/x402/pipeline-remesh.js
index 5eca4e686..93c55002b 100644
--- a/api/x402/pipeline-remesh.js
+++ b/api/x402/pipeline-remesh.js
@@ -106,7 +106,7 @@ export const BAZAAR = {
example: {
stage: 'remesh',
input_url: 'https://three.ws/avatars/mannequin.glb',
- output_url: 'https://cdn.three.ws/x402-pipeline/remesh/abc123.glb',
+ output_url: 'https://three.ws/cdn/x402-pipeline/remesh/abc123.glb',
bytes: 812_044,
persisted: true,
remesh_mode: 'quad',
diff --git a/api/x402/pipeline-rig.js b/api/x402/pipeline-rig.js
index fda455202..dbdc9b650 100644
--- a/api/x402/pipeline-rig.js
+++ b/api/x402/pipeline-rig.js
@@ -81,7 +81,7 @@ export const BAZAAR = {
example: {
stage: 'rig',
input_url: 'https://three.ws/avatars/mannequin.glb',
- output_url: 'https://cdn.three.ws/x402-pipeline/rig/abc123.glb',
+ output_url: 'https://three.ws/cdn/x402-pipeline/rig/abc123.glb',
bytes: 1_940_112,
persisted: true,
rig_type: 'biped',
diff --git a/api/x402/pipeline-stylize.js b/api/x402/pipeline-stylize.js
index f945dfabf..889469712 100644
--- a/api/x402/pipeline-stylize.js
+++ b/api/x402/pipeline-stylize.js
@@ -93,7 +93,7 @@ export const BAZAAR = {
example: {
stage: 'stylize',
input_url: 'https://three.ws/avatars/mannequin.glb',
- output_url: 'https://cdn.three.ws/x402-pipeline/stylize/abc123.glb',
+ output_url: 'https://three.ws/cdn/x402-pipeline/stylize/abc123.glb',
bytes: 512_880,
persisted: true,
style: 'voxel',
diff --git a/api/x402/pipeline.js b/api/x402/pipeline.js
index 14c1d2f0b..d5a43a3f1 100644
--- a/api/x402/pipeline.js
+++ b/api/x402/pipeline.js
@@ -126,7 +126,7 @@ const OUTPUT_EXAMPLE = {
poll_url: '/api/forge?job=f1.eyJwIjoicGlwZWxpbmUifQ.sig',
price_usdc: '0.15',
stages: [
- { id: 'generate', status: 'done', output_url: 'https://cdn.three.ws/forge/…/model.glb' },
+ { id: 'generate', status: 'done', output_url: 'https://three.ws/cdn/forge/…/model.glb' },
{ id: 'rig', status: 'running', output_url: null },
],
};
diff --git a/docs/3d-api.md b/docs/3d-api.md
index 95c13c619..d655c9b0a 100644
--- a/docs/3d-api.md
+++ b/docs/3d-api.md
@@ -126,9 +126,9 @@ model comes straight back:
```json
{
"status": "done",
- "glbUrl": "https://cdn.three.ws/forge/anon/a1b2c3d4.glb",
- "viewerUrl": "https://three.ws/viewer?src=https%3A%2F%2Fcdn.three.ws%2Fforge%2Fanon%2Fa1b2c3d4.glb",
- "arUrl": "https://three.ws/api/ar?src=https%3A%2F%2Fcdn.three.ws%2Fforge%2Fanon%2Fa1b2c3d4.glb&title=a%20small%20ceramic%20robot%20figurine",
+ "glbUrl": "https://three.ws/cdn/forge/anon/a1b2c3d4.glb",
+ "viewerUrl": "https://three.ws/viewer?src=https%3A%2F%2Fthree.ws%2Fcdn%2Fforge%2Fanon%2Fa1b2c3d4.glb",
+ "arUrl": "https://three.ws/api/ar?src=https%3A%2F%2Fthree.ws%2Fcdn%2Fforge%2Fanon%2Fa1b2c3d4.glb&title=a%20small%20ceramic%20robot%20figurine",
"format": "glb",
"tier": "draft",
"free": true,
@@ -179,7 +179,7 @@ GET /api/3d/generate?job=f1.eyJwIjoibnZpZGlh...&title=a%20small%20ceramic%20robo
{ "status": "pending", "job": "f1...", "poll": "/api/3d/generate?job=f1...&title=...", "retryAfter": 3 }
// ready
-{ "status": "done", "job": "f1...", "glbUrl": "https://cdn.three.ws/forge/anon/done.glb",
+{ "status": "done", "job": "f1...", "glbUrl": "https://three.ws/cdn/forge/anon/done.glb",
"viewerUrl": "https://three.ws/viewer?src=...", "arUrl": "https://three.ws/api/ar?src=...&title=...",
"format": "glb", "tier": "draft", "free": true }
@@ -214,9 +214,9 @@ curl -s -X POST https://three.ws/api/3d/generate \
# 2. Poll until done, then download the GLB
curl -s 'https://three.ws/api/3d/generate?job=f1...'
-# → { "status": "done", "glbUrl": "https://cdn.three.ws/forge/anon/....glb", ... }
+# → { "status": "done", "glbUrl": "https://three.ws/cdn/forge/anon/....glb", ... }
-curl -sL -o model.glb 'https://cdn.three.ws/forge/anon/....glb'
+curl -sL -o model.glb 'https://three.ws/cdn/forge/anon/....glb'
```
The `glbUrl` is a real, durable GLB — open `viewerUrl` in a browser to inspect it,
@@ -352,7 +352,7 @@ tier at deploy time without touching settlement.
```bash
curl -s 'https://three.ws/api/forge?job=f1.eyJ…'
- # → { "status": "done", "glb_url": "https://cdn.three.ws/forge/…/model.glb", … }
+ # → { "status": "done", "glb_url": "https://three.ws/cdn/forge/…/model.glb", … }
```
A draft prompt often finishes inside the submit window and comes back inline with
diff --git a/docs/3d-pipeline.md b/docs/3d-pipeline.md
index b153989d1..638981f83 100644
--- a/docs/3d-pipeline.md
+++ b/docs/3d-pipeline.md
@@ -63,7 +63,7 @@ curl -s -X POST https://three.ws/api/x402/pipeline-rig \
# 2. Pay with an x402 client (settles the 402 and retries automatically)
npx @x402/fetch POST https://three.ws/api/x402/pipeline-rig \
--json '{"glb_url":"https://three.ws/forge/character.glb","rig_type":"biped"}'
-# → { "stage":"rig", "output_url":"https://cdn.three.ws/x402-pipeline/rig/….glb", ... }
+# → { "stage":"rig", "output_url":"https://three.ws/cdn/x402-pipeline/rig/….glb", ... }
```
### Remesh — `POST /api/x402/pipeline-remesh` — $0.03
@@ -122,7 +122,7 @@ mesh. **In:** an image (PNG/JPEG/WEBP/GIF). **Out:** a transparent PNG.
```bash
npx @x402/fetch POST https://three.ws/api/x402/pipeline-rembg \
--json '{"image_url":"https://three.ws/uploads/photo.jpg","model":"rmbg2"}'
-# → { "stage":"rembg", "output_url":"https://cdn.three.ws/x402-pipeline/rembg/….png" }
+# → { "stage":"rembg", "output_url":"https://three.ws/cdn/x402-pipeline/rembg/….png" }
```
Options: `model` (`rmbg2` | `u2net` | `isnet` | `u2net_human_seg` | `silueta`).
diff --git a/docs/ALL.md b/docs/ALL.md
index 90585ccf1..86a368304 100644
--- a/docs/ALL.md
+++ b/docs/ALL.md
@@ -1,7 +1,7 @@
<!-- GENERATED by scripts/combine-docs.mjs — do not edit by hand. Edit the source files under docs/ and re-run. -->
# three.ws — Combined Documentation
-> Single-file snapshot of every document under [`docs/`](.). Generated 2026-07-22 from **361 files** (~5196 KB).
+> Single-file snapshot of every document under [`docs/`](.). Generated 2026-07-27 from **370 files** (~5309 KB).
> The individual source files remain the canonical, editable copies — this file is a read-only aggregate.
## Table of contents
@@ -23,189 +23,192 @@
- [agent-sniper.md](#sec-055)
- [agent-studio.md](#sec-056)
- [agent-system.md](#sec-057)
-- [agent-wallets.md](#sec-058)
-- [agents-vs-avatars.md](#sec-059)
-- [agi.md](#sec-060)
-- [agora.md](#sec-061)
-- [alpha-copilot.md](#sec-074)
-- [animation-studio.md](#sec-075)
-- [animations.md](#sec-076)
-- [api-reference.md](#sec-077)
-- [ar-studio.md](#sec-079)
-- [ar.md](#sec-080)
-- [architecture.md](#sec-081)
-- [assistant-widget.md](#sec-082)
-- [authentication.md](#sec-083)
-- [autonomous-economy.md](#sec-084)
-- [autonomous-x402.md](#sec-085)
-- [autopilot.md](#sec-086)
-- [avatar-creation.md](#sec-087)
-- [avatar-inspector.md](#sec-088)
-- [avatar-pipeline.md](#sec-089)
-- [avatar-reconstruction.md](#sec-090)
-- [avatar-studio.md](#sec-091)
-- [avatar-thumbnails.md](#sec-092)
-- [aws-builder-center-marketplace-x402.md](#sec-093)
-- [aws-builder-center-mcp-agents.md](#sec-094)
-- [aws-marketplace-listing-kit.md](#sec-095)
-- [aws-marketplace.md](#sec-096)
-- [aws-partner-spotlight.md](#sec-097)
-- [bnb-babt-findings.md](#sec-098)
-- [bnb-payments.md](#sec-099)
-- [bnb-vault.md](#sec-100)
-- [bnb-world.md](#sec-101)
-- [brain.md](#sec-102)
-- [btn-pill-migration.md](#sec-103)
-- [build.md](#sec-104)
-- [capture.md](#sec-105)
-- [changelog.md](#sec-106)
-- [character-studio.md](#sec-107)
-- [chatgpt-ar.md](#sec-108)
-- [circulation-engine.md](#sec-109)
-- [clash.md](#sec-110)
-- [clip-director.md](#sec-111)
-- [coin-launches.md](#sec-112)
-- [coin-pages.md](#sec-113)
-- [coinmarketcap-article-play.md](#sec-114)
-- [coinmarketcap-article.md](#sec-115)
-- [compose.md](#sec-116)
-- [concierge.md](#sec-117)
-- [configuration.md](#sec-118)
-- [contributing.md](#sec-125)
-- [cosmos.md](#sec-126)
-- [crypto-api.md](#sec-127)
-- [custody.md](#sec-128)
-- [daily-forge.md](#sec-129)
-- [demo-routes.md](#sec-130)
-- [deployment.md](#sec-131)
-- [diorama.md](#sec-132)
-- [do-i-need-crypto.md](#sec-133)
-- [economy-heartbeat.md](#sec-134)
-- [economy-master.md](#sec-135)
-- [editor.md](#sec-136)
-- [embedding.md](#sec-137)
-- [embody.md](#sec-138)
-- [erc8004.md](#sec-139)
-- [examples.md](#sec-141)
-- [fact-check.md](#sec-142)
-- [financial-controls.md](#sec-143)
-- [forge-background-generation.md](#sec-144)
-- [forge-off.md](#sec-145)
-- [forge-pipeline.md](#sec-146)
-- [forge.md](#sec-147)
-- [galaxy.md](#sec-148)
-- [genesis.md](#sec-149)
-- [genome.md](#sec-150)
-- [guardian.md](#sec-151)
-- [hold-to-access.md](#sec-152)
-- [how-forge-works.md](#sec-153)
-- [how-it-works.md](#sec-154)
-- [i18n.md](#sec-155)
-- [ibm-x402-mcp.md](#sec-156)
-- [ibm.md](#sec-157)
-- [image-to-3d.md](#sec-158)
-- [integrations.md](#sec-159)
-- [introduction.md](#sec-160)
-- [irl.md](#sec-161)
-- [js-api.md](#sec-163)
-- [labor-market.md](#sec-164)
-- [launch-usecases.md](#sec-165)
-- [layers.md](#sec-166)
-- [lipsync.md](#sec-167)
-- [listings.md](#sec-168)
-- [make-your-agent.md](#sec-169)
-- [market-data-api.md](#sec-170)
-- [marketplace.md](#sec-171)
-- [mcp-3d-studio.md](#sec-172)
-- [mcp-agent.md](#sec-173)
-- [mcp-studio.md](#sec-174)
-- [mcp-tools.md](#sec-175)
-- [mcp-x402-bazaar.md](#sec-176)
-- [mcp.md](#sec-177)
-- [memetic-launcher.md](#sec-178)
-- [memory.md](#sec-179)
-- [meta-allocator.md](#sec-180)
-- [mint-mark.md](#sec-181)
-- [mocap-studio.md](#sec-182)
-- [money-feed.md](#sec-183)
-- [money-map.md](#sec-184)
-- [motion-swap.md](#sec-185)
-- [multi-agent.md](#sec-186)
-- [news-rights.md](#sec-187)
-- [nvidia-inception.md](#sec-188)
-- [nvidia-models.md](#sec-189)
-- [nvidia-nemotron-spotlight.md](#sec-190)
-- [okx-marketplace.md](#sec-191)
-- [onchain-agents.md](#sec-192)
-- [oracle.md](#sec-201)
-- [package-extraction.md](#sec-202)
-- [pay-skills-listing.md](#sec-204)
-- [permissions.md](#sec-205)
-- [persona-hub.md](#sec-206)
-- [plan-checkout.md](#sec-207)
-- [popular-3d-github-repos.md](#sec-208)
-- [premium.md](#sec-209)
-- [provenance.md](#sec-210)
-- [pump-fun-mcp-edge.md](#sec-211)
-- [pump-launch-repos.md](#sec-212)
-- [pump-launcher.md](#sec-213)
-- [pump-platform-fee.md](#sec-214)
-- [quick-start.md](#sec-235)
-- [radar.md](#sec-236)
-- [remix.md](#sec-237)
-- [reputation.md](#sec-238)
-- [restyle.md](#sec-239)
-- [risk-acknowledgment.md](#sec-240)
-- [robinhood-chain-markets.md](#sec-241)
-- [sas-attestations.md](#sec-242)
-- [scene-studio.md](#sec-243)
-- [sdk.md](#sec-244)
-- [security.md](#sec-245)
-- [selfie-to-avatar.md](#sec-246)
-- [share-and-embed.md](#sec-247)
-- [sign-language.md](#sec-248)
-- [signals.md](#sec-249)
-- [sketchfab.md](#sec-250)
-- [skills.md](#sec-251)
-- [smart-contracts.md](#sec-252)
-- [smart-money.md](#sec-253)
-- [social-layer.md](#sec-254)
-- [solana-pumpfun.md](#sec-255)
-- [solana-reputation.md](#sec-256)
-- [solana.md](#sec-257)
-- [spatial-mcp.md](#sec-258)
-- [splat.md](#sec-260)
-- [start-here.md](#sec-261)
-- [strategy-objects.md](#sec-262)
-- [syndication.md](#sec-263)
-- [talking-avatar-video.md](#sec-264)
-- [terminal.md](#sec-265)
-- [three-microbuy.md](#sec-266)
-- [token-gated-3d-embeds.md](#sec-267)
-- [trader-card.md](#sec-268)
-- [trading-arenas.md](#sec-269)
-- [trading-copilot.md](#sec-270)
-- [trading-experiment.md](#sec-271)
-- [trading-surfaces.md](#sec-272)
-- [troubleshooting.md](#sec-273)
-- [trust-primitives.md](#sec-274)
-- [ui-juice.md](#sec-328)
-- [validation.md](#sec-341)
-- [vanity.md](#sec-342)
-- [viewer.md](#sec-343)
-- [voice-lab.md](#sec-344)
-- [web-component.md](#sec-345)
-- [widget-api.md](#sec-346)
-- [widget-studio.md](#sec-347)
-- [widgets.md](#sec-348)
-- [x402-buyer.md](#sec-349)
-- [x402-dev-tools.md](#sec-350)
-- [x402-distribution.md](#sec-351)
-- [x402-endpoints.md](#sec-352)
-- [x402-revenue.md](#sec-353)
-- [x402-ring-economy.md](#sec-354)
-- [x402-studio.md](#sec-355)
-- [x402.md](#sec-356)
+- [agent-wallets.md](#sec-063)
+- [agents-vs-avatars.md](#sec-064)
+- [agi.md](#sec-065)
+- [agora.md](#sec-066)
+- [alpha-copilot.md](#sec-079)
+- [animation-studio.md](#sec-080)
+- [animations.md](#sec-081)
+- [api-reference.md](#sec-082)
+- [ar-studio.md](#sec-084)
+- [ar.md](#sec-085)
+- [architecture.md](#sec-086)
+- [assistant-widget.md](#sec-087)
+- [authentication.md](#sec-088)
+- [autonomous-economy.md](#sec-089)
+- [autonomous-x402.md](#sec-090)
+- [autopilot.md](#sec-091)
+- [avatar-creation.md](#sec-092)
+- [avatar-fidelity-program.md](#sec-093)
+- [avatar-inspector.md](#sec-094)
+- [avatar-pipeline.md](#sec-095)
+- [avatar-reconstruction.md](#sec-096)
+- [avatar-studio.md](#sec-097)
+- [avatar-thumbnails.md](#sec-098)
+- [avatar-wardrobe.md](#sec-099)
+- [aws-builder-center-marketplace-x402.md](#sec-100)
+- [aws-builder-center-mcp-agents.md](#sec-101)
+- [aws-marketplace-listing-kit.md](#sec-102)
+- [aws-marketplace.md](#sec-103)
+- [aws-partner-spotlight.md](#sec-104)
+- [bnb-babt-findings.md](#sec-105)
+- [bnb-payments.md](#sec-106)
+- [bnb-vault.md](#sec-107)
+- [bnb-world.md](#sec-108)
+- [brain.md](#sec-109)
+- [btn-pill-migration.md](#sec-110)
+- [build.md](#sec-111)
+- [capture.md](#sec-112)
+- [changelog.md](#sec-113)
+- [character-studio.md](#sec-114)
+- [chatgpt-ar.md](#sec-115)
+- [circulation-engine.md](#sec-116)
+- [clash.md](#sec-117)
+- [clip-director.md](#sec-118)
+- [coin-launches.md](#sec-119)
+- [coin-pages.md](#sec-120)
+- [coinmarketcap-article-play.md](#sec-121)
+- [coinmarketcap-article.md](#sec-122)
+- [compose.md](#sec-123)
+- [concierge.md](#sec-124)
+- [configuration.md](#sec-125)
+- [contributing.md](#sec-132)
+- [cosmos.md](#sec-133)
+- [crypto-api.md](#sec-134)
+- [custody.md](#sec-135)
+- [daily-forge.md](#sec-136)
+- [demo-routes.md](#sec-137)
+- [deployment.md](#sec-138)
+- [diorama.md](#sec-139)
+- [do-i-need-crypto.md](#sec-140)
+- [economy-heartbeat.md](#sec-141)
+- [economy-master.md](#sec-142)
+- [editor.md](#sec-143)
+- [embedding.md](#sec-144)
+- [embody.md](#sec-145)
+- [erc8004.md](#sec-146)
+- [examples.md](#sec-148)
+- [fact-check.md](#sec-149)
+- [financial-controls.md](#sec-150)
+- [forge-background-generation.md](#sec-151)
+- [forge-off.md](#sec-152)
+- [forge-pipeline.md](#sec-153)
+- [forge.md](#sec-154)
+- [galaxy.md](#sec-155)
+- [genesis.md](#sec-156)
+- [genome.md](#sec-157)
+- [guardian.md](#sec-158)
+- [hold-to-access.md](#sec-159)
+- [how-forge-works.md](#sec-160)
+- [how-it-works.md](#sec-161)
+- [i18n.md](#sec-162)
+- [ibm-x402-mcp.md](#sec-163)
+- [ibm.md](#sec-164)
+- [image-to-3d.md](#sec-165)
+- [integrations.md](#sec-166)
+- [introduction.md](#sec-167)
+- [irl.md](#sec-168)
+- [js-api.md](#sec-170)
+- [labor-market.md](#sec-171)
+- [launch-usecases.md](#sec-172)
+- [layers.md](#sec-173)
+- [lipsync.md](#sec-174)
+- [listings.md](#sec-175)
+- [make-your-agent.md](#sec-176)
+- [market-data-api.md](#sec-177)
+- [marketplace.md](#sec-178)
+- [mcp-3d-studio.md](#sec-179)
+- [mcp-agent.md](#sec-180)
+- [mcp-studio.md](#sec-181)
+- [mcp-tools.md](#sec-182)
+- [mcp-x402-bazaar.md](#sec-183)
+- [mcp.md](#sec-184)
+- [memetic-launcher.md](#sec-185)
+- [memory.md](#sec-186)
+- [meta-allocator.md](#sec-187)
+- [mint-mark.md](#sec-188)
+- [mocap-studio.md](#sec-189)
+- [money-feed.md](#sec-190)
+- [money-map.md](#sec-191)
+- [motion-swap.md](#sec-192)
+- [multi-agent.md](#sec-193)
+- [news-rights.md](#sec-194)
+- [nvidia-inception.md](#sec-195)
+- [nvidia-models.md](#sec-196)
+- [nvidia-nemotron-spotlight.md](#sec-197)
+- [okx-marketplace.md](#sec-198)
+- [onchain-agents.md](#sec-199)
+- [oracle.md](#sec-208)
+- [package-extraction.md](#sec-209)
+- [pay-skills-listing.md](#sec-211)
+- [permissions.md](#sec-212)
+- [persona-hub.md](#sec-213)
+- [plan-checkout.md](#sec-214)
+- [popular-3d-github-repos.md](#sec-215)
+- [premium.md](#sec-216)
+- [provenance.md](#sec-217)
+- [pump-fun-mcp-edge.md](#sec-218)
+- [pump-launch-repos.md](#sec-219)
+- [pump-launcher.md](#sec-220)
+- [pump-platform-fee.md](#sec-221)
+- [quick-start.md](#sec-242)
+- [radar.md](#sec-243)
+- [remix.md](#sec-244)
+- [reputation.md](#sec-245)
+- [restyle.md](#sec-246)
+- [risk-acknowledgment.md](#sec-247)
+- [robinhood-chain-markets.md](#sec-248)
+- [sas-attestations.md](#sec-249)
+- [scene-studio.md](#sec-250)
+- [sdk.md](#sec-251)
+- [security.md](#sec-252)
+- [selfie-to-avatar.md](#sec-253)
+- [share-and-embed.md](#sec-254)
+- [sign-language.md](#sec-255)
+- [signals.md](#sec-256)
+- [sketchfab.md](#sec-257)
+- [skills.md](#sec-258)
+- [smart-contracts.md](#sec-259)
+- [smart-money.md](#sec-260)
+- [sniper-autonomy.md](#sec-261)
+- [social-layer.md](#sec-262)
+- [solana-pumpfun.md](#sec-263)
+- [solana-reputation.md](#sec-264)
+- [solana.md](#sec-265)
+- [spatial-mcp.md](#sec-266)
+- [splat.md](#sec-268)
+- [start-here.md](#sec-269)
+- [strategy-objects.md](#sec-270)
+- [syndication.md](#sec-271)
+- [talking-avatar-video.md](#sec-272)
+- [terminal.md](#sec-273)
+- [three-microbuy.md](#sec-274)
+- [token-gated-3d-embeds.md](#sec-275)
+- [trader-card.md](#sec-276)
+- [trading-arenas.md](#sec-277)
+- [trading-copilot.md](#sec-278)
+- [trading-experiment.md](#sec-279)
+- [trading-surfaces.md](#sec-280)
+- [troubleshooting.md](#sec-281)
+- [trust-primitives.md](#sec-282)
+- [ui-juice.md](#sec-337)
+- [validation.md](#sec-350)
+- [vanity.md](#sec-351)
+- [viewer.md](#sec-352)
+- [voice-lab.md](#sec-353)
+- [web-component.md](#sec-354)
+- [widget-api.md](#sec-355)
+- [widget-studio.md](#sec-356)
+- [widgets.md](#sec-357)
+- [x402-buyer.md](#sec-358)
+- [x402-dev-tools.md](#sec-359)
+- [x402-distribution.md](#sec-360)
+- [x402-endpoints.md](#sec-361)
+- [x402-revenue.md](#sec-362)
+- [x402-ring-economy.md](#sec-363)
+- [x402-studio.md](#sec-364)
+- [x402.md](#sec-365)
### agent-abilities
@@ -252,162 +255,171 @@
- [agent-abilities/wallet/22-recovery.md](#sec-048)
- [agent-abilities/wallet/23-self-defense.md](#sec-049)
+### agent-tasks
+
+- [agent-tasks/README.md](#sec-058)
+- [agent-tasks/fix-x402-502-bursts.md](#sec-059)
+- [agent-tasks/fix-x402-caller-mismatches.md](#sec-060)
+- [agent-tasks/fix-x402-wallet-health.md](#sec-061)
+- [agent-tasks/new-trading-arm-x402-signals.md](#sec-062)
+
### agora
-- [agora/tasks/00-INDEX.md](#sec-062)
-- [agora/tasks/01-verify-foundation.md](#sec-063)
-- [agora/tasks/02-life-engine.md](#sec-064)
-- [agora/tasks/03-task-supply.md](#sec-065)
-- [agora/tasks/04-professions.md](#sec-066)
-- [agora/tasks/05-commons-scaffold.md](#sec-067)
-- [agora/tasks/06-economy-visuals.md](#sec-068)
-- [agora/tasks/07-verify-and-passport.md](#sec-069)
-- [agora/tasks/08-humans-first-class.md](#sec-070)
-- [agora/tasks/09-arena-and-guilds.md](#sec-071)
-- [agora/tasks/10-agora-mcp.md](#sec-072)
-- [agora/tasks/11-production-hardening.md](#sec-073)
+- [agora/tasks/00-INDEX.md](#sec-067)
+- [agora/tasks/01-verify-foundation.md](#sec-068)
+- [agora/tasks/02-life-engine.md](#sec-069)
+- [agora/tasks/03-task-supply.md](#sec-070)
+- [agora/tasks/04-professions.md](#sec-071)
+- [agora/tasks/05-commons-scaffold.md](#sec-072)
+- [agora/tasks/06-economy-visuals.md](#sec-073)
+- [agora/tasks/07-verify-and-passport.md](#sec-074)
+- [agora/tasks/08-humans-first-class.md](#sec-075)
+- [agora/tasks/09-arena-and-guilds.md](#sec-076)
+- [agora/tasks/10-agora-mcp.md](#sec-077)
+- [agora/tasks/11-production-hardening.md](#sec-078)
### api
-- [api/forge-x402.md](#sec-078)
+- [api/forge-x402.md](#sec-083)
### content
-- [content/use-cases/README.md](#sec-119)
-- [content/use-cases/ai-agent-developer.md](#sec-120)
-- [content/use-cases/brand-marketer.md](#sec-121)
-- [content/use-cases/crypto-community.md](#sec-122)
-- [content/use-cases/game-studio.md](#sec-123)
-- [content/use-cases/indie-creator.md](#sec-124)
+- [content/use-cases/README.md](#sec-126)
+- [content/use-cases/ai-agent-developer.md](#sec-127)
+- [content/use-cases/brand-marketer.md](#sec-128)
+- [content/use-cases/crypto-community.md](#sec-129)
+- [content/use-cases/game-studio.md](#sec-130)
+- [content/use-cases/indie-creator.md](#sec-131)
### erc8004
-- [erc8004/validation-attestation.md](#sec-140)
+- [erc8004/validation-attestation.md](#sec-147)
### irl
-- [irl/THREAT-MODEL.md](#sec-162)
+- [irl/THREAT-MODEL.md](#sec-169)
### openai-pr
-- [openai-pr/00-START-HERE.md](#sec-193)
-- [openai-pr/01-orphan-widget-resolution.md](#sec-194)
-- [openai-pr/02-wellknown-manifest-conflict.md](#sec-195)
-- [openai-pr/03-forge-free-tier-truth.md](#sec-196)
-- [openai-pr/04-openai-surface-test-coverage.md](#sec-197)
-- [openai-pr/05-custom-gpt-openapi-serving.md](#sec-198)
-- [openai-pr/06-docs-accuracy-reconciliation.md](#sec-199)
-- [openai-pr/07-final-verification-and-submit.md](#sec-200)
+- [openai-pr/00-START-HERE.md](#sec-200)
+- [openai-pr/01-orphan-widget-resolution.md](#sec-201)
+- [openai-pr/02-wellknown-manifest-conflict.md](#sec-202)
+- [openai-pr/03-forge-free-tier-truth.md](#sec-203)
+- [openai-pr/04-openai-surface-test-coverage.md](#sec-204)
+- [openai-pr/05-custom-gpt-openapi-serving.md](#sec-205)
+- [openai-pr/06-docs-accuracy-reconciliation.md](#sec-206)
+- [openai-pr/07-final-verification-and-submit.md](#sec-207)
### partners
-- [partners/sperax-proposal.md](#sec-203)
+- [partners/sperax-proposal.md](#sec-210)
### pumpfun-program
-- [pumpfun-program/README.md](#sec-215)
-- [pumpfun-program/UPSTREAM-buy-sell-v2-announcement.md](#sec-216)
-- [pumpfun-program/UPSTREAM-pumpswap-virtual-quote-reserves.md](#sec-217)
-- [pumpfun-program/docs/BREAKING_FEE_RECIPIENT.md](#sec-218)
-- [pumpfun-program/docs/CPI_README.md](#sec-219)
-- [pumpfun-program/docs/FAQ.md](#sec-220)
-- [pumpfun-program/docs/FEE_PROGRAM_README.md](#sec-221)
-- [pumpfun-program/docs/FEE_RECIPIENTS.md](#sec-222)
-- [pumpfun-program/docs/PUMP_CASHBACK_README.md](#sec-223)
-- [pumpfun-program/docs/PUMP_CREATOR_FEE_README.md](#sec-224)
-- [pumpfun-program/docs/PUMP_PROGRAM_README.md](#sec-225)
-- [pumpfun-program/docs/PUMP_SWAP_CREATOR_FEE_README.md](#sec-226)
-- [pumpfun-program/docs/PUMP_SWAP_README.md](#sec-227)
-- [pumpfun-program/docs/PUMP_SWAP_SDK_README.md](#sec-228)
-- [pumpfun-program/docs/instructions/BUY.md](#sec-229)
-- [pumpfun-program/docs/instructions/CLAIM_CASHBACK.md](#sec-230)
-- [pumpfun-program/docs/instructions/COIN_CREATION.md](#sec-231)
-- [pumpfun-program/docs/instructions/COLLECT_CREATOR_FEE.md](#sec-232)
-- [pumpfun-program/docs/instructions/CREATOR_FEE_SHARING.md](#sec-233)
-- [pumpfun-program/docs/instructions/SELL.md](#sec-234)
+- [pumpfun-program/README.md](#sec-222)
+- [pumpfun-program/UPSTREAM-buy-sell-v2-announcement.md](#sec-223)
+- [pumpfun-program/UPSTREAM-pumpswap-virtual-quote-reserves.md](#sec-224)
+- [pumpfun-program/docs/BREAKING_FEE_RECIPIENT.md](#sec-225)
+- [pumpfun-program/docs/CPI_README.md](#sec-226)
+- [pumpfun-program/docs/FAQ.md](#sec-227)
+- [pumpfun-program/docs/FEE_PROGRAM_README.md](#sec-228)
+- [pumpfun-program/docs/FEE_RECIPIENTS.md](#sec-229)
+- [pumpfun-program/docs/PUMP_CASHBACK_README.md](#sec-230)
+- [pumpfun-program/docs/PUMP_CREATOR_FEE_README.md](#sec-231)
+- [pumpfun-program/docs/PUMP_PROGRAM_README.md](#sec-232)
+- [pumpfun-program/docs/PUMP_SWAP_CREATOR_FEE_README.md](#sec-233)
+- [pumpfun-program/docs/PUMP_SWAP_README.md](#sec-234)
+- [pumpfun-program/docs/PUMP_SWAP_SDK_README.md](#sec-235)
+- [pumpfun-program/docs/instructions/BUY.md](#sec-236)
+- [pumpfun-program/docs/instructions/CLAIM_CASHBACK.md](#sec-237)
+- [pumpfun-program/docs/instructions/COIN_CREATION.md](#sec-238)
+- [pumpfun-program/docs/instructions/COLLECT_CREATOR_FEE.md](#sec-239)
+- [pumpfun-program/docs/instructions/CREATOR_FEE_SHARING.md](#sec-240)
+- [pumpfun-program/docs/instructions/SELL.md](#sec-241)
### specs
-- [specs/agent-trading.md](#sec-259)
+- [specs/agent-trading.md](#sec-267)
### tutorials
-- [tutorials/add-a-3d-assistant.md](#sec-275)
-- [tutorials/agent-personality.md](#sec-276)
-- [tutorials/agent-reputation.md](#sec-277)
-- [tutorials/animate-your-avatar.md](#sec-278)
-- [tutorials/arm-an-agent-sniper.md](#sec-279)
-- [tutorials/build-a-scene.md](#sec-280)
-- [tutorials/build-a-site-concierge.md](#sec-281)
-- [tutorials/claim-threews-name.md](#sec-282)
-- [tutorials/connect-ai-brain.md](#sec-283)
-- [tutorials/create-and-edit-memory.md](#sec-284)
-- [tutorials/custom-skill.md](#sec-285)
-- [tutorials/customize-appearance.md](#sec-286)
-- [tutorials/deploy-to-vercel-custom-domain.md](#sec-287)
-- [tutorials/embed-in-30-seconds.md](#sec-288)
-- [tutorials/embed-on-website.md](#sec-289)
-- [tutorials/emotion-from-data.md](#sec-290)
-- [tutorials/first-agent.md](#sec-291)
-- [tutorials/first-prompt-to-3d.md](#sec-292)
-- [tutorials/generate-3d-api.md](#sec-293)
-- [tutorials/getting-started.md](#sec-294)
-- [tutorials/greeting-and-first-speech.md](#sec-295)
-- [tutorials/image-to-3d.md](#sec-296)
-- [tutorials/import-avatar-url.md](#sec-297)
-- [tutorials/js-api-events.md](#sec-298)
-- [tutorials/mcp-server-for-your-agent.md](#sec-299)
-- [tutorials/mine-vanity-address.md](#sec-300)
-- [tutorials/mint-pumpfun-token.md](#sec-301)
-- [tutorials/multi-agent-coordination.md](#sec-302)
-- [tutorials/nvidia-3d-free.md](#sec-303)
-- [tutorials/nvidia-nim-self-host.md](#sec-304)
-- [tutorials/paid-x402-endpoint.md](#sec-305)
-- [tutorials/pay-for-x402-service.md](#sec-306)
-- [tutorials/personal-ai-site.md](#sec-307)
-- [tutorials/place-agent-irl.md](#sec-308)
-- [tutorials/prompts-for-3d.md](#sec-309)
-- [tutorials/register-onchain.md](#sec-310)
-- [tutorials/self-host-agent-backend.md](#sec-311)
-- [tutorials/selfie-to-avatar.md](#sec-312)
-- [tutorials/share-your-agent.md](#sec-313)
-- [tutorials/shopify-store-guide-advanced.md](#sec-314)
-- [tutorials/shopify-store-guide.md](#sec-315)
-- [tutorials/skill-with-database-auth.md](#sec-316)
-- [tutorials/solana-agent-reputation.md](#sec-317)
-- [tutorials/sperax-tour.md](#sec-318)
-- [tutorials/swap-avatar-in-studio.md](#sec-319)
-- [tutorials/text-to-3d.md](#sec-320)
-- [tutorials/trigger-from-page-events.md](#sec-321)
-- [tutorials/upload-custom-glb.md](#sec-322)
-- [tutorials/view-in-ar.md](#sec-323)
-- [tutorials/voice-and-lipsync.md](#sec-324)
-- [tutorials/walk-companion.md](#sec-325)
-- [tutorials/web-component-end-to-end.md](#sec-326)
-- [tutorials/x402-server-sdk.md](#sec-327)
+- [tutorials/add-a-3d-assistant.md](#sec-283)
+- [tutorials/agent-personality.md](#sec-284)
+- [tutorials/agent-reputation.md](#sec-285)
+- [tutorials/animate-your-avatar.md](#sec-286)
+- [tutorials/arm-an-agent-sniper.md](#sec-287)
+- [tutorials/build-a-scene.md](#sec-288)
+- [tutorials/build-a-site-concierge.md](#sec-289)
+- [tutorials/claim-threews-name.md](#sec-290)
+- [tutorials/connect-ai-brain.md](#sec-291)
+- [tutorials/create-and-edit-memory.md](#sec-292)
+- [tutorials/custom-skill.md](#sec-293)
+- [tutorials/customize-appearance.md](#sec-294)
+- [tutorials/deploy-to-vercel-custom-domain.md](#sec-295)
+- [tutorials/embed-in-30-seconds.md](#sec-296)
+- [tutorials/embed-on-website.md](#sec-297)
+- [tutorials/emotion-from-data.md](#sec-298)
+- [tutorials/first-agent.md](#sec-299)
+- [tutorials/first-prompt-to-3d.md](#sec-300)
+- [tutorials/generate-3d-api.md](#sec-301)
+- [tutorials/getting-started.md](#sec-302)
+- [tutorials/greeting-and-first-speech.md](#sec-303)
+- [tutorials/image-to-3d.md](#sec-304)
+- [tutorials/import-avatar-url.md](#sec-305)
+- [tutorials/js-api-events.md](#sec-306)
+- [tutorials/mcp-server-for-your-agent.md](#sec-307)
+- [tutorials/mine-vanity-address.md](#sec-308)
+- [tutorials/mint-pumpfun-token.md](#sec-309)
+- [tutorials/multi-agent-coordination.md](#sec-310)
+- [tutorials/nvidia-3d-free.md](#sec-311)
+- [tutorials/nvidia-nim-self-host.md](#sec-312)
+- [tutorials/paid-x402-endpoint.md](#sec-313)
+- [tutorials/pay-for-x402-service.md](#sec-314)
+- [tutorials/personal-ai-site.md](#sec-315)
+- [tutorials/place-agent-irl.md](#sec-316)
+- [tutorials/prompts-for-3d.md](#sec-317)
+- [tutorials/register-onchain.md](#sec-318)
+- [tutorials/self-host-agent-backend.md](#sec-319)
+- [tutorials/selfie-to-avatar.md](#sec-320)
+- [tutorials/share-your-agent.md](#sec-321)
+- [tutorials/shopify-shopping-assistant.md](#sec-322)
+- [tutorials/shopify-store-guide-advanced.md](#sec-323)
+- [tutorials/shopify-store-guide.md](#sec-324)
+- [tutorials/skill-with-database-auth.md](#sec-325)
+- [tutorials/solana-agent-reputation.md](#sec-326)
+- [tutorials/sperax-tour.md](#sec-327)
+- [tutorials/swap-avatar-in-studio.md](#sec-328)
+- [tutorials/text-to-3d.md](#sec-329)
+- [tutorials/trigger-from-page-events.md](#sec-330)
+- [tutorials/upload-custom-glb.md](#sec-331)
+- [tutorials/view-in-ar.md](#sec-332)
+- [tutorials/voice-and-lipsync.md](#sec-333)
+- [tutorials/walk-companion.md](#sec-334)
+- [tutorials/web-component-end-to-end.md](#sec-335)
+- [tutorials/x402-server-sdk.md](#sec-336)
### ux-flows
-- [ux-flows/01-onboarding-creation.md](#sec-329)
-- [ux-flows/02-forge-text-to-3d.md](#sec-330)
-- [ux-flows/03-3d-editing-viewer.md](#sec-331)
-- [ux-flows/04-embed-widget-studio.md](#sec-332)
-- [ux-flows/05-discovery-social.md](#sec-333)
-- [ux-flows/06-marketplace-skills.md](#sec-334)
-- [ux-flows/07-crypto-trading-analytics.md](#sec-335)
-- [ux-flows/08-coin-launch-wallets.md](#sec-336)
-- [ux-flows/09-x402-agent-commerce.md](#sec-337)
-- [ux-flows/10-chat-brain-labs.md](#sec-338)
-- [ux-flows/11-account-dashboard.md](#sec-339)
-- [ux-flows/12-home-and-content.md](#sec-340)
+- [ux-flows/01-onboarding-creation.md](#sec-338)
+- [ux-flows/02-forge-text-to-3d.md](#sec-339)
+- [ux-flows/03-3d-editing-viewer.md](#sec-340)
+- [ux-flows/04-embed-widget-studio.md](#sec-341)
+- [ux-flows/05-discovery-social.md](#sec-342)
+- [ux-flows/06-marketplace-skills.md](#sec-343)
+- [ux-flows/07-crypto-trading-analytics.md](#sec-344)
+- [ux-flows/08-coin-launch-wallets.md](#sec-345)
+- [ux-flows/09-x402-agent-commerce.md](#sec-346)
+- [ux-flows/10-chat-brain-labs.md](#sec-347)
+- [ux-flows/11-account-dashboard.md](#sec-348)
+- [ux-flows/12-home-and-content.md](#sec-349)
### zauth
-- [zauth/database.md](#sec-357)
-- [zauth/index.md](#sec-358)
-- [zauth/provider-hub.md](#sec-359)
-- [zauth/reposcan.md](#sec-360)
-- [zauth/vector.md](#sec-361)
+- [zauth/database.md](#sec-366)
+- [zauth/index.md](#sec-367)
+- [zauth/provider-hub.md](#sec-368)
+- [zauth/reposcan.md](#sec-369)
+- [zauth/vector.md](#sec-370)
---
@@ -543,9 +555,9 @@ model comes straight back:
```json
{
"status": "done",
- "glbUrl": "https://cdn.three.ws/forge/anon/a1b2c3d4.glb",
- "viewerUrl": "https://three.ws/viewer?src=https%3A%2F%2Fcdn.three.ws%2Fforge%2Fanon%2Fa1b2c3d4.glb",
- "arUrl": "https://three.ws/api/ar?src=https%3A%2F%2Fcdn.three.ws%2Fforge%2Fanon%2Fa1b2c3d4.glb&title=a%20small%20ceramic%20robot%20figurine",
+ "glbUrl": "https://three.ws/cdn/forge/anon/a1b2c3d4.glb",
+ "viewerUrl": "https://three.ws/viewer?src=https%3A%2F%2Fthree.ws%2Fcdn%2Fforge%2Fanon%2Fa1b2c3d4.glb",
+ "arUrl": "https://three.ws/api/ar?src=https%3A%2F%2Fthree.ws%2Fcdn%2Fforge%2Fanon%2Fa1b2c3d4.glb&title=a%20small%20ceramic%20robot%20figurine",
"format": "glb",
"tier": "draft",
"free": true,
@@ -596,7 +608,7 @@ GET /api/3d/generate?job=f1.eyJwIjoibnZpZGlh...&title=a%20small%20ceramic%20robo
{ "status": "pending", "job": "f1...", "poll": "/api/3d/generate?job=f1...&title=...", "retryAfter": 3 }
// ready
-{ "status": "done", "job": "f1...", "glbUrl": "https://cdn.three.ws/forge/anon/done.glb",
+{ "status": "done", "job": "f1...", "glbUrl": "https://three.ws/cdn/forge/anon/done.glb",
"viewerUrl": "https://three.ws/viewer?src=...", "arUrl": "https://three.ws/api/ar?src=...&title=...",
"format": "glb", "tier": "draft", "free": true }
@@ -631,9 +643,9 @@ curl -s -X POST https://three.ws/api/3d/generate \
# 2. Poll until done, then download the GLB
curl -s 'https://three.ws/api/3d/generate?job=f1...'
-# → { "status": "done", "glbUrl": "https://cdn.three.ws/forge/anon/....glb", ... }
+# → { "status": "done", "glbUrl": "https://three.ws/cdn/forge/anon/....glb", ... }
-curl -sL -o model.glb 'https://cdn.three.ws/forge/anon/....glb'
+curl -sL -o model.glb 'https://three.ws/cdn/forge/anon/....glb'
```
The `glbUrl` is a real, durable GLB — open `viewerUrl` in a browser to inspect it,
@@ -769,7 +781,7 @@ tier at deploy time without touching settlement.
```bash
curl -s 'https://three.ws/api/forge?job=f1.eyJ…'
- # → { "status": "done", "glb_url": "https://cdn.three.ws/forge/…/model.glb", … }
+ # → { "status": "done", "glb_url": "https://three.ws/cdn/forge/…/model.glb", … }
```
A draft prompt often finishes inside the submit window and comes back inline with
@@ -1244,7 +1256,7 @@ curl -s -X POST https://three.ws/api/x402/pipeline-rig \
# 2. Pay with an x402 client (settles the 402 and retries automatically)
npx @x402/fetch POST https://three.ws/api/x402/pipeline-rig \
--json '{"glb_url":"https://three.ws/forge/character.glb","rig_type":"biped"}'
-# → { "stage":"rig", "output_url":"https://cdn.three.ws/x402-pipeline/rig/….glb", ... }
+# → { "stage":"rig", "output_url":"https://three.ws/cdn/x402-pipeline/rig/….glb", ... }
```
### Remesh — `POST /api/x402/pipeline-remesh` — $0.03
@@ -1303,7 +1315,7 @@ mesh. **In:** an image (PNG/JPEG/WEBP/GIF). **Out:** a transparent PNG.
```bash
npx @x402/fetch POST https://three.ws/api/x402/pipeline-rembg \
--json '{"image_url":"https://three.ws/uploads/photo.jpg","model":"rmbg2"}'
-# → { "stage":"rembg", "output_url":"https://cdn.three.ws/x402-pipeline/rembg/….png" }
+# → { "stage":"rembg", "output_url":"https://three.ws/cdn/x402-pipeline/rembg/….png" }
```
Options: `model` (`rmbg2` | `u2net` | `isnet` | `u2net_human_seg` | `silueta`).
@@ -1610,17 +1622,68 @@ matches(address, prefix, suffix, ignoreCase):
```
The Base58 alphabet excludes `0 O I l`. **Difficulty** is the mean of a geometric
-distribution — the expected number of candidates to a hit:
+distribution, the expected number of candidates to a hit, computed as the
+reciprocal of the probability that a random address satisfies the pattern.
+
+Base58 is a positional encoding of a 256-bit integer, **not** a string of
+independent symbols, so the *leading* character is not uniform. A 32-byte key
+encodes to 44 digits when its value is at least 58⁴³ and 43 digits otherwise, and
+2²⁵⁶ / 58⁴³ ≈ 17.05, so a 44-digit encoding can only ever lead with one of the
+first 17 symbols, while the ~5.9% of keys short enough for 43 digits can lead
+with anything. Trailing characters *are* uniform.
+
+```
+prefixProbability(prefix): // EXACT, count, do not approximate
+ zeros = number of leading '1's in prefix // a '1' is a leading zero BYTE
+ rest = prefix without those leading '1's
+ if rest == "": return 2^(256 - 8*zeros) / 2^256
+ lo, hi = 2^(8*(31-zeros)), 2^(8*(32-zeros)) // top byte non-zero
+ v = base58 value of rest
+ count = 0
+ for pad = 0, 1, 2, …:
+ [a, b) = [v·58^pad, (v+1)·58^pad) ∩ [lo, hi)
+ if v·58^pad >= hi: break
+ count += max(0, b - a)
+ return count / 2^256
+
+suffixProbability(suffix, ignoreCase):
+ p = 1
+ for ch in suffix: p *= matchesPerChar(ch, ignoreCase) / 58
+ return p
-```
expectedAttempts(prefix, suffix, ignoreCase):
- n = 1
- for ch in prefix ‖ suffix:
- n *= 58 / matchesPerChar(ch, ignoreCase) // 2 iff ignoreCase and both cases are valid Base58, else 1
- return n
+ pp = ignoreCase ? Σ over Base58-valid case spellings of prefixProbability(spelling)
+ : prefixProbability(prefix)
+ return 1 / (pp · suffixProbability(suffix, ignoreCase))
```
-The receipt's `difficulty.expectedAttempts` MUST equal `round(expectedAttempts(…))`.
+`matchesPerChar` is 2 iff `ignoreCase` and both cases are valid Base58, else 1.
+The resulting per-symbol leading probabilities fall into six bands:
+
+| Leading symbol | P(lead) | vs uniform 1/58 |
+|---|---|---|
+| `1` | 1/256 | 0.23× |
+| `2`-`3` | 5.804e-2 | 3.37× easier |
+| `4` | 5.814e-2 | 3.37× easier |
+| `5`-`H` | 5.904e-2 | 3.43× easier |
+| `J` | 1.433e-2 | 0.83× |
+| `K`-`z` | 1.001e-3 | 17.2× harder |
+
+### 4.1 Difficulty model versioning
+
+The receipt's `difficulty.expectedAttempts` MUST equal `round(expectedAttempts(…))`
+under the model named in `difficulty.model`:
+
+| `difficulty.model` | Meaning |
+|---|---|
+| `base58-exact/v2` | The exact distribution above. Required for all new receipts. |
+| `58^effectiveLength` | Superseded: every character treated as uniform 1/58. Wrong for the leading character by up to 17×. |
+
+A verifier MUST check a receipt against the model the receipt itself declares,
+and MUST treat an absent `difficulty.model` as `58^effectiveLength`, every
+receipt issued before the correction carried that model. Re-scoring an old
+receipt under the new model would brand an honestly-issued attestation as
+fraudulent.
## 5. Sealed delivery
@@ -1688,7 +1751,9 @@ recompute — never trust — each of the following. All must pass.
3. **derivation** — re-derive `masterSeed` (§2) and `address_{winningIndex}`
(§3); it MUST equal `receipt.address`.
4. **pattern** — `receipt.address` satisfies `receipt.pattern` (§4).
-5. **difficulty** — `difficulty.expectedAttempts == round(expectedAttempts(…))`.
+5. **difficulty**, `difficulty.expectedAttempts == round(expectedAttempts(…))`
+ under the model named in `difficulty.model` (§4.1), NOT under the verifier's
+ current default.
6. **signature** — Ed25519-verify the canonical message (§6) against the pinned
service key, AND the receipt's `servicePublicKey` equals the pinned key
(reject impostors that self-sign under a different key).
@@ -13792,7 +13857,7 @@ A snipe is not one decision. It is a chain of gates, and a coin must pass every
2. **Entry scoring** (`workers/agent-sniper/scorer.js`, pure function, no I/O). The coin must be SOL-quoted, inside the strategy's market-cap band, pass creator-history checks, and carry socials if the strategy demands them. Every skip is recorded with a reason string, so you can see why a coin was passed over, not just which ones were bought.
3. **Fleet safety band.** Worker-level env clamps (`SNIPER_MIN_MC_FLOOR_USD` / `SNIPER_MAX_MC_CEIL_USD`) tighten every strategy at once. A per-strategy bound can only narrow this band, never widen it. Unknown market cap fails closed: the sniper never buys a coin it cannot price.
4. **Mayhem gate** (`workers/agent-sniper/mayhem-gate.js`). Pump.fun "Mayhem mode" tokens are excluded by owner rule. The flag is not in the firehose, so the worker reads it from the on-chain bonding curve, one cached RPC read per mint.
-5. **Trade firewall** (`api/_lib/trade-firewall.js`). Before broadcasting, the executor runs a real simulated buy-then-sell on-chain. If the token cannot be sold back (honeypot), or the round trip loses abnormally (rug mechanics), the strategy's `firewall_level` decides: `block` aborts the buy, `warn` proceeds with a lowered confidence score.
+5. **Trade firewall** (`api/_lib/trade-firewall.js`). Before broadcasting, the executor runs a real simulated buy-then-sell on-chain. The classification is leg-aware: only a revert on the **sell** leg has the honeypot shape (you can get in but not out) and stays a fatal block. A revert on the **buy** leg (the payer cannot fund the probe, or the curve moved past the quoted slippage) is a warning, not a honeypot verdict, because it says nothing about sellability; on the pump.fun curve the sell path is the curve program itself, and the authority audit separately catches freeze/mint rugs. The strategy's `firewall_level` decides what a verdict does: `block` aborts the buy on a block verdict or a critical unproven-safety warning, `warn` proceeds with a lowered confidence score.
6. **Execution** (`workers/agent-sniper/executor.js`, the only file that signs). The agent's key is decrypted from its at-rest AES-256-GCM secret box, the v0 transaction is signed and broadcast with the strategy's slippage and priority-fee settings, and an idempotency lock guarantees one buy per mint per strategy.
7. **The decision ledger.** Every trade appends an entry to `agent_decisions`: the inputs (trigger, firewall verdict and score, price impact, size), a plain-language rationale, a falsifiable prediction, and a mechanically computed confidence. Entries are hash-chained (`prev_hash` to `entry_hash`), so the reasoning history cannot be silently rewritten.
8. **Position management** (`workers/agent-sniper/positions.js` + `exit-logic.js`). A sweep re-quotes every open position against the bonding curve (or the AMM after graduation), updates the high-water mark, and decides exits in strict priority order: **stop-loss, then signal-flip, then trailing-stop, then take-profit, then timeout**. The laddered variant recovers initial cost at a configured multiple and lets a moon bag ride the trailing stop.
@@ -13862,7 +13927,7 @@ The strategy row (`agent_sniper_strategies`, armed via `POST /api/sniper/strateg
| Field | What it does |
|---|---|
-| `trigger` | `new_mint`, `first_claim`, `intel_confirmed`, `graduation_ride` (buy at migration, sell into pump.fun's 5-minute BOOST buyback window), alpha/radar variants |
+| `trigger` | `new_mint`, `first_claim`, `intel_confirmed`, `graduation_ride` (buy at migration, sell into pump.fun's 5-minute BOOST buyback window), `oracle_crossing` (buy the first time a coin crosses the strategy's Oracle-conviction bar; see below), alpha/radar variants |
| `per_trade_lamports` / `daily_budget_lamports` | Position size and the hard daily spend ceiling |
| `max_concurrent_positions` | Open-position cap |
| `min_market_cap_usd` / `max_market_cap_usd` | Entry band; tightened by the fleet-wide safety band |
@@ -13871,7 +13936,7 @@ The strategy row (`agent_sniper_strategies`, armed via `POST /api/sniper/strateg
| `firewall_level` | `block` (abort on a failed simulation) or `warn` |
| `slippage_bps` / `max_price_impact_pct` | Execution guards |
| `stop_loss_pct` | Hard floor below entry, always evaluated first |
-| `trailing_stop_pct` | Percent off the position's high-water mark |
+| `trailing_stop_pct` | Percent off the position's high-water mark. Arms only once the position has been above breakeven; underwater, the stop-loss alone owns the downside (measured across the fleet's first 90 trades: every below-breakeven trail just realized a loss the stop would have capped) |
| `take_profit_pct` | Profit ceiling. **Set this.** Null means winners are only ever closed by the trailing stop or the clock |
| `max_hold_seconds` | The timeout backstop; closes the position regardless of PnL |
| `initials_out_multiple` / `moonbag_min_pct` | The laddered exit: recover cost at N times entry, let the rest ride |
@@ -13879,13 +13944,19 @@ The strategy row (`agent_sniper_strategies`, armed via `POST /api/sniper/strateg
Exit rules are evaluated in a fixed order (stop-loss, signal-flip, trailing-stop, take-profit, timeout) by a pure, unit-tested function (`workers/agent-sniper/exit-logic.js`), so a backtest and the live worker agree on exactly when a position closes.
+### The `oracle_crossing` trigger
+
+Most triggers judge a coin at launch, when the Oracle has no signal yet. `oracle_crossing` inverts that: a watcher (`workers/agent-sniper/oracle-crossing.js`) polls `oracle_conviction` and buys a coin the **first time** its score crosses the strategy's `min_oracle_score` (default 50), provided the coin is young (`SNIPER_CROSSING_MAX_AGE_MIN`, default 90) and the score is fresh. The empirical case, measured over the fleet's first window (2026-07-20..23): coins that crossed conviction 50 pumped or graduated **77.5%** of the time vs an 11.8% base rate; the crossing lands a **median of 2 minutes after launch**; and the median crossing offered 1.23x from the crossing candle with 35% reaching 1.5x. The same data says the median crossing coin eventually decays to 0.32x of the crossing price, so a crossing strategy should always ship with a reachable take-profit or the initials-out ladder. One attempt per (strategy, mint); candidates route through the same `executeBuy` chokepoint (Mayhem gate, firewall round trip, budgets, market-cap clamps) plus an explicit x402 rugpull veto. Full analysis: [the 90-trade postmortem](/blog/autonomous-trading-experiment).
+
## How the fleet improves itself
The hard-config sniper is the control group: its constants (band edges, stop percentages, hold time) are frozen at arm time, so it cannot react to regime changes. A band that is right at midnight is wrong at noon, and the only fix used to be a human editing numbers. That is no longer the case. The fleet now improves itself through three layers, each running above the same execution stack and each bounded so it can only ever tune what a human owner already tunes.
**Layer 1: LLM-judged entry (`decision_mode = 'llm'`).** An arm can skip the rule shields and instead ask a model (an OpenRouter slug, via the platform's LLM failover chain) to judge each launch, returning `{ buy, confidence, thesis }`. The verdict is persisted and later scored against what the coin actually did (`sniper_evolution_log` / the judgment ledger), so a model's calls are measured independent of trade size. The deterministic rails (firewall, Mayhem exclusion, budgets, concurrency) still apply to LLM arms identically.
-**Layer 2: intra-arm optimizer (`api/cron/sniper-optimize.js` + `api/_lib/sniper-optimizer.js`).** On a cadence it reads each arm's own real trading record over a trailing window, including the exit-reason distribution, and proposes bounded adjustments to that arm's *inward* knobs: take-profit, trailing/stop percentages, hold time, entry-quality thresholds, and per-trade size. Every proposal is clamped to a hard range and to a small per-run step, so one run can never lurch an arm to an extreme. It runs **shadow by default** (`SNIPER_OPTIMIZER_MODE`): it persists what it *would* do to `agent_sniper_optimizer_runs` and mutates nothing, so you can watch it make tuning calls before it ever touches a live arm. In `apply` mode it enacts changes only for arms that opted in (`auto_optimize = true`), and logs each change to the agent's tamper-evident Reasoning Ledger (`kind = 'optimize'`) next to the trades it learned from. This is the layer that would have caught the first trade's missing take-profit automatically.
+**Layer 2: intra-arm optimizer (`api/cron/sniper-optimize.js` + `api/_lib/sniper-optimizer.js`).** On a cadence it reads each arm's own real trading record over a trailing window, including the exit-reason distribution, and proposes bounded adjustments to that arm's *inward* knobs: take-profit, trailing/stop percentages, hold time, entry-quality thresholds, and per-trade size. Every proposal is clamped to a hard range and to a small per-run step, so one run can never lurch an arm to an extreme. Below `MIN_SAMPLE` closed trades the rules stay quiet, with one exception: an arm with **zero wins** over `MIN_SAMPLE_WINLESS` or more real closes and net losses gets the single de-risking move (shrink per-trade size) and nothing else, so a winless arm can never bleed at full size while waiting to accumulate a "real" sample.
+
+Two rules exist specifically to keep the loop honest about *size*, because `avgPnlPct` is an unweighted mean of percentages while real positions differ by up to 50x. **Rule S** fires when an arm's average percent is positive but its net lamports are negative: arithmetically that is only possible when the larger bets are the worse ones, so the arm's edge does not scale and the response is to shrink the position rather than tune an exit percentage. It runs *before* the scale-up rule and claims `per_trade_lamports` first. And the high-win-rate scale-up path now additionally requires `netPnl >= 0`, so an arm can never be handed a bigger position while it is losing real money just because its hit rate looks healthy. Both encode the fleet postmortem's first lesson: win rate and average percent are vanity metrics; expectancy in lamports is the thing being optimized. It runs **shadow by default** (`SNIPER_OPTIMIZER_MODE`): it persists what it *would* do to `agent_sniper_optimizer_runs` and mutates nothing, so you can watch it make tuning calls before it ever touches a live arm. In `apply` mode it enacts changes only for arms that opted in (`auto_optimize = true`), and logs each change to the agent's tamper-evident Reasoning Ledger (`kind = 'optimize'`) next to the trades it learned from. This is the layer that would have caught the first trade's missing take-profit automatically.
**Layer 3: portfolio evolution (`scripts/sniper-evolve.mjs` + `api/cron/sniper-evolve.js`).** Across arms, it scores each arm's fitness against the ground-truth base rate (what fraction of launches actually win, from `pump_coin_outcomes`) using Wilson confidence bounds, then reallocates the fleet's daily budget toward higher-fitness arms, retires an arm proven worse than a coin flip, and revives a retired arm after a cooldown to re-test it. It runs autonomously on a 12-hour cron (dry-run unless `SNIPER_EVOLVE_APPLY=1`) and is also runnable by hand (`node scripts/sniper-evolve.mjs --apply`); both paths share the one `runEvolve()` engine. Every move is journaled to `sniper_evolution_log` with before/after and evidence.
@@ -14574,6 +14645,197 @@ Quick reference for where each piece of the system lives:
<a id="sec-058"></a>
+> **Source:** `docs/agent-tasks/README.md` · [↑ table of contents](#table-of-contents)
+
+# Agent task prompts
+
+Self-contained task briefs for Claude agents, written to be pasted (or referenced by path) into a fresh chat. Each file carries all context needed to start cold: verified diagnostic data with dates, the job, constraints, and an explicit definition of done. One agent per file; run them in separate chats so each stays focused.
+
+| File | Task | Depends on |
+|---|---|---|
+| [fix-x402-502-bursts.md](fix-x402-502-bursts.md) | Root-cause the autonomous loop's Cloud Run 502 bursts and the flapping Redis cache | nothing |
+| [fix-x402-caller-mismatches.md](fix-x402-caller-mismatches.md) | Fix deterministic 405/400/422/402 loop failures and the zero-value Ring Tick service | nothing |
+| [fix-x402-wallet-health.md](fix-x402-wallet-health.md) | Ring wallet SOL floors, unconfigured wallets, USDC float rebalancing | nothing |
+| [new-trading-arm-x402-signals.md](new-trading-arm-x402-signals.md) | NEW trading arm driven by paid x402 signals. On HOLD until owner green-light | 502 + caller fixes landed |
+
+Ground rules baked into every brief: existing autonomous trading arms are untouchable, all payments and trades are real, on-chain spend needs an explicit owner yes, and CLAUDE.md applies in full.
+
+When a task completes, delete its file or mark it done here so a later agent does not re-run it.
+
+---
+
+<a id="sec-059"></a>
+
+> **Source:** `docs/agent-tasks/fix-x402-502-bursts.md` · [↑ table of contents](#table-of-contents)
+
+# Task: Root-cause and fix the x402 autonomous loop 502 bursts
+
+## Context (verified 2026-07-25)
+
+The autonomous x402 buyer loop (user agent `threews-x402-autonomous/1.0`) fails 69% of its calls all-time. The dominant error is `http_502`: 67,770 all-time, 20,030 in the last 48 hours, and it is still happening (last spike 09:00 to 11:00 UTC today at roughly 500 per hour).
+
+Hard data already gathered, do not re-derive it:
+
+- Failure breakdown lives in the `x402_autonomous_log` Neon table (`DATABASE_URL` in `.env`), column `error_msg`. Top offenders last 48h: `http_502` 20,030; `http_405` 3,026; `http_400` 2,798; `sponsor_sol_floor` 2,527; `http_402` 1,911.
+- The 502s hit many different `/api/x402/*` endpoints (crypto-intel, analytics, skill-marketplace, spend-session, did, cross-chain, notify, wallet-connect, feed-health, `/api/x402/d/coin/...`, `/api/mcp`), so it is not one broken handler.
+- The same endpoints return correct 402 challenges when curled manually outside the burst window, so this is load-correlated, not a hard outage.
+- During the 10:00 UTC hour today the loop's own traffic mix on Cloud Run was: 501x 402 (good), 365x 502, 62x 405, 56x 400, 8x 422, 5x 200, 2x 404, 1x 503.
+- Cloud Run 502 log entries carry NO textPayload (no app-level error), latencies range 0.3s to 8.6s. Startup probes succeed; no OOM or exit signatures found in the last 48h. A burst of new instance startups happened at 10:40 UTC while 502s were flowing.
+- Cloud Run config for `three-ws-api` (region `us-central1`, project `aerial-vehicle-466722-p5`): containerConcurrency 160, minScale 2, maxScale 100, cpu-throttling on, startup-cpu-boost on, VPC connector `three-ws-vpc` with private-ranges-only egress.
+- Separate but possibly related: the Redis cache layer is flapping. App logs show repeated `[cache] redis GET/SET failed, using memory fallback: upstash 500 SRH: Unable to connect to the Redis server` and timeout variants. A failing cache makes every request slower and heavier, which can amplify burst saturation.
+
+## Job
+
+1. Find the 502 mechanism. Likely candidates to check, in order: the loop hammering the service through the public LB/CDN in tight bursts and hitting per-instance connection resets; in-process handler crashes that kill in-flight requests without logging; LB backend timeout mismatch (Cloud Run request timeout vs LB timeout); the Node server (`server/index.mjs`) closing keep-alive sockets under load (classic Node keepAliveTimeout < LB idle timeout bug, which produces exactly this signature: intermittent 502s at the LB with no app logs). Check `server/index.mjs` for `keepAliveTimeout` and `headersTimeout` settings; Google Front End reuses connections and needs server keepAliveTimeout above the LB's 600s idle default, or at minimum above 61s. This is the most probable root cause given the evidence.
+2. Fix it properly (no retries-as-bandaid; fix the mechanism, then add sane retry with backoff in the loop caller as defense in depth if it does not already exist).
+3. Fix the Redis/SRH cache failures too: find where the Upstash/SRH endpoint is configured (Cloud Run env), verify whether the SRH proxy is dead or misconfigured, and either restore it or point the cache at a working Redis (Memorystore on the existing VPC connector is pre-approved GCP spend). Memory fallback must remain as the last resort, not the steady state.
+4. Verify: re-run or wait for the next loop cycle and show the 502 count for a full loop window dropping to near zero (`x402_autonomous_log` query by `ts` and Cloud Run request logs). Manual curl checks are not sufficient evidence; the failure only shows under burst load.
+
+## Constraints
+
+- OWNER RULE, overrides everything: do not modify anything that is working today. Free lanes, paid endpoints that settle correctly, the forge, the gallery, all of it is frozen. Only touch provably-broken paths, and prefer additive changes (new module, new config) over edits to shared working code. If a fix seems to require changing a working path, stop and flag it in your report instead of doing it. Server tuning (keep-alive timeouts, cache backend) counts as fixing a broken path only if you first prove the current values are causing the 502s.
+- Do NOT touch the autonomous trading bots (the arms described at three.ws/blog/autonomous-trading-experiment). They are out of scope.
+- Do not reduce loop volume to make the errors go away; the point is that the platform sustains the load.
+- Config-only `gcloud run services update` changes are pre-approved. Use `--update-env-vars`, never `--set-env-vars`.
+- A production deploy of code changes needs owner approval: commit locally, prepare the deploy, and state the one command left to run.
+- CLAUDE.md rules apply, including: never use em-dash or en-dash characters anywhere, changelog entry only if user-visible, stage explicit paths only.
+
+## Done means
+
+502s from the autonomous loop during a full burst window are near zero, the cache layer reports healthy, the root cause is stated in one paragraph in your report, and tests pass (`npm test`, no `tail` pipe).
+
+---
+
+<a id="sec-060"></a>
+
+> **Source:** `docs/agent-tasks/fix-x402-caller-mismatches.md` · [↑ table of contents](#table-of-contents)
+
+# Task: Fix x402 autonomous loop caller/endpoint mismatches (405, 400, 422, 402 failures)
+
+## Context (verified 2026-07-25)
+
+The autonomous x402 buyer loop logs its calls to the `x402_autonomous_log` Neon table (`DATABASE_URL` in `.env`). Beyond the 502s (a separate task, `fix-x402-502-bursts.md`, may already be claimed), a steady share of failures are deterministic client-side mismatches. Last 48 hours:
+
+- `http_405` 3,026, almost all on `https://three.ws/api/x402/dance-tip` (2,768). Curling GET and POST on that endpoint both return 402 today, so the loop is sending some other method, a stale path, or hitting a route that redirects and re-requests with the wrong method.
+- `http_400` 2,798, concentrated on `/api/x402/forge` (721, EXCLUDED from this task: the forge lane is being rebuilt separately, skip it), `/api/x402/agent-reputation` (573), `/api/x402/telegram-health` (506), `/api/x402/llm-proxy` (506). The loop is paying for calls whose request bodies or params the endpoint rejects. Note "Agent Reputation Leaderboard" has succeeded only 19 times out of 4,648 attempts all-time; it is effectively always broken in the loop config.
+- `http_422` 394.
+- `http_402` 1,911 spread over `skill-marketplace`, `club-cover`, `billboard`: these are calls where payment was attached but the endpoint still answered 402, meaning the payment header was malformed, the wrong price/asset was paid, or the requirements changed and the loop caches stale requirements.
+- Also: the "Ring Tick" service has 10,320 calls, zero successes, zero dollars, all-time. Find what it is supposed to do; fix it if it has a purpose, delete it from the loop roster if it does not. Zero-value calls burn loop capacity and pollute the stats.
+
+## Job
+
+1. Locate the loop's service roster and request construction (search for where `x402_autonomous_log` is inserted and where service names like "Dance Tip Volume", "Agent Reputation Leaderboard", "Ring Tick" are defined).
+2. For each failing service, diff what the loop sends (method, path, query, body, payment header) against what the live endpoint handler actually requires. Fix the caller when the caller is wrong, fix the endpoint when the endpoint is wrong (e.g. an endpoint that rejects a valid documented body). Do not loosen endpoint validation just to make the loop pass.
+3. For the `http_402`-with-payment cases, check whether the loop caches payment requirements across price changes, and make it re-fetch the 402 challenge on any 402 response before retrying once.
+4. Verify each fix with a real paid call end to end (the loop's own wallets and self-facilitator settle path; smallest configured price). Show the tx signature and the successful response for at least one call per fixed service, then confirm in `x402_autonomous_log` after the next loop cycle that the error class is gone.
+
+## Constraints
+
+- OWNER RULE, overrides everything: do not modify anything that is working today. A caller with zero or near-zero successes is broken and fair game; an endpoint that answers correctly to a well-formed request is working and frozen. Fix the broken caller side, never "loosen" or rewrite a working endpoint. Prefer additive changes over edits to shared loop code that working services flow through; if you must touch a shared path, prove behavior is unchanged for the working services in your report.
+- Do NOT touch the autonomous trading bots (three.ws/blog/autonomous-trading-experiment). Out of scope.
+- Real payments only; no mocked settlement. Per-call prices are the existing configured micro-prices; do not raise prices in this task.
+- Production deploy of code changes needs owner approval: commit locally, prepare the deploy, state the one remaining command.
+- CLAUDE.md rules apply, including: never use em-dash or en-dash characters anywhere; stage explicit paths only, never `git add -A`.
+
+## Done means
+
+405/400/422 from the loop are near zero over a full cycle, every roster service either succeeds or is removed with a stated reason, Ring Tick is fixed or gone, and `npm test` passes (no `tail` pipe).
+
+---
+
+<a id="sec-061"></a>
+
+> **Source:** `docs/agent-tasks/fix-x402-wallet-health.md` · [↑ table of contents](#table-of-contents)
+
+# Task: Fix x402 ring wallet health (SOL floors, unconfigured wallets, USDC float)
+
+## UPDATE 2026-07-25 (owner funded the ring, read before acting)
+
+The owner deposited 2 SOL into the sponsor wallet and it has been distributed: payer `X4o2Uu…` now holds ~0.15 SOL + ~$54 USDC (0.6 SOL was swapped to USDC via Jupiter, tx `ReVNCLDvGH9hgCs9rpKkKqMpeC7Zw5xTStaPNN1nByMy5RLyg4TYw5ZqT9y5KgZC1EnztxnPzdn3J3MDkC6sgpm`), sponsor ~0.26 SOL, treasury ~0.30 SOL, and each agent wallet ~0.07 SOL. Daily caps were raised on Cloud Run (autonomous $30→$100/day, ring settle $150→$500/day). Do NOT ask the owner for more funding and do NOT re-run a top-up. Your remaining scope: items 1, 2 and 5 below, plus root-causing why the automated rebalancer swept 0.5 SOL of fresh funding straight back to the owner master wallet (`wwwqvAbN4R…`) within seconds of the deposit; that sweep fights any future funding and its threshold or logic likely needs tuning. An automated rebalancer IS active (it moved funds within seconds on 2026-07-25 13:01 UTC); find it before changing anything.
+
+## Context (verified 2026-07-25)
+
+The x402 ring economy recirculates real USDC between three.ws-controlled Solana wallets, settled by our own facilitator (`docs/x402-ring-economy.md` is required reading; self-pay is the operative default, so each payer wallet pays its own ~5,000 lamport fee and its SOL balance is the hard stop that pauses the loop).
+
+Wallet-side failures in `x402_autonomous_log` (Neon, `DATABASE_URL` in `.env`):
+
+- `sponsor_sol_floor` 4,797 all-time and 2,527 in the last 48h, meaning it is active and getting worse: wallets are at or under their SOL fee floor and settlement is refusing to proceed.
+- `insufficient_payer_usdc` 4,143 all-time: some payer wallets have run dry of USDC float while others presumably hold the recirculated balance.
+- `wallet_unconfigured` 2,528 all-time, 471 in the last 48h: part of the loop roster points at wallets that do not exist or have no key configured.
+- `not_settled` 445 in the last 48h.
+- Related caps, working as designed but worth a sanity pass: `cap_would_exceed` 4,017, `ring_daily_cap_reached` 1,377.
+
+## Job
+
+1. Map the ring wallet set: the `x402_ring_wallets` and `x402_ring_ledger` tables, plus wherever keys/addresses are configured (Cloud Run env on `three-ws-api`, Secret Manager). Produce a live balance table: wallet, role, SOL, USDC, floor status.
+2. Fix `wallet_unconfigured`: either configure the missing wallets properly or remove the roster entries that reference them. No dead entries left.
+3. Rebalance: top up SOL on payer wallets below floor and redistribute USDC float so no payer starves. There is likely an existing rebalance mechanism (`api/_lib/economy-rebalance.js` exists; find how it is triggered and why it is not preventing this). Fix the automation so balances self-heal; a one-time manual top-up that decays back into this state within days is a failed fix.
+4. IMPORTANT SPEND GATE: moving SOL or USDC between wallets is an on-chain spend action. Before executing any transfer, print recipient, amount, token, chain and get an explicit yes from the owner in the chat. Design and wire everything first so the approval is one yes away. Automated recirculation inside the already-approved ring settle path does not need per-transaction approval; NEW funding transfers into the ring do.
+5. Sanity-check the caps: report current daily cap values and whether they match the ring economy doc's fee-floor strategy (fewer, larger payments preferred over many micro payments).
+
+## Constraints
+
+- OWNER RULE, overrides everything: do not modify anything that is working today. Balance top-ups and removing dead roster entries are in scope; rewriting settle paths, caps logic, or rebalance code that currently functions is not. If the existing rebalance automation is genuinely broken (prove it), fix it minimally or add a new complementary mechanism rather than replacing it.
+- Do NOT touch the autonomous trading bots or their wallets (three.ws/blog/autonomous-trading-experiment). Ring wallets only.
+- Never print or log private keys. Never move funds without the explicit confirmation described above.
+- Config-only `gcloud run services update` changes are pre-approved; use `--update-env-vars` (merges), never `--set-env-vars`.
+- CLAUDE.md rules apply, including: never use em-dash or en-dash characters anywhere.
+
+## Done means
+
+Zero `wallet_unconfigured` in a full loop cycle, `sponsor_sol_floor` and `insufficient_payer_usdc` at zero after rebalance, the self-healing mechanism verified live (show the log line or ledger row where it acted), balance table in the report, `npm test` passes (no `tail` pipe).
+
+---
+
+<a id="sec-062"></a>
+
+> **Source:** `docs/agent-tasks/new-trading-arm-x402-signals.md` · [↑ table of contents](#table-of-contents)
+
+# Task: Build a NEW autonomous trading arm that consumes paid x402 signals (do not touch existing arms)
+
+## Status: HOLD until the owner green-lights it in your chat. Read fully, then confirm scope with the owner before writing code.
+
+## Context
+
+three.ws runs an autonomous trading experiment: 11 agents, 8 actively trading strategies ("arms"), real Solana wallets, trading pump.fun launches. Public writeup and live results: https://three.ws/blog/autonomous-trading-experiment. Architecture facts from that page you must honor:
+
+- Arms are modular entry logic plugged into an identical execution stack: shared safety rails, on-chain firewall (simulated buy+sell round trip before execution), exit ladder, per-arm position sizing, daily budgets, concurrency constraints.
+- Every decision writes to a hash-chained reasoning ledger. All wallets and receipts are publicly auditable.
+- Performance verdict so far: the LLM cohort won only 24% of trades but was net positive (+0.0147 SOL, average winner +52.3%); rules arms won 30% but net negative. Win rate is a vanity metric; net PnL and average-winner size are what count.
+- A self-improving optimizer tunes parameters every 6 hours within hard bounds.
+
+## The hard rule
+
+Do NOT modify, retune, pause, or rewire ANY existing arm, their wallets, their budgets, or shared execution code paths in a way that changes existing behavior. You are ADDING one new arm. If a shared-stack change is unavoidable, it must be provably behavior-neutral for existing arms (show the diff and the reasoning in your report) and kept minimal.
+
+## The new arm: "paid-intel"
+
+Entry logic that buys its signals through the platform's own x402 rails with real USDC micro-payments before every decision. This is the point: proving paid agent-to-agent data flows produce trading decisions.
+
+1. Signal sources: the existing paid endpoints already served by the platform, at minimum `Pump Launch Monitor: Recent Launches`, `Pump.fun Volume Anomaly Oracle`, and `Crypto Intel: Pump.fun Trending Score Feed` (find their handlers under `api/x402/`). Each cycle: pay, fetch, decide. Log the payment tx signature IN the reasoning ledger entry alongside the decision so every trade is traceable to the paid signals that caused it.
+2. Entry rule (starting point, optimizer may tune within bounds): require agreement of at least two paid signals (e.g. launch appears in recent-launches with quality fields passing, AND anomaly oracle flags positive-side volume anomaly). The blog's lesson is that selective, high-conviction entries with big winners beat high-frequency small winners; bias the arm toward fewer, better entries.
+3. Budget: smallest existing per-arm daily budget in the fleet, halved, for the first 76-hour window. Position sizing at the fleet minimum. This arm must be cheap to be wrong.
+4. Benchmarks it must beat to graduate (measured over its first 76 hours, same grading as the blog): net PnL > +0.0147 SOL equivalent per equal budget (beat the current best cohort), zero firewall violations, zero premature-sell audit failures, and 100% of ledger entries carrying valid x402 tx signatures.
+5. If x402 signal purchase fails (endpoint down, wallet dry), the arm SKIPS the cycle and logs why. It never falls back to fetching the same data unpaid; that would defeat the experiment.
+
+## Spend gate
+
+Funding a new wallet and every real trade are on-chain spend actions. Wire everything, then present the owner: new wallet address, requested SOL/USDC funding amounts, daily budget, and get an explicit yes before the first funding transfer. The arm's autonomous trading after funding follows the fleet's existing approval model.
+
+## Constraints
+
+- OWNER RULE, overrides everything: do not modify anything that is working today. This arm is strictly additive: new files, new wallet, new roster entry. Zero edits to existing arms or to shared execution code unless provably behavior-neutral, and even then minimal.
+- Solana only. Real payments, real trades, no mocks anywhere.
+- CLAUDE.md rules apply, including: never use em-dash or en-dash characters anywhere; changelog entry when the arm goes live; docs update (`docs/agent-sniper.md` or the blog data page, follow existing patterns).
+
+## Done means
+
+Arm implemented and wired into the fleet infrastructure but NOT funded/trading until the owner's explicit yes; dry verification that it produces decisions from real paid signals (payments settled, tx sigs in ledger); report includes the funding request table and the graduation benchmarks above.
+
+---
+
+<a id="sec-063"></a>
+
> **Source:** `docs/agent-wallets.md` · [↑ table of contents](#table-of-contents)
# Agent wallets
@@ -14666,7 +14928,7 @@ An agent can pay a human-readable name instead of a base58 address. `/api/x402/p
---
-<a id="sec-059"></a>
+<a id="sec-064"></a>
> **Source:** `docs/agents-vs-avatars.md` · [↑ table of contents](#table-of-contents)
@@ -14727,7 +14989,7 @@ You don't use an avatar by itself, and you don't use an agent without a body. Pa
---
-<a id="sec-060"></a>
+<a id="sec-065"></a>
> **Source:** `docs/agi.md` · [↑ table of contents](#table-of-contents)
@@ -14817,7 +15079,7 @@ An "awakening" envelope (no eligible trading agent yet) is still valid and fully
---
-<a id="sec-061"></a>
+<a id="sec-066"></a>
> **Source:** `docs/agora.md` · [↑ table of contents](#table-of-contents)
@@ -15163,7 +15425,7 @@ simulation).
---
-<a id="sec-062"></a>
+<a id="sec-067"></a>
> **Source:** `docs/agora/tasks/00-INDEX.md` · [↑ table of contents](#table-of-contents)
@@ -15337,7 +15599,7 @@ Verification · Guardrails.**
---
-<a id="sec-063"></a>
+<a id="sec-068"></a>
> **Source:** `docs/agora/tasks/01-verify-foundation.md` · [↑ table of contents](#table-of-contents)
@@ -15426,7 +15688,7 @@ curl -s "localhost:3000/api/agora/passport?id=00000000-0000-0000-0000-0000000000
---
-<a id="sec-064"></a>
+<a id="sec-069"></a>
> **Source:** `docs/agora/tasks/02-life-engine.md` · [↑ table of contents](#table-of-contents)
@@ -15557,7 +15819,7 @@ Confirm tx signatures on `https://explorer.solana.com/?cluster=devnet`.
---
-<a id="sec-065"></a>
+<a id="sec-070"></a>
> **Source:** `docs/agora/tasks/03-task-supply.md` · [↑ table of contents](#table-of-contents)
@@ -15656,7 +15918,7 @@ curl -s "localhost:3000/api/agenc/get-task?taskPda=<pda>&cluster=devnet&lifecycl
---
-<a id="sec-066"></a>
+<a id="sec-071"></a>
> **Source:** `docs/agora/tasks/04-professions.md` · [↑ table of contents](#table-of-contents)
@@ -15752,7 +16014,7 @@ curl -sL "<deliverableUrl>" -o /tmp/d.glb && sha256sum /tmp/d.glb # == on-chai
---
-<a id="sec-067"></a>
+<a id="sec-072"></a>
> **Source:** `docs/agora/tasks/05-commons-scaffold.md` · [↑ table of contents](#table-of-contents)
@@ -15843,7 +16105,7 @@ Throttle network to see progressive load.
---
-<a id="sec-068"></a>
+<a id="sec-073"></a>
> **Source:** `docs/agora/tasks/06-economy-visuals.md` · [↑ table of contents](#table-of-contents)
@@ -15936,7 +16198,7 @@ flow + rep tick. Leave it open 10 min; confirm stable memory in devtools.
---
-<a id="sec-069"></a>
+<a id="sec-074"></a>
> **Source:** `docs/agora/tasks/07-verify-and-passport.md` · [↑ table of contents](#table-of-contents)
@@ -16034,7 +16296,7 @@ against `/api/agenc/get-agent`. For the handshake, confirm the canonical id equa
---
-<a id="sec-070"></a>
+<a id="sec-075"></a>
> **Source:** `docs/agora/tasks/08-humans-first-class.md` · [↑ table of contents](#table-of-contents)
@@ -16130,7 +16392,7 @@ insufficient balance (honest error). Confirm tx signatures on Explorer.
---
-<a id="sec-071"></a>
+<a id="sec-076"></a>
> **Source:** `docs/agora/tasks/09-arena-and-guilds.md` · [↑ table of contents](#table-of-contents)
@@ -16217,7 +16479,7 @@ watch the race resolve to the real winner. Cross-check the winner + escrow again
---
-<a id="sec-072"></a>
+<a id="sec-077"></a>
> **Source:** `docs/agora/tasks/10-agora-mcp.md` · [↑ table of contents](#table-of-contents)
@@ -16311,7 +16573,7 @@ in `/api/agora/pulse`.
---
-<a id="sec-073"></a>
+<a id="sec-078"></a>
> **Source:** `docs/agora/tasks/11-production-hardening.md` · [↑ table of contents](#table-of-contents)
@@ -16411,7 +16673,7 @@ Then `completionist` on changed files + `/code-review` on the diff.
---
-<a id="sec-074"></a>
+<a id="sec-079"></a>
> **Source:** `docs/alpha-copilot.md` · [↑ table of contents](#table-of-contents)
@@ -16494,7 +16756,7 @@ When `read.hallucination_guard.line_replaced` is true, the co-pilot caught a fig
---
-<a id="sec-075"></a>
+<a id="sec-080"></a>
> **Source:** `docs/animation-studio.md` · [↑ table of contents](#table-of-contents)
@@ -16583,7 +16845,7 @@ curl -X POST 'https://three.ws/api/animations/clips' \
- **Saving and selling need an account.** Export and download are open to everyone; saving to the library and listing for sale require sign-in.
- **The sellable artifact is the baked GLB.** A marketplace listing sells the baked animated GLB, so the buyer gets a self-contained, playable file.
- **Mannequin-only controls.** Build, skin color, and joint constraints apply to the primitive mannequin; on a loaded GLB avatar those controls are disabled.
-- **Fingerspelling spells A to Z.** The Spell box keeps letters and spaces and drops everything else (digits and punctuation have distinct signs that are not letter handshapes). It needs a loaded rigged avatar with finger bones; the mannequin and finger-less rigs are refused with an explanation.
+- **Fingerspelling spells letters and numbers.** The Spell box keeps A to Z, the ASL number handshapes 0 to 9, and spaces, and drops punctuation. It needs a loaded rigged avatar with finger bones; the mannequin and finger-less rigs are refused with an explanation.
## Related
@@ -16595,7 +16857,7 @@ curl -X POST 'https://three.ws/api/animations/clips' \
---
-<a id="sec-076"></a>
+<a id="sec-081"></a>
> **Source:** `docs/animations.md` · [↑ table of contents](#table-of-contents)
@@ -16680,7 +16942,7 @@ Resolved (see `public/animations/registry.json` → `resolved_issues`): the `fid
---
-<a id="sec-077"></a>
+<a id="sec-082"></a>
> **Source:** `docs/api-reference.md` · [↑ table of contents](#table-of-contents)
@@ -17365,8 +17627,8 @@ silently.
{
"data": {
"status": "done",
- "glb_url": "https://cdn.three.ws/forge/anon/<id>.glb",
- "viewer_url": "https://three.ws/viewer?src=https%3A%2F%2Fcdn.three.ws%2Fforge%2Fanon%2F%3Cid%3E.glb",
+ "glb_url": "https://three.ws/cdn/forge/anon/<id>.glb",
+ "viewer_url": "https://three.ws/viewer?src=https%3A%2F%2Fthree.ws%2Fcdn%2Fforge%2Fanon%2F%3Cid%3E.glb",
"creation_id": "<uuid>",
"backend": "nvidia",
"tier": "draft"
@@ -17442,7 +17704,7 @@ content-safety gate before any GPU work starts.
**Response, finished inline**
```json
-{ "status": "done", "glbUrl": "https://cdn.three.ws/forge/anon/<id>.glb", "viewerUrl": "https://three.ws/viewer?src=…", "arUrl": "https://three.ws/api/ar?src=…&title=a%20small%20ceramic%20robot%20figurine", "format": "glb" }
+{ "status": "done", "glbUrl": "https://three.ws/cdn/forge/anon/<id>.glb", "viewerUrl": "https://three.ws/viewer?src=…", "arUrl": "https://three.ws/api/ar?src=…&title=a%20small%20ceramic%20robot%20figurine", "format": "glb" }
```
`arUrl` is the place-in-your-room link (`GET /api/ar`, documented below):
@@ -17498,7 +17760,7 @@ provider answers at all it **fails open** (`verdict.pass: true`,
```json
{
- "glbUrl": "https://cdn.three.ws/forge/anon/<id>.glb",
+ "glbUrl": "https://three.ws/cdn/forge/anon/<id>.glb",
"prompt": "a medieval knight in full plate steel armor",
"subject": "person",
"tier": "standard",
@@ -17650,6 +17912,56 @@ x-forge-client: <stable browser id> # optional — resolves per-card `voted`
narrows Top to the current Forge-Off week (Monday→Monday UTC). Full feature
docs: [docs/forge-off.md](./forge-off.md).
+### Agent-forged gallery feed — `GET /api/forged`
+
+```
+GET /api/forged → recent agent-bought props (status done)
+GET /api/forged?category=crate → filter by prop family (crate|barrel|furniture|terrain)
+GET /api/forged?status=all → include queued/failed rows (audit view)
+GET /api/forged?limit=60 → page size (default 30, max 100)
+```
+
+The public feed behind [/forged](https://three.ws/forged): 3D props the
+platform's autonomous agents bought with real USDC via `POST /api/x402/forge`,
+each carrying its payment provenance. Free, cached ~20s, rate-limited per IP.
+Every row is a real settled generation — no synthetic entries.
+
+**Response**
+
+```json
+{
+ "props": [
+ {
+ "id": 42,
+ "ts": "2026-07-25T18:00:11.000Z",
+ "prompt": "a weathered wooden shipping crate, iron banded corners, game-ready prop",
+ "category": "crate",
+ "tier": "draft",
+ "status": "done",
+ "glb_url": "https://three.ws/cdn/forge/…​.glb",
+ "novelty": 0.83,
+ "cluster_id": 2,
+ "price_usdc": 0.05,
+ "payer": "<agent wallet address>",
+ "payer_short": "wwwwwD…ccrU",
+ "tx_sig": "<solana settlement signature>",
+ "explorer_url": "https://solscan.io/tx/<sig>",
+ "viewer_url": "/app?src=…"
+ }
+ ],
+ "stats": {
+ "total": 128, "done": 117, "queued": 4,
+ "spent_usdc": 6.4,
+ "categories": { "crate": 30, "barrel": 29, "furniture": 30, "terrain": 28 },
+ "latest_ts": "2026-07-25T18:00:11.000Z"
+ }
+}
+```
+
+Written by the hourly autonomous forge-content pipeline
+(`api/_lib/x402/pipelines/forge-content.js`); the paid generation endpoint it
+buys from is documented under `POST /api/x402/forge` in the x402 section.
+
---
## Material Studio API
@@ -17689,7 +18001,7 @@ new lineage version.
**Response**
```json
-{ "ok": true, "url": "https://cdn.three.ws/material-studio/checkpoints/<uuid>.glb", "bytes": 842113 }
+{ "ok": true, "url": "https://three.ws/cdn/material-studio/checkpoints/<uuid>.glb", "bytes": 842113 }
```
### AI restyle
@@ -17716,14 +18028,14 @@ are byte-identical to the source.
```json
{
"ok": true,
- "glbUrl": "https://cdn.three.ws/material-studio/restyle/<uuid>.glb",
- "sourceGlbUrl": "https://cdn.three.ws/creations/<id>/mesh.glb",
+ "glbUrl": "https://three.ws/cdn/material-studio/restyle/<uuid>.glb",
+ "sourceGlbUrl": "https://three.ws/cdn/creations/<id>/mesh.glb",
"instruction": "make it chrome",
"factors": { "name": "Polished chrome", "baseColorFactor": [0.79, 0.81, 0.83], "metallicFactor": 1, "roughnessFactor": 0.05, "emissiveFactor": [0, 0, 0] },
"materialsEdited": 1,
"lineage": [
- { "index": 0, "parentIndex": null, "glbUrl": "https://cdn.three.ws/creations/<id>/mesh.glb", "refKind": "origin" },
- { "index": 1, "parentIndex": 0, "glbUrl": "https://cdn.three.ws/material-studio/restyle/<uuid>.glb", "instruction": "make it chrome", "refKind": "restyle" }
+ { "index": 0, "parentIndex": null, "glbUrl": "https://three.ws/cdn/creations/<id>/mesh.glb", "refKind": "origin" },
+ { "index": 1, "parentIndex": 0, "glbUrl": "https://three.ws/cdn/material-studio/restyle/<uuid>.glb", "instruction": "make it chrome", "refKind": "restyle" }
],
"activeIndex": 1
}
@@ -17753,18 +18065,18 @@ as its own real, validated GLB**, not just a live preview swap.
```json
{
"ok": true,
- "sourceGlbUrl": "https://cdn.three.ws/creations/<id>/mesh.glb",
+ "sourceGlbUrl": "https://three.ws/cdn/creations/<id>/mesh.glb",
"preset": "chrome",
"seed": 42,
"count": 3,
"variants": [
- { "glbUrl": "https://cdn.three.ws/material-studio/variants/<uuid1>.glb", "label": "Chrome 1", "seed": 42, "config": { "color": "#c9ced4", "metalness": 1, "roughness": 0.05 }, "lineageIndex": 1 },
- { "glbUrl": "https://cdn.three.ws/material-studio/variants/<uuid2>.glb", "label": "Chrome 2", "seed": 43, "config": { "color": "#a1c9d4", "metalness": 0.94, "roughness": 0.09 }, "lineageIndex": 2 }
+ { "glbUrl": "https://three.ws/cdn/material-studio/variants/<uuid1>.glb", "label": "Chrome 1", "seed": 42, "config": { "color": "#c9ced4", "metalness": 1, "roughness": 0.05 }, "lineageIndex": 1 },
+ { "glbUrl": "https://three.ws/cdn/material-studio/variants/<uuid2>.glb", "label": "Chrome 2", "seed": 43, "config": { "color": "#a1c9d4", "metalness": 0.94, "roughness": 0.09 }, "lineageIndex": 2 }
],
"lineage": [
- { "index": 0, "parentIndex": null, "glbUrl": "https://cdn.three.ws/creations/<id>/mesh.glb", "refKind": "origin" },
- { "index": 1, "parentIndex": 0, "glbUrl": "https://cdn.three.ws/material-studio/variants/<uuid1>.glb", "instruction": "Chrome 1", "refKind": "variant" },
- { "index": 2, "parentIndex": 0, "glbUrl": "https://cdn.three.ws/material-studio/variants/<uuid2>.glb", "instruction": "Chrome 2", "refKind": "variant" }
+ { "index": 0, "parentIndex": null, "glbUrl": "https://three.ws/cdn/creations/<id>/mesh.glb", "refKind": "origin" },
+ { "index": 1, "parentIndex": 0, "glbUrl": "https://three.ws/cdn/material-studio/variants/<uuid1>.glb", "instruction": "Chrome 1", "refKind": "variant" },
+ { "index": 2, "parentIndex": 0, "glbUrl": "https://three.ws/cdn/material-studio/variants/<uuid2>.glb", "instruction": "Chrome 2", "refKind": "variant" }
],
"activeIndex": 0
}
@@ -17822,7 +18134,7 @@ outage never burns a free generation.
```json
{
- "url": "https://cdn.three.ws/forge/refs/<id>.jpg",
+ "url": "https://three.ws/cdn/forge/refs/<id>.jpg",
"provider": "nvidia-nim",
"model": "black-forest-labs/flux.1-schnell",
"width": 1024,
@@ -20007,6 +20319,21 @@ Each call resolves to one of four billing lanes, in this order:
| **plan** | authenticate with a three.ws API key / OAuth token / session | uses the platform's upstream key, counts against your plan |
| **x402** | send no credentials, no free quota left | pay per call in USDC — the standard HTTP 402 challenge |
+**Upstream failover (automatic, all lanes).** A provider backed by a pool of
+interchangeable hosts declares them in its descriptor (`bases`), and the
+aggregator walks that pool inside a single request when a host answers 429, a
+5xx, or is unreachable (up to 3 hosts per call; caller-fault 4xx never
+retries; up to 6 hosts per call). A host that just failed is skipped for a
+short cooldown window while an alternate exists, so an upstream outage costs
+one discovery, not one per request. The whole chain runs under a 25s deadline
+(pooled attempts abort at 10s each) so the caller always gets the aggregator's
+answer, never a load balancer timeout. The `solana` provider fronts the
+platform's full priority-ordered RPC pool this way and shares the process-wide
+RPC host-health registry in both directions: a host another subsystem found
+quota-dead is skipped here immediately, and failures seen here park the host
+for everyone. Single-host providers behave as plain pass-throughs with one
+attempt.
+
### The free tier
This is what makes "free crypto API" true instead of marketing copy: an agent
@@ -20044,6 +20371,24 @@ through to the standard x402 402 challenge (pay per call), or succeeds
immediately if you send a three.ws API key or a BYOK header instead. No dead
end, no silent downgrade.
+**Calling an endpoint with no arguments at all** returns the 402 challenge
+rather than a `400 missing_param`, on every endpoint, free-marked or not. This
+is the discovery path: x402 directory crawlers and uptime monitors sweep the
+whole catalog parameterless to confirm each endpoint is alive and priced, and a
+400 would report a healthy endpoint as broken. The challenge names the resource
+and its price like any other 402, and an `X-Param-Error` header carries the
+specific argument you would need to make the call for real:
+
+```bash
+curl -si "https://three.ws/api/v1/x/coingecko/price" | head -2
+# HTTP/2 402
+# x-param-error: query param "ids" is required
+```
+
+Send **any** argument and you are treated as a real caller: `?ids=` (present but
+empty) answers `400 missing_param` with the message above, because at that point
+the specific error is the useful reply.
+
**Current free quotas** (also machine-readable via `GET /api/v1/x` below —
every endpoint's `free` field is `{ perMin, perDay }` or `false`):
@@ -20201,7 +20546,7 @@ Omitting `limit` returns the full array exactly as before (no `offset`/`next_off
"loop": true,
"duration": 4.4,
"bytes": 1174283,
- "url": "https://cdn.three.ws/animations/library/clips/mx-hip-hop-dancing.json"
+ "url": "https://three.ws/cdn/animations/library/clips/mx-hip-hop-dancing.json"
}
],
"total": 2400,
@@ -20329,7 +20674,7 @@ const { agents } = await res.json();
---
-<a id="sec-078"></a>
+<a id="sec-083"></a>
> **Source:** `docs/api/forge-x402.md` · [↑ table of contents](#table-of-contents)
@@ -20447,7 +20792,7 @@ for (;;) {
---
-<a id="sec-079"></a>
+<a id="sec-084"></a>
> **Source:** `docs/ar-studio.md` · [↑ table of contents](#table-of-contents)
@@ -20551,7 +20896,7 @@ You can also hand-build a share link: append `?src=<https glb url>&title=<name>`
---
-<a id="sec-080"></a>
+<a id="sec-085"></a>
> **Source:** `docs/ar.md` · [↑ table of contents](#table-of-contents)
@@ -21018,7 +21363,7 @@ How this link ships through ChatGPT end to end (the app connector, the custom GP
---
-<a id="sec-081"></a>
+<a id="sec-086"></a>
> **Source:** `docs/architecture.md` · [↑ table of contents](#table-of-contents)
@@ -21282,7 +21627,7 @@ A minimal Node + Neon + Anthropic deployment is enough for a single agent. The b
---
-<a id="sec-082"></a>
+<a id="sec-087"></a>
> **Source:** `docs/assistant-widget.md` · [↑ table of contents](#table-of-contents)
@@ -21434,7 +21779,7 @@ Ask your agent something like "build a 3D assistant widget named Aria with an oc
---
-<a id="sec-083"></a>
+<a id="sec-088"></a>
> **Source:** `docs/authentication.md` · [↑ table of contents](#table-of-contents)
@@ -21909,7 +22254,7 @@ Password hashing cost is configurable via `PASSWORD_ROUNDS` (default: `11` bcryp
---
-<a id="sec-084"></a>
+<a id="sec-089"></a>
> **Source:** `docs/autonomous-economy.md` · [↑ table of contents](#table-of-contents)
@@ -22066,7 +22411,7 @@ zero.
---
-<a id="sec-085"></a>
+<a id="sec-090"></a>
> **Source:** `docs/autonomous-x402.md` · [↑ table of contents](#table-of-contents)
@@ -22108,6 +22453,17 @@ Each tick:
Payments are real on chain — no mocks, no simulations.
+Two per-tick balance reads act as hard pause switches in front of every paid
+call, because neither cap above can see them: the payer's **USDC float** (an
+empty float skips paid entries instead of signing payments that die at settle
+with "Simulation failed") and the sponsor fee wallet's **SOL settle floor**
+(below `X402_SPONSOR_SOL_FLOOR_LAMPORTS` the self-facilitator fail-closes every
+sponsor-mode settle, so the loop skips paid entries rather than hammering
+hundreds of doomed 502s per hour). Both fire one deduped CRITICAL ops alert
+naming the wallet; free endpoints and `run()`-style monitors keep running while
+paused, and `api/cron/treasury-topup` refuels the wallets when the economy
+master holds funds.
+
## Configuration
| Env var | Default | Purpose |
@@ -22259,7 +22615,8 @@ corroborate — the ops financial-integrity surface alerts on those. Detail:
| Sink | Written by |
|---|---|
| `x402_autonomous_log` | Every call (success or failure), with `signal_data` / `value_extracted`. |
-| `oracle_intel_signals` | `oracle` / `sniper` entries, keyed by source + topic; consumed by the sniper oracle gate. |
+| `oracle_intel_signals` | `oracle` / `sniper` entries, keyed by source + topic; consumed by the sniper oracle gate. Each row carries `tx_signature`, the settle signature of the paid call that bought it, so a gate decision can cite its receipt (surfaced as `signal_receipts` on gate results). |
+| `forge_creations` | Every settled `POST /api/x402/forge` generation (any buyer, not just this loop). The row lands in the public community gallery with `x402_payer` / `x402_tx_sig` / `x402_price_atomic` provenance; the gallery renders a Solscan-linked "x402 · $price" badge. Inline-done lanes materialize immediately; async lanes store the full job token and `api/cron/forge-finalize` completes them server-side. |
| `agent_custody_events` | The USDC spend, with `category: 'x402'` (see [Money feed](money-feed.md)). |
| `x402_volume_metrics` | Per-endpoint proof-of-volume + liveness ledger from the Volume Bootstrap Loop (see [x402 revenue](x402-revenue.md#proof-of-volume--x402_volume_metrics)). |
| `payment_reconciliation` | One verdict per settlement claim from the daily reconciliation job (see [x402 revenue](x402-revenue.md#reconciliation--payment_reconciliation)). |
@@ -22274,7 +22631,7 @@ corroborate — the ops financial-integrity surface alerts on those. Detail:
---
-<a id="sec-086"></a>
+<a id="sec-091"></a>
> **Source:** `docs/autopilot.md` · [↑ table of contents](#table-of-contents)
@@ -22377,7 +22734,7 @@ A confirmed buyback narrates as: "Bought back and burned $120 of $YOURCOIN. Supp
---
-<a id="sec-087"></a>
+<a id="sec-092"></a>
> **Source:** `docs/avatar-creation.md` · [↑ table of contents](#table-of-contents)
@@ -22713,7 +23070,431 @@ No regeneration provider is configured on this deployment. Set `AVATAR_REGEN_PRO
---
-<a id="sec-088"></a>
+<a id="sec-093"></a>
+
+> **Source:** `docs/avatar-fidelity-program.md` · [↑ table of contents](#table-of-contents)
+
+# Avatar fidelity program — owning selfie → avatar end to end
+
+**Goal:** a selfie-to-avatar engine that beats the leading commercial
+selfie-avatar products on identity fidelity, runs entirely on infrastructure we
+own, and costs nothing per avatar. Not "good enough to avoid a bill" — better
+than the thing we would have paid for.
+
+This is the program plan. The subsystem it improves is documented in
+[avatar-reconstruction.md](avatar-reconstruction.md); the worker lives in
+[`workers/avatar-reconstruction/`](../workers/avatar-reconstruction).
+
+## Why we are not buying this
+
+Commercial vendors sell exactly this capability, metered per avatar. Two
+reasons we build instead:
+
+1. **It is the product.** three.ws is an avatar platform. Renting the step that
+ turns a person into an avatar means the core of the product is someone
+ else's, priced by them, rate-limited by them, and deprecable by them.
+2. **The architecture is already ours.** The worker fits a person onto a
+ pre-rigged fixed-topology template — the same approach the major commercial
+ avatar platforms use. The output is born rigged with 52 ARKit blendshapes
+ and 15 visemes. What is missing is fidelity, and fidelity is a compute-and-research
+ problem, which is precisely what ~$100k of Google Cloud credits buys.
+
+Every stage is commercial-clean (Apache-2.0 / MIT / BSD / CC0). Holding that
+line is a hard constraint, not a preference: the highest-quality published face
+models are almost all built on a non-commercial 3DMM (FLAME, BFM, SMPL) or
+carry non-commercial weights. See the licence section in
+[avatar-reconstruction.md](avatar-reconstruction.md#licensing--why-this-stack)
+for the verdicts, including why FaceLift was evaluated and rejected.
+
+## The spine: measure before optimising
+
+Every track below is judged by one number, **Identity Shape Error (ISE)** —
+texture-blind, pose- and scale-invariant, dimensionless. Full definition and
+usage: [`workers/avatar-reconstruction/eval/README.md`](../workers/avatar-reconstruction/eval/README.md).
+
+Without it, "better than the commercial benchmark" is an opinion and a research
+track can burn GPU-months moving a number nobody measured. With it, every
+change is a diff:
+
+```bash
+python -m eval.run_eval --compare eval/reports/v1.json eval/reports/v2.json
+```
+
+Rule for this program: **no fidelity claim without a report, and no report
+without naming the reference set it scored.**
+
+## What actually binds
+
+Not money. Two things:
+
+- **L4 GPU quota = 3 for us-central1**, shared by six warm GPU services. The
+ fleet is permanently at its ceiling. See
+ [ops/gcp-credits-plan.md](ops/gcp-credits-plan.md). An RTX PRO 6000 (Blackwell,
+ 96 GB) is already granted and validated live at 1 instance, but needs a CUDA
+ 12.8 / torch cu128 rebuild — L4 images do not run on it.
+- **Training-data licensing.** The reason to prefer per-subject optimisation
+ over training an identity regressor: a regressor needs a face dataset, and the
+ commercially-usable ones are thin. Optimisation needs only the user's own
+ photo. This is the central design decision of the program.
+
+## Tracks
+
+Tracks 1-3 are independent and can run in parallel. Track 0 gates the claims of
+all of them.
+
+### Track 0 — Measurement `[done]`
+
+The ISE metric, batch runner, revision comparator, parameter tuner and property
+tests, plus a 40-face reference set generated by
+[`eval/make_refs.py`](../workers/avatar-reconstruction/eval/make_refs.py) over a
+deterministic grid of the platform's diversity matrix and mirrored to
+`gs://three-ws-avatar-reconstructions/eval-refs/`.
+
+Faces are synthesised rather than collected: no real person's biometrics in a
+benchmark that gets copied between machines, no licensing terms, and any agent
+can rebuild the identical set.
+
+Because every reference face is a clean frontal portrait, ISE alone cannot see
+what the outlier machinery is for, so the set is paired with
+[`eval/robustness.py`](../workers/avatar-reconstruction/eval/robustness.py):
+each face is degraded on the fly (blur, 12° turn, occlusion, dim, 1/6 resolution)
+and scored on whether the same person still yields the same head. Fidelity and
+stability pull opposite ways, and shipped parameters sit at the knee (Track 1).
+
+The confidently-wrong detection is covered too, by a 16-sample adversarial set
+([`eval/make_adversarial.py`](../workers/avatar-reconstruction/eval/make_adversarial.py))
+spanning non-faces (pet, statue, doll, mask, mannequin), depicted faces (poster,
+phone screen, painting, magazine), crowds, and out-of-envelope shots
+(near-profile, hard backlight, motion blur, macro), audited by
+[`eval/detection_guard.py`](../workers/avatar-reconstruction/eval/detection_guard.py).
+That audit produced three findings, one of which killed the guard I was about to
+build:
+
+**A face-plausibility gate cannot work — do not rebuild one.** The natural design
+is to align landmarks to the canonical face and reject a large residual. MediaPipe
+FaceMesh is a *fitted model*: it does not decide whether something is a face, it
+reports where a face would be. A golden retriever scored 0.4758, a *better*
+canonical fit than all 40 real humans (0.5035-0.5238). Any threshold separating
+them rejects real people first.
+
+**The catastrophic failure mode does not exist in this architecture.** Head
+displacement from the template: real faces 0.2713-0.2839, every detected
+adversarial input 0.2586-0.2929, and **zero** ungated adversarial inputs distort
+more than a real face. A dog photo yields a slightly unusual *human* head, not a
+monstrous one. Four mechanisms compose to guarantee it: canonical alignment
+removes pose and scale, `strength` damps the residual, the per-point clamp bounds
+outliers, and the TPS off-face mask confines deformation to the face. Guarding the
+mesh against wrong detections is therefore unnecessary — which is worth knowing
+before someone spends a sprint on it.
+
+**Yaw was the one thing worth gating.** Real frontals peak at 2.7°; the
+near-profile shot reads 58.6° and was the sole input pushing the head outside the
+real-face band. Past roughly a third of a turn the far side of the face is
+self-occluded, so its depth is extrapolation and the morph fits guesswork as bone
+structure. `face_pipeline.MAX_MORPH_YAW_DEG` (35°) now skips the morph and keeps
+texture transfer above that, clearing every genuine frontal by ~13x. Photos of
+photos sit at 9-18°, already produce in-band heads, and are deliberately not
+blocked.
+
+### Track 1 — Ship the morph that is already written `[done]`
+
+`face_geometry.py` (Phase 2 head-shape morph) had been written, tested and never
+deployed: production `/health` reported `face_texture_transfer_v1` and omitted
+`geometry_morph` entirely, so the running image predated the work. Production was
+texture-only — a person's face painted on a generic skull. It now reports
+`face_texture_transfer_v2` with `geometry_morph: true`.
+
+Deploying it surfaced two things worth more than the deploy:
+
+**A latent correctness bug.** `landmarks_to_array` passed MediaPipe's raw
+normalised landmarks straight into the morph. MediaPipe divides x by image width
+and y by image *height*, so on any non-square photo the point cloud is
+anisotropically stretched; Umeyama fits one uniform scale and cannot undo that,
+so the stretch survived alignment and was consumed as facial identity. The
+camera's aspect ratio was being baked into the avatar's skull — the same person
+at 3:4 and 1:1 got head shapes differing by 3.07% of head size, and 3:4 is
+exactly what the selfie page recommends. Fixed by scaling to an isotropic pixel
+frame; drift is now 0. Pinned by a test that fails on the old path.
+
+**Defaults that had never been measured.** A sweep over the 40-face set
+([`eval/tune_morph.py`](../workers/avatar-reconstruction/eval/tune_morph.py))
+moved `strength` / `max_displacement_frac` off 0.75 / 0.18, whose clamp permitted
+only ~1.9 cm of travel per control point and was throttling genuine facial
+variation rather than rejecting outliers. Every setting in the usable range beat
+it, and **no face was made worse** by the change.
+
+Setting the clamp on fidelity alone is not possible: a benchmark of clean
+portraits contains nothing for a clamp to reject, so it will always recommend no
+clamping at all. That produced the program's second measurement tool,
+[`eval/robustness.py`](../workers/avatar-reconstruction/eval/robustness.py),
+which asks the complementary question — **does a degraded photo of the same
+person still give the same head?** Each face is blurred, turned 12°, occluded,
+dimmed and downsampled to 1/6 resolution, and the score is the divergence from
+the clean-photo head. The person did not change, so all of it is the pipeline
+reacting to photo quality rather than identity.
+
+| clamp | ISE | vs floor | instability |
+|---|---|---|---|
+| 0.18 (was shipped) | 0.2932 | 26.5% | 0.0027 |
+| 0.45 | 0.1684 | 57.8% | 0.0053 |
+| **0.55 (shipped)** | **0.1591** | **60.1%** | **0.0057** |
+| 0.65 (sweep optimum) | 0.1587 | 60.2% | 0.0060 |
+| 1.00 | 0.1587 | 60.2% | 0.0060 |
+
+Fidelity flatlines past 0.65 while instability keeps climbing, so anything looser
+is pure downside; across the usable range each step buys ~40-50x more fidelity
+than it costs in stability. 0.55 is the knee. A first pass shipped 0.45 on
+physical reasoning before the robustness data existed, which turned out to be
+2.3 points of fidelity too conservative — a fair illustration of why the second
+metric was worth building.
+
+**Still unmeasured:** all 75 degraded images yielded a face detection, so the
+catastrophic regime the clamp ultimately guards is untested. A detection
+*failure* is safe (the job degrades to texture-only); a confident *wrong*
+detection is not, and nothing bounds that yet. That is the remaining Track 0
+work.
+
+Cost: negligible. As predicted, the largest fidelity gain per unit of effort in
+the program, because the work was already paid for.
+
+### Track 2 — Full-head photoreal texture (Vertex AI Imagen)
+
+A selfie shows one side of a face under one lighting condition. Cheeks in
+shadow, ears, the scalp, under the jaw — none of it is in the photo, and today
+those regions fall back to a tinted template texture. That mismatch is what
+reads as "avatar" rather than "person" the moment the head turns.
+
+**Measure the opportunity first, it is bigger than it looks.** Of the head
+mesh's texels, only **10.4% is the face oval** the selfie actually covers (9.4%
+of its actual surface area). The other **~90%**, ears, scalp, neck, under-jaw,
+is template texture the camera never saw, personalised solely by a global
+skin-tone tint. That is the real prize here, and it also bounds what the
+mechanisms below can achieve.
+
+> An earlier revision of this doc quoted 19.2% / 80.8%. That was measured
+> against the wrong denominator (it counted atlas texels the head mesh does not
+> use). Re-measured against head-only texels on the shipped template it is
+> 10.4%, so the gap was *larger* than first reported, not smaller. The number is
+> now produced by `eval/measure_projection_coverage.py` rather than by hand.
+
+**A landmark-driven warp cannot reach most of it.** MediaPipe's 468 landmarks are
+face-only: there are no ear, scalp or neck points, and `_warp_face_to_uv` masks
+to the face-oval polygon accordingly. So warping extra synthesised views through
+the existing path improves *lateral cheek and jaw* fidelity (where a frontal is
+foreshortened) but cannot texture the other ~90%, because no correspondence
+exists there. Anyone picking this up should not expect the view-warp route to
+fill the scalp.
+
+**The mechanism that does reach it is projective texturing off the mesh we
+already have. SHIPPED.** [`face_projection.py`](../workers/avatar-reconstruction/face_projection.py)
+solves the camera by PnP against the head's landmark vertices, rasterises the
+head in UV space so every texel knows its 3D position and normal, then projects
+each texel into the photo and samples it. No landmarks are needed for the
+surface itself, so ears, jawline and neck fall out naturally.
+
+Four gates keep it honest, because projection will otherwise paint the back of a
+head with whatever pixel lies behind it: the texel must land inside the photo,
+face the camera, survive a depth-buffer occlusion test, and sample a foreground
+pixel. Anything failing a gate keeps its existing colour. The result blends
+*under* the face-oval composite, which stays authoritative where the landmark
+warp already applies, and is capped at `MAX_BLEND` so a slightly-wrong pose
+degrades to a tint rather than to a visibly wrong image.
+
+**Measured on the shipped Wolf3D head** (`eval/measure_projection_coverage.py`),
+photographic coverage of the head goes from **10.4% to 37.5%, a 3.6x increase**,
+and holds up as the subject turns (37.4% at 15 degrees, 38.0% at 30):
+
+| Camera | Projection reaches | New beyond the oval | Total photographic |
+|---|---|---|---|
+| Frontal | 36.1% | 27.1% | **37.5%** |
+| 15 deg turn | 37.4% | 28.5% | 38.8% |
+| 30 deg turn | 38.0% | 29.1% | 39.5% |
+
+One tuning decision is worth recording because it nearly went the wrong way: a
+facing falloff of cos^3 with a 0.15 floor stops painting at 58 degrees from the
+camera, which **rejects the ears outright**. Ears sit at 70-90 degrees from a
+frontal camera and are a large share of the surface this exists to reach, so
+that setting would have left the headline gap unclosed while appearing to
+address it. The shipped curve is cos^1.5 with a 0.06 floor, which admits them as
+a light wash. Coverage of no-landmark surface measured 0% before the change and
+91% after.
+
+The camera-pose machinery is shared with Track 3.
+
+Already fixed on the way in: the skin tint was being applied to the *whole*
+texture, including the face oval that had just been composited from the user's
+photograph — shifting the only region with true photographic colour toward an
+average of itself by ~1.4% of range. It is now masked to the regions the photo
+could not cover, which is what its own comment always said it was for
+(`test_face_pipeline.py` pins the mask behaviour, including that the tint still
+reaches every unprotected pixel — a mask that over-protected would leave a
+template-coloured neck against a photographic face, a worse artefact than the
+one being fixed).
+
+Two candidate mechanisms for the remainder, and the measurement in Track 3
+decides between them.
+
+**Do not inpaint the UV atlas directly.** A UV layout is not a photograph; a
+generative image model conditioned on one will produce photographically plausible
+but UV-incoherent content, and the seams land exactly where the head turns.
+
+**Do synthesise additional camera views and warp them through the existing path.**
+Each view goes through the same landmark-driven TPS warp as the frontal
+(`_warp_face_to_uv`), so coverage of cheeks, ears and jawline is UV-coherent by
+construction rather than by hoping the model understood the atlas.
+
+Crucially, the finding that kills multi-view for *geometry* (Track 3) does not
+kill it for *texture*. Rotated synthesised views measure as a different person
+geometrically, but the same-pose control shows appearance is reproduced faithfully
+(0.0069 divergence), and texture needs plausible skin, not millimetre-accurate
+landmarks. A 3/4 view that is 0.03 off in face shape still carries the correct
+complexion, beard, hairline and ear into the regions a frontal cannot see. The
+severity of the error differs by an order of magnitude between the two uses.
+
+ISE will not move — it is a geometry metric, texture-blind by design. This track
+must bring its own: masked SSIM / LPIPS against held-out views, plus a
+seam-continuity check across the UV boundary. Gate the synthesised view on the
+same-pose identity check before compositing, so a bad generation is rejected
+rather than painted on.
+
+### Track 3 — Dense identity geometry by per-subject optimisation
+
+The Phase-2 morph is driven by 468 sparse landmarks diffused across 2162 head
+vertices. It captures gross proportion — face width, jaw, nose projection, brow
+— and cannot capture fine structure, because the signal is not there.
+
+The unencumbered path to dense identity is **analysis-by-synthesis**: render the
+current head, compare to the photo, backpropagate to vertex positions, repeat.
+
+- **Differentiable rasteriser: PyTorch3D (BSD-3-Clause).** Commercially clean.
+ Deliberately *not* nvdiffrast, whose NVIDIA Source Code License is
+ non-commercial.
+- **Regularisation** with a Laplacian smoothness term and a displacement bound,
+ so the head stays on a plausible face manifold and every ARKit blendshape
+ survives. Vertex count and order never change, so `glb_ops.set_head_geometry`
+ writes the result back without touching skinning or morph targets — the
+ property `test_face_geometry.py` already pins.
+- **Multi-view from one photo — MEASURED AND REJECTED for geometry.** The plan
+ was to synthesise 3/4 and profile views with a Vertex image model and fit
+ against all of them at once. It does not survive contact with the identity
+ metric. Asking `gemini-2.5-flash-image` for the same person turned 30°:
+
+ | comparison | identity-shape divergence |
+ |---|---|
+ | same-pose regeneration (control) | **0.0069** |
+ | synthesised 3/4 view (19.7° yaw) | 0.0396 |
+ | a *different real person* | 0.0358 (range 0.0268-0.0489) |
+
+ The control matters: at unchanged pose the model reproduces the person ~5x more
+ faithfully than a stranger, so identity preservation is genuinely good. But once
+ the head is rotated, the recoverable face geometry is **statistically
+ indistinguishable from a different person**. Whether the cause is the model
+ drifting under pose change or MediaPipe's depth being pose-dependent (likely
+ both), the signal is too degraded to fit a skull to. Feeding it to a
+ differentiable fit would optimise confidently toward someone who does not exist.
+
+ Do not revive this leg on synthesised views. It needs genuine multi-pose capture
+ — several real frames of the actual user, which the `/scan` flow already
+ collects — and the metric above is the acceptance test any such source must pass
+ before it drives geometry.
+
+No third-party weights, no face dataset, no licence question: it optimises
+against the user's own photo. It is GPU-hungry per avatar, which is exactly the
+resource we have.
+
+Alternative shortcut, **requires owner approval because it is external spend**:
+a commercial FLAME licence from MPI unlocks MICA for dense identity in one
+forward pass. Cheaper in engineering time, adds a licensing dependency, and
+`register_head_to_target` is already model-agnostic so it drops straight in if
+the owner wants it. Recommendation: build the optimisation path first, since it
+is unencumbered and permanent.
+
+### Track 4 — Capacity
+
+Fidelity work is throughput-bound before it is idea-bound: Track 3 is minutes of
+GPU per avatar against a fleet already at its ceiling.
+
+- Chase the L4 quota preference (`l4-no-zonal-us-central1-8`, preferred 16). On
+ a grant ≥ 8, the fleet-wide scale-up commands are pre-approved and listed in
+ [ops/gcp-credits-plan.md](ops/gcp-credits-plan.md).
+- Port the reconstruction worker to the granted RTX PRO 6000 (CUDA 12.8 / torch
+ cu128; platform minimum 20 CPU / 80 Gi). `workers/model-hunyuan3d/Dockerfile.hunyuan21rtx`
+ is the first mover to copy. 96 GB of VRAM makes the Track 3 optimisation loop
+ practical at interactive latency.
+- Vertex AI custom jobs for any batch experiment, so research load never competes
+ with the serving fleet for the same three L4s.
+
+### Track 5 — Fully-owned body (v3)
+
+The reconstruction template is a third-party Wolf3D base — the last such asset in
+the pipeline. **The replacement already exists in this repo** and the roadmap
+entry above is out of date: [`public/avatars/parametric-base.glb`](../public/avatars)
+is a CC0 MakeHuman/MPFB2 body (vendored via [naver/anny](https://github.com/naver/anny)
+in [`avatar-sources/anny/`](../avatar-sources/anny)) carrying **122 baked morph
+sliders** — nose, ears, mouth, eyes, jaw, cheeks, head shape, neck, plus gender,
+muscle, weight, age, height, torso, hips, limbs — on a 52-bone `mixamorig:*`
+skeleton, built by [`scripts/build-parametric-base.mjs`](../scripts/build-parametric-base.mjs)
+and already live in Avatar Studio's base switcher.
+
+That turns this track from "build a body" into "retarget reconstruction onto the
+body we ship", and it changes the shape of the whole program: the 122 sliders are
+a **parametric identity basis**. Fitting a person becomes solving for slider
+values, which is a far better-conditioned problem than free-form vertex
+optimisation — bounded, always on the face manifold, and interpretable. Track 3's
+differentiable fit should target this basis first and fall back to free-form
+vertex displacement only for residual detail.
+
+Work: rebuild `face_uv_map.json` against the parametric base (`precompute_uv.py`
+is already parameterised by template), transfer the ARKit-52 expression set with
+ICT-FaceKit (MIT) since the Anny base does not ship visemes, and re-baseline
+every ISE report — scores are only comparable within one template.
+
+**This track also owns the `body_type` dead path.** `POST /reconstruct` accepts
+`male | female | neutral` and the selfie page offers the choice, but
+[`face_pipeline._load_template`](../workers/avatar-reconstruction/face_pipeline.py)
+looks for `templates/male.glb` and `female.glb`, neither of which exists, so every
+request silently falls back to `default.glb`. The parameter has never done
+anything.
+
+Staging the existing stock bases as those two files is the obvious patch and is the
+wrong move. `public/avatars/realistic-male.glb` is topology-compatible (same 2162-
+vertex `Wolf3D_Head`) but carries only 60 morph targets against `default.glb`'s
+67, so it would silently drop seven expressions. `realistic-female.glb` is a
+different head entirely (1531 vertices, mesh names stripped), so it needs its own
+precomputed map and a `_find_head_prim` that does not key on a mesh name — and it
+would still leave two more templates to maintain in lockstep.
+
+The parametric base dissolves the problem: body type stops being a discrete
+template swap and becomes slider values (gender, muscle, weight, height, hips) on
+one mesh with one skeleton, one UV map and one blendshape set. Fix it here, not
+by adding template files.
+
+## Where the credits go
+
+| Line | Rough monthly | Notes |
+|---|---|---|
+| Warm GPU serving (current 6-service fleet) | $4-6k | Already running |
+| RTX PRO 6000 warm instance | ~$2-3k | Track 3 serving + Track 4 headroom |
+| Vertex AI custom training/experiment jobs | $2-5k while active | Track 3 sweeps, Track 2 evaluation |
+| Vertex Imagen inference | usage-based, small | Track 2 |
+
+Steady state stays in the range [ops/gcp-credits-plan.md](ops/gcp-credits-plan.md)
+already sets out: comfortably over a year of runway on the grant. The standing
+directive is to spend on quality and never downgrade to conserve credits.
+
+## Owner decisions
+
+Everything above proceeds without asking, per the standing GCP approvals. Two
+items do not:
+
+1. **Commercial FLAME/MICA licence from MPI** — external paid dependency
+ (Track 3 alternative). Not needed if the optimisation path lands.
+2. **Production deploys of the main API/frontend.** GPU worker deploys and
+ config-only `gcloud run services update` changes are pre-approved.
+
+---
+
+<a id="sec-094"></a>
> **Source:** `docs/avatar-inspector.md` · [↑ table of contents](#table-of-contents)
@@ -22797,7 +23578,7 @@ Related reading: [agent reputation](agent-reputation.md) · [Agora](agora.md).
---
-<a id="sec-089"></a>
+<a id="sec-095"></a>
> **Source:** `docs/avatar-pipeline.md` · [↑ table of contents](#table-of-contents)
@@ -22901,7 +23682,7 @@ pose operations.
---
-<a id="sec-090"></a>
+<a id="sec-096"></a>
> **Source:** `docs/avatar-reconstruction.md` · [↑ table of contents](#table-of-contents)
@@ -22918,6 +23699,35 @@ blendshapes instead of a bare mesh that still needs auto-rigging.
- **Worker:** [`workers/avatar-reconstruction/`](../workers/avatar-reconstruction) — FastAPI on a Cloud Run L4 GPU.
- **Backend provider:** [`api/_providers/gcp.js`](../api/_providers/gcp.js), selected by `AVATAR_REGEN_PROVIDER=gcp` (see [`api/_lib/regen-provider.js`](../api/_lib/regen-provider.js)).
- **User entry points:** the selfie/upload flow and text→avatar prompt flow in [`api/avatars/_actions.js`](../api/avatars/_actions.js) (`POST /api/avatars/reconstruct`).
+- **Completion:** normally driven by the browser polling `/api/avatars/regenerate-status`, which runs the finalize stages inline. [`api/cron/reconstruct-sweep.js`](../api/cron/reconstruct-sweep.js) is the server-side backstop for when it isn't — see below.
+
+## Who finishes the job
+
+A reconstruct job is advanced by whoever polls it. The `/create/selfie` page
+polls every few seconds, and each poll pulls provider status and runs the shared
+finalize stages in [`reconstruct-finalize.js`](../api/_lib/reconstruct-finalize.js).
+
+That made the browser tab load-bearing. Close it mid-build and the worker still
+finished the GLB and stored it durably in GCS, but nothing ever collected it: the
+job row stayed `queued`/`running` forever and the avatar never reached the user's
+library. Production had 26 jobs stranded that way, the oldest from 2026-05-31,
+invisible to `db-retention` (which only prunes terminal rows).
+
+`reconstruct-sweep` closes that hole. Every 5 minutes it picks up reconstruct
+jobs quiet for over 3 minutes and runs **the same finalize stages** the browser
+poll would have, so an abandoned job still lands in the library. Design notes:
+
+- **30-day rescue window**, far longer than the auto-rig sweep's 6 hours. The
+ worker's GLBs (GCS) and job state (Firestore) are both durable, so a weeks-old
+ abandoned job is still genuinely deliverable to a real user.
+- Past that window, and for jobs whose provider is no longer pollable with
+ platform credentials, rows are failed out with an honest reason — the open set
+ must not grow without bound.
+- **BYOK jobs (meshy/tripo) stay browser-driven.** They authenticate with the
+ user's own key, which the status poll resolves from request context; a cron has
+ no user context to decrypt it. They age out via the same window.
+- A provider 404 (`gcp_task_missing`) is terminal here, so a job whose worker
+ record is genuinely gone resolves instead of being retried forever.
## How it works
@@ -22947,10 +23757,19 @@ closes that gap:
3. That displacement is carried onto the head's corresponding vertices (a
nearest-vertex map precomputed by `precompute_uv.py`), scaled into head units,
and clamped to reject landmark/pose outliers.
-4. A **normalised-Gaussian RBF** (partition of unity — local, bounded, no
- extrapolation) diffuses the sparse displacements across all 2162 head vertices,
- with a locality mask that fades the morph to zero off the face so the scalp,
- ears and neck stay put.
+4. A **thin-plate spline** interpolates the sparse displacements across all 2162
+ head vertices. TPS passes exactly through its control points, so localised
+ identity (a wider jaw, a longer nose) survives instead of being averaged away
+ — the failure mode of normalised-Gaussian/Shepard weighting. TPS extrapolates
+ freely, so a Gaussian locality mask fades the field to zero off the face and
+ the scalp, ears and neck stay put.
+
+`strength` and `max_displacement_frac` default to **0.6 / 0.45**, chosen by an
+ISE sweep over the 40-face reference set (`python -m eval.tune_morph`), not by
+eye. They cut mean ISE 43% against the original 0.75 / 0.18, whose ~1.9 cm
+displacement ceiling was throttling genuine facial variation rather than
+rejecting outliers. See [avatar-fidelity-program.md](avatar-fidelity-program.md)
+for why the sweep's own looser optimum was deliberately not shipped.
Because vertex count and order never change, `glb_ops.set_head_geometry` writes
the morphed positions (and recomputed normals) back **without disturbing the
@@ -22961,6 +23780,48 @@ ARKit expression survive intact. This is verified end-to-end in
Toggle Phase 2 with the `GEOMETRY_MORPH` env var (default `1`). It degrades
cleanly to texture-only if anything fails; the shape refinement never fails a job.
+### Phase 3: projective texturing (the rest of the head)
+
+Phases 1 and 2 both stop at the face. The face-oval polygon Phase 1 composites
+into is only **10.4% of the head's texels** (9.4% of its surface area), because
+MediaPipe's 468 landmarks are face-only: there are no ear, scalp or neck points,
+so outside the oval there is no correspondence to warp with. Everything else was
+template texture personalised by a single global skin tint.
+
+[`face_projection.py`](../workers/avatar-reconstruction/face_projection.py) takes
+the other route. Phase 2 leaves us the head's real 3D shape, which turns the
+problem from *find matching points* into *find where each surface point lands in
+the photo*:
+
+1. **Solve the camera** with PnP (RANSAC, then refined on inliers) against the
+ head's landmark vertices. This is the only use of landmarks, and they locate
+ the camera rather than establishing surface correspondence. Focal length is
+ assumed equal to the image width, the usual stand-in for a phone camera.
+2. **Rasterize the head in UV space** so every texel carries its 3D position and
+ normal.
+3. **Project and sample.** Each texel's 3D position goes through the camera into
+ the photo. Ears, jawline and neck fall out for free.
+
+Four gates decide whether a texel may be painted at all, because projection will
+otherwise paint the back of a head with whatever pixel lies behind it. The texel
+must land inside the photo, face the camera (confidence falls off as
+cos^1.5 of the view angle), survive a depth-buffer occlusion test that catches
+the nose shadowing the cheek, and sample a foreground pixel per the rembg alpha.
+A texel failing any gate keeps its existing colour rather than inventing one. The
+result blends *under* the Phase 1 composite, which stays authoritative where the
+landmark warp applies, and is capped at `MAX_BLEND = 0.85` so a slightly-wrong
+pose degrades to a tint rather than a visibly wrong image.
+
+Measured on the shipped template by
+[`eval/measure_projection_coverage.py`](../workers/avatar-reconstruction/eval/measure_projection_coverage.py),
+photographic coverage of the head rises from **10.4% to 37.5%, a 3.6x increase**,
+holding up as the subject turns (38.8% at 15 degrees, 39.5% at 30).
+
+Toggle with `PROJECTIVE_TEXTURE` (default `1`). Like the morph, it degrades
+cleanly: a pose that will not solve logs and leaves the warp-only skin in place.
+It runs *after* the geometry morph, since projecting onto the template and then
+morphing would slide the texture off the features it was sampled from.
+
> **Fixed in this change:** `precompute_uv.py` and `glb_ops` previously read the
> interleaved head buffer stride-unaware, so `face_uv_map.json` was built on
> corrupted vertex data. The reader is now stride-aware, which also repairs the
@@ -22978,6 +23839,11 @@ is unencumbered.
## Roadmap — beating Avaturn on fidelity
+> The active plan built on this roadmap — tracks, owners, capacity and credit
+> allocation — is [avatar-fidelity-program.md](avatar-fidelity-program.md).
+> Fidelity claims are scored with the ISE metric in
+> [`workers/avatar-reconstruction/eval/`](../workers/avatar-reconstruction/eval/README.md).
+
Phase 2 captures gross face identity (proportions, projection) but not fine
geometry. The path to and past Avaturn quality, with the verified licence for
each link:
@@ -22987,7 +23853,8 @@ each link:
| **v1 (shipped)** | Real face-shape morph (sparse) | MediaPipe Face Mesh | Apache-2.0 — clean |
| **v2 (recommended)** | Dense identity geometry, fused via `register_head_to_target` | **MICA + FLAME**, commercial licence from MPI | Paid MPI commercial licence — clean once signed. FLAME's fixed topology + expression basis map straight to ARKit |
| **v2 (fallback)** | Dense identity, no licence fee | HRN re-based on **FLAME-2023-Open** (CC-BY-4.0) | Clean, but weeks of GPU R&D to retrain the identity regressor |
-| **v2 (texture)** | Full-head photoreal texture (fills cheeks/ears/scalp the selfie can't see) | **Imagen** inpaint on Vertex AI | GCP — pre-approved |
+| **v2 (texture)** SHIPPED | Projective texturing off the morphed mesh: fills ears, jawline and neck from the *same* photo (10.4% to 37.5% of the head) | none, geometry we already have | Clean; no new model or licence |
+| **v3 (texture)** | Inpaint what no camera saw (scalp, far cheek) | **Imagen** inpaint on Vertex AI | GCP, pre-approved |
| **v3** | Drop the RPM-template dependency for a fully-owned body | **Anny** (parametric body) + **ICT-FaceKit** (ARKit-52) + deformation transfer | Anny Apache-2.0 + CC0; ICT-FaceKit + DT MIT — clean |
**Rejected: FaceLift (ICCV'25)** — initially floated as the clean v2 model, but
@@ -23022,7 +23889,7 @@ Full runbook: [`docs/ops/gcp-production.md`](ops/gcp-production.md).
---
-<a id="sec-091"></a>
+<a id="sec-097"></a>
> **Source:** `docs/avatar-studio.md` · [↑ table of contents](#table-of-contents)
@@ -23103,7 +23970,7 @@ curl 'https://three.ws/api/avatars/<avatarId>' -H 'cookie: <session>'
---
-<a id="sec-092"></a>
+<a id="sec-098"></a>
> **Source:** `docs/avatar-thumbnails.md` · [↑ table of contents](#table-of-contents)
@@ -23335,7 +24202,148 @@ that adoption HEAD-checks the preview object before persisting it.
---
-<a id="sec-093"></a>
+<a id="sec-099"></a>
+
+> **Source:** `docs/avatar-wardrobe.md` · [↑ table of contents](#table-of-contents)
+
+# Additive Wardrobe — dress any avatar from the garment catalog
+
+The wardrobe has two halves. The **subtractive** half has existed for a while:
+recolour or hide the garment layers an avatar's GLB already contains
+(`src/avatar-wardrobe.js`). This document covers the **additive** half: putting
+a garment ON an avatar that was never generated with it — a catalog shirt onto
+a Forge-generated character, a hairstyle onto a selfie reconstruction.
+
+Open any avatar in the editor (`/avatar-edit?id=…`), Wardrobe tab. The layer
+cards for the model's built-in garments render first; the **Closet** renders
+beneath them with one rack per slot (tops, bottoms, footwear, outerwear, hair,
+headwear, glasses, accessories). Click a piece to wear it, click again or "Take
+off" to remove it. Saving the avatar persists what it wears, and the baked GLB
+served to embeds, AR, and external engines includes the garments.
+
+## Why this is not the usual wardrobe
+
+Commercial avatar platforms author every garment against one skeleton they
+control, so "attach" is trivial — and their wardrobe only fits avatars from
+their own generator. Ours binds at runtime instead: a garment authored on its
+own skeleton, with its own bone naming and its own rest pose, is rebound onto
+whatever humanoid is loaded. That works because the platform already
+normalises arbitrary rigs to a canonical bone set
+([`src/glb-canonicalize.js`](../src/glb-canonicalize.js)) — the same machinery
+that lets any humanoid drive the animation clip library.
+
+Concretely, `attachGarment()`:
+
+1. rewrites the garment's skin indices from garment-bone-order into
+ avatar-bone-order by canonical name, with helper/twist joints the avatar
+ lacks falling back to their nearest mapped ancestor;
+2. re-indexes the garment's inverse bind matrices, keeping the **garment's**
+ values where the two skeletons correspond — which is what makes a T-pose
+ garment land correctly on an A-pose avatar;
+3. refuses any garment that binds under 60% of its skin **weight**
+ (`MIN_BIND_COVERAGE`) rather than attaching a mesh that would deform into
+ garbage;
+4. masks the body in the regions the garment declares it covers
+ (`occludes`), so skin never pokes through cloth. Declarations are clamped
+ at apply time to the slot's plausible region set (`SLOT_OCCLUDABLE` in
+ [`src/garment-taxonomy.js`](../src/garment-taxonomy.js)): a shirt cannot
+ hide the legs, and headwear/hair can hide nothing at all, because the
+ `scalp` region resolves to the Head bone and culling it would take the
+ avatar's face with it. The same clamp runs in the server-side baker, so a
+ legacy or third-party manifest can never produce a defaced avatar.
+
+A garment with no skin at all (hat, glasses) is parented to a single joint
+(`rig.attachBone`) instead of deformed.
+
+## The pieces
+
+| Piece | Where | Job |
+|---|---|---|
+| Attachment engine | [`src/avatar-garment.js`](../src/avatar-garment.js) | Skin rebind, occlusion, slot occupancy — the runtime core |
+| Shared taxonomy | [`src/garment-taxonomy.js`](../src/garment-taxonomy.js) | Slots, body regions, region→bone map, coverage gate |
+| Catalog loader | [`src/garment-catalog.js`](../src/garment-catalog.js) | Fetch + validate manifests; drops anything malformed or unlicensed |
+| Closet UI + controller | [`src/garment-closet.js`](../src/garment-closet.js) | Racks/tiles in the editor, attach/detach queue, appearance sync |
+| Editor wiring | [`src/avatar-edit.js`](../src/avatar-edit.js) | Hydrate on load, persist `appearance.garments`, reset/save |
+| Region mask (pixel-exact occlusion) | Baker [`scripts/build-body-region-mask.mjs`](../scripts/build-body-region-mask.mjs) → `public/avatars/parametric-base.regions.png`, sampler [`src/garment-region-mask.js`](../src/garment-region-mask.js) | On the parametric base, worn garments cut the skin via a baked UV mask (alphaMap) instead of triangle culling; any other body falls back to bone-cull |
+| Server schema | [`api/_lib/validate.js`](../api/_lib/validate.js) | `appearance.garments` — one garment per slot, catalog-shaped refs |
+| Bake pass | [`api/_lib/bake-garments.js`](../api/_lib/bake-garments.js) | Same rebind on the @gltf-transform document, so exports are dressed |
+| Manifest contract | [`specs/GARMENT_MANIFEST.md`](../specs/GARMENT_MANIFEST.md) | What a wearable must declare to enter the catalog |
+
+## The catalog
+
+One public JSON array of Garment Manifest v1 documents:
+
+```
+https://storage.googleapis.com/three-ws-garments/garments/catalog.json
+```
+
+Assets live under `garments/<slot>/<id>/v<version>/` in the same bucket, one
+immutable directory per version. Every manifest pins its GLB's `sha256`; both
+the client and the baker verify the bytes before attaching, so a swapped or
+truncated download is refused, never worn.
+
+Validation is strict and central (`validateManifest`): unknown spec, unknown
+slot, unknown body region, malformed hash, or a licence outside the approved
+commercial set (CC0, CC-BY, MIT, Apache-2.0, BSD) drops the entry with a
+console warning. A broken manifest becomes a missing tile, not a broken avatar.
+
+## Generating new garments
+
+The catalog is fed by the Garment Forge
+([`workers/garment-forge/`](../workers/garment-forge/README.md)): a text
+prompt becomes a rigged, validated, published catalog piece in about seven
+minutes. The platform endpoint is a thin proxy over that worker:
+
+```
+POST /api/garment-forge { "prompt": "a red varsity jacket", "slot": "outerwear" }
+ → 202 { job_id, status, eta_seconds }
+GET /api/garment-forge?job=<id>
+ → { status, stage, glb_url, manifest_url, coverage, occludes }
+```
+
+`stage` walks `image → mesh → compose → rig → extract → validate → publish`.
+When the job reports `done`, the piece is already live in the catalog above;
+a closet refresh (`loadCatalog({ force: true })`) shows it immediately. Every
+published piece passed the same ≥60% bind-coverage gate the closet enforces,
+measured against the canonical body before publish, so a generated garment
+can never be a tile the closet then refuses to wear. Offline proof harness:
+`node scripts/verify-garment.mjs <manifest url> [avatar.glb]`.
+
+## Persistence shape
+
+```json
+"appearance": {
+ "garments": [
+ { "slot": "top", "id": "oxford-shirt-white" },
+ { "slot": "footwear", "id": "low-top-sneakers" }
+ ]
+}
+```
+
+One garment per slot, max 8, enforced by the zod schema. Existence against the
+live catalog is deliberately NOT checked at save time — a garment retired from
+the catalog later degrades to "not worn" on the next load/bake instead of
+bricking the avatar.
+
+## Failure posture
+
+- Garment can't reach the skeleton → refused with the measured coverage in the
+ reason string; the slot keeps its previous occupant.
+- Catalog unreachable → closet shows a retry state; the rest of the editor is
+ unaffected.
+- Bake-time garment failure → logged and skipped; the bake always lands.
+- Non-humanoid model → the closet is withheld (`supportsWardrobe` gate), same
+ policy as the animation library's humanoid gate.
+
+## Related
+
+- [`docs/avatar-reconstruction.md`](avatar-reconstruction.md) — selfie → avatar
+- [`docs/avatar-fidelity-program.md`](avatar-fidelity-program.md) — identity fidelity program
+- [`specs/GARMENT_MANIFEST.md`](../specs/GARMENT_MANIFEST.md) — the wearable contract
+
+---
+
+<a id="sec-100"></a>
> **Source:** `docs/aws-builder-center-marketplace-x402.md` · [↑ table of contents](#table-of-contents)
@@ -23594,7 +24602,7 @@ The product on the other side of all this plumbing is the platform: three.ws age
---
-<a id="sec-094"></a>
+<a id="sec-101"></a>
> **Source:** `docs/aws-builder-center-mcp-agents.md` · [↑ table of contents](#table-of-contents)
@@ -23709,7 +24717,7 @@ If you wire it into something, or you want to list a paid tool of your own, the
---
-<a id="sec-095"></a>
+<a id="sec-102"></a>
> **Source:** `docs/aws-marketplace-listing-kit.md` · [↑ table of contents](#table-of-contents)
@@ -23922,7 +24930,7 @@ Not done (requires AWS console / seller creds — cannot be done from this repo)
---
-<a id="sec-096"></a>
+<a id="sec-103"></a>
> **Source:** `docs/aws-marketplace.md` · [↑ table of contents](#table-of-contents)
@@ -23965,7 +24973,7 @@ For platform support, open an issue at [github.com/nirholas/three.ws/issues](htt
---
-<a id="sec-097"></a>
+<a id="sec-104"></a>
> **Source:** `docs/aws-partner-spotlight.md` · [↑ table of contents](#table-of-contents)
@@ -24061,7 +25069,7 @@ One product. Two ways to pay. One AWS bill.
---
-<a id="sec-098"></a>
+<a id="sec-105"></a>
> **Source:** `docs/bnb-babt-findings.md` · [↑ table of contents](#table-of-contents)
@@ -24257,7 +25265,7 @@ shipped:
---
-<a id="sec-099"></a>
+<a id="sec-106"></a>
> **Source:** `docs/bnb-payments.md` · [↑ table of contents](#table-of-contents)
@@ -24430,7 +25438,7 @@ full verified-facts list.
---
-<a id="sec-100"></a>
+<a id="sec-107"></a>
> **Source:** `docs/bnb-vault.md` · [↑ table of contents](#table-of-contents)
@@ -24578,7 +25586,7 @@ this campaign, not a bug in this code path.
---
-<a id="sec-101"></a>
+<a id="sec-108"></a>
> **Source:** `docs/bnb-world.md` · [↑ table of contents](#table-of-contents)
@@ -24825,7 +25833,7 @@ reproduction commands are recorded in `contracts/DEPLOYMENTS.md`'s "Prompt
---
-<a id="sec-102"></a>
+<a id="sec-109"></a>
> **Source:** `docs/brain.md` · [↑ table of contents](#table-of-contents)
@@ -24963,7 +25971,7 @@ done; wait
---
-<a id="sec-103"></a>
+<a id="sec-110"></a>
> **Source:** `docs/btn-pill-migration.md` · [↑ table of contents](#table-of-contents)
@@ -25087,7 +26095,7 @@ These classes are defined across the codebase. Follow-up agents should replace t
---
-<a id="sec-104"></a>
+<a id="sec-111"></a>
> **Source:** `docs/build.md` · [↑ table of contents](#table-of-contents)
@@ -25250,7 +26258,7 @@ grep -l 'vite-plugin-pwa:register-sw' dist/widget.html dist/embed.html # expec
---
-<a id="sec-105"></a>
+<a id="sec-112"></a>
> **Source:** `docs/capture.md` · [↑ table of contents](#table-of-contents)
@@ -25351,7 +26359,7 @@ console.log(job.result_url, job.num_points); // coloured .ply + point count
---
-<a id="sec-106"></a>
+<a id="sec-113"></a>
> **Source:** `docs/changelog.md` · [↑ table of contents](#table-of-contents)
@@ -25683,7 +26691,7 @@ cd sdk && npm publish
---
-<a id="sec-107"></a>
+<a id="sec-114"></a>
> **Source:** `docs/character-studio.md` · [↑ table of contents](#table-of-contents)
@@ -25930,7 +26938,7 @@ For cases that need more control than the studio provides, create your avatar in
---
-<a id="sec-108"></a>
+<a id="sec-115"></a>
> **Source:** `docs/chatgpt-ar.md` · [↑ table of contents](#table-of-contents)
@@ -26084,7 +27092,7 @@ The generation lane is operator-funded (NVIDIA NIM running Microsoft TRELLIS for
---
-<a id="sec-109"></a>
+<a id="sec-116"></a>
> **Source:** `docs/circulation-engine.md` · [↑ table of contents](#table-of-contents)
@@ -26265,7 +27273,7 @@ budget, so raise gradually and watch tick runtime and treasury balance.
---
-<a id="sec-110"></a>
+<a id="sec-117"></a>
> **Source:** `docs/clash.md` · [↑ table of contents](#table-of-contents)
@@ -26351,7 +27359,7 @@ The Coin Clash state and leaderboard are also exposed read-only over MCP through
---
-<a id="sec-111"></a>
+<a id="sec-118"></a>
> **Source:** `docs/clip-director.md` · [↑ table of contents](#table-of-contents)
@@ -26441,7 +27449,7 @@ message instead of an error, so a card is only ever minted from a real closed ro
---
-<a id="sec-112"></a>
+<a id="sec-119"></a>
> **Source:** `docs/coin-launches.md` · [↑ table of contents](#table-of-contents)
@@ -26531,7 +27539,7 @@ hardcode or surface any other specific mint as a recommendation.
---
-<a id="sec-113"></a>
+<a id="sec-120"></a>
> **Source:** `docs/coin-pages.md` · [↑ table of contents](#table-of-contents)
@@ -26996,7 +28004,7 @@ server mirrors each (including the dynamic `/coin/:id` path). The pre-existing
---
-<a id="sec-114"></a>
+<a id="sec-121"></a>
> **Source:** `docs/coinmarketcap-article-play.md` · [↑ table of contents](#table-of-contents)
@@ -27142,7 +28150,7 @@ The chart has always told you *what* a coin is doing. /play lets you go stand wh
---
-<a id="sec-115"></a>
+<a id="sec-122"></a>
> **Source:** `docs/coinmarketcap-article.md` · [↑ table of contents](#table-of-contents)
@@ -27345,7 +28353,7 @@ If you've been waiting for the moment AI and crypto stop talking past each other
---
-<a id="sec-116"></a>
+<a id="sec-123"></a>
> **Source:** `docs/compose.md` · [↑ table of contents](#table-of-contents)
@@ -27429,7 +28437,7 @@ curl -X PATCH 'https://three.ws/api/avatars/<avatarId>' \
---
-<a id="sec-117"></a>
+<a id="sec-124"></a>
> **Source:** `docs/concierge.md` · [↑ table of contents](#table-of-contents)
@@ -27482,6 +28490,10 @@ Most site chatbots need a crawler, an index, and an onboarding flow. Concierge s
Because the page itself is the knowledge source, the concierge is never stale: edit your pricing page and the very next answer reflects it.
+## Shopping mode (Shopify)
+
+On a Shopify store the concierge becomes a shopping assistant that knows your live catalog and shows real product cards. It needs no app, no API key, and no product feed: Shopify serves every storefront's catalog and policies publicly, and the widget reads them at ask-time (`/products.json`, `/collections.json`, `/policies/*`, all same-origin on the store). Per question it retrieves the handful of products the shopper asked about, grounds the streamed answer in them, and renders cards (image, live price, link, add-to-cart) from that same set, so prices and links are always real. It understands shopping intent ("a gift under $75", "cheapest hoodie", "anything on sale?") and answers shipping and returns from your published policies. Turn it on with the same one tag: it auto-detects the storefront, or force it with `data-shopping="true"` / `data-shop="your-store.myshopify.com"`. Full walkthrough: [Shopify shopping assistant tutorial](/tutorials/shopify-shopping-assistant).
+
## The avatar
The catalog (`sol`, `nova`, `vera`, `atlas`, `echo`) is the same rigged, viseme-capable roster the [page-agent](https://www.npmjs.com/package/@three-ws/page-agent) ships, served from `https://three.ws/avatars/`. Visitors pick their concierge from the built-in picker (their choice persists), or the host pins a single custom rigged GLB with `custom-avatar`. The 3D stage initializes on first open only, so a closed widget costs the host page zero GPU and no GLB download.
@@ -27491,7 +28503,7 @@ The catalog (`sol`, `nova`, `vera`, `atlas`, `echo`) is the same rigged, viseme-
The hosted endpoint is free, but the wire format is open. Any server that accepts the POST body and streams the same three SSE event types can be swapped in via the `endpoint` option:
```
-→ POST { message, history[], site{url,name,title,description,headings,nav,knowledge,content}, persona?, lang? }
+→ POST { message, history[], site{url,name,title,description,headings,nav,knowledge,content}, shopping?{store,currency,summary,collections[],policies,products}, persona?, lang? }
← data: {"type":"chunk","text":"..."}
← data: {"type":"done","provider":"...","model":"..."}
← data: {"type":"error","code":"...","message":"..."}
@@ -27539,7 +28551,7 @@ Runnable examples ship with the SDK ([concierge-sdk/examples/](https://github.co
---
-<a id="sec-118"></a>
+<a id="sec-125"></a>
> **Source:** `docs/configuration.md` · [↑ table of contents](#table-of-contents)
@@ -28093,7 +29105,7 @@ Before going live, verify the following:
---
-<a id="sec-119"></a>
+<a id="sec-126"></a>
> **Source:** `docs/content/use-cases/README.md` · [↑ table of contents](#table-of-contents)
@@ -28138,7 +29150,7 @@ Every scenario on these pages is an **example workflow** — clearly labeled "Im
---
-<a id="sec-120"></a>
+<a id="sec-127"></a>
> **Source:** `docs/content/use-cases/ai-agent-developer.md` · [↑ table of contents](#table-of-contents)
@@ -28186,7 +29198,7 @@ A standards-based interface (MCP + A2A), a working USDC payment rail (x402 on Ba
---
-<a id="sec-121"></a>
+<a id="sec-128"></a>
> **Source:** `docs/content/use-cases/brand-marketer.md` · [↑ table of contents](#table-of-contents)
@@ -28220,7 +29232,7 @@ Four real capabilities cover embodiment, reach, and trust:
```html
<script type="module" src="https://three.ws/agent-3d/1.5.2/agent-3d.js"></script>
<agent-3d
- body="https://cdn.three.ws/models/brand-agent.glb"
+ body="https://three.ws/cdn/models/brand-agent.glb"
brain="claude-sonnet-4-6"
name="Lyra-bot"
instructions="Official brand assistant. Answer product questions, link to pricing, stay on-brand."
@@ -28245,7 +29257,7 @@ A conversational 3D brand presence that's easy to embed and share, plus a public
---
-<a id="sec-122"></a>
+<a id="sec-129"></a>
> **Source:** `docs/content/use-cases/crypto-community.md` · [↑ table of contents](#table-of-contents)
@@ -28292,7 +29304,7 @@ A shared 3D home for the token's holders, a real (not mocked) on-chain agent-exc
---
-<a id="sec-123"></a>
+<a id="sec-130"></a>
> **Source:** `docs/content/use-cases/game-studio.md` · [↑ table of contents](#table-of-contents)
@@ -28339,7 +29351,7 @@ A character that renders with production-grade glTF handling, converses through
---
-<a id="sec-124"></a>
+<a id="sec-131"></a>
> **Source:** `docs/content/use-cases/indie-creator.md` · [↑ table of contents](#table-of-contents)
@@ -28375,7 +29387,7 @@ Together: your face (or your prompt) becomes a model, the model becomes a talkin
```html
<script type="module" src="https://three.ws/agent-3d/1.5.2/agent-3d.js"></script>
<agent-3d
- body="https://cdn.three.ws/models/procyon-fox.glb"
+ body="https://three.ws/cdn/models/procyon-fox.glb"
brain="claude-sonnet-4-6"
name="Procyon"
instructions="You are Procyon's studio fox. Greet visitors warmly, talk about the art prints, and wave when someone says hi."
@@ -28399,7 +29411,7 @@ A real, embedded, conversational 3D avatar that loads in any modern browser. The
---
-<a id="sec-125"></a>
+<a id="sec-132"></a>
> **Source:** `docs/contributing.md` · [↑ table of contents](#table-of-contents)
@@ -28740,7 +29752,7 @@ By contributing, you agree that your contributions are provided under the terms
---
-<a id="sec-126"></a>
+<a id="sec-133"></a>
> **Source:** `docs/cosmos.md` · [↑ table of contents](#table-of-contents)
@@ -28830,7 +29842,7 @@ else {
---
-<a id="sec-127"></a>
+<a id="sec-134"></a>
> **Source:** `docs/crypto-api.md` · [↑ table of contents](#table-of-contents)
@@ -29670,7 +30682,7 @@ curl -s "https://three.ws/api/crypto/holders?address=FeMbDoX7R1Psc4GEcvJdsbNbZA3
---
-<a id="sec-128"></a>
+<a id="sec-135"></a>
> **Source:** `docs/custody.md` · [↑ table of contents](#table-of-contents)
@@ -29760,7 +30772,7 @@ Every step of recovery and inheritance writes to the custody trail and the audit
---
-<a id="sec-129"></a>
+<a id="sec-136"></a>
> **Source:** `docs/daily-forge.md` · [↑ table of contents](#table-of-contents)
@@ -29866,7 +30878,7 @@ console.log(themeIndex(new Date().toISOString().slice(0, 10), 24));
---
-<a id="sec-130"></a>
+<a id="sec-137"></a>
> **Source:** `docs/demo-routes.md` · [↑ table of contents](#table-of-contents)
@@ -30050,7 +31062,7 @@ Verified on the live Vite dev server (`npm run dev`, port 3000):
---
-<a id="sec-131"></a>
+<a id="sec-138"></a>
> **Source:** `docs/deployment.md` · [↑ table of contents](#table-of-contents)
@@ -30643,7 +31655,7 @@ Upstash REST API uses HTTPS — no ports to open. If you see connection errors,
---
-<a id="sec-132"></a>
+<a id="sec-139"></a>
> **Source:** `docs/diorama.md` · [↑ table of contents](#table-of-contents)
@@ -30740,7 +31752,7 @@ The compose response shape (abridged):
---
-<a id="sec-133"></a>
+<a id="sec-140"></a>
> **Source:** `docs/do-i-need-crypto.md` · [↑ table of contents](#table-of-contents)
@@ -30827,7 +31839,7 @@ When you do interact with on-chain features, the platform's native token is **$T
---
-<a id="sec-134"></a>
+<a id="sec-141"></a>
> **Source:** `docs/economy-heartbeat.md` · [↑ table of contents](#table-of-contents)
@@ -30988,7 +32000,7 @@ Related: [circulation engine](circulation-engine.md) ·
---
-<a id="sec-135"></a>
+<a id="sec-142"></a>
> **Source:** `docs/economy-master.md` · [↑ table of contents](#table-of-contents)
@@ -31109,8 +32121,16 @@ shuffle the remaining SOL, and when it hits zero the Money Pulse
([`/pulse`](../pages/pulse.html)) goes quiet. Historically the only cure was a
human moving SOL in.
-When the master can't cover the engines' real deficit, the topup cron self-heals
-in two automatic steps before it ever pages a human, in cheapest-first order:
+When the master can't cover the real deficit, the topup cron self-heals in two
+automatic steps before it ever pages a human, in cheapest-first order. The
+deficit counts the engines under floor **plus the master's own shortfall**: the
+master doubles as the x402 sponsor fee wallet, and below the sponsor SOL floor
+(0.02) every autonomous settle fail-closes, but the master can never be a topup
+target (it is the funding root), so without this term the self-healing never
+fired for it and the economy stalled with the master a hair under the settle
+floor (the July 2026 recurrences). The master's operating floor is
+`ECONOMY_MASTER_RESERVE_SOL` plus `ECONOMY_MASTER_OPERATING_SOL` (default 0.15,
+sized to clear the fuel step's minimum-gap trigger).
**Step 1: reclaim idle SOL (free).** `reclaimIdleSol`
([`api/_lib/economy-sweepback.js`](../api/_lib/economy-sweepback.js)) pulls SOL
@@ -31177,6 +32197,7 @@ congestion, clamped to a hard ceiling.
| `ECONOMY_MASTER_ADDRESS` | no | Override the expected pubkey if the master is ever rotated. Defaults to the address above. |
| `ECONOMY_MASTER_RESERVE_SOL` / `_PER_TOPUP_MAX_SOL` / `_RUN_CAP_SOL` | no | Guard caps (see table). |
| `ECONOMY_FUEL_ENABLED` | no | `0` disables the USDC→SOL auto-refuel (default on). |
+| `ECONOMY_MASTER_OPERATING_SOL` | no | Working headroom above the reserve the master keeps for sponsor co-sign fees; its shortfall below reserve + this counts toward the self-heal deficit. Default 0.15. |
| `ECONOMY_FUEL_PER_RUN_USDC` / `_DAILY_USDC` | no | Fuel caps: max USDC per swap (default 25) and per UTC day (default 100). |
| `ECONOMY_FUEL_USDC_KEEP` | no | USDC the refuel never spends below (revenue reserve). Default 0. |
| `ECONOMY_FUEL_MIN_GAP_SOL` / `_TARGET_SOL` | no | Only refuel when the SOL gap is at least this (default 0.1); buy toward this spendable-SOL buffer (default 1.0). |
@@ -31329,7 +32350,7 @@ The master is configured and funded, but the tree it feeds is only partly wired:
---
-<a id="sec-136"></a>
+<a id="sec-143"></a>
> **Source:** `docs/editor.md` · [↑ table of contents](#table-of-contents)
@@ -31678,7 +32699,7 @@ The full contract lives in [specs/EDITOR_SPEC.md](https://github.com/nirholas/th
---
-<a id="sec-137"></a>
+<a id="sec-144"></a>
> **Source:** `docs/embedding.md` · [↑ table of contents](#table-of-contents)
@@ -32422,7 +33443,7 @@ The platform records anonymous embed impressions (country, referrer hostname) vi
---
-<a id="sec-138"></a>
+<a id="sec-145"></a>
> **Source:** `docs/embody.md` · [↑ table of contents](#table-of-contents)
@@ -32532,7 +33553,7 @@ Embody is a thin, honest wire over pieces that already exist — no new pipeline
---
-<a id="sec-139"></a>
+<a id="sec-146"></a>
> **Source:** `docs/erc8004.md` · [↑ table of contents](#table-of-contents)
@@ -33205,7 +34226,7 @@ The same MAINNET addresses apply to all 15 mainnets. The same TESTNET addresses
---
-<a id="sec-140"></a>
+<a id="sec-147"></a>
> **Source:** `docs/erc8004/validation-attestation.md` · [↑ table of contents](#table-of-contents)
@@ -33297,7 +34318,7 @@ ValidationRegistry is deployed, `/api/erc8004/validate` returns a clear ops erro
---
-<a id="sec-141"></a>
+<a id="sec-148"></a>
> **Source:** `docs/examples.md` · [↑ table of contents](#table-of-contents)
@@ -34030,7 +35051,7 @@ genuinely invested in the user's progress.
---
-<a id="sec-142"></a>
+<a id="sec-149"></a>
> **Source:** `docs/fact-check.md` · [↑ table of contents](#table-of-contents)
@@ -34132,7 +35153,7 @@ Once the free quota is spent, the same POST returns `402` with an x402 challenge
---
-<a id="sec-143"></a>
+<a id="sec-150"></a>
> **Source:** `docs/financial-controls.md` · [↑ table of contents](#table-of-contents)
@@ -34411,7 +35432,7 @@ Ranked by accounting/regulatory risk. Each is a tracked remediation item.
---
-<a id="sec-144"></a>
+<a id="sec-151"></a>
> **Source:** `docs/forge-background-generation.md` · [↑ table of contents](#table-of-contents)
@@ -34524,7 +35545,7 @@ and the notification preference model in
---
-<a id="sec-145"></a>
+<a id="sec-152"></a>
> **Source:** `docs/forge-off.md` · [↑ table of contents](#table-of-contents)
@@ -34641,7 +35662,7 @@ Backfill a past week's winner (owner): `GET /api/cron/forge-off-crown?week=YYYY-
---
-<a id="sec-146"></a>
+<a id="sec-153"></a>
> **Source:** `docs/forge-pipeline.md` · [↑ table of contents](#table-of-contents)
@@ -34899,7 +35920,7 @@ Fast diagnostics: `forge_creations` carries per-generation backend, status, erro
---
-<a id="sec-147"></a>
+<a id="sec-154"></a>
> **Source:** `docs/forge.md` · [↑ table of contents](#table-of-contents)
@@ -34963,6 +35984,7 @@ Generation is a job. `POST /api/forge` returns a `job_id`; the client polls `GET
4. Optionally open the quality controls and pick a tier (Draft, Standard, High) and an engine. The default engine carries a **FREE** pill. Down lanes are disabled with the reason shown.
5. Click Generate. A real elapsed-driven progress line runs against the catalog's ETA estimate for the chosen path, tier, and engine.
6. When the model lands, orbit it in the viewer, view it in AR, download the GLB, or run the post-generation tools (stylize, optimize, Game-Ready retopology, split).
+7. Keep going on the same result: **Rig for animation** adds a humanoid skeleton (POST `/api/forge?action=rig`) and hands off to Pose Studio or IRL placement; **Restyle materials** re-skins the surface with a free-text instruction or a preset chip (chrome, wood, gold, neon, marble, rust) via `/api/material-studio`, keeping the mesh untouched; **Iterate** makes a shape-changing edit from a plain-language instruction ("make the helmet red", "add a backpack") via `/api/forge-iterate` — the same conversational core the `refine_model` MCP tool uses — and keeps every version in a branchable lineage strip; **Place IRL** opens `/irl?avatar=<glb_url>` to anchor the model in AR at a real-world location.
## Examples
@@ -35024,17 +36046,29 @@ console.log(job.glb_url); // downloadable, textured GLB
- **Photo input** accepts up to four views of one object; text-only engines are filtered out of the photo modes automatically.
- Rate limits are per client IP on the shared 3D generation buckets.
+## Measuring realism
+
+Any change that could affect output quality (a tier's sampler budget, a new
+lane, a prompt-enhancement change) should be checked against the realism
+benchmark before and after: `node scripts/quality-bench.mjs` runs a fixed
+23-prompt set through this real `/api/forge` path and scores the result with
+Vertex Gemini vision; `node scripts/quality-bench.mjs --compare=latest,previous`
+exits nonzero on a >1.0 mean-score drop. See
+[data/quality-bench/README.md](../data/quality-bench/README.md) and the
+dashboard at [/quality-bench](https://three.ws/quality-bench) (internal).
+
## Related
- [The Forge pipeline](./forge-pipeline.md) is the architecture deep dive: the engine grid, routing, failover, job lifecycle, workers, and payments, end to end. [How the Forge works](./how-forge-works.md) is the same story in plain language.
- [Image to 3D](./image-to-3d.md) is the photo lane opened directly at [/image-to-3d](https://three.ws/image-to-3d).
+- [/forge-max](https://three.ws/forge-max) is the maximum-quality lane opened directly: the same Forge with the High tier pinned on arrival (200k-poly target, 4K PBR and HD textures, subject-aware engine routing). `?tier=draft|standard|high` presets the quality selector on any Forge URL the same way. The High tier's $THREE hold-or-pay gate applies unchanged; BYOK engines (your own Meshy, Tripo, or Rodin key) are exempt as always. For DamagedHelmet-class artist benchmarks, remember the ceiling is the current state of generative 3D, not the routing: this lane maxes every budget the engines expose, and [Measuring realism](#measuring-realism) is how we track that ceiling moving.
- [Diorama](./diorama.md) forges a whole scene of Forge objects into one explorable world.
- The 3D generation architecture: [3D pipeline](./3d-pipeline.md), [3D asset pipeline](./3d-asset-pipeline.md), [3D API](./3d-api.md).
- Pages: [/create](https://three.ws/create) (the avatar creator), [/scene](https://three.ws/scene) (Scene Studio), [/restyle](https://three.ws/restyle) (re-skin a GLB), [/gallery](https://three.ws/gallery).
---
-<a id="sec-148"></a>
+<a id="sec-155"></a>
> **Source:** `docs/galaxy.md` · [↑ table of contents](#table-of-contents)
@@ -35118,7 +36152,7 @@ curl -X POST 'https://three.ws/api/galaxy' \
---
-<a id="sec-149"></a>
+<a id="sec-156"></a>
> **Source:** `docs/genesis.md` · [↑ table of contents](#table-of-contents)
@@ -35264,7 +36298,7 @@ curl -s -X POST "https://three.ws/api/agents/$AGENT_ID/wallet/provision" \
---
-<a id="sec-150"></a>
+<a id="sec-157"></a>
> **Source:** `docs/genome.md` · [↑ table of contents](#table-of-contents)
@@ -35406,7 +36440,7 @@ curl -s "https://three.ws/api/genome/lineage?agentId=<child-uuid>&verify=1"
---
-<a id="sec-151"></a>
+<a id="sec-158"></a>
> **Source:** `docs/guardian.md` · [↑ table of contents](#table-of-contents)
@@ -35492,7 +36526,7 @@ The console reads this on load, resolves your viewer id (so it can tell whether
---
-<a id="sec-152"></a>
+<a id="sec-159"></a>
> **Source:** `docs/hold-to-access.md` · [↑ table of contents](#table-of-contents)
@@ -35711,7 +36745,7 @@ worlds unaffected.
---
-<a id="sec-153"></a>
+<a id="sec-160"></a>
> **Source:** `docs/how-forge-works.md` · [↑ table of contents](#table-of-contents)
@@ -35761,7 +36795,7 @@ Everything above is also a tool call. AI agents (Claude, ChatGPT, or your own) g
---
-<a id="sec-154"></a>
+<a id="sec-161"></a>
> **Source:** `docs/how-it-works.md` · [↑ table of contents](#table-of-contents)
@@ -35864,7 +36898,7 @@ Three production paths. Pick whichever fits your use case:
- **Selfie capture** — upload a photo, get a rigged 3D version of yourself in ~60 seconds. See [avatar-creation.md](./avatar-creation.md).
- **Upload your own** — any glTF 2.0 / GLB with a humanoid rig works. Drop the file into the editor at [three.ws/create](https://three.ws/create) or POST to `/api/avatars`.
-Every avatar ends up as a hosted GLB URL (served from the `cdn.three.ws` asset CDN) plus a database record. When you wire one into an agent, the agent's manifest references it under `body.uri`.
+Every avatar ends up as a hosted GLB URL (served from the first-party asset CDN at `three.ws/cdn/<key>`) plus a database record. When you wire one into an agent, the agent's manifest references it under `body.uri`.
---
@@ -35932,7 +36966,7 @@ Quick lookup for "I want to ship X":
---
-<a id="sec-155"></a>
+<a id="sec-162"></a>
> **Source:** `docs/i18n.md` · [↑ table of contents](#table-of-contents)
@@ -36177,7 +37211,7 @@ round-trips, lint rules, runtime resolution/fallback, and catalog merge/prune.
---
-<a id="sec-156"></a>
+<a id="sec-163"></a>
> **Source:** `docs/ibm-x402-mcp.md` · [↑ table of contents](#table-of-contents)
@@ -36548,7 +37582,7 @@ Catalog/listing copy is maintained in
---
-<a id="sec-157"></a>
+<a id="sec-164"></a>
> **Source:** `docs/ibm.md` · [↑ table of contents](#table-of-contents)
@@ -36867,7 +37901,7 @@ Unit tests for the same paths live in [`tests/`](../tests/) (`granite-oracle`, `
---
-<a id="sec-158"></a>
+<a id="sec-165"></a>
> **Source:** `docs/image-to-3d.md` · [↑ table of contents](#table-of-contents)
@@ -36969,7 +38003,7 @@ console.log(job.glb_url);
---
-<a id="sec-159"></a>
+<a id="sec-166"></a>
> **Source:** `docs/integrations.md` · [↑ table of contents](#table-of-contents)
@@ -37141,7 +38175,7 @@ for the full table.
---
-<a id="sec-160"></a>
+<a id="sec-167"></a>
> **Source:** `docs/introduction.md` · [↑ table of contents](#table-of-contents)
@@ -37367,7 +38401,7 @@ If you want to look at what's already in the hosted platform — browsing agents
---
-<a id="sec-161"></a>
+<a id="sec-168"></a>
> **Source:** `docs/irl.md` · [↑ table of contents](#table-of-contents)
@@ -37480,7 +38514,7 @@ The rollup is served at `GET /api/irl/analytics` (admin-gated, same `x-ops-secre
---
-<a id="sec-162"></a>
+<a id="sec-169"></a>
> **Source:** `docs/irl/THREAT-MODEL.md` · [↑ table of contents](#table-of-contents)
@@ -37615,7 +38649,7 @@ in a way that drops legitimate discovery, update this file in the same change.
---
-<a id="sec-163"></a>
+<a id="sec-170"></a>
> **Source:** `docs/js-api.md` · [↑ table of contents](#table-of-contents)
@@ -38245,7 +39279,7 @@ window.VIEWER.app.viewer.updateDisplay();
---
-<a id="sec-164"></a>
+<a id="sec-171"></a>
> **Source:** `docs/labor-market.md` · [↑ table of contents](#table-of-contents)
@@ -38350,7 +39384,7 @@ economy move:
---
-<a id="sec-165"></a>
+<a id="sec-172"></a>
> **Source:** `docs/launch-usecases.md` · [↑ table of contents](#table-of-contents)
@@ -38486,7 +39520,7 @@ GET /api/pump/launch-studio?action=preview&id=github-fresh-breakouts&limit=6
---
-<a id="sec-166"></a>
+<a id="sec-173"></a>
> **Source:** `docs/layers.md` · [↑ table of contents](#table-of-contents)
@@ -38648,7 +39682,7 @@ Versioned CDN bundles are published at `/agent-3d/<version>/agent-3d.js`. Use `l
---
-<a id="sec-167"></a>
+<a id="sec-174"></a>
> **Source:** `docs/lipsync.md` · [↑ table of contents](#table-of-contents)
@@ -38745,7 +39779,7 @@ tick();
---
-<a id="sec-168"></a>
+<a id="sec-175"></a>
> **Source:** `docs/listings.md` · [↑ table of contents](#table-of-contents)
@@ -38837,7 +39871,7 @@ Subscribe via RSS to track new listings, integrations, and protocol updates.
---
-<a id="sec-169"></a>
+<a id="sec-176"></a>
> **Source:** `docs/make-your-agent.md` · [↑ table of contents](#table-of-contents)
@@ -38930,7 +39964,7 @@ Changes take effect immediately — no republishing needed for most settings.
---
-<a id="sec-170"></a>
+<a id="sec-177"></a>
> **Source:** `docs/market-data-api.md` · [↑ table of contents](#table-of-contents)
@@ -39050,7 +40084,7 @@ A failed upstream never charges you: the endpoint verifies payment, runs the dat
---
-<a id="sec-171"></a>
+<a id="sec-178"></a>
> **Source:** `docs/marketplace.md` · [↑ table of contents](#table-of-contents)
@@ -39144,7 +40178,7 @@ their chosen `currency_mint`; the platform promotes no coin other than $THREE.
---
-<a id="sec-172"></a>
+<a id="sec-179"></a>
> **Source:** `docs/mcp-3d-studio.md` · [↑ table of contents](#table-of-contents)
@@ -39382,7 +40416,7 @@ npx @modelcontextprotocol/inspector http://localhost:3000/api/mcp-3d
---
-<a id="sec-173"></a>
+<a id="sec-180"></a>
> **Source:** `docs/mcp-agent.md` · [↑ table of contents](#table-of-contents)
@@ -39458,7 +40492,7 @@ npx @modelcontextprotocol/inspector http://localhost:3000/api/mcp-agent
---
-<a id="sec-174"></a>
+<a id="sec-181"></a>
> **Source:** `docs/mcp-studio.md` · [↑ table of contents](#table-of-contents)
@@ -39524,15 +40558,17 @@ launcher, living avatars, link unfurls) is documented end to end in
## Tools
-The server exposes **nine** tools: the six generation tools documented here, plus
-three persona/embodiment tools (`create_agent_persona`, `get_agent_persona`,
-`persona_say`) documented in the **Embodiment** section below. All nine are free
-and keyless.
+The server exposes **ten** tools: the six generation tools documented here, the
+`check_job` collector, plus three persona/embodiment tools
+(`create_agent_persona`, `get_agent_persona`, `persona_say`) documented in the
+**Embodiment** section below. All ten are free and keyless.
All six generation tools are free and run operator-funded on the platform's own
generation pipeline. Annotations: `readOnlyHint:false`, `destructiveHint:false`,
`idempotentHint:false`, `openWorldHint:true` (work runs against external model
-APIs; nothing is ever modified or deleted).
+APIs; nothing is ever modified or deleted). `check_job` is the exception: it is a
+pure status probe (`readOnlyHint:true`, `idempotentHint:true`) and never counts
+against the generation quota.
| Tool | Title | Input | Returns |
|---|---|---|---|
@@ -39542,6 +40578,7 @@ APIs; nothing is ever modified or deleted).
| `rig_mesh` | Rig a 3D model for animation | `glb_url` | rigged GLB |
| `forge_avatar` | Generate a rigged, animation-ready avatar | `prompt?` / `image_url?`, `allow_non_humanoid?` | rigged GLB avatar |
| `refine_model` | Refine a 3D model by describing a change | `glb_url`, `instruction`, `parent_prompt?`, `parent_lineage?`, `parent_index?` | refined GLB + version lineage |
+| `check_job` | Check a pending 3D generation and collect it | `job_id` | GLB model, or an updated pending state |
### Response shape
@@ -39571,6 +40608,42 @@ Rigged avatars additionally carry `irlUrl`, the living-agent handoff into
Every result also includes a `spatial` field, the open Spatial MCP artifact
(`specs/SPATIAL_MCP.md`) so any Spatial-MCP renderer can display the model.
+### Pending generations (`check_job`)
+
+A detailed model can take longer than a single tool call should block for. When
+that happens the generating tool does **not** fail: it returns a success result
+carrying a pollable handle, and the job keeps running server-side.
+
+```json
+{
+ "status": "pending",
+ "jobId": "f1.eyJwIjoiZ2NwIiw…",
+ "pollUrl": "https://three.ws/api/gpt-forge?job=f1.eyJwIjoiZ2NwIiw…",
+ "etaRemainingSeconds": 42,
+ "prompt": "a friendly round robot mascot, glossy white plastic"
+}
+```
+
+`etaRemainingSeconds` is the live estimate for the lane actually running the job
+(its typical duration minus time already elapsed), so the assistant knows how
+long to wait rather than retrying blind. Call `check_job` with that `jobId` to
+collect the result:
+
+- **done**: returns the ordinary success envelope (`glbUrl`, `viewerUrl`,
+ `arUrl`, …) and the model renders inline in the widget, exactly as if the
+ original call had finished in time.
+- **still rendering**: returns a fresh `pending` envelope with updated
+ `etaRemainingSeconds`. Call again after the suggested wait.
+- **failed**: returns a clean, actionable error.
+
+`check_job` is read-only and idempotent, and it does not consume generation
+quota, so collecting a model can never be rate-limited by the generation that
+created it. The inline widget renders the pending state as a designed
+"still rendering" panel with the live countdown, not an empty state.
+
+Any HTTP client can poll `pollUrl` directly instead; it is the same public,
+auth-free job handle the [3D API](/docs/3d-api) hands anonymous callers.
+
### Conversational refinement (`refine_model`)
Iterate on a model by describing the change in words — *"make it metallic"*,
@@ -39723,7 +40796,7 @@ any surface that rides it. The agent-facing REST endpoints (`/api/3d/generate`,
---
-<a id="sec-175"></a>
+<a id="sec-182"></a>
> **Source:** `docs/mcp-tools.md` · [↑ table of contents](#table-of-contents)
@@ -39862,7 +40935,7 @@ promote no specific token.
---
-<a id="sec-176"></a>
+<a id="sec-183"></a>
> **Source:** `docs/mcp-x402-bazaar.md` · [↑ table of contents](#table-of-contents)
@@ -39937,7 +41010,7 @@ npx @modelcontextprotocol/inspector http://localhost:3000/api/mcp-bazaar
---
-<a id="sec-177"></a>
+<a id="sec-184"></a>
> **Source:** `docs/mcp.md` · [↑ table of contents](#table-of-contents)
@@ -40531,6 +41604,72 @@ Returns `{ mint, sources: [...], dexscreener?, jupiter?, solana?, skipped: [...]
---
+### `text_to_animation`
+
+Generate a brand-new motion from a natural-language prompt ("waving confidently", "a slow tai-chi sweep") with a text-to-motion diffusion model (MDM, MIT), then retarget it onto a caller-supplied rigged humanoid GLB — the same retarget engine `apply_animation` uses. Unlike the curated animation library, the motion does not pre-exist: it's synthesized for the prompt, on the self-host `model-text2motion` GPU worker (`workers/model-text2motion/`).
+
+```json
+{
+ "type": "object",
+ "properties": {
+ "prompt": { "type": "string", "minLength": 3, "maxLength": 1000 },
+ "model_url": { "type": "string", "format": "uri", "description": "Public https URL of a rigged humanoid .glb to animate." },
+ "duration_seconds": { "type": "number", "minimum": 1, "maximum": 10, "default": 4 }
+ },
+ "required": ["prompt", "model_url"],
+ "additionalProperties": false
+}
+```
+
+Returns the retargeted three.js `AnimationClip` JSON (or a baked animated GLB) plus a retarget report, the same shape `apply_animation` returns. Requires the text2motion worker configured on the deployment (`GCP_TEXT2MOTION_URL`) — errors with `-32001` if unset. Also reachable outside MCP via `POST /api/forge-motion` (`GET /api/forge-motion?job=<id>` to poll).
+
+### `generate_garment`
+
+Turn a text prompt ("a red varsity jacket") into a rigged, wearable garment published to the three.ws wardrobe catalog: reference image (Vertex image lane) → PBR mesh (self-host GPU fleet) → skinned to the canonical humanoid skeleton with full-body context (`model-rig`) → validated against every rule in `specs/GARMENT_MANIFEST.md`, including the 60% bind-coverage gate, before publish. Asynchronous (about 7 minutes); poll with `garment_status`.
+
+```json
+{
+ "type": "object",
+ "properties": {
+ "prompt": { "type": "string", "minLength": 3, "maxLength": 500 },
+ "slot": { "type": "string", "enum": ["top", "bottom", "footwear", "outerwear", "hair", "headwear", "glasses", "accessory"] }
+ },
+ "required": ["prompt", "slot"],
+ "additionalProperties": false
+}
+```
+
+Returns `{ job_id, status, eta_seconds }`. The finished garment appears in the public catalog automatically and attaches to any humanoid avatar via the additive wardrobe (`docs/avatar-wardrobe.md`). Requires `GCP_GARMENT_FORGE_URL` on the deployment — errors with `-32001` if unset. Also reachable outside MCP via `POST /api/garment-forge`.
+
+### `garment_status`
+
+Poll a `generate_garment` job. While running, reports the pipeline stage (`image → mesh → compose → rig → extract → validate → publish`); when done, returns the published `glb_url`, `manifest_url`, thumbnail, measured bind `coverage`, and the occluded body regions.
+
+```json
+{
+ "type": "object",
+ "properties": { "job_id": { "type": "string" } },
+ "required": ["job_id"],
+ "additionalProperties": false
+}
+```
+
+### `list_garment_catalog`
+
+Fetch the public wardrobe catalog: every published garment manifest (id, slot, name, GLB url, thumbnail, occluded regions, license), optionally filtered by `slot`. Any entry attaches to any humanoid avatar.
+
+```json
+{
+ "type": "object",
+ "properties": {
+ "slot": { "type": "string", "enum": ["top", "bottom", "footwear", "outerwear", "hair", "headwear", "glasses", "accessory"] }
+ },
+ "additionalProperties": false
+}
+```
+
+---
+
## Rate limits
| Scope | Limit |
@@ -40556,7 +41695,7 @@ Here is a realistic conversation showing how Claude uses the MCP tools end-to-en
1. `get_avatar({ slug: "storm-mage" })` — resolves the UUID and model URL.
-2. `validate_model({ url: "https://cdn.three.ws/u/…/storm-mage.glb" })` — runs the Khronos validator.
+2. `validate_model({ url: "https://three.ws/cdn/u/…/storm-mage.glb" })` — runs the Khronos validator.
Response:
```
@@ -40565,7 +41704,7 @@ Here is a realistic conversation showing how Claude uses the MCP tools end-to-en
[WRN] NODE_EMPTY: node "Armature" has no mesh and no children
```
-3. `inspect_model({ url: "https://cdn.three.ws/u/…/storm-mage.glb" })` — structural overview.
+3. `inspect_model({ url: "https://three.ws/cdn/u/…/storm-mage.glb" })` — structural overview.
Response:
```
@@ -40668,7 +41807,7 @@ Restart Claude Code after editing `.mcp.json` so the new server config is picked
---
-<a id="sec-178"></a>
+<a id="sec-185"></a>
> **Source:** `docs/memetic-launcher.md` · [↑ table of contents](#table-of-contents)
@@ -40759,7 +41898,7 @@ POST /api/launcher/me { "action": "resume" } → clear a tripped circuit brea
---
-<a id="sec-179"></a>
+<a id="sec-186"></a>
> **Source:** `docs/memory.md` · [↑ table of contents](#table-of-contents)
@@ -41154,7 +42293,7 @@ In `ipfs` mode without encryption, treat the memory as semi-public. Don't store
---
-<a id="sec-180"></a>
+<a id="sec-187"></a>
> **Source:** `docs/meta-allocator.md` · [↑ table of contents](#table-of-contents)
@@ -41255,7 +42394,7 @@ plan `source` is `"empty"` with a helpful message instead of an error.
---
-<a id="sec-181"></a>
+<a id="sec-188"></a>
> **Source:** `docs/mint-mark.md` · [↑ table of contents](#table-of-contents)
@@ -41387,7 +42526,7 @@ No other mint should appear in tests, fixtures, or documentation.
---
-<a id="sec-182"></a>
+<a id="sec-189"></a>
> **Source:** `docs/mocap-studio.md` · [↑ table of contents](#table-of-contents)
@@ -41475,7 +42614,7 @@ curl 'https://three.ws/api/mocap/clips/<clipId>' -H 'cookie: <session>'
---
-<a id="sec-183"></a>
+<a id="sec-190"></a>
> **Source:** `docs/money-feed.md` · [↑ table of contents](#table-of-contents)
@@ -41587,7 +42726,7 @@ and millisecond `ts`.
---
-<a id="sec-184"></a>
+<a id="sec-191"></a>
> **Source:** `docs/money-map.md` · [↑ table of contents](#table-of-contents)
@@ -41782,7 +42921,7 @@ that set `auto_fund_enabled = true` (default off). See
---
-<a id="sec-185"></a>
+<a id="sec-192"></a>
> **Source:** `docs/motion-swap.md` · [↑ table of contents](#table-of-contents)
@@ -41868,7 +43007,7 @@ its error state.
---
-<a id="sec-186"></a>
+<a id="sec-193"></a>
> **Source:** `docs/multi-agent.md` · [↑ table of contents](#table-of-contents)
@@ -42206,7 +43345,7 @@ To extend this into a full turn-based scene, add a `brain` attribute to Mira wit
---
-<a id="sec-187"></a>
+<a id="sec-194"></a>
> **Source:** `docs/news-rights.md` · [↑ table of contents](#table-of-contents)
@@ -42304,7 +43443,7 @@ Three rules, in order of importance:
---
-<a id="sec-188"></a>
+<a id="sec-195"></a>
> **Source:** `docs/nvidia-inception.md` · [↑ table of contents](#table-of-contents)
@@ -42347,7 +43486,7 @@ Membership is a startup program, not a partnership or an investment: NVIDIA revi
---
-<a id="sec-189"></a>
+<a id="sec-196"></a>
> **Source:** `docs/nvidia-models.md` · [↑ table of contents](#table-of-contents)
@@ -42551,7 +43690,7 @@ The free NVIDIA TTS lane: **Magpie multilingual on Riva**, selected by an NVCF `
---
-<a id="sec-190"></a>
+<a id="sec-197"></a>
> **Source:** `docs/nvidia-nemotron-spotlight.md` · [↑ table of contents](#table-of-contents)
@@ -42706,7 +43845,7 @@ Build the small stuff. Put it in front. The generator was never the hard part.
---
-<a id="sec-191"></a>
+<a id="sec-198"></a>
> **Source:** `docs/okx-marketplace.md` · [↑ table of contents](#table-of-contents)
@@ -42721,7 +43860,7 @@ the artifact. Our marketplace listing is agent **#2632 "three.ws 3D Studio"**.
> [x402 payments](./x402.md) · seller-side protocol spec: [`specs/okx-agent-payments.md`](../specs/okx-agent-payments.md)
The **single source of truth** for every service (names, 2-part OKX descriptions, prices,
-endpoints, input schemas) is [`api/_lib/okx-catalog.js`](../api/_lib/okx-catalog.js) — the
+endpoints, input schemas) is [`api/_lib/okx-catalog.js`](../api/_lib/okx-catalog.js), the
free catalog endpoint below serves it verbatim, so the docs, the endpoints, and the OKX
listing can never drift apart.
@@ -42741,19 +43880,19 @@ curl https://three.ws/api/okx/3d/health
---
-## Agent Identity Studio — `$1.50` per identity
+## Agent Identity Studio, `$1.50` per identity
**The flagship.** Turns an AI agent's brand brief into a complete 3D identity:
- a **square PFP** (1024 px PNG + 128 px preview) framed head-and-shoulders, sized for the
OKX.AI avatar slot and legible at marketplace thumbnail size;
-- a **full-body render set** — three distinct poses from the three.ws pose library, studio
+- a **full-body render set**, three distinct poses from the three.ws pose library, studio
lighting, consistent backdrop;
- the **rigged, animation-ready GLB** itself (humanoid skeleton + skin weights), usable in
three.ws scenes, games, and any glTF runtime;
- a live [three.ws viewer](https://three.ws/viewer) link and pose-studio link.
-Endpoint: `https://three.ws/api/okx/3d/identity-studio` — an A2MCP service (MCP Streamable
+Endpoint: `https://three.ws/api/okx/3d/identity-studio`, an A2MCP service (MCP Streamable
HTTP, JSON-RPC `tools/call`). Demo identities generated end-to-end by this pipeline:
[three.ws/agent-identities](https://three.ws/agent-identities).
@@ -42785,7 +43924,7 @@ Arguments:
| `agent_name` | yes | ≤80 chars, rendered into the identity brief |
| `brief` | yes | any language; >2000 chars is truncated and the response flags `brief_truncated` |
| `style_hints` | no | palette / materials / era / mood |
-| `reference_image_url` | no | public image guiding the look — validated **before** any charge |
+| `reference_image_url` | no | public image guiding the look, validated **before** any charge |
Success returns `{ job_id, status: "queued", poll_tool: "identity_status", eta_seconds }`.
@@ -42807,24 +43946,24 @@ the full-body set, `rigged_glb_url`, `mesh_glb_url`, `viewer_url`, and `pose_stu
### Payment semantics
-Each guarantee below is enforced in code — the request path is
+Each guarantee below is enforced in code, the request path is
`verify → dispatch → settle-on-success` ([`api/okx/3d/[service].js`](../api/okx/3d/%5Bservice%5D.js)),
-so an engine error is answered *before* settlement — and is covered by the endpoint's unit
+so an engine error is answered *before* settlement, and is covered by the endpoint's unit
tests.
-- **You pay only when the job is accepted.** Input validation — including fetching your
- `reference_image_url` — runs before settlement; an invalid brief or unreachable image
+- **You pay only when the job is accepted.** Input validation, including fetching your
+ `reference_image_url`, runs before settlement; an invalid brief or unreachable image
fails the call and **no payment settles**.
- **Failed stages retry free.** Generation and rigging each retry up to 3 total attempts on
transient upstream failures; renders re-run on the next poll. Only exhausted retries mark
the job `failed`, with the last actionable error in `last_error`.
-- **Status polling is free and unauthenticated** — job tokens are HMAC-signed, so they are
+- **Status polling is free and unauthenticated**, job tokens are HMAC-signed, so they are
the only capability needed to read a job.
- One payment ↔ one job: the payment proof is single-use across dispatch + settlement
(replay-guarded), and the settled amount always equals the advertised price.
> **Not yet demonstrated end to end.** The X Layer rail reports `settleable: true` in
-> production, but no *funded* call has settled on-chain against this endpoint yet — the payer
+> production, but no *funded* call has settled on-chain against this endpoint yet, the payer
> wallet is unfunded, so every real attempt returns `insufficient_balance`. Treat the bullets
> above as the implemented and unit-tested contract, not as a claim of an observed on-chain
> settlement. The first settled transaction hash will be recorded in
@@ -42832,14 +43971,14 @@ tests.
### Also on this endpoint (free)
-- `getting_started` — overview of the server, tools, prices, and links.
-- `GET https://three.ws/api/okx/3d/identity-studio` — SSE / discovery challenge.
+- `getting_started`, overview of the server, tools, prices, and links.
+- `GET https://three.ws/api/okx/3d/identity-studio`, SSE / discovery challenge.
---
## Decomposed 3D studio services
-Micro-priced, single-capability REST endpoints — plain JSON `POST`, one price each, all
+Micro-priced, single-capability REST endpoints, plain JSON `POST`, one price each, all
backed by the same engines the [MCP 3D studio](./mcp.md) runs (no separate pipeline).
`GET` on any of them returns its free descriptor (price, description, input schema).
@@ -42856,13 +43995,12 @@ backed by the same engines the [MCP 3D studio](./mcp.md) runs (no separate pipel
The buyer flow is the same for all of them: unpaid `POST` → 402 → sign
(`onchainos payment pay --payload '<402 body>'`) → replay with
-`PAYMENT-SIGNATURE`. Generation-grade services reply `{status:"queued", job_id, poll_url}`
-— polling `GET https://three.ws/api/forge?job=<job_id>` is free and unlimited; fast
+`PAYMENT-SIGNATURE`. Generation-grade services reply `{status:"queued", job_id, poll_url}`, polling `GET https://three.ws/api/forge?job=<job_id>` is free and unlimited; fast
services (`retarget`, `pose-seed`) reply `{status:"done", …}` inline. Settlement happens
**after** the engine accepts the job; invalid input, the avatar humanoid gate, or an
engine failure answers before settlement and never charges.
-### Text → 3D Model (GLB) — $0.01
+### Text → 3D Model (GLB), $0.01
Textured GLB from a text prompt on the fast draft lane (NVIDIA NIM TRELLIS).
@@ -42872,7 +44010,7 @@ curl -i -X POST https://three.ws/api/okx/3d/text-to-3d \
-d '{"prompt":"a brass steampunk owl, full body"}'
```
-### Text → 3D Model (Pro) — $0.30
+### Text → 3D Model (Pro), $0.30
An LLM art director refines the prompt, then a higher-quality lane generates the GLB.
`tier:"standard"` (default) or `tier:"high"` (max geometric detail + PBR textures).
@@ -42883,7 +44021,7 @@ curl -i -X POST https://three.ws/api/okx/3d/text-to-3d-pro \
-d '{"prompt":"ornate elven longsword","tier":"high"}'
```
-### Image → 3D Model — $0.30
+### Image → 3D Model, $0.30
Reconstructs a textured GLB from 1–4 public photos of one object.
@@ -42893,21 +44031,21 @@ curl -i -X POST https://three.ws/api/okx/3d/image-to-3d \
-d '{"image_urls":["https://example.com/owl-front.jpg","https://example.com/owl-side.jpg"]}'
```
-### GLB Auto-Rigging — $0.25
+### GLB Auto-Rigging, $0.25
Adds an animation-ready humanoid skeleton and skin weights to a static GLB (UniRig lane).
```bash
curl -i -X POST https://three.ws/api/okx/3d/rig \
-H 'content-type: application/json' \
- -d '{"glb_url":"https://cdn.three.ws/models/knight.glb"}'
+ -d '{"glb_url":"https://three.ws/cdn/models/knight.glb"}'
```
-### Text → Rigged Avatar — $0.50
+### Text → Rigged Avatar, $0.50
Mesh generation + auto-rig in one call. Obvious non-humanoid prompts are refused **before**
payment settles (`allow_non_humanoid: true` overrides). The paid response returns the mesh
-GLB immediately (`mesh_glb_url` + viewer link) plus the rig job to poll — a rig hiccup
+GLB immediately (`mesh_glb_url` + viewer link) plus the rig job to poll, a rig hiccup
never loses the paid generation.
```bash
@@ -42916,9 +44054,9 @@ curl -i -X POST https://three.ws/api/okx/3d/avatar \
-d '{"prompt":"a heroic knight in silver armor, full body"}'
```
-### Animation Retargeting — $0.10
+### Animation Retargeting, $0.10
-Retargets a curated clip (idle, walk, dance, …) onto any rigged humanoid GLB — returns the
+Retargets a curated clip (idle, walk, dance, …) onto any rigged humanoid GLB, returns the
retargeted AnimationClip JSON keyed to the rig's actual bones plus a bone-coverage report.
Completes inside the request. Clip names are free at
[`/animations/manifest.json`](https://three.ws/animations/manifest.json).
@@ -42926,10 +44064,10 @@ Completes inside the request. Clip names are free at
```bash
curl -i -X POST https://three.ws/api/okx/3d/retarget \
-H 'content-type: application/json' \
- -d '{"model_url":"https://cdn.three.ws/models/knight-rigged.glb","animation":"idle"}'
+ -d '{"model_url":"https://three.ws/cdn/models/knight-rigged.glb","animation":"idle"}'
```
-### Pose Seed — $0.02
+### Pose Seed, $0.02
Deterministic pose resolution: natural-language description → stable seed + full
joint-rotation map for humanoid rigs. Same prompt, same pose, every time. Completes inside
@@ -42941,7 +44079,7 @@ curl -i -X POST https://three.ws/api/okx/3d/pose-seed \
-d '{"prompt":"confident standing pose, arms crossed"}'
```
-### FBX Export (rig-preserving) — $0.10
+### FBX Export (rig-preserving), $0.10
GLB → FBX for Unity/Unreal; a rigged GLB keeps its skeleton, skin weights, and blendshapes.
Other formats: `obj`, `stl`, `ply`, `usdz`, `3mf`.
@@ -42949,16 +44087,16 @@ Other formats: `obj`, `stl`, `ply`, `usdz`, `3mf`.
```bash
curl -i -X POST https://three.ws/api/okx/3d/fbx-export \
-H 'content-type: application/json' \
- -d '{"model_url":"https://cdn.three.ws/models/knight-rigged.glb","format":"fbx"}'
+ -d '{"model_url":"https://three.ws/cdn/models/knight-rigged.glb","format":"fbx"}'
```
### Guarantees (all decomposed services)
-- **Pay only after the job is accepted** — verify runs before the engine, settle after it;
+- **Pay only after the job is accepted**, verify runs before the engine, settle after it;
failure replies state explicitly that the payment was not taken.
-- **Retried payments are safe** — the same payment + body replays the same response
+- **Retried payments are safe**, the same payment + body replays the same response
(idempotency cache); a payment proof is single-use across dispatch + settlement.
-- **One service, one price** — every rail advertised in a service's 402 quotes the same
+- **One service, one price**, every rail advertised in a service's 402 quotes the same
amount, derived from the catalog module.
---
@@ -42973,7 +44111,7 @@ USDC rails. The wire format OKX buyers use (headers `PAYMENT-REQUIRED` /
---
-<a id="sec-192"></a>
+<a id="sec-199"></a>
> **Source:** `docs/onchain-agents.md` · [↑ table of contents](#table-of-contents)
@@ -43270,7 +44408,7 @@ A confirmed canary asset shows `inCollection=true`, `royalty=500bps`, `attrs=11`
---
-<a id="sec-193"></a>
+<a id="sec-200"></a>
> **Source:** `docs/openai-pr/00-START-HERE.md` · [↑ table of contents](#table-of-contents)
@@ -43367,7 +44505,7 @@ These are non-negotiable and OVERRIDE any default behavior:
---
-<a id="sec-194"></a>
+<a id="sec-201"></a>
> **Source:** `docs/openai-pr/01-orphan-widget-resolution.md` · [↑ table of contents](#table-of-contents)
@@ -43492,7 +44630,7 @@ fetches from** (three.ws, the R2 storage origin, and the CDN if used). Match wha
---
-<a id="sec-195"></a>
+<a id="sec-202"></a>
> **Source:** `docs/openai-pr/02-wellknown-manifest-conflict.md` · [↑ table of contents](#table-of-contents)
@@ -43613,7 +44751,7 @@ manifest layer. Recommended approach (implement this unless you find it wrong):
---
-<a id="sec-196"></a>
+<a id="sec-203"></a>
> **Source:** `docs/openai-pr/03-forge-free-tier-truth.md` · [↑ table of contents](#table-of-contents)
@@ -43715,7 +44853,7 @@ and a doc claiming it works.
---
-<a id="sec-197"></a>
+<a id="sec-204"></a>
> **Source:** `docs/openai-pr/04-openai-surface-test-coverage.md` · [↑ table of contents](#table-of-contents)
@@ -43801,7 +44939,7 @@ exported per the file). Use an existing JSON-schema/OpenAPI validator already in
---
-<a id="sec-198"></a>
+<a id="sec-205"></a>
> **Source:** `docs/openai-pr/05-custom-gpt-openapi-serving.md` · [↑ table of contents](#table-of-contents)
@@ -43890,7 +45028,7 @@ be normalized to one canonical form.
---
-<a id="sec-199"></a>
+<a id="sec-206"></a>
> **Source:** `docs/openai-pr/06-docs-accuracy-reconciliation.md` · [↑ table of contents](#table-of-contents)
@@ -43971,7 +45109,7 @@ Task 03). Do not fight those tasks for those specific edits; coordinate.
---
-<a id="sec-200"></a>
+<a id="sec-207"></a>
> **Source:** `docs/openai-pr/07-final-verification-and-submit.md` · [↑ table of contents](#table-of-contents)
@@ -44061,7 +45199,7 @@ go/no-go report. Do not submit; prepare so the human's final submit is one actio
---
-<a id="sec-201"></a>
+<a id="sec-208"></a>
> **Source:** `docs/oracle.md` · [↑ table of contents](#table-of-contents)
@@ -44445,7 +45583,7 @@ The more data we watch, the sharper every score. Oracle is live now.
---
-<a id="sec-202"></a>
+<a id="sec-209"></a>
> **Source:** `docs/package-extraction.md` · [↑ table of contents](#table-of-contents)
@@ -44564,7 +45702,7 @@ part of the extraction itself — extract and publish first, swap the import lat
---
-<a id="sec-203"></a>
+<a id="sec-210"></a>
> **Source:** `docs/partners/sperax-proposal.md` · [↑ table of contents](#table-of-contents)
@@ -44612,7 +45750,7 @@ Both sides already ship for a living — this proposal only asks each of us to d
---
-<a id="sec-204"></a>
+<a id="sec-211"></a>
> **Source:** `docs/pay-skills-listing.md` · [↑ table of contents](#table-of-contents)
@@ -44713,7 +45851,7 @@ are supported.
---
-<a id="sec-205"></a>
+<a id="sec-212"></a>
> **Source:** `docs/permissions.md` · [↑ table of contents](#table-of-contents)
@@ -45093,7 +46231,7 @@ Set `SMOKE_SKIP_REVOKE=1` to skip the on-chain revocation step if the test walle
---
-<a id="sec-206"></a>
+<a id="sec-213"></a>
> **Source:** `docs/persona-hub.md` · [↑ table of contents](#table-of-contents)
@@ -45256,8 +46394,8 @@ A successful response looks like:
"avatar": {
"id": "a-1",
"name": "My Avatar",
- "url": "https://cdn.three.ws/u/<user>/avatar.glb",
- "thumbnail_url": "https://cdn.three.ws/u/<user>/avatar.png"
+ "url": "https://three.ws/cdn/u/<user>/avatar.glb",
+ "thumbnail_url": "https://three.ws/cdn/u/<user>/avatar.png"
},
"tenant_origin": "https://coolgame.three.ws",
"alg": "ES256"
@@ -45296,8 +46434,8 @@ The base64url payload of the issued token decodes to:
"avatar": {
"id": "a-1",
"name": "My Avatar",
- "url": "https://cdn.three.ws/u/<user>/avatar.glb",
- "thumbnail_url": "https://cdn.three.ws/u/<user>/avatar.png"
+ "url": "https://three.ws/cdn/u/<user>/avatar.glb",
+ "thumbnail_url": "https://three.ws/cdn/u/<user>/avatar.png"
},
"iss": "https://three.ws",
"sub": "<three.ws user id>",
@@ -45490,7 +46628,7 @@ JWT claims:
---
-<a id="sec-207"></a>
+<a id="sec-214"></a>
> **Source:** `docs/plan-checkout.md` · [↑ table of contents](#table-of-contents)
@@ -45617,7 +46755,7 @@ Plan prices live in [api/payments/_config.js](../api/payments/_config.js) (`PLAN
---
-<a id="sec-208"></a>
+<a id="sec-215"></a>
> **Source:** `docs/popular-3d-github-repos.md` · [↑ table of contents](#table-of-contents)
@@ -45880,7 +47018,7 @@ Apply a 3D-signal regex filter over `description + topics` and a denylist of non
---
-<a id="sec-209"></a>
+<a id="sec-216"></a>
> **Source:** `docs/premium.md` · [↑ table of contents](#table-of-contents)
@@ -46003,7 +47141,7 @@ tiers that remain free (news feed, digest, archive stats/trending).
---
-<a id="sec-210"></a>
+<a id="sec-217"></a>
> **Source:** `docs/provenance.md` · [↑ table of contents](#table-of-contents)
@@ -46070,7 +47208,7 @@ Real hashing, real ed25519 signature, real on-chain write. Requires the issuer k
---
-<a id="sec-211"></a>
+<a id="sec-218"></a>
> **Source:** `docs/pump-fun-mcp-edge.md` · [↑ table of contents](#table-of-contents)
@@ -46126,7 +47264,7 @@ Both runtimes import `TOOLS` from `src/pump/mcp-tools.js`, so the tool list expo
---
-<a id="sec-212"></a>
+<a id="sec-219"></a>
> **Source:** `docs/pump-launch-repos.md` · [↑ table of contents](#table-of-contents)
@@ -46225,7 +47363,7 @@ rate-limits under the ~450 txs a full run makes. Pass a dedicated `--rpc`
---
-<a id="sec-213"></a>
+<a id="sec-220"></a>
> **Source:** `docs/pump-launcher.md` · [↑ table of contents](#table-of-contents)
@@ -46376,7 +47514,7 @@ token itself always deploys on **Solana mainnet** — pump.fun is mainnet-only.
---
-<a id="sec-214"></a>
+<a id="sec-221"></a>
> **Source:** `docs/pump-platform-fee.md` · [↑ table of contents](#table-of-contents)
@@ -46437,7 +47575,7 @@ The fee is **never** charged silently. When `platform_fee_bps > 0`:
---
-<a id="sec-215"></a>
+<a id="sec-222"></a>
> **Source:** `docs/pumpfun-program/README.md` · [↑ table of contents](#table-of-contents)
@@ -46496,7 +47634,7 @@ tracked in `tasks/pumpfun-upstream/01-v2-trade-instructions-usdc-audit.md`.
---
-<a id="sec-216"></a>
+<a id="sec-223"></a>
> **Source:** `docs/pumpfun-program/UPSTREAM-buy-sell-v2-announcement.md` · [↑ table of contents](#table-of-contents)
@@ -46600,7 +47738,7 @@ Currently, no quote mint other than native SOL can be used to create or trade co
---
-<a id="sec-217"></a>
+<a id="sec-224"></a>
> **Source:** `docs/pumpfun-program/UPSTREAM-pumpswap-virtual-quote-reserves.md` · [↑ table of contents](#table-of-contents)
@@ -46801,7 +47939,7 @@ Upstream: <https://github.com/pump-fun/pump-public-docs#pumpswap-update-virtual-
---
-<a id="sec-218"></a>
+<a id="sec-225"></a>
> **Source:** `docs/pumpfun-program/docs/BREAKING_FEE_RECIPIENT.md` · [↑ table of contents](#table-of-contents)
@@ -46875,7 +48013,7 @@ The new accounts can be passed before the program upgrade happens on Monday. The
---
-<a id="sec-219"></a>
+<a id="sec-226"></a>
> **Source:** `docs/pumpfun-program/docs/CPI_README.md` · [↑ table of contents](#table-of-contents)
@@ -46979,7 +48117,7 @@ pump-rust-client = { version = "...", path = "..." }
---
-<a id="sec-220"></a>
+<a id="sec-227"></a>
> **Source:** `docs/pumpfun-program/docs/FAQ.md` · [↑ table of contents](#table-of-contents)
@@ -47017,7 +48155,7 @@ is recommended to use a static big enough CU limit like `100_000`.
---
-<a id="sec-221"></a>
+<a id="sec-228"></a>
> **Source:** `docs/pumpfun-program/docs/FEE_PROGRAM_README.md` · [↑ table of contents](#table-of-contents)
@@ -47231,7 +48369,7 @@ If you implement the fee logic correctly, any future change to the fee tiers str
---
-<a id="sec-222"></a>
+<a id="sec-229"></a>
> **Source:** `docs/pumpfun-program/docs/FEE_RECIPIENTS.md` · [↑ table of contents](#table-of-contents)
@@ -47294,7 +48432,7 @@ Use one of these as `buybackFeeRecipient` for any coin.
---
-<a id="sec-223"></a>
+<a id="sec-230"></a>
> **Source:** `docs/pumpfun-program/docs/PUMP_CASHBACK_README.md` · [↑ table of contents](#table-of-contents)
@@ -47411,7 +48549,7 @@ To read unclaimed cashback for pump swap / Pump AMM program:
---
-<a id="sec-224"></a>
+<a id="sec-231"></a>
> **Source:** `docs/pumpfun-program/docs/PUMP_CREATOR_FEE_README.md` · [↑ table of contents](#table-of-contents)
@@ -47546,7 +48684,7 @@ we update the programs on Mainnet.
---
-<a id="sec-225"></a>
+<a id="sec-232"></a>
> **Source:** `docs/pumpfun-program/docs/PUMP_PROGRAM_README.md` · [↑ table of contents](#table-of-contents)
@@ -47747,7 +48885,7 @@ at https://solscan.io/account/EsmVk4MTsoT71JFaRM5DWFZboKpMQjfY6EYzAgUuksXw#accou
---
-<a id="sec-226"></a>
+<a id="sec-233"></a>
> **Source:** `docs/pumpfun-program/docs/PUMP_SWAP_CREATOR_FEE_README.md` · [↑ table of contents](#table-of-contents)
@@ -47856,7 +48994,7 @@ PumpSwap program on Mainnet to the coin creator fee update.
---
-<a id="sec-227"></a>
+<a id="sec-234"></a>
> **Source:** `docs/pumpfun-program/docs/PUMP_SWAP_README.md` · [↑ table of contents](#table-of-contents)
@@ -48090,7 +49228,7 @@ Each Anchor instruction has a set of corresponding autocomplete methods that can
---
-<a id="sec-228"></a>
+<a id="sec-235"></a>
> **Source:** `docs/pumpfun-program/docs/PUMP_SWAP_SDK_README.md` · [↑ table of contents](#table-of-contents)
@@ -48170,7 +49308,7 @@ to autocomplete the `base` and `quote` displayed amounts based on the `lpToken`
---
-<a id="sec-229"></a>
+<a id="sec-236"></a>
> **Source:** `docs/pumpfun-program/docs/instructions/BUY.md` · [↑ table of contents](#table-of-contents)
@@ -48348,7 +49486,7 @@ ixs.extend(
---
-<a id="sec-230"></a>
+<a id="sec-237"></a>
> **Source:** `docs/pumpfun-program/docs/instructions/CLAIM_CASHBACK.md` · [↑ table of contents](#table-of-contents)
@@ -48458,7 +49596,7 @@ let ix = sdk.claim_cashback_v2_instruction(
---
-<a id="sec-231"></a>
+<a id="sec-238"></a>
> **Source:** `docs/pumpfun-program/docs/instructions/COIN_CREATION.md` · [↑ table of contents](#table-of-contents)
@@ -48613,7 +49751,7 @@ let ixs = sdk
---
-<a id="sec-232"></a>
+<a id="sec-239"></a>
> **Source:** `docs/pumpfun-program/docs/instructions/COLLECT_CREATOR_FEE.md` · [↑ table of contents](#table-of-contents)
@@ -48715,7 +49853,7 @@ ixs.extend(sdk.collect_creator_fee_v2_instructions(
---
-<a id="sec-233"></a>
+<a id="sec-240"></a>
> **Source:** `docs/pumpfun-program/docs/instructions/CREATOR_FEE_SHARING.md` · [↑ table of contents](#table-of-contents)
@@ -49069,7 +50207,7 @@ ixs.extend(sdk.distribute_creator_fees_v2_instructions(
---
-<a id="sec-234"></a>
+<a id="sec-241"></a>
> **Source:** `docs/pumpfun-program/docs/instructions/SELL.md` · [↑ table of contents](#table-of-contents)
@@ -49246,7 +50384,7 @@ ixs.extend(
---
-<a id="sec-235"></a>
+<a id="sec-242"></a>
> **Source:** `docs/quick-start.md` · [↑ table of contents](#table-of-contents)
@@ -49392,6 +50530,7 @@ The `brain` attribute turns the 3D viewer into a conversational agent:
| `brain` | LLM model ID. Registered Claude IDs: `claude-sonnet-4-6`, `claude-opus-4-7`, `claude-opus-4-6`, `claude-haiku-4-5-20251001`, `claude-fable-5`, `claude-mythos-5`. Free models (no key, routed through the platform proxy) are also accepted, e.g. `meta-llama/llama-3.3-70b-instruct:free`. Omit for a viewer-only display with no AI (provider `none`). |
| `instructions` | System prompt for the agent's personality and role. |
| `mode` | Layout mode: `inline` (flows with page content), `floating` (fixed bubble in a corner), `fullscreen`, or `section`. Default: `inline`. |
+| `sign-language` | The avatar signs every reply in ASL fingerspelling plus its sign vocabulary (any value except `off`/`false` enables it; works at boot or toggled at runtime). See the [sign language guide](sign-language.md). |
The chat input and microphone button appear automatically when `brain` is set. The agent can play animations, look at the camera, and respond to voice input.
@@ -49541,7 +50680,7 @@ If you're embedding inside a sandboxed iframe, make sure the parent grants `allo
---
-<a id="sec-236"></a>
+<a id="sec-243"></a>
> **Source:** `docs/radar.md` · [↑ table of contents](#table-of-contents)
@@ -49635,7 +50774,7 @@ console.log(clean.map((c) => `${c.symbol} q${c.quality_score}`));
---
-<a id="sec-237"></a>
+<a id="sec-244"></a>
> **Source:** `docs/remix.md` · [↑ table of contents](#table-of-contents)
@@ -49837,7 +50976,7 @@ still recorded — the royalty leg reports `payout_unconfigured` instead of payi
---
-<a id="sec-238"></a>
+<a id="sec-245"></a>
> **Source:** `docs/reputation.md` · [↑ table of contents](#table-of-contents)
@@ -50045,7 +51184,7 @@ See the [Validation](./validation.md) documentation for details.
---
-<a id="sec-239"></a>
+<a id="sec-246"></a>
> **Source:** `docs/restyle.md` · [↑ table of contents](#table-of-contents)
@@ -50145,7 +51284,7 @@ Pass the returned `lineage` array back as `parent_lineage` on the next call to e
---
-<a id="sec-240"></a>
+<a id="sec-247"></a>
> **Source:** `docs/risk-acknowledgment.md` · [↑ table of contents](#table-of-contents)
@@ -50257,7 +51396,7 @@ the same change.
---
-<a id="sec-241"></a>
+<a id="sec-248"></a>
> **Source:** `docs/robinhood-chain-markets.md` · [↑ table of contents](#table-of-contents)
@@ -50358,7 +51497,7 @@ math; Chainlink feed prices are already multiplier-adjusted, so they're never re
---
-<a id="sec-242"></a>
+<a id="sec-249"></a>
> **Source:** `docs/sas-attestations.md` · [↑ table of contents](#table-of-contents)
@@ -50587,7 +51726,7 @@ Closing (revoking) an attestation is done server-side via `sasClose()` in [api/_
---
-<a id="sec-243"></a>
+<a id="sec-250"></a>
> **Source:** `docs/scene-studio.md` · [↑ table of contents](#table-of-contents)
@@ -50655,7 +51794,7 @@ A typical round trip from another studio:
---
-<a id="sec-244"></a>
+<a id="sec-251"></a>
> **Source:** `docs/sdk.md` · [↑ table of contents](#table-of-contents)
@@ -51095,7 +52234,7 @@ python3 -m http.server 8080
---
-<a id="sec-245"></a>
+<a id="sec-252"></a>
> **Source:** `docs/security.md` · [↑ table of contents](#table-of-contents)
@@ -51457,7 +52596,7 @@ For validator misconduct (biased or falsified on-chain attestations), open a pub
---
-<a id="sec-246"></a>
+<a id="sec-253"></a>
> **Source:** `docs/selfie-to-avatar.md` · [↑ table of contents](#table-of-contents)
@@ -51548,7 +52687,7 @@ Request body: `name` (1-120, required), `photos` (1-6 image URLs or data URIs) *
---
-<a id="sec-247"></a>
+<a id="sec-254"></a>
> **Source:** `docs/share-and-embed.md` · [↑ table of contents](#table-of-contents)
@@ -51645,63 +52784,143 @@ To customize the preview image, change the agent's thumbnail in the editor.
---
-<a id="sec-248"></a>
+<a id="sec-255"></a>
> **Source:** `docs/sign-language.md` · [↑ table of contents](#table-of-contents)
# Sign language: avatars that sign
-three.ws avatars can communicate in American Sign Language. Today that means ASL fingerspelling everywhere an avatar performs, and signed chat replies on the platform's conversational surfaces. The system is built in layers so that real lexical signs (captured from human signers) progressively replace fingerspelling word by word as the sign library grows.
+three.ws avatars can communicate in American Sign Language. Words with a sign are signed, on one or both hands; everything else is fingerspelled. It runs everywhere an avatar performs, including signed chat replies on the platform's conversational surfaces.
> Studio usage (the Spell box, exports, share links) is covered in [Animation Studio](./animation-studio.md). This page covers the system: the engines, the chat integration, and the roadmap.
## What works today
-- **Fingerspell any word.** All 26 ASL handshapes, the traced J and Z motions, and the double-letter bounce, compiled on-device into a standard animation clip that plays on any rigged avatar with finger bones. Try it at [/pose](https://three.ws/pose), or share a spelled word: `https://three.ws/pose?spell=HELLO`.
+- **Fingerspell any word or number.** All 26 ASL letter handshapes, the number handshapes 0-9, the traced J and Z motions, and the double-letter bounce, compiled on-device into a standard animation clip that plays on any rigged avatar with finger bones. Try it at [/pose](https://three.ws/pose), or share a spelled word: `https://three.ws/pose?spell=HELLO`.
- **Signed chat replies.** In the [/app](https://three.ws/app) agent chat, the 🤟 button in the chat header turns on sign-language mode: the avatar signs every assistant reply. Embedders get the same with one attribute on the web component:
```html
<agent-3d agent-id="your-agent" chat sign-language></agent-3d>
```
-- **Motion capture with hands.** The video-to-motion worker tracks 21 landmarks per hand and solves all 30 finger joints, so a video of a real signer becomes a retargetable animation clip. This is the pipeline that will populate the lexical sign dictionary.
+- **Sign INTO the chat with your camera.** The 🎥 button in the agent chat opens your webcam with a mirrored self-view: fingerspell at the camera, click again, and the transcription lands in the message box for review before sending. Landmarks are extracted in your browser (MediaPipe Holistic), so video never leaves your device: only pose coordinates go to the recognizer ([workers/model-asl-recognition](../workers/model-asl-recognition), the Kaggle-2023 1st-place fingerspelling model; Apache-2.0 weights, CC BY 4.0 corpus). Expect a 10-20% character error rate on webcam fingerspelling; the chat model is robust to it.
+- **Signed sentences, not lists of words.** A signer raises their hands once for a sentence and lowers them once at the end. The compiler does the same: only the first word leads in from rest, only the last settles back, and everything between keeps the hands up in signing space. You can also set the pace (0.5×, 0.75×, 1×) and switch the avatar to left-handed signing, since about one signer in ten is left-dominant; both choices, and the avatar choice, persist across visits. Under `prefers-reduced-motion` the page never auto-plays; signing starts only on an explicit action.
+- **Contact that actually touches.** Signs like FALL, HELP, GOOD and KNOW are defined by contact: two fingers stand *on* the flat palm, the fingertips touch the *forehead*. Those are solved from the posed geometry rather than from a fixed wrist coordinate, so the contact still lands on an avatar with longer fingers or a bigger head.
+- **Non-manual markers.** In ASL the face is grammar: raised brows mark a yes/no question, furrowed brows a wh-question. Signs carry those markers as blendshape lanes, applied on any avatar that ships ARKit face shapes (most generated avatars do). An avatar without them still signs; it just loses the marker. On [/sign-language](https://three.ws/sign-language) the Avatar setting switches the hero between the light classic rig and an expressive rig whose face actually shows the markers.
+- **A lexical sign vocabulary.** Common words are SIGNED, not spelled: `HELLO`, `THANK`, `HAPPY`, `SORRY`, `HELP`, `LOVE`, `WANT`, `YALL` and the rest of [`src/sign-dictionary.js`](../src/sign-dictionary.js), two-handed where the sign is two-handed. Browse and play the whole vocabulary at [/sign-language](https://three.ws/sign-language), or share a signed phrase directly: `https://three.ws/sign-language?say=happy+to+meet+you` (the page's share chip copies this link for whatever was just signed). A word with no sign fingerspells, in the same clip, with no seam.
+- **Motion capture with hands.** The video-to-motion worker tracks 21 landmarks per hand and solves all 30 finger joints, so a video of a real signer becomes a retargetable animation clip: the path for growing the vocabulary from real signers.
## How it works
-Two engines, both dependency-free JavaScript modules:
+Signing is a spatial language. A sign is a handshape, a place on or in front of the body, and a movement between places: never a list of joint angles. The stack is built that way, as dependency-free JavaScript modules:
-- [`src/fingerspelling.js`](../src/fingerspelling.js) — a parametric ASL hand model. Each letter is defined by per-finger curl, splay, a thumb preset, and wrist orientation, compiled to quaternion tracks on the canonical skeleton. `buildFingerspellingClip('HELLO')` returns the same `AnimationClip` JSON document the animation library serves.
-- [`src/sign-speech.js`](../src/sign-speech.js) — the signed counterpart of text-to-speech. `compileUtterance(text, { signs })` splits text into words, resolves each against a sign dictionary (lexical clips), fingerspells the misses, and concatenates everything into one continuous clip. `SignSpeaker` drives an avatar's `AnimationManager` like a TTS engine:
+- [`src/sign-rig.js`](../src/sign-rig.js), kinematics for the canonical skeleton. It **measures** the reference rig (bone axes, bone lengths, each hand's palm and thumb-side directions, where its fingertips are, the parent chain) from the generated bind pose in `src/animation-canonical-rest.js` rather than assuming a convention, then offers forward kinematics (`Pose`), a two-bone arm IK (`solveArm`) that puts a wrist at a POINT with a natural elbow, and the hand geometry (`handPoint`, `handPartOffset`) that contact is solved from. Assuming the convention instead of measuring it is what once left the signing arm pointing behind the avatar's back.
+- [`src/sign-handshapes.js`](../src/sign-handshapes.js), the handshape catalogue: A-Z, 0-9, and the named shapes with no letter (`CLAW`, `FLAT_O`, `BENT_B`, `OPEN_8`, `ILY`). Each is per-finger curl, splay, and a thumb preset.
+- [`src/sign-clip.js`](../src/sign-clip.js), the authoring layer: a resting signer to start and end from, `posePhase()` to solve one phase of a sign, and `SignTimeline` to string phases together with eased transitions, a breathing idle, and clip output.
+- [`src/sign-dictionary.js`](../src/sign-dictionary.js), the vocabulary. Each sign lists its phases; `both:` poses two hands from one description because places and directions are body-relative, so the non-dominant hand mirrors for free.
+- [`src/fingerspelling.js`](../src/fingerspelling.js), the manual alphabet. The hand sits in front of the dominant shoulder at jaw height, palm to the reader, and only the handshape changes between letters, which is what makes fingerspelling readable. `buildFingerspellingClip('HELLO')` returns the same `AnimationClip` JSON document the animation library serves.
+- [`src/sign-speech.js`](../src/sign-speech.js), the signed counterpart of text-to-speech. `compileUtterance(text, { signs })` splits text into words, resolves each against a sign dictionary (lexical clips), fingerspells the misses, and concatenates everything into one continuous clip. `SignSpeaker` drives an avatar's `AnimationManager` like a TTS engine:
```js
import { SignSpeaker } from './sign-speech.js';
+// The built-in vocabulary is the default: known words sign, the rest spell.
const speaker = new SignSpeaker({ manager: viewer.animationManager });
-await speaker.speak('hello world'); // resolves when the signing ends
+const { signed, spelled } = await speaker.speak('happy to meet you');
+// signed → ['HAPPY', 'MEET', 'YOU']
+// spelled → ['TO']
+```
+
+Pass `signs: null` for spelling only, or your own lookup to override the vocabulary. Every clip is upper-body: signing never writes the root translation, so it can never move the avatar off the floor.
+
+Adding a sign is a data change. Describe its phases and assert where the hands land:
+
+```js
+// src/sign-dictionary.js
+WELCOME: {
+ gloss: 'Open palm sweeps in toward the body, inviting.',
+ phases: [
+ { t: 0.32, right: { shape: 'FLAT', at: { anchor: 'sternum', out: 0.22, up: -0.04, forward: 0.30 },
+ fingers: ['forward', 'out'], palm: 'up' }, head: { turn: -4 } },
+ { t: 0.34, right: { shape: 'FLAT', at: { anchor: 'sternum', out: 0.02, up: -0.06, forward: 0.22 },
+ fingers: ['forward', 'in'], palm: 'up' }, head: { nod: 4 }, hold: 0.18 },
+ ],
+},
+```
+
+Anchors (`forehead`, `nose`, `chin`, `mouth`, `sternum`, `belly`, `shoulder`, `hip`) are measured off the reference skeleton and follow the body, so a place on the chin stays on the chin when the head turns. Offsets are metres: `out` away from the midline, `in` toward it, `forward` toward the person reading. Directions take the same words. Because a sign is described anatomically, the same entry reads correctly on a tall avatar, a short one, and either hand.
+
+A sign defined by contact says so instead of guessing a coordinate. `touch` names the part of the acting hand, and what it meets: the other hand, or a place on the body:
+
+```js
+FALL: {
+ gloss: 'Two legs stand on the flat palm, then tip over onto their back.',
+ phases: [
+ { t: 0.32, left: BASE_PALM,
+ right: { shape: 'V', touch: { part: 'fingertips', on: 'palm' }, fingers: 'down', palm: 'back' }, hold: 0.16 },
+ { t: 0.3, left: BASE_PALM,
+ right: { shape: 'V', touch: { part: 'edge', on: 'palm', out: 0.09, up: 0.02 },
+ fingers: ['out', 'forward'], palm: 'up' }, head: { turn: -4, tilt: 4 }, hold: 0.2 },
+ ],
+},
+```
+
+The solver works backwards: the hand's orientation is known from `fingers`/`palm`, so the offset from the wrist to the touching part is known, and the wrist goes wherever puts that part on the target. Hand parts are `wrist`, `palm`, `back`, `knuckles`, `fingers`, `edge`, `fingertips`, `indextip`, `middletip`, `thumbtip`; `gap` holds a clearance instead of touching.
+
+Grammar on the face is a `face:` key, naming a marker (`question`, `wh`, `negate`, `topic`, `pleasant`, `concern`, `intense`) or explicit blendshape weights:
+
+```js
+{ face: 'wh', t: 0.3, both: { shape: '5', at: NEUTRAL, fingers: ['forward', 'out'], palm: 'up' },
+ head: { tilt: 3, nod: -3 } },
```
Chat surfaces integrate through `AgentAvatar.setSignLanguage(true)`: the avatar layer already receives every assistant reply (the protocol `SPEAK` event), so signing rides the same event with no per-surface plumbing. Rigs without finger bones are refused with an explanation rather than signing wrong.
+## Checking a sign
+
+Two tools, because signing fails in two different ways.
+
+**Positional goldens** catch a sign drifting. `tests/sign-goldens.test.js` compares every sign's wrists, elbows and fingertips at four moments against `tests/fixtures/sign-poses.json`, with an 8 mm tolerance. A change to the IK, an anchor, or a shared handshape moves many signs at once, and no property assertion notices five centimetres. After an intended change, re-record and read the diff:
+
+```bash
+node scripts/build-sign-goldens.mjs
+```
+
+**A contact sheet** catches a sign being illegible, which is a judgement made by looking. With the dev server running:
+
+```bash
+npm run sign:sheet # every sign, one frame each
+npm run sign:sheet -- --letters # the manual alphabet
+npm run sign:sheet -- --sign FALL --frames 8 # one sign over time
+npm run sign:sheet -- --dominant Left # left-handed signer
+```
+
+`tests/sign-linguistics.test.js` additionally lints the vocabulary against Battison's constraints: when both hands move they must share a handshape, and a passive hand of a different handshape must be one of the unmarked set. A new entry is checked against the language, not just against whether it renders.
+
## Honest scope
-Fingerspelling spells English words letter by letter; it is not grammatical ASL, which has its own grammar and non-manual markers (facial expressions carry meaning). The design principle for the lexical layer: signs come from recordings of real signers, captured through the motion pipeline, never synthesized guesses. That is also why the sign dictionary starts empty rather than shipping approximations.
+The vocabulary is a core set of citation-form signs, strung together in English word order. That is signed English, not ASL grammar: real ASL reorders sentences, inflects verbs through space, and carries grammar on the face. The signs here are authored from standard descriptions, not captured from a specific signer, so they read as clear citation forms rather than as any individual's signing. Words with no entry are fingerspelled letter by letter.
+
+Non-manual markers cover brows, eyes and mouth on avatars that carry ARKit blendshapes; the default classic rig on /sign-language has none (switch the Avatar setting to the expressive rig to see them). Marker coverage is also a fraction of what the face does in real ASL, which includes mouth morphemes, eye gaze, and body shift that this does not model.
+
+None of this replaces a human interpreter. It makes an avatar legible to signers instead of silent.
## Roadmap
-1. **Lexical sign dictionary** — captured clips (commissioned signers, community capture through [Motion Swap](https://three.ws/motion-swap), permissively licensed video) served as a `sign-language` library category and fed to `compileUtterance` so common words are signed, not spelled.
-2. **Sign recognition** — webcam ASL input transcribed to text for the chat (the reverse direction), so signed conversations work both ways.
-3. **Non-manual markers** — eyebrow and mouth blendshape tracks alongside the hand tracks.
-4. **Standalone package** — the engines are platform-free by design and will ship as an npm package plus reference integration.
+1. **Captured signs**: clips from real signers (commissioned, community capture through [Motion Swap](https://three.ws/motion-swap), permissively licensed video) replacing authored entries word by word, through the same dictionary interface.
+2. **Word-level sign recognition**: the current recognizer reads fingerspelling; a 250-sign vocabulary model (MIT architecture retrained on the CC BY 4.0 PopSign corpus) will let common signs be recognized directly.
+3. **Review by Deaf signers**: the vocabulary is authored, not validated. Growing it past a core set should follow review and capture, not more authoring.
+4. **Standalone package**: the engines are platform-free by design and will ship as an npm package plus reference integration.
## Related
-- [Animation Studio](./animation-studio.md) — the Spell box, exports, and share links
-- [docs/animations.md](./animations.md) — clip formats and the retarget engine
-- [Motion Swap](https://three.ws/motion-swap) — video motion capture, including hands
+- [Animation Studio](./animation-studio.md), the Spell box, exports, and share links
+- [docs/animations.md](./animations.md), clip formats and the retarget engine
+- [Motion Swap](https://three.ws/motion-swap), video motion capture, including hands
---
-<a id="sec-249"></a>
+<a id="sec-256"></a>
> **Source:** `docs/signals.md` · [↑ table of contents](#table-of-contents)
@@ -51807,7 +53026,7 @@ curl -s https://three.ws/api/signals/subscribe -H 'authorization: Bearer YOUR_TO
---
-<a id="sec-250"></a>
+<a id="sec-257"></a>
> **Source:** `docs/sketchfab.md` · [↑ table of contents](#table-of-contents)
@@ -51897,7 +53116,7 @@ and [`api/_lib/sketchfab.js`](https://github.com/nirholas/three.ws/blob/main/api
---
-<a id="sec-251"></a>
+<a id="sec-258"></a>
> **Source:** `docs/skills.md` · [↑ table of contents](#table-of-contents)
@@ -52644,7 +53863,7 @@ Publish your own from the marketplace ("Publish a Skill") or `POST /api/skills`
---
-<a id="sec-252"></a>
+<a id="sec-259"></a>
> **Source:** `docs/smart-contracts.md` · [↑ table of contents](#table-of-contents)
@@ -53250,7 +54469,7 @@ On Base at typical gas prices (~0.001 gwei base fee), an agent registration runs
---
-<a id="sec-253"></a>
+<a id="sec-260"></a>
> **Source:** `docs/smart-money.md` · [↑ table of contents](#table-of-contents)
@@ -53356,7 +54575,188 @@ for (const c of conviction.slice(0, 5)) {
---
-<a id="sec-254"></a>
+<a id="sec-261"></a>
+
+> **Source:** `docs/sniper-autonomy.md` · [↑ table of contents](#table-of-contents)
+
+# Earned autonomy: freedom the fleet has to trade for
+
+The sniper fleet runs several strategies ("arms") side by side against the same
+market. Two loops improve them without a human in the seat: the
+[optimizer](../api/cron/sniper-optimize.js) tunes each arm's own knobs, and the
+[evolution loop](../scripts/sniper-evolve.mjs) moves budget between arms.
+
+Both used to treat every arm identically. Same hard bounds, same per-run step,
+same short list of writable fields, same context in front of the LLM judge. An
+arm that had been profitable for weeks was allowed to search exactly as narrow a
+space as one that had never had a winning day, and was told exactly as little
+before deciding.
+
+Earned autonomy fixes that. An arm's own realized record decides how much rope it
+gets, and the decision is recomputed from scratch every run.
+
+## The tiers
+
+| Tier | Earned by | What it grants |
+|---|---|---|
+| `probation` | net negative with an average per-trade edge at or below -0.5%, over 15+ real trades | Narrowed bounds, half-size steps, per-trade size capped at 0.05 SOL, base knowledge |
+| `standard` | the default: too few trades to judge, or no decisive edge | Historical bounds and steps, base knowledge |
+| `trusted` | net positive with an average edge of at least +0.5%, over 12+ real trades | Wider bounds, 1.75x steps, unlocks the entry universe, the LLM confidence bar and the take-initials ladder, informed knowledge pack |
+| `autonomous` | net positive with an average edge of at least +5%, over 40+ real trades | Widest bounds, 2.5x steps, every tunable field, complete knowledge pack |
+
+The gates live in [`api/_lib/sniper-autonomy.js`](../api/_lib/sniper-autonomy.js)
+as `GATES`, and the whole policy is pure: no I/O, no clock, no DB, so the same
+function decides the tier everywhere it is read and the entire thing is
+unit-testable ([tests](../tests/sniper-autonomy.test.js)).
+
+### Why average edge and not win rate
+
+An arm can win 36% of the time and still be the most profitable on the board,
+because the winners are far larger than the losers. Win rate would demote that
+arm. The tier is decided on realized net P&L plus average per-trade edge, so the
+arm that actually makes money is the one that earns room, whatever its hit rate.
+
+The reverse case is just as important: an arm that wins 60% of its trades and is
+still net negative (small winners, large losers) is not succeeding, and gets
+`probation` rather than a reward.
+
+### It is symmetric, and it is continuous
+
+A tier is not granted once. Every optimizer run recomputes it against a trailing
+window, so an arm that stops making money loses its rope on the next pass without
+anyone intervening, and a demoted arm earns it back the same way. Freedom is
+rented, never owned.
+
+## What a tier changes
+
+### 1. How far and how fast the optimizer may move a knob
+
+Each tier carries its own `TIER_BOUNDS` and a step multiplier. Higher tiers widen
+the search space in both directions and let a single run move further; probation
+narrows it and halves the step. `standard` is the historical behaviour exactly,
+so anything that does not pass a tier is unchanged.
+
+### 2. Which fields the optimizer may touch at all
+
+Every tier can tune stops, take-profit, hold time, the quality and oracle floors,
+and position size. Reaching `trusted` unlocks four more:
+
+- `llm_min_confidence`: a profitable judge earns a lower bar, so it acts on more
+ of what it sees instead of passing on launches it would have won.
+- `min_market_cap_usd` / `max_market_cap_usd`: a wider hunting ground, widened
+ outward only. An arm with no band set is already unrestricted and nothing here
+ will restrict it.
+- `initials_out_multiple`, the proactive
+ [take-initials ladder](./trading-experiment.md): recover the stake as soon as
+ the position hits 2x rather than waiting for an exit to trigger. Turned on only
+ for an arm whose winners demonstrably run past its average exit. Note this is
+ only the *early* recovery: never fully selling a winner is fleet-wide policy
+ that applies at every tier, ladder or no ladder.
+
+`autonomous` adds `max_creator_launches`, so a proven arm can test whether a
+prolific creator is really a bad one.
+
+### 3. How much of the fleet budget an arm concentrates
+
+The evolution loop multiplies each arm's fitness by its tier weight (0.6 on
+probation up to 2.2 at autonomous) before splitting the fixed fleet budget. The
+fleet total never changes and the per-arm floor still keeps exploration alive:
+this only decides how the same pot is divided.
+
+### 4. How much the LLM judge is told
+
+This is the "more knowledge" half, and it is built in
+[`workers/agent-sniper/judge-knowledge.js`](../workers/agent-sniper/judge-knowledge.js).
+
+- **base** (probation, standard): the launch brief and the market-realness read.
+ Exactly the prompt the judge has always received.
+- **informed** (trusted): plus the ground-truth base rate (what fraction of
+ launches actually win, so the model knows how skeptical its prior should be),
+ the learned signal weights retrained every 15 minutes from labeled outcomes,
+ and the arm's own realized record.
+- **full** (autonomous): plus the conditional win-rate table (per signal bucket,
+ the realized win rate versus baseline: what actually happened, not a
+ correlation the model has to interpret) and the model's own calibration, so it
+ can correct its own bias.
+
+Every line of it is read from real rows. When a table is empty or the database is
+unreachable the pack degrades to a shorter block or to nothing at all, and the
+judge falls back to the prompt it used before. An arm is told what is true or it
+is told nothing.
+
+**Cost note.** Verdicts are cached per `(mint, model, knowledge depth)`. Arms at
+base depth still share one call across a same-model fleet exactly as before. An
+arm with earned context is asking a materially different question, so it pays for
+its own call. Only a profitable arm has one.
+
+## What no tier can ever touch
+
+Earned autonomy widens the space an arm may search. It never removes the floor
+under it. These are enforced at the `executeBuy` chokepoint and are out of reach
+of both loops at every tier:
+
+- the trade firewall's real buy → sell round-trip
+- Mayhem exclusion
+- `max_price_impact_pct` and slippage caps
+- SOL headroom and the daily loss cap
+- `max_concurrent_positions`
+- the fleet daily budget ceiling
+- the kill switch
+
+A hard stop-loss also survives every tier. The range widens (up to 65% at
+`autonomous`) but it can never be unset and never reach zero, so "no stop" is not
+a state any amount of profit can unlock. The worst an autonomous arm can do is
+take a firewall-vetted, stop-loss-protected, budget-bounded trade.
+
+A test asserts this directly: no safety field appears in any tier's writable set,
+and every tier keeps a bounded stop.
+
+## Reading it
+
+The tier is visible in three places:
+
+- **[/sniper/experiments](https://three.ws/sniper/experiments)**: a badge on any
+ arm that has moved off `standard`, with the evidence in its tooltip, plus an
+ "Earned autonomy" summary tile. `GET /api/sniper/experiments` returns
+ `autonomy_tier`, `autonomy_reason` and `autonomy_grants` per arm.
+- **`agent_sniper_optimizer_runs`**: every run records the `autonomy_tier` and
+ `autonomy_reason` it acted under, so you can see which tier an arm held when a
+ given knob moved.
+- **the Reasoning Ledger**: an applied tuning names the tier and its evidence in
+ the rationale, next to the trades it learned from.
+
+## Worked example
+
+The fleet as of 2026-07-25, classified over its all-time record:
+
+| Arm | Closed | Net SOL | Avg edge | Tier |
+|---|---|---|---|---|
+| llm-grok | 33 | +0.0027 | +0.81% | `trusted` |
+| llm-auto | 20 | +0.0001 | +0.04% | `standard` (noise, not profit) |
+| llm-claude | 13 | -0.0116 | -8.89% | `standard` (sample below the demotion gate) |
+| boost-ride | 62 | -0.0201 | -3.24% | `probation` |
+| oracle-open | 30 | -0.0234 | -15.4% | `probation` |
+
+`llm-grok` is the only arm that has earned anything, which is the correct read:
+it is the only one with a real sample and a real profit. Its budget share rises
+by roughly half, its judge starts seeing the base rate and the learned weights,
+and the optimizer may now walk its confidence floor down and turn its ladder on.
+`boost-ride` wins 60% of its trades and is still net negative, so it is held
+tighter rather than rewarded for the hit rate.
+
+## Related
+
+- [Agent Sniper](./agent-sniper.md): the trading pipeline the arms run on
+- [The 10 SOL trading experiment](./trading-experiment.md): the exit thesis the
+ ladder implements
+- [`api/_lib/sniper-optimizer.js`](../api/_lib/sniper-optimizer.js): the tuning
+ rules, tier-scaled
+- [`scripts/sniper-evolve.mjs`](../scripts/sniper-evolve.mjs): the portfolio
+ layer, tier-weighted
+
+---
+
+<a id="sec-262"></a>
> **Source:** `docs/social-layer.md` · [↑ table of contents](#table-of-contents)
@@ -53583,7 +54983,7 @@ be replayed any time from the getting-started page.
---
-<a id="sec-255"></a>
+<a id="sec-263"></a>
> **Source:** `docs/solana-pumpfun.md` · [↑ table of contents](#table-of-contents)
@@ -53770,7 +55170,7 @@ The MCP client and cron crawler are unit-tested with mocked `fetch` and `sql`. E
---
-<a id="sec-256"></a>
+<a id="sec-264"></a>
> **Source:** `docs/solana-reputation.md` · [↑ table of contents](#table-of-contents)
@@ -53969,7 +55369,7 @@ The shapes differ; the purpose is identical — let an agent decide, before it p
---
-<a id="sec-257"></a>
+<a id="sec-265"></a>
> **Source:** `docs/solana.md` · [↑ table of contents](#table-of-contents)
@@ -54218,7 +55618,7 @@ A full ERC-8004-equivalent on Solana (Identity / Reputation / Validation as Anch
---
-<a id="sec-258"></a>
+<a id="sec-266"></a>
> **Source:** `docs/spatial-mcp.md` · [↑ table of contents](#table-of-contents)
@@ -54227,8 +55627,10 @@ A full ERC-8004-equivalent on Solana (Identity / Reputation / Validation as Anch
Spatial MCP is an open shape for returning a **live, interactive 3D scene** as an MCP tool result instead of a URL in text. A conformant host renders it inline — orbit, animate, place in AR — with an embedded component. three.ws is the reference implementation; the shape is renderer-agnostic and carries **no** payment, wallet, or coin surface, so it drops into crypto-free app stores unchanged.
- **Spec:** [`specs/SPATIAL_MCP.md`](https://github.com/nirholas/three.ws/blob/main/specs/SPATIAL_MCP.md) (v0.1, CC0)
-- **Validator (code):** [`api/_lib/spatial-mcp.js`](https://github.com/nirholas/three.ws/blob/main/api/_lib/spatial-mcp.js) — `validateSpatialArtifact()`, `buildSpatialArtifact()`
+- **Validator (package):** [`packages/spatial-mcp`](https://github.com/nirholas/three.ws/tree/main/packages/spatial-mcp) — `@three-ws/spatial-mcp`: `validateSpatialArtifact()`, `buildSpatialArtifact()`, `lintSpatialMeta()`, plus the conformance fixture corpus. Dependency-free; the npm registry publish is queued, and the import-by-URL below works today.
+- **Validator (import by URL, no npm):** `https://three.ws/spatial-mcp/spatial-validator.js` — the same module, served directly. Source: [`public/spatial-mcp/spatial-validator.js`](https://github.com/nirholas/three.ws/blob/main/public/spatial-mcp/spatial-validator.js); server-side code imports it via `api/_lib/spatial-mcp.js`, and a CI drift guard keeps the npm copy byte-identical.
- **Validator (MCP tool):** `validate_spatial_response({ artifact })` on the three.ws 3D Studio server
+- **Validator (no code at all):** paste a payload into the checker on [`/spatial-mcp`](https://three.ws/spatial-mcp) and read the diagnostics, conformance and data-minimization lint both
- **Reference renderer:** [`/spatial-mcp`](https://three.ws/spatial-mcp) — `public/spatial-mcp/spatial-renderer.js`
## Quick start — emit a conformant artifact
@@ -54256,7 +55658,7 @@ return {
## Validate before you ship
```js
-import { validateSpatialArtifact } from './spatial-mcp.js';
+import { validateSpatialArtifact } from 'https://three.ws/spatial-mcp/spatial-validator.js';
const { valid, errors, warnings } = validateSpatialArtifact(spatial);
if (!valid) throw new Error('non-conformant: ' + errors.map(e => `${e.path}: ${e.message}`).join('; '));
@@ -54264,6 +55666,10 @@ if (!valid) throw new Error('non-conformant: ' + errors.map(e => `${e.path}: ${e
`errors` and `warnings` each name the offending `path` and the fix, so you can correct output rather than guess. Wire it into CI as an invariant over every 3D tool's real output (three.ws does — see `tests/spatial-mcp.test.js`).
+The validator is dependency-free and runs anywhere: a browser, a Node tool, a CI step. It is the same module the reference page loads, so what the page reports about a payload is what your build will report.
+
+**Or validate nothing yourself.** The checker on [`/spatial-mcp`](https://three.ws/spatial-mcp) runs that module in your browser against whatever you paste, as you type, and lists every `path` with its fix. It also ships a deliberately broken example so you can see the diagnostics before you have a payload of your own. Conformant payloads render in place; unusable ones show the renderer's designed fallback, which is what a host would show a user.
+
Agents can validate over MCP without importing anything:
```jsonc
@@ -54294,7 +55700,7 @@ function toSpatialArtifact(f) {
}
```
-The live demo at [`/spatial-mcp`](https://three.ws/spatial-mcp) renders exactly this transform beside a native three.ws artifact — the same renderer displays both, proving portability.
+The live demo at [`/spatial-mcp`](https://three.ws/spatial-mcp) renders exactly this transform beside a native three.ws artifact — the same renderer displays both, proving portability. Both frames carry the validator's verdict underneath, so the conformance claim on that page is demonstrated rather than asserted.
## Render it yourself
@@ -54315,6 +55721,21 @@ It applies `camera`/`environment`/`affordances`, plays `animation` when present,
`meta` is human-facing only. Never place session/job/creation/prediction/trace ids, wallet addresses, prices, or any auth/coin field anywhere in the artifact. Strip them at emit time — this is what keeps the shape reusable across the Claude and OpenAI tracks.
+The reference lint flags the common violations:
+
+```js
+import { lintSpatialMeta } from 'https://three.ws/spatial-mcp/spatial-validator.js';
+
+lintSpatialMeta(artifact);
+// [{ path: 'meta.session_id', message: 'looks like an internal/auth/coin field — the spec requires emitters to strip these (data minimization)' }]
+```
+
+Findings are advisory and never affect validity: the lint cannot know your internal field names, so a clean result is evidence, not proof. The checker on [`/spatial-mcp`](https://three.ws/spatial-mcp) runs it on every pasted payload.
+
+## Prove your implementation conformant
+
+`@three-ws/spatial-mcp` ships the fixture corpus (`fixtures/manifest.json` plus the artifacts it names): payloads a conformant validator must accept, reject with specific error paths, or lint. Run your implementation over every entry; disagreeing with a required verdict or missing a `mustFlag` path means non-conformance. The package's own test suite does exactly this, so the corpus and the reference validator can never drift apart.
+
## Who emits it on three.ws
Free 3D Studio (`structuredContent.spatial`): `forge_free`, `text_to_avatar`, `mesh_forge`, `rig_mesh`, `forge_avatar`, `refine_model`. Paid 3D Studio: `preview_3d`. Conformance gate: `validate_spatial_response`.
@@ -54328,7 +55749,7 @@ Free 3D Studio (`structuredContent.spatial`): `forge_free`, `text_to_avatar`, `m
---
-<a id="sec-259"></a>
+<a id="sec-267"></a>
> **Source:** `docs/specs/agent-trading.md` · [↑ table of contents](#table-of-contents)
@@ -54415,7 +55836,7 @@ Real routes (no mocks), server-side guards with tests (including the $THREE-sell
---
-<a id="sec-260"></a>
+<a id="sec-268"></a>
> **Source:** `docs/splat.md` · [↑ table of contents](#table-of-contents)
@@ -54486,7 +55907,7 @@ Supported inputs at a glance:
---
-<a id="sec-261"></a>
+<a id="sec-269"></a>
> **Source:** `docs/start-here.md` · [↑ table of contents](#table-of-contents)
@@ -54575,6 +55996,7 @@ Curious what happens between the prompt and the model? [How the Forge works](./h
- **Want a full-body avatar assistant on your site instead?** → [Assistant widget](./assistant-widget.md) — a launcher button opens an animated 3D character standing directly on your page (or a color/gradient), with a free-lane or bring-your-own-key chatbot and a speak mode that says whatever you type, out loud, in a speech bubble
- **Trading?** → [The trading surfaces](./trading-surfaces.md) maps the solo stack (Radar, Coin Intelligence, Live Trade Feed, Watchlist, Mission Control); [trading arenas](./trading-arenas.md) covers tournaments, the theater, vaults, and swarms; [Oracle](./oracle.md) is the conviction engine underneath all of it
- **Want your agent to trade for you?** → [Agent Sniper](./agent-sniper.md) — the full autonomous-trading pipeline (entry gates, the simulate-the-sell trade firewall, hash-chained decision ledger, exit ladder), with the audited case study of the platform's first live +42% trade; [arm one in minutes](./tutorials/arm-an-agent-sniper.md)
+- **Curious how the trading fleet improves itself?** → [Earned autonomy](./sniper-autonomy.md), where each arm's own realized record decides how much rope it gets: wider tuning bounds, unlocked settings, a bigger share of the fleet budget, and a deeper evidence pack in front of its LLM judge, all re-earned continuously and none of it able to touch a safety rail
- **Trusting an agent with money?** → [Custody you can verify](./custody.md) — spend limits, freeze, Merkle proof-of-custody, and social recovery; [claim your wallet](./trader-card.md) turns any pump.fun track record into a public, provable Trader Card. Every real-funds feature sits behind the [risk acknowledgment](./risk-acknowledgment.md) — read the [Risk Disclosure](https://three.ws/legal/risk) before committing anything
- **Vetting a counterparty before you pay it?** → [Trust primitives](./trust-primitives.md) — the cross-chain Agent Reputation endpoint scores ANY wallet, mint, or agent id (Solana or EVM) 0–100 from real on-chain evidence, in one paid call, before your agent transacts
- **Wondering where the platform's money goes?** → [The autonomous economy](./autonomous-economy.md) — how the on-chain treasury funds itself, the funding-root → engines → sweepback loop, the locks that keep every dollar inside platform-owned wallets, and the two leak scanners that audit every wallet on-chain every minute (so far: 44,122 transactions scanned, zero leaks)
@@ -54599,7 +56021,7 @@ Curious what happens between the prompt and the model? [How the Forge works](./h
---
-<a id="sec-262"></a>
+<a id="sec-270"></a>
> **Source:** `docs/strategy-objects.md` · [↑ table of contents](#table-of-contents)
@@ -54714,7 +56136,7 @@ curl -s https://three.ws/api/sniper/backtest \
---
-<a id="sec-263"></a>
+<a id="sec-271"></a>
> **Source:** `docs/syndication.md` · [↑ table of contents](#table-of-contents)
@@ -54836,7 +56258,7 @@ updated feed.
---
-<a id="sec-264"></a>
+<a id="sec-272"></a>
> **Source:** `docs/talking-avatar-video.md` · [↑ table of contents](#table-of-contents)
@@ -54926,7 +56348,7 @@ curl -H 'cookie: __Host-sid=<SESSION>' \
---
-<a id="sec-265"></a>
+<a id="sec-273"></a>
> **Source:** `docs/terminal.md` · [↑ table of contents](#table-of-contents)
@@ -55031,7 +56453,7 @@ es.addEventListener('graduation', (e) => console.log('graduated', JSON.parse(e.d
---
-<a id="sec-266"></a>
+<a id="sec-274"></a>
> **Source:** `docs/three-microbuy.md` · [↑ table of contents](#table-of-contents)
@@ -55196,7 +56618,7 @@ The response reports `fired`, `paid`, `buys`, `pending`, `errors`, `toll_spent_u
---
-<a id="sec-267"></a>
+<a id="sec-275"></a>
> **Source:** `docs/token-gated-3d-embeds.md` · [↑ table of contents](#table-of-contents)
@@ -55314,7 +56736,7 @@ Every check that matters happens on the server:
---
-<a id="sec-268"></a>
+<a id="sec-276"></a>
> **Source:** `docs/trader-card.md` · [↑ table of contents](#table-of-contents)
@@ -55372,7 +56794,7 @@ Returns the identity summary, KPI aggregates, and the per-coin ledger — `known
---
-<a id="sec-269"></a>
+<a id="sec-277"></a>
> **Source:** `docs/trading-arenas.md` · [↑ table of contents](#table-of-contents)
@@ -55441,7 +56863,7 @@ Prove yourself solo (the [trading surfaces](trading-surfaces.md) → the [leader
---
-<a id="sec-270"></a>
+<a id="sec-278"></a>
> **Source:** `docs/trading-copilot.md` · [↑ table of contents](#table-of-contents)
@@ -55580,7 +57002,7 @@ plumbing — and never suggests, shills, or names another token on its own initi
---
-<a id="sec-271"></a>
+<a id="sec-279"></a>
> **Source:** `docs/trading-experiment.md` · [↑ table of contents](#table-of-contents)
@@ -55635,15 +57057,104 @@ sellFraction = min( entry / current_value , 1 − moonbag_floor )
After the take-initials leg, the position stays **open** with the moon bag, its
trailing-stop high-water is reset to the remaining value (so the pre-sale peak
doesn't instantly trip the trailing stop), and the ladder is marked recovered so
-it fires exactly once. The remainder then exits only on the **trailing stop**,
-the **stop-loss**, the optional take-profit ceiling, or the **timeout** — all
-full exits of what remains.
+it fires exactly once.
Priority order (stop-loss always wins): `stop_loss → signal_flip → trailing_stop
→ take_initials → take_profit(ceiling) → timeout`.
-The ladder is **opt-in**: a strategy with no `initials_out_multiple` keeps the
-classic single-shot full-exit behavior, so existing strategies are unchanged.
+## We never sell 100% of a winner
+
+This is fleet policy, not a per-strategy option, and it applies whether or not
+the take-initials ladder above ever fired.
+
+**Once a position's cost basis is back, the remainder is free.** A free bag is
+worth zero at worst and uncapped at best. Selling that last slice to bank a few
+thousandths of a SOL trades away every possible outcome above it for a rounding
+error. So a terminal exit that is **in profit** sells down to the moon-bag floor
+(`moonbag_min_pct`, default 15%) and the retained tokens ride indefinitely.
+
+| Situation | What happens |
+|---|---|
+| Trailing stop / take-profit / timeout, **in profit** | Sell enough to return the stake (or bank down to the floor if the stake is already home). The rest rides. |
+| Any terminal exit **after** initials were recovered | Sell down to the floor. Never to zero: none of it is our money any more. |
+| Stop-loss with the stake **still at risk** | **Full exit.** Nothing is free yet, and the hard downside cap is the one rule nothing overrides. |
+| Timeout or signal-flip **underwater**, initials never recovered | **Full exit**, same reason. |
+| Kill switch | **Full exit**, always. An owner pulling the switch means out. |
+
+Worked example, the case the rule exists for: an arm enters at 1 SOL, the price
+runs to 1.4x but never reaches the 2x ladder band, then the trailing stop trips.
+The old behavior sold 100% of the bag to realize about +0.0028 SOL. The rule now
+sells `1/1.4 = 71%` (exactly the stake) and keeps 29% riding at zero cost basis.
+
+**A held bag does not block the arm.** The position still books `status='closed'`
+when this happens, so its realized P&L lands in every existing report unchanged
+and its `max_concurrent_positions` slot is released immediately. Only the tokens
+stay behind, recorded on the position row (`moonbag_base_amount`,
+`moonbag_entry_lamports`) and surfaced on
+[/sniper/experiments](https://three.ws/sniper/experiments).
+
+Because loss exits still sell out completely, rugs close fully and only *winners*
+leave a bag behind. That bounds the retained-rent cost to the number of winners
+rather than the number of trades (each held SPL token account locks about
+0.002 SOL of rent).
+
+Set `moonbag_always = false` on a strategy to opt a single arm out. The column
+defaults to true and a null is read as true, so every existing strategy has the
+rule without a backfill.
+
+The proactive 2x ladder is the **fleet default** (owner rule, 2026-07-25): every
+strategy is born with `initials_out_multiple = 2`, so the first time a position
+doubles, the initial stake comes off the table and the remainder rides. Setting
+the field to an explicit null through the arm API opts a single arm back into
+the classic single-shot exit; even then it never fully exits a winner, because
+the fleet-wide moon-bag rule below covers that independently.
+
+The multiple itself stays tunable. A human sets it directly (this script, or the
+arm API), **or** an arm earns the right to have it tuned: once the autonomy
+engine places an arm at `trusted` or above and its winners demonstrably run past
+its average exit, the optimizer adjusts the multiple by itself within its bounds
+and records why. See
+[Earned autonomy](./sniper-autonomy.md). A losing arm cannot reach the field at
+all, so the ladder is only ever switched on for a strategy whose record shows it
+actually catches runners.
+
+## The post-audit fixes (from the published fleet postmortem)
+
+The [published audit](https://three.ws/blog/autonomous-trading-experiment) of the
+fleet's first 90 real trades produced three findings that are now code:
+
+**Overconfidence ceiling** (`llm_max_confidence`). The audit's calibration table
+showed judge verdicts in the 0.7 confidence band performed best while 0.9+
+verdicts went winless. Each LLM arm can now carry a confidence CEILING next to
+its floor: a buy verdict at or above it is recorded for calibration but never
+funded. The experiment arms run floor 0.65, ceiling 0.9. Gate:
+`llmVerdictGate` in [workers/agent-sniper/llm-judge.js](../workers/agent-sniper/llm-judge.js).
+
+**Named-model strictness** (`llm_strict_model`). During the audit window the LLM
+failover chain answered most named-model calls, so "Grok vs Claude" was really
+"fallback vs fallback". A strict arm now refuses to trade on any verdict whose
+answering model was a fallback (`fallback:*` tag): the verdict still lands in the
+judgment ledger, but the arm pauses rather than pollutes its own experiment. The
+grok and claude arms are strict; the auto-router arm is not (a fallback IS its
+router pick).
+
+**Liquidity-decay exit** (`liquidity_decay`). A bonding-curve quote only moves
+when someone trades, so a position whose re-quoted value is exactly frozen sweep
+after sweep is a coin nobody is trading. The audit found those squatting on
+concurrency slots until the 30-minute timeout. Now an underwater position whose
+value has not moved at all for `SNIPER_LIQUIDITY_DECAY_S` (default 300s) exits
+early with reason `liquidity_decay` and frees the slot. The clock never runs in
+profit (quiet winners belong to the trailing stop and the moon-bag rule), resets
+on any trade, and a house-money position keeps its moon-bag floor even here.
+
+**Row-count watchdog** (`/api/cron/sniper-loops-health`). The audit's worst
+operational finding: two learning loops ran dead for two days behind green
+health checks. An hourly cron now asks each autonomous loop (weight training,
+outcome labeling, LLM judging, optimizer, evolution, Oracle scoring) the one
+question that cannot lie, "when did you last write a row?", and pages the ops
+channel when any answer exceeds that loop's cadence-derived limit. A loop with
+no rows at all is the worst finding, not an exemption. Policy is pure and
+tested: [api/_lib/sniper-loops-health.js](../api/_lib/sniper-loops-health.js).
### No-Mayhem enforcement (`workers/agent-sniper/mayhem-gate.js`)
@@ -55736,7 +57247,7 @@ much — and tune the next run. That is the whole point of the experiment.
---
-<a id="sec-272"></a>
+<a id="sec-280"></a>
> **Source:** `docs/trading-surfaces.md` · [↑ table of contents](#table-of-contents)
@@ -55883,7 +57394,7 @@ Agents wanting the same intel over MCP: see [docs/mcp.md](mcp.md) (`@three-ws/in
---
-<a id="sec-273"></a>
+<a id="sec-281"></a>
> **Source:** `docs/troubleshooting.md` · [↑ table of contents](#table-of-contents)
@@ -56542,7 +58053,7 @@ Idle blink and head-drift are active in the current release: `src/idle-animation
---
-<a id="sec-274"></a>
+<a id="sec-282"></a>
> **Source:** `docs/trust-primitives.md` · [↑ table of contents](#table-of-contents)
@@ -56782,7 +58293,7 @@ See also: [x402 paid endpoints](./x402.md) · [Agent Bouncer](./api-reference.md
---
-<a id="sec-275"></a>
+<a id="sec-283"></a>
> **Source:** `docs/tutorials/add-a-3d-assistant.md` · [↑ table of contents](#table-of-contents)
@@ -56900,7 +58411,7 @@ Then ask, in plain language: "build a 3D assistant widget named Aria with an oce
---
-<a id="sec-276"></a>
+<a id="sec-284"></a>
> **Source:** `docs/tutorials/agent-personality.md` · [↑ table of contents](#table-of-contents)
@@ -57353,7 +58864,7 @@ The system prompt is the cheapest, highest-leverage thing you can change about a
---
-<a id="sec-277"></a>
+<a id="sec-285"></a>
> **Source:** `docs/tutorials/agent-reputation.md` · [↑ table of contents](#table-of-contents)
@@ -57654,7 +59165,7 @@ A read costs nothing and asks no one's permission. That's the property that lets
---
-<a id="sec-278"></a>
+<a id="sec-286"></a>
> **Source:** `docs/tutorials/animate-your-avatar.md` · [↑ table of contents](#table-of-contents)
@@ -57879,7 +59390,7 @@ Primary call to action: open **[/pose](/pose)**, load an avatar, and apply your
---
-<a id="sec-279"></a>
+<a id="sec-287"></a>
> **Source:** `docs/tutorials/arm-an-agent-sniper.md` · [↑ table of contents](#table-of-contents)
@@ -57991,7 +59502,7 @@ The hard-config sniper you just armed is the control group. The next phase runs
---
-<a id="sec-280"></a>
+<a id="sec-288"></a>
> **Source:** `docs/tutorials/build-a-scene.md` · [↑ table of contents](#table-of-contents)
@@ -58210,7 +59721,7 @@ The leverage of [Scene Studio](/scene) is that it's a *real* editor producing a
---
-<a id="sec-281"></a>
+<a id="sec-289"></a>
> **Source:** `docs/tutorials/build-a-site-concierge.md` · [↑ table of contents](#table-of-contents)
@@ -58328,7 +59839,7 @@ Then: `<three-concierge endpoint="/my/concierge">`. The production reference, wi
---
-<a id="sec-282"></a>
+<a id="sec-290"></a>
> **Source:** `docs/tutorials/claim-threews-name.md` · [↑ table of contents](#table-of-contents)
@@ -58636,7 +60147,7 @@ See also:
---
-<a id="sec-283"></a>
+<a id="sec-291"></a>
> **Source:** `docs/tutorials/connect-ai-brain.md` · [↑ table of contents](#table-of-contents)
@@ -58993,7 +60504,7 @@ The brain is the part of the agent you'll iterate on most after the system promp
---
-<a id="sec-284"></a>
+<a id="sec-292"></a>
> **Source:** `docs/tutorials/create-and-edit-memory.md` · [↑ table of contents](#table-of-contents)
@@ -59314,7 +60825,7 @@ The leverage is in *enhancement*: the right type, one fact per memory, tags, del
---
-<a id="sec-285"></a>
+<a id="sec-293"></a>
> **Source:** `docs/tutorials/custom-skill.md` · [↑ table of contents](#table-of-contents)
@@ -59834,7 +61345,7 @@ The skill installs via a URI in the agent manifest, runs entirely client-side, a
---
-<a id="sec-286"></a>
+<a id="sec-294"></a>
> **Source:** `docs/tutorials/customize-appearance.md` · [↑ table of contents](#table-of-contents)
@@ -60272,7 +61783,7 @@ Most production embeds use four or five of these together. The combination is wh
---
-<a id="sec-287"></a>
+<a id="sec-295"></a>
> **Source:** `docs/tutorials/deploy-to-vercel-custom-domain.md` · [↑ table of contents](#table-of-contents)
@@ -60789,7 +62300,7 @@ In rough order of likelihood:
---
-<a id="sec-288"></a>
+<a id="sec-296"></a>
> **Source:** `docs/tutorials/embed-in-30-seconds.md` · [↑ table of contents](#table-of-contents)
@@ -61063,7 +62574,7 @@ A working embedded agent is the foundation everything else builds on. From here,
---
-<a id="sec-289"></a>
+<a id="sec-297"></a>
> **Source:** `docs/tutorials/embed-on-website.md` · [↑ table of contents](#table-of-contents)
@@ -61574,7 +63085,7 @@ Squarespace's developer preview and published output can differ. Try adding the
---
-<a id="sec-290"></a>
+<a id="sec-298"></a>
> **Source:** `docs/tutorials/emotion-from-data.md` · [↑ table of contents](#table-of-contents)
@@ -61802,7 +63313,7 @@ function reactIfConfident(clipOrEmoteName, { confident, useExactClip = false } =
---
-<a id="sec-291"></a>
+<a id="sec-299"></a>
> **Source:** `docs/tutorials/first-agent.md` · [↑ table of contents](#table-of-contents)
@@ -62311,7 +63822,7 @@ Now that you have a working agent, here's what to explore next:
---
-<a id="sec-292"></a>
+<a id="sec-300"></a>
> **Source:** `docs/tutorials/first-prompt-to-3d.md` · [↑ table of contents](#table-of-contents)
@@ -62431,7 +63942,7 @@ A rigged avatar's AR link gains a **Bring it to life** option: instead of a froz
---
-<a id="sec-293"></a>
+<a id="sec-301"></a>
> **Source:** `docs/tutorials/generate-3d-api.md` · [↑ table of contents](#table-of-contents)
@@ -62643,7 +64154,7 @@ If you've never made an x402 call, start with [Build a paid x402 endpoint](/tuto
---
-<a id="sec-294"></a>
+<a id="sec-302"></a>
> **Source:** `docs/tutorials/getting-started.md` · [↑ table of contents](#table-of-contents)
@@ -62814,7 +64325,7 @@ Everything is editable forever — swap the body, rewrite the prompt, add capabi
---
-<a id="sec-295"></a>
+<a id="sec-303"></a>
> **Source:** `docs/tutorials/greeting-and-first-speech.md` · [↑ table of contents](#table-of-contents)
@@ -63160,7 +64671,7 @@ A working greeting moves the embed from "decoration" to "interaction", which is
---
-<a id="sec-296"></a>
+<a id="sec-304"></a>
> **Source:** `docs/tutorials/image-to-3d.md` · [↑ table of contents](#table-of-contents)
@@ -63263,7 +64774,7 @@ Everything you generate is kept in **Your creations** at the bottom of the page,
---
-<a id="sec-297"></a>
+<a id="sec-305"></a>
> **Source:** `docs/tutorials/import-avatar-url.md` · [↑ table of contents](#table-of-contents)
@@ -63431,7 +64942,7 @@ The URL path and the file-upload path converge on the same avatar record and the
---
-<a id="sec-298"></a>
+<a id="sec-306"></a>
> **Source:** `docs/tutorials/js-api-events.md` · [↑ table of contents](#table-of-contents)
@@ -63897,7 +65408,7 @@ The `whenReady`, awaited-`ask()`, and try/catch patterns are small but they remo
---
-<a id="sec-299"></a>
+<a id="sec-307"></a>
> **Source:** `docs/tutorials/mcp-server-for-your-agent.md` · [↑ table of contents](#table-of-contents)
@@ -64543,7 +66054,7 @@ Things that look right but bite you:
---
-<a id="sec-300"></a>
+<a id="sec-308"></a>
> **Source:** `docs/tutorials/mine-vanity-address.md` · [↑ table of contents](#table-of-contents)
@@ -64575,7 +66086,7 @@ This tutorial covers the full lifecycle: **grind in the browser → (optionally)
## How grinding works (two minutes of theory)
-The address space is the Base58 alphabet (`123…ABC…xyz`, minus the ambiguous `0 O I l` — 58 symbols). To match `n` chosen characters you expect to try about `58ⁿ` random keypairs:
+The address space is the Base58 alphabet (`123…ABC…xyz`, minus the ambiguous `0 O I l`, 58 symbols). Each character you pin multiplies the work by ~58, so a rough ladder looks like this:
| Pattern length | Expected attempts | Feel |
|---|---|---|
@@ -64585,6 +66096,16 @@ The address space is the Base58 alphabet (`123…ABC…xyz`, minus the ambiguous
| 5 chars | ~633M | minutes to hours |
| 6+ chars | billions | a fleet, or a bounty |
+**The first character is the exception, and it matters a lot.** Base58 encodes an address as one big 256-bit number, not as a string of independent symbols. A 32-byte key needs 44 Base58 digits unless it happens to be small enough for 43, and since 2²⁵⁶ / 58⁴³ ≈ 17, a 44-digit address can only ever *start* with one of the first 17 symbols. Anything later in the alphabet has to come from the ~5.9% of keys that fit in 43 digits:
+
+| Your prefix starts with | Difficulty vs. the flat 58ⁿ guess |
+|---|---|
+| `2`-`H` | **3.4× easier** |
+| `J` | about the same |
+| `K`-`z` (40 of the 58 symbols) | **17× harder** |
+
+So `Agent…` is dramatically cheaper to grind than `zebra…`, even though both are five characters. Suffixes have no such skew, the *last* characters of an address are uniform at 1/58 each, which is why moving a pattern to the suffix is often the cheapest way to get the look you want.
+
A **case-insensitive** match (matching letters in any case) roughly halves the work per letter, at the cost of not choosing the casing of the result.
Two ways to do the grind exist on three.ws, and they solve different problems:
@@ -64613,13 +66134,15 @@ type a prefix or suffix to see estimated time
rough estimate: ~40s on 4 cores [tier: slow — minutes+]
```
-The estimate comes from the honest `58ⁿ` model and your selected core count. The page calculates expected attempts as:
+The estimate comes from the exact Base58 distribution and your selected core count:
```
-expectedAttempts = product over each pattern character of (58 / matchesPerChar)
+expectedAttempts = 1 / ( P(address starts with your prefix) × 58^-len(suffix) )
```
-where `matchesPerChar` is `2` for a letter when case-insensitive is on (both cases are valid Base58), otherwise `1`. This is the same difficulty math the paid receipt commits to — see [src/solana/vanity/validation.js](../../src/solana/vanity/validation.js).
+The prefix term is counted exactly rather than approximated as `58^-n`, it is the fraction of all 2²⁵⁶ possible keys whose encoding begins with your prefix, which is what makes the first-character table above fall out. Case-insensitivity sums the probabilities of every Base58-valid spelling (note `i`, `o` and `L` have only one valid case, since the alphabet drops `I`, `O` and `l`).
+
+This is the same difficulty math the paid receipt commits to, see [src/solana/vanity/base58-distribution.js](../../src/solana/vanity/base58-distribution.js) for the derivation and [src/solana/vanity/validation.js](../../src/solana/vanity/validation.js) for the model dispatch. Receipts name their model in `difficulty.model`, so a receipt issued before this correction still verifies against the model it was issued under.
> **Tip:** the suggested-pattern chips (`AGNT…`, `…pump`, `GM…gm`, …) each show their own estimate. They're a fast way to see how dramatically each extra character costs you.
@@ -64685,7 +66208,7 @@ If you buy a grind from the paid endpoint (`/api/x402/vanity-verifiable`, an x40
1. the key came from entropy the server **committed to before** it knew your pattern (no precomputed table of keys);
2. **your own entropy** (`clientSeed`) was mixed in, so neither party alone controlled the address;
-3. the address really derives from the revealed seed, matches your pattern, and the difficulty claim is the honest `58ⁿ` model;
+3. the address really derives from the revealed seed, matches your pattern, and the difficulty claim matches the model the receipt names in `difficulty.model`;
4. the receipt was **signed by the real three.ws service key**, not an impostor;
5. (optionally) the key you recovered from the sealed envelope is byte-for-byte the one the receipt describes — **you alone hold it**.
@@ -64707,7 +66230,7 @@ The page runs every check locally and shows a pass/fail line for each:
- **commitment** — `SHA-256(serverSeed)` equals the published commitment, so the server was locked to that seed before grinding.
- **derivation** — re-deriving the master seed and the candidate at `winningIndex` reproduces exactly `receipt.address`.
- **pattern** — the address actually satisfies the requested prefix/suffix.
-- **difficulty** — `difficulty.expectedAttempts` equals the honest rounded `58ⁿ` value.
+- **difficulty**, `difficulty.expectedAttempts` equals the honest rounded value under the model named in `difficulty.model` (`base58-exact/v2` for anything issued since 2026-07-25).
- **signature** — the Ed25519 signature verifies, **and** the receipt's signing key matches the one pinned from the well-known document (impostors who self-sign under a different key fail here).
- **custody** *(if you opened the seal)* — the decrypted seed's public key equals `receipt.address`.
@@ -64795,7 +66318,7 @@ So the grind searches for a **salt** that produces a contract address matching y
You learned to mine a Solana vanity address and to operate the proof-of-grind protocol around it:
- **Grind in the browser** ([/vanity-wallet](/vanity-wallet)) — pick a prefix/suffix, choose case sensitivity and cores, grind locally with WASM Web Workers, and download the key. Nothing leaves your device.
-- **Difficulty is `58ⁿ`** — every character multiplies the work; case-insensitive roughly halves per letter.
+- **Difficulty is ~58 per character, except the first**, the leading symbol ranges from 3.4× easier to 17× harder than a flat `58ⁿ` guess; case-insensitive roughly halves per letter.
- **Provably-fair paid grind** — when the server holds the work, `three-vanity/v1` proves the key was fresh, your entropy was mixed in, and no copy was kept.
- **Verify** ([/vanity/verify](/vanity/verify)) — paste a receipt to re-check commitment, derivation, pattern, difficulty, signature, and (optionally) custody, all in your browser, pinned to the live service key.
- **Gallery** ([/vanity/gallery](/vanity/gallery)) — appraise any address or opt-in publish a verified, secret-free receipt to the rarity leaderboard.
@@ -64812,7 +66335,7 @@ The protocol itself is fully specified in [docs/PROTOCOL-vanity.md](../PROTOCOL-
---
-<a id="sec-301"></a>
+<a id="sec-309"></a>
> **Source:** `docs/tutorials/mint-pumpfun-token.md` · [↑ table of contents](#table-of-contents)
@@ -65164,7 +66687,7 @@ If you have a lawyer, talk to them before launching. If you don't, default to th
---
-<a id="sec-302"></a>
+<a id="sec-310"></a>
> **Source:** `docs/tutorials/multi-agent-coordination.md` · [↑ table of contents](#table-of-contents)
@@ -65724,7 +67247,7 @@ async function safeHandoff(targetEl, brief, fallbackEl, originalQuestion) {
---
-<a id="sec-303"></a>
+<a id="sec-311"></a>
> **Source:** `docs/tutorials/nvidia-3d-free.md` · [↑ table of contents](#table-of-contents)
@@ -65841,7 +67364,7 @@ It talks **directly** to a TRELLIS NIM and returns the GLB **synchronously** in
---
-<a id="sec-304"></a>
+<a id="sec-312"></a>
> **Source:** `docs/tutorials/nvidia-nim-self-host.md` · [↑ table of contents](#table-of-contents)
@@ -66017,7 +67540,7 @@ The proxy normalizes every documented artifact shape (inline `base64`, a bare st
---
-<a id="sec-305"></a>
+<a id="sec-313"></a>
> **Source:** `docs/tutorials/paid-x402-endpoint.md` · [↑ table of contents](#table-of-contents)
@@ -66709,7 +68232,7 @@ Both work. Choose based on whether your endpoint is part of an agent platform yo
---
-<a id="sec-306"></a>
+<a id="sec-314"></a>
> **Source:** `docs/tutorials/pay-for-x402-service.md` · [↑ table of contents](#table-of-contents)
@@ -66721,7 +68244,7 @@ This is the **consume** side of x402. If you want to *build* an endpoint that ta
**Prerequisites:**
-- A browser wallet: **Phantom** (or Solflare) for Solana, or **MetaMask** / **Coinbase Wallet** for Base (EVM). The checkout detects whichever is installed.
+- A browser wallet: **Phantom** (or Solflare) for Solana, or **MetaMask** / **Coinbase Wallet** for Base (EVM). The checkout detects whichever is installed. **Or no browser wallet at all:** if you're signed in to three.ws and one of your agents holds USDC in its own wallet, the checkout offers that agent as a payment method and settles server-side, with no extension and no popup (see "Paying" below).
- A small USDC balance on the network you'll pay from. Most calls are $0.001–$0.01, so ~$1 USDC funds thousands of them. On Solana you also need a little SOL for the account; on Base the signature is gasless from your side.
- Light JavaScript familiarity for the programmatic path (Steps 5–6). The UI paths (Steps 2–4) need none.
@@ -66753,6 +68276,7 @@ There are two distinct problems: **finding** an endpoint and **paying** it.
- For **Solana**, the wallet can only sign serialized transactions, so the module posts the challenge's `accept` to `/api/x402-checkout?action=prepare` (`api/x402-checkout.js`), gets back a partially-signed SPL `transferChecked`, has Phantom add the buyer's signature, then `?action=encode`s it into the `X-PAYMENT` header.
- For **Base / EVM**, the wallet signs an EIP-3009 `transferWithAuthorization` typed-data message locally — no server prep needed.
+- For an **agent wallet** (signed-in three.ws users only), no browser wallet is involved at all. The modal lists your agents with their live USDC balances (from `/api/x402-pay?agents=1`), and picking one sends the payment through `POST /api/x402-pay`: the server decrypts the agent's custodial key (audit-logged), enforces the agent's per-call/daily spend policy *before* signing, builds and settles the SPL transfer, and streams progress back. Underfunded agents render disabled with their exact balance; the option pays Solana USDC only, and never appears on third-party merchant embeds (the session cookie doesn't travel cross-origin).
Either way the signed payload is base64-encoded into `X-PAYMENT`, the gated request is retried once, and the unlocked result plus the decoded `X-PAYMENT-RESPONSE` receipt come back.
@@ -66782,7 +68306,7 @@ Find an HTTP service you want and click **Try it** on its card.
1. The drop-in payment modal opens, having already re-fetched the live 402 challenge to confirm the current price (prices can change; the card is a cached hint, the modal is the source of truth).
2. The modal shows the **price**, the **network**, and **who you're paying** — the on-chain `payTo` address, linked to a block explorer so you can verify the recipient before committing.
-3. Pick your wallet. The modal only offers wallets that match a network in the challenge's `accepts` and are actually detected in your browser; undetected ones render disabled with an "install" hint.
+3. Pick your wallet. The modal only offers wallets that match a network in the challenge's `accepts` and are actually detected in your browser; undetected ones render disabled with an "install" hint. Signed-in users with funded agents also see a **"Your agents"** group at the top; picking one skips the wallet popup entirely and pays from the agent's own USDC under its spend limits.
4. Approve the payment in your wallet. Before prompting you, the modal does a fail-open balance pre-check — if it can positively read that your wallet is short, it shows an insufficient-funds state with the exact shortfall and an explorer link, instead of letting you sign a doomed transaction.
5. The platform settles on-chain and retries the call. The card's receipt area fills in with the result and a link to the on-chain transaction.
@@ -66973,7 +68497,7 @@ package family is listed under [x402 → Open-source packages](/x402#open-source
---
-<a id="sec-307"></a>
+<a id="sec-315"></a>
> **Source:** `docs/tutorials/personal-ai-site.md` · [↑ table of contents](#table-of-contents)
@@ -67528,7 +69052,7 @@ The technical investment is one HTML file, a GLB avatar, and a system prompt. Th
---
-<a id="sec-308"></a>
+<a id="sec-316"></a>
> **Source:** `docs/tutorials/place-agent-irl.md` · [↑ table of contents](#table-of-contents)
@@ -67776,7 +69300,7 @@ This is fundamentally different from viewing a single model in AR. If you only n
---
-<a id="sec-309"></a>
+<a id="sec-317"></a>
> **Source:** `docs/tutorials/prompts-for-3d.md` · [↑ table of contents](#table-of-contents)
@@ -67912,7 +69436,7 @@ The tiers are explained in detail in [the text-to-3D tutorial](/tutorials/text-t
---
-<a id="sec-310"></a>
+<a id="sec-318"></a>
> **Source:** `docs/tutorials/register-onchain.md` · [↑ table of contents](#table-of-contents)
@@ -68261,7 +69785,7 @@ Your agent's URL will keep working as long as Base exists and IPFS gateways serv
---
-<a id="sec-311"></a>
+<a id="sec-319"></a>
> **Source:** `docs/tutorials/self-host-agent-backend.md` · [↑ table of contents](#table-of-contents)
@@ -68837,7 +70361,7 @@ A self-hosted instance with light traffic runs at $20–50/month all-in. The dom
---
-<a id="sec-312"></a>
+<a id="sec-320"></a>
> **Source:** `docs/tutorials/selfie-to-avatar.md` · [↑ table of contents](#table-of-contents)
@@ -69085,7 +70609,7 @@ The result is a standard `.glb` that animates in the [Animation Studio](/pose),
---
-<a id="sec-313"></a>
+<a id="sec-321"></a>
> **Source:** `docs/tutorials/share-your-agent.md` · [↑ table of contents](#table-of-contents)
@@ -69411,7 +70935,117 @@ The agent's URL is the durable handle. Embed it, link it, print it. The agent sh
---
-<a id="sec-314"></a>
+<a id="sec-322"></a>
+
+> **Source:** `docs/tutorials/shopify-shopping-assistant.md` · [↑ table of contents](#table-of-contents)
+
+# Add a 3D AI shopping assistant to your Shopify store
+
+Give your store a shopping assistant with a face: a floating chat where a rigged 3D avatar answers questions, recommends real products from your live catalog, and helps shoppers check out, all from one script tag. It is the [Concierge](/concierge) widget in **shopping mode**, and it needs no app install, no API key, and no product feed to maintain.
+
+This is different from the [3D Store Guide](/tutorials/shopify-store-guide), which walks a visitor through your storefront like a tour. The shopping assistant is a persistent chat: the shopper types (or speaks) what they want, and the assistant finds it.
+
+What you need: a Shopify store and two minutes. That is genuinely all.
+
+---
+
+## What it does
+
+- **Knows your live catalog.** It reads your store's public `/products.json`, `/collections.json`, and policy pages at ask-time. Change a price or add a product and the assistant knows immediately, with nothing to re-sync.
+- **Recommends real products as cards.** When a shopper asks "help me find a rain jacket under $120," it shows product cards with the real image, live price, and a link, plus an **Add to cart** button that works on the store.
+- **Answers shipping and returns** grounded in your published policies, not made up.
+- **Has a face and a voice.** A 3D avatar blinks, idles, and lipsyncs the answer aloud, with push-to-talk voice input where the browser supports it.
+
+Prices and links on the cards come straight from your catalog, so the assistant can never invent a product, a price, or a discount.
+
+## Step 1: paste one tag
+
+In your Shopify admin go to **Online Store → Themes → Edit code → `theme.liquid`**, and paste this just before `</body>`:
+
+```html
+<script type="module"
+ src="https://three.ws/concierge/concierge.global.js"
+ data-concierge
+ data-site-name="Your Store"
+ data-avatar="nova"
+ data-accent="#3f7d5b"></script>
+```
+
+Save. Open your store. A launcher appears in the corner; click it and ask "what do you recommend?" Shopping mode turned itself on because the widget detected your Shopify storefront.
+
+## Step 2: make it yours
+
+Every attribute is optional. The ones that matter for a store:
+
+| Attribute | What it does |
+| --- | --- |
+| `data-site-name` | Your store name, used in the greeting and answers. |
+| `data-avatar` | `sol`, `nova`, `vera`, `atlas`, or `echo`. Or bring your own with `data-custom-avatar="<glb-url>"`. |
+| `data-accent` | Any CSS color; restyles the whole widget to match your brand. |
+| `data-currency` | ISO code (`USD`, `GBP`, `EUR`, …) if prices should show in a specific currency. |
+| `data-max-products` | How many product cards to show per answer (1–8, default 4). |
+| `data-persona` | One line of tone, e.g. `"a warm, expert associate who keeps it brief"`. |
+| `data-suggestions` | Starter chips, pipe-separated: `"Help me pick a gift\|What's on sale?\|Do you ship to Canada?"`. |
+
+Force shopping mode on or off with `data-shopping="true"` / `"false"`, or point it at a specific storefront with `data-shop="your-store.myshopify.com"` (useful if you embed it somewhere that is not the store origin).
+
+## Step 3: see it work
+
+Ask the assistant the way a customer would. It understands shopping intent, not just keywords:
+
+- **"a warm wool scarf"** → ranks your catalog by relevance and shows the closest matches.
+- **"a gift under $75"** → filters to products at or below that price.
+- **"cheapest hoodie you have"** → sorts by price.
+- **"anything on sale?"** → surfaces products with a compare-at price.
+- **"do you ship to Canada?"** → answers from your shipping policy.
+
+If nothing in the catalog fits, it says so honestly and points the shopper to a collection to browse, instead of inventing a product.
+
+## How it works (for the curious)
+
+There is no crawler and no vector database. Every Shopify storefront exposes its catalog publicly, and the widget reads it directly:
+
+```
+GET https://your-store.myshopify.com/products.json?limit=250 → catalog
+GET https://your-store.myshopify.com/collections.json → collections
+GET https://your-store.myshopify.com/policies/shipping-policy → shipping
+GET https://your-store.myshopify.com/policies/refund-policy → returns
+```
+
+On the store these are same-origin, so there is no CORS wall. The widget fetches them once, caches them for the session, and for each question runs a small keyword retrieval to pick the handful of products the shopper asked about. Only that handful, plus a compact store summary and the relevant policy, is sent to the answer endpoint. The answer streams back grounded in exactly those products, and the cards are rendered from the same set, so what the assistant says and what it shows always match.
+
+Add-to-cart posts to Shopify's public `/cart/add.js` and fires a `cart:refresh` event so your theme updates its cart count.
+
+## Do it in code
+
+Prefer to wire it yourself, or run your own backend? The same building blocks are exported from [`@three-ws/concierge`](https://www.npmjs.com/package/@three-ws/concierge):
+
+```js
+import {
+ fetchCatalog, fetchPolicies, searchProducts, buildShoppingPayload,
+} from '@three-ws/concierge';
+
+const catalog = await fetchCatalog({ shop: 'your-store.myshopify.com' });
+const policies = await fetchPolicies({ shop: 'your-store.myshopify.com' });
+
+const question = 'a warm wool scarf under $60';
+const recommended = searchProducts(catalog.products, question, 4);
+const shopping = buildShoppingPayload(catalog, recommended, policies, question);
+// → POST { message: question, shopping } to /api/concierge, render `recommended` as cards
+```
+
+`searchProducts` returns already-ranked, price-filtered products. `buildShoppingPayload` bounds what is sent to the model. Point `endpoint` at your own SSE server if you want to host the answer engine yourself; the [wire format](/docs/concierge) is documented.
+
+## Related
+
+- [Concierge](/concierge) — the widget this is built on, for any website.
+- [3D Store Guide for Shopify](/tutorials/shopify-store-guide) — a guided storefront tour (complementary: run both, hand off from the tour to the assistant).
+- [Assistant widget](/docs/assistant-widget) — a full-body avatar assistant, the sibling surface.
+- Use it from an AI agent: [`@three-ws/concierge-mcp`](https://www.npmjs.com/package/@three-ws/concierge-mcp).
+
+---
+
+<a id="sec-323"></a>
> **Source:** `docs/tutorials/shopify-store-guide-advanced.md` · [↑ table of contents](#table-of-contents)
@@ -69721,7 +71355,7 @@ The clip URLs inside the manifest resolve **relative to the manifest**, so a sel
---
-<a id="sec-315"></a>
+<a id="sec-324"></a>
> **Source:** `docs/tutorials/shopify-store-guide.md` · [↑ table of contents](#table-of-contents)
@@ -69810,7 +71444,7 @@ It's powered by the open-source [`@three-ws/tour`](https://www.npmjs.com/package
---
-<a id="sec-316"></a>
+<a id="sec-325"></a>
> **Source:** `docs/tutorials/skill-with-database-auth.md` · [↑ table of contents](#table-of-contents)
@@ -70548,7 +72182,7 @@ Before this skill faces a real visitor:
---
-<a id="sec-317"></a>
+<a id="sec-326"></a>
> **Source:** `docs/tutorials/solana-agent-reputation.md` · [↑ table of contents](#table-of-contents)
@@ -70731,7 +72365,7 @@ A read costs nothing and asks no one's permission — which is exactly what lets
---
-<a id="sec-318"></a>
+<a id="sec-327"></a>
> **Source:** `docs/tutorials/sperax-tour.md` · [↑ table of contents](#table-of-contents)
@@ -70902,7 +72536,7 @@ This is covered by an automated test — [`tour-sdk/test/director.test.mjs`](htt
---
-<a id="sec-319"></a>
+<a id="sec-328"></a>
> **Source:** `docs/tutorials/swap-avatar-in-studio.md` · [↑ table of contents](#table-of-contents)
@@ -71162,7 +72796,7 @@ The key insight is the snippet's stability. Once embedded, your customers' pages
---
-<a id="sec-320"></a>
+<a id="sec-329"></a>
> **Source:** `docs/tutorials/text-to-3d.md` · [↑ table of contents](#table-of-contents)
@@ -71286,7 +72920,7 @@ This is normal — prompt, generate, adjust, repeat is the workflow, not a failu
---
-<a id="sec-321"></a>
+<a id="sec-330"></a>
> **Source:** `docs/tutorials/trigger-from-page-events.md` · [↑ table of contents](#table-of-contents)
@@ -71790,7 +73424,7 @@ The pattern under all of these is the same: every recipe starts with `whenReady(
---
-<a id="sec-322"></a>
+<a id="sec-331"></a>
> **Source:** `docs/tutorials/upload-custom-glb.md` · [↑ table of contents](#table-of-contents)
@@ -72186,7 +73820,7 @@ Once the body is on the platform, the embed snippet doesn't change. The same `<a
---
-<a id="sec-323"></a>
+<a id="sec-332"></a>
> **Source:** `docs/tutorials/view-in-ar.md` · [↑ table of contents](#table-of-contents)
@@ -72371,7 +74005,7 @@ AR surface detection needs a moment to work. Move the phone slowly over the targ
---
-<a id="sec-324"></a>
+<a id="sec-333"></a>
> **Source:** `docs/tutorials/voice-and-lipsync.md` · [↑ table of contents](#table-of-contents)
@@ -72602,7 +74236,7 @@ The leverage is that the avatar drives its mouth from the *audio it actually pla
---
-<a id="sec-325"></a>
+<a id="sec-334"></a>
> **Source:** `docs/tutorials/walk-companion.md` · [↑ table of contents](#table-of-contents)
@@ -72955,7 +74589,7 @@ The leverage is composability: the same engine renders the corner mascot, the fu
---
-<a id="sec-326"></a>
+<a id="sec-335"></a>
> **Source:** `docs/tutorials/web-component-end-to-end.md` · [↑ table of contents](#table-of-contents)
@@ -73556,7 +75190,7 @@ The web component is the most robust integration point the platform offers. Buil
---
-<a id="sec-327"></a>
+<a id="sec-336"></a>
> **Source:** `docs/tutorials/x402-server-sdk.md` · [↑ table of contents](#table-of-contents)
@@ -73769,7 +75403,7 @@ const res = await pay('https://your.api/v1/embed', { method: 'POST', body });
---
-<a id="sec-328"></a>
+<a id="sec-337"></a>
> **Source:** `docs/ui-juice.md` · [↑ table of contents](#table-of-contents)
@@ -73931,7 +75565,7 @@ should reach for these primitives rather than re-rolling RAF loops.
---
-<a id="sec-329"></a>
+<a id="sec-338"></a>
> **Source:** `docs/ux-flows/01-onboarding-creation.md` · [↑ table of contents](#table-of-contents)
@@ -74137,7 +75771,7 @@ should reach for these primitives rather than re-rolling RAF loops.
---
-<a id="sec-330"></a>
+<a id="sec-339"></a>
> **Source:** `docs/ux-flows/02-forge-text-to-3d.md` · [↑ table of contents](#table-of-contents)
@@ -74310,7 +75944,7 @@ Routing facts (from `vercel.json`):
---
-<a id="sec-331"></a>
+<a id="sec-340"></a>
> **Source:** `docs/ux-flows/03-3d-editing-viewer.md` · [↑ table of contents](#table-of-contents)
@@ -74516,7 +76150,7 @@ Routing summary (from `vite.config.js`):
---
-<a id="sec-332"></a>
+<a id="sec-341"></a>
> **Source:** `docs/ux-flows/04-embed-widget-studio.md` · [↑ table of contents](#table-of-contents)
@@ -74690,7 +76324,7 @@ Routing recap (from `vercel.json`):
---
-<a id="sec-333"></a>
+<a id="sec-342"></a>
> **Source:** `docs/ux-flows/05-discovery-social.md` · [↑ table of contents](#table-of-contents)
@@ -74961,7 +76595,7 @@ Routing recap (from `vercel.json`):
---
-<a id="sec-334"></a>
+<a id="sec-343"></a>
> **Source:** `docs/ux-flows/06-marketplace-skills.md` · [↑ table of contents](#table-of-contents)
@@ -75175,7 +76809,7 @@ Routing facts confirmed in `vercel.json`:
---
-<a id="sec-335"></a>
+<a id="sec-344"></a>
> **Source:** `docs/ux-flows/07-crypto-trading-analytics.md` · [↑ table of contents](#table-of-contents)
@@ -75524,7 +77158,7 @@ coin-intel, pump-visualizer and pump-live — adding a coin on any surface shows
---
-<a id="sec-336"></a>
+<a id="sec-345"></a>
> **Source:** `docs/ux-flows/08-coin-launch-wallets.md` · [↑ table of contents](#table-of-contents)
@@ -75797,7 +77431,7 @@ real Solana/EVM RPC, pump.fun, and x402 — no mocks.
---
-<a id="sec-337"></a>
+<a id="sec-346"></a>
> **Source:** `docs/ux-flows/09-x402-agent-commerce.md` · [↑ table of contents](#table-of-contents)
@@ -75811,7 +77445,8 @@ files under `pages/` or `public/`.
The cluster's spine is the **x402 pay-per-call** loop: hit a paid endpoint → get
`402 Payment Required` with `paymentRequirements` → pay (server-held agent wallet,
-or the user's Phantom/MetaMask wallet via the shared `/x402.js` modal) → re-send the
+or the user's Phantom/MetaMask wallet, via the shared `/x402.js` modal, which also
+offers a signed-in user's own agents as server-side payers) → re-send the
request with an `X-PAYMENT` header → facilitator verifies + settles on-chain →
endpoint runs and returns the result. The "agent economy" demos wrap this loop in a
choreographed two-agent narrative driven by Server-Sent Events.
@@ -76139,7 +77774,7 @@ choreographed two-agent narrative driven by Server-Sent Events.
---
-<a id="sec-338"></a>
+<a id="sec-347"></a>
> **Source:** `docs/ux-flows/10-chat-brain-labs.md` · [↑ table of contents](#table-of-contents)
@@ -76381,7 +78016,7 @@ modules. Routes resolved via `vercel.json` rewrites.
---
-<a id="sec-339"></a>
+<a id="sec-348"></a>
> **Source:** `docs/ux-flows/11-account-dashboard.md` · [↑ table of contents](#table-of-contents)
@@ -76601,7 +78236,7 @@ Shared auth concepts:
---
-<a id="sec-340"></a>
+<a id="sec-349"></a>
> **Source:** `docs/ux-flows/12-home-and-content.md` · [↑ table of contents](#table-of-contents)
@@ -76789,7 +78424,7 @@ All `/.well-known/*` and `/openapi.json` / `/sitemap.xml` responses are JSON/XML
---
-<a id="sec-341"></a>
+<a id="sec-350"></a>
> **Source:** `docs/validation.md` · [↑ table of contents](#table-of-contents)
@@ -77147,7 +78782,7 @@ The toggle's CSS class reflects the highest severity: `level-0` (errors), `level
---
-<a id="sec-342"></a>
+<a id="sec-351"></a>
> **Source:** `docs/vanity.md` · [↑ table of contents](#table-of-contents)
@@ -77188,11 +78823,16 @@ the currency an agent on Base or Solana already holds — and the key is deliver
once, over TLS, and never stored.
> **What can you actually match?** Base58 excludes `0`, `O`, `I`, `l`. An address
-> is 32 random bytes Base58-encoded, so its **leading** characters are not
-> uniformly distributed — a given prefix can be markedly harder than the naive
-> 58ⁿ estimate, while suffix characters are uniform. Each extra character
-> multiplies expected work by ~58, which is why the char caps and price ladder
-> climb steeply.
+> is 32 random bytes Base58-encoded, so its **leading** character is not
+> uniformly distributed: the 40 symbols from `K` to `z` are **~17× harder** to
+> lead with than `2`-`H`, a 58× spread across the alphabet. Suffix characters
+> *are* uniform at 1/58. Quotes, prices and rarity all use the exact
+> distribution rather than a flat 58ⁿ estimate, so a `zebra…` prefix is priced
+> as the genuinely harder grind it is, and an `Agent…` prefix is not overcharged.
+> Each *additional* character still multiplies expected work by ~58, which is why
+> the char caps and price ladder climb steeply. If a pattern cannot be found
+> inside the request's time budget, the endpoint declines it up front with the
+> real attempt count instead of grinding to a timeout.
---
@@ -77251,7 +78891,7 @@ tier for the requested pattern.
| `ignoreCase` | `1`/`true` matches the pattern case-insensitively (faster, less specific). |
| `format` | `keypair` (default) or `mnemonic`. |
| `strength` | Mnemonic only: `128` (12 words, default) or `256` (24 words). |
-| `sealTo` | Optional X25519 public key (Base58/Base64url/hex) — see [Security model](#security-model). |
+| `sealTo` | Optional X25519 public key (Base58/Base64url/hex), see [Security model](#security-model). Prefix with `base58:`, `base64url:` or `hex:` to be explicit; a bare 43-character string is a valid encoding under two of them and is rejected rather than guessed. Keys from our SDK's `generateRecipientKeypair()` are always unambiguous. |
### Example
@@ -77378,7 +79018,7 @@ challenges and the discovery doc stay in parity.
---
-<a id="sec-343"></a>
+<a id="sec-352"></a>
> **Source:** `docs/viewer.md` · [↑ table of contents](#table-of-contents)
@@ -77772,7 +79412,7 @@ A subset of state (background, transparency, background color, auto-rotate, expo
---
-<a id="sec-344"></a>
+<a id="sec-353"></a>
> **Source:** `docs/voice-lab.md` · [↑ table of contents](#table-of-contents)
@@ -77865,7 +79505,7 @@ The agent-voice handler ([`api/agents/_id/voice.js`](../api/agents/_id/voice.js)
---
-<a id="sec-345"></a>
+<a id="sec-354"></a>
> **Source:** `docs/web-component.md` · [↑ table of contents](#table-of-contents)
@@ -78789,7 +80429,7 @@ defineElement('my-agent');
---
-<a id="sec-346"></a>
+<a id="sec-355"></a>
> **Source:** `docs/widget-api.md` · [↑ table of contents](#table-of-contents)
@@ -78996,7 +80636,7 @@ If you have multiple widgets and want to coordinate them (sync camera, broadcast
---
-<a id="sec-347"></a>
+<a id="sec-356"></a>
> **Source:** `docs/widget-studio.md` · [↑ table of contents](#table-of-contents)
@@ -79247,7 +80887,7 @@ You can override these freely in the iframe `width` and `height` attributes. Add
---
-<a id="sec-348"></a>
+<a id="sec-357"></a>
> **Source:** `docs/widgets.md` · [↑ table of contents](#table-of-contents)
@@ -79765,7 +81405,7 @@ Need to drive a widget from the parent page — change the camera, play an anima
---
-<a id="sec-349"></a>
+<a id="sec-358"></a>
> **Source:** `docs/x402-buyer.md` · [↑ table of contents](#table-of-contents)
@@ -79867,7 +81507,7 @@ set) back into the payment so attribution survives the round trip.
---
-<a id="sec-350"></a>
+<a id="sec-359"></a>
> **Source:** `docs/x402-dev-tools.md` · [↑ table of contents](#table-of-contents)
@@ -80062,7 +81702,7 @@ implementation against a live server.
---
-<a id="sec-351"></a>
+<a id="sec-360"></a>
> **Source:** `docs/x402-distribution.md` · [↑ table of contents](#table-of-contents)
@@ -80275,7 +81915,7 @@ script. Everything else above updates itself.
---
-<a id="sec-352"></a>
+<a id="sec-361"></a>
> **Source:** `docs/x402-endpoints.md` · [↑ table of contents](#table-of-contents)
@@ -80455,7 +82095,7 @@ datapoints at **$0.0005** USDC each by default, overridable per family with
| Endpoint | Default | Returns |
| ----------------------------------------------------------- | --------- | -------------------------------------------------------------------------------------------- |
-| `/api/x402/forge` | tiered | Text/image → 3D model (price by tier; GPU-bound). See [Avatar pipeline](avatar-pipeline.md). |
+| `/api/x402/forge` | tiered | Text/image → 3D model (price by tier; GPU-bound). Every settled generation also lands in the public community gallery (`forge_creations`) stamped with the payer, settle signature, and price; the gallery shows a Solscan-linked "x402" provenance badge. See [Avatar pipeline](avatar-pipeline.md). |
| `/api/x402/embody` | $1.00 | **Embodiment.** One call, an agent buys itself a body: prompt or image in → rigged, voiced 3D avatar out, plus a durable persona id and a one-tag `<iframe>` embed for any website. Settles on delivery — a failed generation never charges. See [Embodiment](embody.md). |
| `/api/x402/pipeline` | per stage | **One call, full 3D asset pipeline** — text or GLB in, rigged/optimized game-ready GLB out. Ordered chain of `generate → rig → remesh → gameready → stylize`; the 402 quote is the exact sum of the requested stages. Poll free at `/api/forge?job=<id>` for per-stage progress. See [3D pipeline](3d-pipeline.md). |
| `/api/x402/pipeline-rig` | $0.05 | **Pipeline — Rig.** Static GLB in → animation-ready rigged GLB out (skeleton + skin weights). One paid call, durable URL. See [3D pipeline](3d-pipeline.md). |
@@ -80543,7 +82183,7 @@ input and do not promote any specific token.
---
-<a id="sec-353"></a>
+<a id="sec-362"></a>
> **Source:** `docs/x402-revenue.md` · [↑ table of contents](#table-of-contents)
@@ -80904,7 +82544,7 @@ settled activity (include it), and label it as such.
---
-<a id="sec-354"></a>
+<a id="sec-363"></a>
> **Source:** `docs/x402-ring-economy.md` · [↑ table of contents](#table-of-contents)
@@ -80926,6 +82566,53 @@ control.
> *not* to do. The public organic-revenue feed is a separate surface
> ([/api/x402-revenue](../api/x402-revenue.js)).
+## The runway governor: funding IS the throttle
+
+The per-minute ring tick no longer fires a fixed `X402_RING_TICK_CALLS` blindly.
+`governedCalls()` (`api/_lib/x402/ring-tick-plan.js`) scales each tick's call
+count so the payer's spendable SOL (balance minus the untouchable floor) lasts
+`X402_RING_TARGET_RUNWAY_DAYS` (default 3) at the governed rate, assuming
+`X402_RING_FEE_PER_CALL_LAMPORTS` (default 7,000, the conservative end of the
+measured 6,300-7,800 self-pay cost) per call. Consequences:
+
+- Fund the payer more, the ring speeds up automatically. Let it drain, the rate
+ tapers smoothly instead of sprinting to the floor and flat-lining until the
+ next manual top-up (the failure mode that killed the ring daily at the
+ 94-calls/min fixed rate).
+- The governor only throttles DOWN from the configured rate, never above it,
+ so `X402_RING_TICK_CALLS` remains the hard ceiling.
+- **Heartbeat (`X402_RING_MIN_CALLS`, default 1).** Above the hard SOL floor the
+ governor never returns 0. Runway-only governing left a dead band between the
+ floor and "floor + `runwayDays` of 1 call/min" (0.03 SOL at stock knobs) where
+ the ring did nothing — and doing nothing is self-reinforcing: no calls means no
+ settles, no settles means no treasury USDC, so no sweep, no revshare, no fuel
+ swap, and the economy cannot restart itself from its own balances. Observed
+ 2026-07-26: 58 consecutive `runway_exhausted` ticks while spendable SOL sat
+ idle. The hard floor is the real protection (`assessBackpressure` stops the
+ rail there), so spending the band at the heartbeat rate strictly dominates
+ hoarding it. Set `X402_RING_MIN_CALLS=0` to restore strict runway-only mode.
+- Only at or below the floor does the tick skip with `runway_exhausted` (one
+ throttled ops alert), the loud "fund the payer" signal.
+
+### Known limitation: the governor governs one tenant of a shared wallet
+
+`governedCalls()` throttles the **ring tick only**, but the ring payer is shared
+with roughly a dozen other paid pipelines (`health`, `volume`, `oracle`,
+`sniper`, `datapoint`, `3d`, `ring-agents`, …) that spend ungoverned. Measured
+2026-07-27: in one 20-minute window the ring tick was throttled to 2 paid calls
+while co-tenant pipelines completed ~200. A governor that throttles one tenant
+while others drain the same runway protects nothing under real scarcity — it
+just decides *which* pipeline gets starved. Two follow-ups, in order of value:
+
+1. **Meter the wallet, not the pipeline.** Move the runway budget into a shared
+ accounting key (the same place `ringDailySpent()` lives) so every pipeline
+ draws from one governed allowance.
+2. **Watch the wallet that actually pays.** The governor reads the ring payer's
+ balance, but sponsor-mode settles are fee-paid by the sponsor/master
+ (confirmed on-chain: `accountKeys[0]` is the master on co-tenant payments, 2
+ signatures, 10,001 lamports). In mixed mode the governed balance and the
+ burned balance are different wallets.
+
## Burning the least SOL — two levers
On-chain settlement has a **hard floor**: every Solana transaction costs a base
@@ -81087,6 +82774,14 @@ then kept in a verified, watched, auto-fundable state:
the sponsor" attack **and** enforces "only our wallets settle here".
- **SOL floor.** Below `X402_SPONSOR_SOL_FLOOR_LAMPORTS` (default 0.02 SOL) the
facilitator refuses to settle, pausing the loop before it can drain your SOL.
+ - **Discovery catalog.** `GET /api/x402-facilitator/discovery/resources` serves
+ the facilitator-standard resource list (`?limit=&offset=`, the
+ `ListDiscoveryResourcesResponse` shape crawled by x402scan and every client
+ built on the x402 npm package's `useFacilitator().list()`). It projects the
+ same canonical catalog as `/.well-known/x402.json` into the legacy v1 wire
+ format, so explorers indexing this facilitator list our paid endpoints
+ automatically. Projection lives in
+ [api/_lib/x402/discovery-resources.js](../api/_lib/x402/discovery-resources.js).
- **Ring settlement endpoint** — [api/x402/ring-settle.js](../api/x402/ring-settle.js).
Price-configurable (`X402_PRICE_RING_SETTLE`), internal (`discoverable:false`),
returns a real economic-tick receipt.
@@ -81306,6 +83001,24 @@ independently, so the ring tick never consumes the autonomous loop's
| `X402_PRICE_RING_SETTLE` | $1.00 | the volume carrier's per-call size |
| `X402_RING_TICK_CAP_ATOMIC` | $1.10 | per-tick spend ceiling (fits one settle + its cheap co-riders) |
| `X402_RING_DAILY_CAP_ATOMIC` | $50.00 | ring-tick daily ceiling (separate budget) |
+| `X402_RING_TICK_CONCURRENCY` | 12 | cheap calls in flight at once (1 = strictly sequential) |
+
+### Scaling up: concurrency and reservations
+
+The tick's paid calls run through a bounded-concurrency executor
+([api/_lib/x402/ring-tick-exec.js](../api/_lib/x402/ring-tick-exec.js)): the
+ring-settle carrier runs alone first, then the cheap calls fan out across
+`X402_RING_TICK_CONCURRENCY` worker lanes, which is what lets a tick clear
+~90+ calls inside its 60 s window. Budget safety holds under concurrency by
+reservation: each launch reserves a worst-case slice ($0.02) of the remaining
+tick budget and gets that slice as its own `remainingCap`, which `payX402`
+enforces against the live 402 challenge, so concurrent calls can never
+collectively overspend the tick cap. Unspent slices are refunded as calls
+finish; a mid-tick SOL-floor signal stops further launches and drains what is
+in flight. Fee math when scaling: fees track *transaction count*, not USDC
+size — ~10,001 lamports per settle, so ~94 calls/min ≈ 135k tx/day ≈ 1.35
+SOL/day. Raise `X402_RING_DAILY_FEE_BUDGET_LAMPORTS`, the daily cap, and payer
+funding together (see the funding table in "Turning it on").
At 3 calls/min the **traffic shape** is:
@@ -81743,7 +83456,7 @@ curl -s -H "Authorization: Bearer $CRON_SECRET" \
---
-<a id="sec-355"></a>
+<a id="sec-364"></a>
> **Source:** `docs/x402-studio.md` · [↑ table of contents](#table-of-contents)
@@ -81852,7 +83565,7 @@ const { tx_base64, blockhash } = await res.json();
---
-<a id="sec-356"></a>
+<a id="sec-365"></a>
> **Source:** `docs/x402.md` · [↑ table of contents](#table-of-contents)
@@ -82035,7 +83748,7 @@ Each package has its own repository with a full README, API reference, and examp
---
-<a id="sec-357"></a>
+<a id="sec-366"></a>
> **Source:** `docs/zauth/database.md` · [↑ table of contents](#table-of-contents)
@@ -82181,7 +83894,7 @@ Use this endpoint to browse all known x402 endpoints before your agents commit t
---
-<a id="sec-358"></a>
+<a id="sec-367"></a>
> **Source:** `docs/zauth/index.md` · [↑ table of contents](#table-of-contents)
@@ -82205,7 +83918,7 @@ zauth is the security and trust layer that allows agents to act with confidence,
---
-<a id="sec-359"></a>
+<a id="sec-368"></a>
> **Source:** `docs/zauth/provider-hub.md` · [↑ table of contents](#table-of-contents)
@@ -82307,7 +84020,7 @@ Supply your EVM or Solana private keys to enable automatic refunds when your end
---
-<a id="sec-360"></a>
+<a id="sec-369"></a>
> **Source:** `docs/zauth/reposcan.md` · [↑ table of contents](#table-of-contents)
@@ -82633,7 +84346,7 @@ TypeScript -@x402/fetch
---
-<a id="sec-361"></a>
+<a id="sec-370"></a>
> **Source:** `docs/zauth/vector.md` · [↑ table of contents](#table-of-contents)
diff --git a/docs/api-reference.md b/docs/api-reference.md
index 248eacb87..1dfebf125 100644
--- a/docs/api-reference.md
+++ b/docs/api-reference.md
@@ -679,8 +679,8 @@ silently.
{
"data": {
"status": "done",
- "glb_url": "https://cdn.three.ws/forge/anon/<id>.glb",
- "viewer_url": "https://three.ws/viewer?src=https%3A%2F%2Fcdn.three.ws%2Fforge%2Fanon%2F%3Cid%3E.glb",
+ "glb_url": "https://three.ws/cdn/forge/anon/<id>.glb",
+ "viewer_url": "https://three.ws/viewer?src=https%3A%2F%2Fthree.ws%2Fcdn%2Fforge%2Fanon%2F%3Cid%3E.glb",
"creation_id": "<uuid>",
"backend": "nvidia",
"tier": "draft"
@@ -756,7 +756,7 @@ content-safety gate before any GPU work starts.
**Response, finished inline**
```json
-{ "status": "done", "glbUrl": "https://cdn.three.ws/forge/anon/<id>.glb", "viewerUrl": "https://three.ws/viewer?src=…", "arUrl": "https://three.ws/api/ar?src=…&title=a%20small%20ceramic%20robot%20figurine", "format": "glb" }
+{ "status": "done", "glbUrl": "https://three.ws/cdn/forge/anon/<id>.glb", "viewerUrl": "https://three.ws/viewer?src=…", "arUrl": "https://three.ws/api/ar?src=…&title=a%20small%20ceramic%20robot%20figurine", "format": "glb" }
```
`arUrl` is the place-in-your-room link (`GET /api/ar`, documented below):
@@ -812,7 +812,7 @@ provider answers at all it **fails open** (`verdict.pass: true`,
```json
{
- "glbUrl": "https://cdn.three.ws/forge/anon/<id>.glb",
+ "glbUrl": "https://three.ws/cdn/forge/anon/<id>.glb",
"prompt": "a medieval knight in full plate steel armor",
"subject": "person",
"tier": "standard",
@@ -990,7 +990,7 @@ Every row is a real settled generation — no synthetic entries.
"category": "crate",
"tier": "draft",
"status": "done",
- "glb_url": "https://cdn.three.ws/forge/…​.glb",
+ "glb_url": "https://three.ws/cdn/forge/…​.glb",
"novelty": 0.83,
"cluster_id": 2,
"price_usdc": 0.05,
@@ -1053,7 +1053,7 @@ new lineage version.
**Response**
```json
-{ "ok": true, "url": "https://cdn.three.ws/material-studio/checkpoints/<uuid>.glb", "bytes": 842113 }
+{ "ok": true, "url": "https://three.ws/cdn/material-studio/checkpoints/<uuid>.glb", "bytes": 842113 }
```
### AI restyle
@@ -1080,14 +1080,14 @@ are byte-identical to the source.
```json
{
"ok": true,
- "glbUrl": "https://cdn.three.ws/material-studio/restyle/<uuid>.glb",
- "sourceGlbUrl": "https://cdn.three.ws/creations/<id>/mesh.glb",
+ "glbUrl": "https://three.ws/cdn/material-studio/restyle/<uuid>.glb",
+ "sourceGlbUrl": "https://three.ws/cdn/creations/<id>/mesh.glb",
"instruction": "make it chrome",
"factors": { "name": "Polished chrome", "baseColorFactor": [0.79, 0.81, 0.83], "metallicFactor": 1, "roughnessFactor": 0.05, "emissiveFactor": [0, 0, 0] },
"materialsEdited": 1,
"lineage": [
- { "index": 0, "parentIndex": null, "glbUrl": "https://cdn.three.ws/creations/<id>/mesh.glb", "refKind": "origin" },
- { "index": 1, "parentIndex": 0, "glbUrl": "https://cdn.three.ws/material-studio/restyle/<uuid>.glb", "instruction": "make it chrome", "refKind": "restyle" }
+ { "index": 0, "parentIndex": null, "glbUrl": "https://three.ws/cdn/creations/<id>/mesh.glb", "refKind": "origin" },
+ { "index": 1, "parentIndex": 0, "glbUrl": "https://three.ws/cdn/material-studio/restyle/<uuid>.glb", "instruction": "make it chrome", "refKind": "restyle" }
],
"activeIndex": 1
}
@@ -1117,18 +1117,18 @@ as its own real, validated GLB**, not just a live preview swap.
```json
{
"ok": true,
- "sourceGlbUrl": "https://cdn.three.ws/creations/<id>/mesh.glb",
+ "sourceGlbUrl": "https://three.ws/cdn/creations/<id>/mesh.glb",
"preset": "chrome",
"seed": 42,
"count": 3,
"variants": [
- { "glbUrl": "https://cdn.three.ws/material-studio/variants/<uuid1>.glb", "label": "Chrome 1", "seed": 42, "config": { "color": "#c9ced4", "metalness": 1, "roughness": 0.05 }, "lineageIndex": 1 },
- { "glbUrl": "https://cdn.three.ws/material-studio/variants/<uuid2>.glb", "label": "Chrome 2", "seed": 43, "config": { "color": "#a1c9d4", "metalness": 0.94, "roughness": 0.09 }, "lineageIndex": 2 }
+ { "glbUrl": "https://three.ws/cdn/material-studio/variants/<uuid1>.glb", "label": "Chrome 1", "seed": 42, "config": { "color": "#c9ced4", "metalness": 1, "roughness": 0.05 }, "lineageIndex": 1 },
+ { "glbUrl": "https://three.ws/cdn/material-studio/variants/<uuid2>.glb", "label": "Chrome 2", "seed": 43, "config": { "color": "#a1c9d4", "metalness": 0.94, "roughness": 0.09 }, "lineageIndex": 2 }
],
"lineage": [
- { "index": 0, "parentIndex": null, "glbUrl": "https://cdn.three.ws/creations/<id>/mesh.glb", "refKind": "origin" },
- { "index": 1, "parentIndex": 0, "glbUrl": "https://cdn.three.ws/material-studio/variants/<uuid1>.glb", "instruction": "Chrome 1", "refKind": "variant" },
- { "index": 2, "parentIndex": 0, "glbUrl": "https://cdn.three.ws/material-studio/variants/<uuid2>.glb", "instruction": "Chrome 2", "refKind": "variant" }
+ { "index": 0, "parentIndex": null, "glbUrl": "https://three.ws/cdn/creations/<id>/mesh.glb", "refKind": "origin" },
+ { "index": 1, "parentIndex": 0, "glbUrl": "https://three.ws/cdn/material-studio/variants/<uuid1>.glb", "instruction": "Chrome 1", "refKind": "variant" },
+ { "index": 2, "parentIndex": 0, "glbUrl": "https://three.ws/cdn/material-studio/variants/<uuid2>.glb", "instruction": "Chrome 2", "refKind": "variant" }
],
"activeIndex": 0
}
@@ -1186,7 +1186,7 @@ outage never burns a free generation.
```json
{
- "url": "https://cdn.three.ws/forge/refs/<id>.jpg",
+ "url": "https://three.ws/cdn/forge/refs/<id>.jpg",
"provider": "nvidia-nim",
"model": "black-forest-labs/flux.1-schnell",
"width": 1024,
@@ -3598,7 +3598,7 @@ Omitting `limit` returns the full array exactly as before (no `offset`/`next_off
"loop": true,
"duration": 4.4,
"bytes": 1174283,
- "url": "https://cdn.three.ws/animations/library/clips/mx-hip-hop-dancing.json"
+ "url": "https://three.ws/cdn/animations/library/clips/mx-hip-hop-dancing.json"
}
],
"total": 2400,
diff --git a/docs/content/use-cases/brand-marketer.md b/docs/content/use-cases/brand-marketer.md
index 094363492..63e5cd0c7 100644
--- a/docs/content/use-cases/brand-marketer.md
+++ b/docs/content/use-cases/brand-marketer.md
@@ -28,7 +28,7 @@ Four real capabilities cover embodiment, reach, and trust:
```html
<script type="module" src="https://three.ws/agent-3d/1.5.2/agent-3d.js"></script>
<agent-3d
- body="https://cdn.three.ws/models/brand-agent.glb"
+ body="https://three.ws/cdn/models/brand-agent.glb"
brain="claude-sonnet-4-6"
name="Lyra-bot"
instructions="Official brand assistant. Answer product questions, link to pricing, stay on-brand."
diff --git a/docs/content/use-cases/indie-creator.md b/docs/content/use-cases/indie-creator.md
index cecc104e4..6bf03fff4 100644
--- a/docs/content/use-cases/indie-creator.md
+++ b/docs/content/use-cases/indie-creator.md
@@ -30,7 +30,7 @@ Together: your face (or your prompt) becomes a model, the model becomes a talkin
```html
<script type="module" src="https://three.ws/agent-3d/1.5.2/agent-3d.js"></script>
<agent-3d
- body="https://cdn.three.ws/models/procyon-fox.glb"
+ body="https://three.ws/cdn/models/procyon-fox.glb"
brain="claude-sonnet-4-6"
name="Procyon"
instructions="You are Procyon's studio fox. Greet visitors warmly, talk about the art prints, and wave when someone says hi."
diff --git a/docs/how-it-works.md b/docs/how-it-works.md
index c00ee5cd2..65b8fc5ba 100644
--- a/docs/how-it-works.md
+++ b/docs/how-it-works.md
@@ -97,7 +97,7 @@ Three production paths. Pick whichever fits your use case:
- **Selfie capture** — upload a photo, get a rigged 3D version of yourself in ~60 seconds. See [avatar-creation.md](./avatar-creation.md).
- **Upload your own** — any glTF 2.0 / GLB with a humanoid rig works. Drop the file into the editor at [three.ws/create](https://three.ws/create) or POST to `/api/avatars`.
-Every avatar ends up as a hosted GLB URL (served from the `cdn.three.ws` asset CDN) plus a database record. When you wire one into an agent, the agent's manifest references it under `body.uri`.
+Every avatar ends up as a hosted GLB URL (served from the first-party asset CDN at `three.ws/cdn/<key>`) plus a database record. When you wire one into an agent, the agent's manifest references it under `body.uri`.
---
diff --git a/docs/mcp.md b/docs/mcp.md
index 730e9d3d0..e47886cb0 100644
--- a/docs/mcp.md
+++ b/docs/mcp.md
@@ -679,7 +679,7 @@ Here is a realistic conversation showing how Claude uses the MCP tools end-to-en
1. `get_avatar({ slug: "storm-mage" })` — resolves the UUID and model URL.
-2. `validate_model({ url: "https://cdn.three.ws/u/…/storm-mage.glb" })` — runs the Khronos validator.
+2. `validate_model({ url: "https://three.ws/cdn/u/…/storm-mage.glb" })` — runs the Khronos validator.
Response:
```
@@ -688,7 +688,7 @@ Here is a realistic conversation showing how Claude uses the MCP tools end-to-en
[WRN] NODE_EMPTY: node "Armature" has no mesh and no children
```
-3. `inspect_model({ url: "https://cdn.three.ws/u/…/storm-mage.glb" })` — structural overview.
+3. `inspect_model({ url: "https://three.ws/cdn/u/…/storm-mage.glb" })` — structural overview.
Response:
```
diff --git a/docs/okx-marketplace.md b/docs/okx-marketplace.md
index 52d5fd924..7b6a2df29 100644
--- a/docs/okx-marketplace.md
+++ b/docs/okx-marketplace.md
@@ -187,7 +187,7 @@ Adds an animation-ready humanoid skeleton and skin weights to a static GLB (UniR
```bash
curl -i -X POST https://three.ws/api/okx/3d/rig \
-H 'content-type: application/json' \
- -d '{"glb_url":"https://cdn.three.ws/models/knight.glb"}'
+ -d '{"glb_url":"https://three.ws/cdn/models/knight.glb"}'
```
### Text → Rigged Avatar, $0.50
@@ -213,7 +213,7 @@ Completes inside the request. Clip names are free at
```bash
curl -i -X POST https://three.ws/api/okx/3d/retarget \
-H 'content-type: application/json' \
- -d '{"model_url":"https://cdn.three.ws/models/knight-rigged.glb","animation":"idle"}'
+ -d '{"model_url":"https://three.ws/cdn/models/knight-rigged.glb","animation":"idle"}'
```
### Pose Seed, $0.02
@@ -236,7 +236,7 @@ Other formats: `obj`, `stl`, `ply`, `usdz`, `3mf`.
```bash
curl -i -X POST https://three.ws/api/okx/3d/fbx-export \
-H 'content-type: application/json' \
- -d '{"model_url":"https://cdn.three.ws/models/knight-rigged.glb","format":"fbx"}'
+ -d '{"model_url":"https://three.ws/cdn/models/knight-rigged.glb","format":"fbx"}'
```
### Guarantees (all decomposed services)
diff --git a/docs/persona-hub.md b/docs/persona-hub.md
index d9b647a0a..21a77a7c8 100644
--- a/docs/persona-hub.md
+++ b/docs/persona-hub.md
@@ -157,8 +157,8 @@ A successful response looks like:
"avatar": {
"id": "a-1",
"name": "My Avatar",
- "url": "https://cdn.three.ws/u/<user>/avatar.glb",
- "thumbnail_url": "https://cdn.three.ws/u/<user>/avatar.png"
+ "url": "https://three.ws/cdn/u/<user>/avatar.glb",
+ "thumbnail_url": "https://three.ws/cdn/u/<user>/avatar.png"
},
"tenant_origin": "https://coolgame.three.ws",
"alg": "ES256"
@@ -197,8 +197,8 @@ The base64url payload of the issued token decodes to:
"avatar": {
"id": "a-1",
"name": "My Avatar",
- "url": "https://cdn.three.ws/u/<user>/avatar.glb",
- "thumbnail_url": "https://cdn.three.ws/u/<user>/avatar.png"
+ "url": "https://three.ws/cdn/u/<user>/avatar.glb",
+ "thumbnail_url": "https://three.ws/cdn/u/<user>/avatar.png"
},
"iss": "https://three.ws",
"sub": "<three.ws user id>",
diff --git a/packages/forge/README.md b/packages/forge/README.md
index bc6e636e2..e96337ffc 100644
--- a/packages/forge/README.md
+++ b/packages/forge/README.md
@@ -72,7 +72,7 @@ import { forge } from '@three-ws/forge';
const model = await forge('a chrome robot with neon trim');
-console.log(model.glbUrl); // → https://cdn.three.ws/forge/…​.glb (durable)
+console.log(model.glbUrl); // → https://three.ws/cdn/forge/…​.glb (durable)
console.log(model.viewerUrl); // → https://three.ws/forge?share=…​
```
diff --git a/packages/forge/test/forge.test.js b/packages/forge/test/forge.test.js
index 5d60e26dd..6176bb4c7 100644
--- a/packages/forge/test/forge.test.js
+++ b/packages/forge/test/forge.test.js
@@ -25,7 +25,7 @@ function stubFetch(responses) {
test('forge() posts the prompt and shapes a synchronous done job', async () => {
const { fetch, calls } = stubFetch([
- { body: { job_id: null, creation_id: 'c1', status: 'done', glb_url: 'https://cdn.three.ws/a.glb', backend: 'nvidia', tier: 'standard', path: 'image', durable: true } },
+ { body: { job_id: null, creation_id: 'c1', status: 'done', glb_url: 'https://three.ws/cdn/a.glb', backend: 'nvidia', tier: 'standard', path: 'image', durable: true } },
]);
const client = createForge({ fetch, baseUrl: 'https://three.ws' });
const res = await client.forge('a chrome robot');
@@ -36,7 +36,7 @@ test('forge() posts the prompt and shapes a synchronous done job', async () => {
assert.equal(sent.prompt, 'a chrome robot');
assert.ok(!('path' in sent), 'unset options are pruned from the body');
assert.equal(res.status, 'done');
- assert.equal(res.glbUrl, 'https://cdn.three.ws/a.glb');
+ assert.equal(res.glbUrl, 'https://three.ws/cdn/a.glb');
assert.equal(res.viewerUrl, 'https://three.ws/forge?share=c1');
assert.equal(res.backend, 'nvidia');
});
@@ -45,13 +45,13 @@ test('forge() polls a queued job until done', async () => {
const { fetch, calls } = stubFetch([
{ body: { job_id: 'j1', creation_id: 'c2', status: 'queued' } },
{ body: { job_id: 'j1', status: 'running' } },
- { body: { job_id: 'j1', creation_id: 'c2', status: 'done', glb_url: 'https://cdn.three.ws/b.glb' } },
+ { body: { job_id: 'j1', creation_id: 'c2', status: 'done', glb_url: 'https://three.ws/cdn/b.glb' } },
]);
const ticks = [];
const client = createForge({ fetch });
const res = await client.forge('a fox', { pollIntervalMs: 1, onProgress: (j) => ticks.push(j.status) });
- assert.equal(res.glbUrl, 'https://cdn.three.ws/b.glb');
+ assert.equal(res.glbUrl, 'https://three.ws/cdn/b.glb');
assert.equal(calls[1].url.searchParams.get('job'), 'j1');
assert.ok(ticks.includes('queued'));
assert.ok(ticks.includes('done'));
@@ -59,13 +59,13 @@ test('forge() polls a queued job until done', async () => {
test('rig() targets action=rig with the glb_url', async () => {
const { fetch, calls } = stubFetch([
- { body: { job_id: null, creation_id: 'c3', status: 'done', glb_url: 'https://cdn.three.ws/rigged.glb' } },
+ { body: { job_id: null, creation_id: 'c3', status: 'done', glb_url: 'https://three.ws/cdn/rigged.glb' } },
]);
const client = createForge({ fetch });
- const res = await client.rig('https://cdn.three.ws/raw.glb');
+ const res = await client.rig('https://three.ws/cdn/raw.glb');
assert.equal(calls[0].url.searchParams.get('action'), 'rig');
- assert.equal(JSON.parse(calls[0].init.body).glb_url, 'https://cdn.three.ws/raw.glb');
- assert.equal(res.glbUrl, 'https://cdn.three.ws/rigged.glb');
+ assert.equal(JSON.parse(calls[0].init.body).glb_url, 'https://three.ws/cdn/raw.glb');
+ assert.equal(res.glbUrl, 'https://three.ws/cdn/rigged.glb');
});
test('the geometry path attaches the BYOK provider key header', async () => {
diff --git a/packages/irl/README.md b/packages/irl/README.md
index 997747fc0..cc82c65f7 100644
--- a/packages/irl/README.md
+++ b/packages/irl/README.md
@@ -98,7 +98,7 @@ const { pin } = await placePin({
lat: fix.lat,
lng: fix.lng,
avatarName: 'Scout',
- avatarUrl: 'https://cdn.three.ws/forge/scout.glb', // from @three-ws/forge
+ avatarUrl: 'https://three.ws/cdn/forge/scout.glb', // from @three-ws/forge
caption: 'Say hi — I drop $THREE alpha here',
});
diff --git a/packages/irl/test/irl.test.js b/packages/irl/test/irl.test.js
index a47cabe7f..2d0dd246d 100644
--- a/packages/irl/test/irl.test.js
+++ b/packages/irl/test/irl.test.js
@@ -53,7 +53,7 @@ test('nearby() sends the fix token in the x-irl-fix header and shapes pins to ca
const { fetch, calls } = stubFetch([
{ body: { pins: [
{ id: 'p1', agent_id: 'a1', lat: 40.74110, lng: -73.98970, heading: 90, distance_m: 12,
- avatar_url: 'https://cdn.three.ws/scout.glb', avatar_name: 'Scout', caption: 'gm',
+ avatar_url: 'https://three.ws/cdn/scout.glb', avatar_name: 'Scout', caption: 'gm',
x402_endpoint: null, view_count: 3, avatar_version: 2, is_mine: false, room_id: null },
] } },
]);
@@ -68,7 +68,7 @@ test('nearby() sends the fix token in the x-irl-fix header and shapes pins to ca
assert.equal(pins.length, 1);
assert.equal(pins[0].agentId, 'a1');
assert.equal(pins[0].distanceM, 12);
- assert.equal(pins[0].avatarUrl, 'https://cdn.three.ws/scout.glb');
+ assert.equal(pins[0].avatarUrl, 'https://three.ws/cdn/scout.glb');
assert.equal(pins[0].viewCount, 3);
assert.equal(pins[0].isMine, false);
assert.equal(pins[0].raw.avatar_name, 'Scout');
@@ -87,13 +87,13 @@ test('nearby() rejects a non-finite radius before any network call', async () =>
test('placePin() posts the body and exposes the permanent flag', async () => {
const { fetch, calls } = stubFetch([
{ status: 201, body: { pin: { id: 'p9', lat: 40.7411, lng: -73.9897, avatar_name: 'Scout',
- caption: 'Say hi — I drop $THREE alpha here', avatar_url: 'https://cdn.three.ws/scout.glb',
+ caption: 'Say hi — I drop $THREE alpha here', avatar_url: 'https://three.ws/cdn/scout.glb',
expires_at: null, permanent: true } } },
]);
const client = createIrl({ fetch });
const { pin } = await client.placePin({
lat: 40.7411, lng: -73.9897, avatarName: 'Scout',
- avatarUrl: 'https://cdn.three.ws/scout.glb', caption: 'Say hi — I drop $THREE alpha here',
+ avatarUrl: 'https://three.ws/cdn/scout.glb', caption: 'Say hi — I drop $THREE alpha here',
});
assert.equal(calls[0].url.pathname, '/api/irl/pins');
diff --git a/packages/readme-3d/docs/tutorials/03-text-to-3d-avatar.md b/packages/readme-3d/docs/tutorials/03-text-to-3d-avatar.md
index 36e0388cc..2c575777d 100644
--- a/packages/readme-3d/docs/tutorials/03-text-to-3d-avatar.md
+++ b/packages/readme-3d/docs/tutorials/03-text-to-3d-avatar.md
@@ -18,7 +18,7 @@ curl -s -X POST https://three.ws/api/v1/ai/text-to-3d \
Generation takes up to a minute or two. When it completes inside the request window you get the model directly:
```json
-{ "data": { "status": "done", "glb_url": "https://cdn.three.ws/forge/anon/<id>.glb", "viewer_url": "..." } }
+{ "data": { "status": "done", "glb_url": "https://three.ws/cdn/forge/anon/<id>.glb", "viewer_url": "..." } }
```
If it returns `"status": "pending"` instead, poll the included `poll_url` (`GET https://three.ws/api/forge?job=<job>`) every few seconds until `status` is `"done"`. Then download:
diff --git a/prompts/store-submissions/_generated/tokenized/metadata-sample.json b/prompts/store-submissions/_generated/tokenized/metadata-sample.json
index 7df238009..20896a5c7 100644
--- a/prompts/store-submissions/_generated/tokenized/metadata-sample.json
+++ b/prompts/store-submissions/_generated/tokenized/metadata-sample.json
@@ -2,9 +2,9 @@
"name": "Knight",
"symbol": "3D",
"description": "A rigged knight, tokenized.",
- "image": "https://cdn.three.ws/tokenized/EXAMPLE/thumb.png",
- "animation_url": "https://cdn.three.ws/tokenized/EXAMPLE/model.glb",
- "external_url": "https://three.ws/viewer?src=https%3A%2F%2Fcdn.three.ws%2Ftokenized%2FEXAMPLE%2Fmodel.glb",
+ "image": "https://three.ws/cdn/tokenized/EXAMPLE/thumb.png",
+ "animation_url": "https://three.ws/cdn/tokenized/EXAMPLE/model.glb",
+ "external_url": "https://three.ws/viewer?src=https%3A%2F%2Fthree.ws%2Fcdn%2Ftokenized%2FEXAMPLE%2Fmodel.glb",
"seller_fee_basis_points": 500,
"attributes": [
{
@@ -60,7 +60,7 @@
"category": "3d",
"files": [
{
- "uri": "https://cdn.three.ws/tokenized/EXAMPLE/model.glb",
+ "uri": "https://three.ws/cdn/tokenized/EXAMPLE/model.glb",
"type": "model/gltf-binary"
},
{
@@ -68,7 +68,7 @@
"type": "model/gltf-binary"
},
{
- "uri": "https://cdn.three.ws/tokenized/EXAMPLE/thumb.png",
+ "uri": "https://three.ws/cdn/tokenized/EXAMPLE/thumb.png",
"type": "image/png"
},
{
diff --git a/public/spatial-mcp/demo.js b/public/spatial-mcp/demo.js
index d0e77e14d..a457b5143 100644
--- a/public/spatial-mcp/demo.js
+++ b/public/spatial-mcp/demo.js
@@ -17,11 +17,16 @@
import { renderSpatialArtifact } from './spatial-renderer.js';
import { validateSpatialArtifact, lintSpatialMeta } from './spatial-validator.js';
-// Left stage: a real forge_free output, generated by the free text→3D lane and
-// served from the same durable bucket a live tool result points at. Right stage:
-// a genuinely third-party asset (Khronos glTF sample) so the foreign payload is
+// Left stage: a real forge_free output, generated by the free text→3D lane.
+// Served through the first-party CDN (/cdn/<r2-key>, api/cdn-object.js) rather
+// than the bucket's public r2.dev domain: that domain is Cloudflare
+// rate-limited, "not meant for production traffic", and answers CORS with an
+// exact-origin allowlist, so a third party copying this artifact to prove
+// portability would be blocked. /cdn serves the same object with
+// `access-control-allow-origin: *` and a 30-day edge cache. Right stage: a
+// genuinely third-party asset (Khronos glTF sample) so the foreign payload is
// foreign end to end, asset and shape both.
-const FORGE_GLB = 'https://pub-2534e921bf9c4314addcd4d8a6e98b7b.r2.dev/forge/anon/eddcea57-a278-474a-a632-99ca99861755.glb';
+const FORGE_GLB = 'https://three.ws/cdn/forge/anon/eddcea57-a278-474a-a632-99ca99861755.glb';
const FOREIGN_GLB = 'https://cdn.jsdelivr.net/gh/KhronosGroup/glTF-Sample-Assets@main/Models/DamagedHelmet/glTF-Binary/DamagedHelmet.glb';
// 1) A native three.ws artifact. This IS forge_free's structuredContent.spatial
diff --git a/scripts/build-discovery-cards.mjs b/scripts/build-discovery-cards.mjs
index 745641901..c17089219 100644
--- a/scripts/build-discovery-cards.mjs
+++ b/scripts/build-discovery-cards.mjs
@@ -114,7 +114,8 @@ if (paid.length < 40) {
// ── crypto-agent-manifest.json (sample agent-manifest/0.2) ───────────────────
{
const manifest = readJson('public/crypto-agent-manifest.json', { indent: ' ' });
- // cdn.three.ws is dead (connection refused) — point the sample body at the
+ // cdn.three.ws has no DNS and never did; the first-party CDN is the
+ // `/cdn/<r2-key>` route (api/cdn-object.js). Point the sample body at the
// live default avatar so the manifest demo actually loads.
manifest.body.uri = 'https://three.ws/avatars/default.glb';
manifest.brain.model = 'claude-sonnet-5';
diff --git a/tests/agent-detail-avatar.test.js b/tests/agent-detail-avatar.test.js
index 71d702d3c..405f8aa1a 100644
--- a/tests/agent-detail-avatar.test.js
+++ b/tests/agent-detail-avatar.test.js
@@ -74,7 +74,7 @@ describe('render3DAvatar', () => {
// back to the mannequin. These lock the URL through the real render seam.
describe('normalize() preserves the avatar model URL for the hero', () => {
it('carries avatar_model_url through so agentAvatarGlb resolves the real GLB', () => {
- const glb = 'https://cdn.three.ws/u/abc/draft-x/horse.glb';
+ const glb = 'https://three.ws/cdn/u/abc/draft-x/horse.glb';
const agent = normalize({ id: 'a1', name: 'bossvernington', avatar_model_url: glb }, null);
expect(agent.avatar_model_url).toBe(glb);
@@ -83,7 +83,7 @@ describe('normalize() preserves the avatar model URL for the hero', () => {
});
it('carries avatar_glb_url through for on-chain/older record shapes', () => {
- const glb = 'https://cdn.three.ws/u/abc/draft-x/model.glb';
+ const glb = 'https://three.ws/cdn/u/abc/draft-x/model.glb';
const agent = normalize({ id: 'a2', name: 'knight', avatar_glb_url: glb }, null);
expect(agent.avatar_glb_url).toBe(glb);
diff --git a/tests/api-me-onboarding-tour.test.js b/tests/api-me-onboarding-tour.test.js
index d570cbd27..441d3a4e8 100644
--- a/tests/api-me-onboarding-tour.test.js
+++ b/tests/api-me-onboarding-tour.test.js
@@ -21,7 +21,7 @@ vi.mock('../api/_lib/rate-limit.js', () => ({
limits: { authedReadIp: vi.fn(async () => ({ success: true })) },
clientIp: () => '127.0.0.1',
}));
-vi.mock('../api/_lib/r2.js', () => ({ thumbnailUrl: (key) => (key ? `https://cdn.three.ws/${key}` : null) }));
+vi.mock('../api/_lib/r2.js', () => ({ thumbnailUrl: (key) => (key ? `https://three.ws/cdn/${key}` : null) }));
vi.mock('../api/_lib/env.js', () => ({ env: { APP_ORIGIN: 'http://localhost:3000' } }));
const { default: meHandler } = await import('../api/me.js');
diff --git a/tests/api/3d-generate.test.js b/tests/api/3d-generate.test.js
index ad43c0c2a..c836f252a 100644
--- a/tests/api/3d-generate.test.js
+++ b/tests/api/3d-generate.test.js
@@ -103,7 +103,7 @@ const SUBMIT_DONE = {
job_id: null,
creation_id: 'a1b2c3d4-0000-4000-8000-000000000001',
status: 'done',
- glb_url: 'https://cdn.three.ws/forge/anon/a1b2c3d4.glb',
+ glb_url: 'https://three.ws/cdn/forge/anon/a1b2c3d4.glb',
durable: true,
backend: 'nvidia',
tier: 'draft',
@@ -119,7 +119,7 @@ const SUBMIT_QUEUED = {
const POLL_DONE = {
job_id: SUBMIT_QUEUED.job_id,
status: 'done',
- glb_url: 'https://cdn.three.ws/forge/anon/done.glb',
+ glb_url: 'https://three.ws/cdn/forge/anon/done.glb',
durable: true,
};
const POLL_RUNNING = { job_id: SUBMIT_QUEUED.job_id, status: 'running' };
diff --git a/tests/api/chat-proxy-ratelimit.test.js b/tests/api/chat-proxy-ratelimit.test.js
index 003181285..cc7585e0e 100644
--- a/tests/api/chat-proxy-ratelimit.test.js
+++ b/tests/api/chat-proxy-ratelimit.test.js
@@ -120,8 +120,15 @@ describe('POST /api/chat/proxy — per-IP rate limit', () => {
const res = makeRes();
await handler(req, res);
expect(res.statusCode).toBe(200);
- expect(fetchMock).toHaveBeenCalledTimes(1);
- expect(fetchMock.mock.calls[0][0]).toContain('openrouter.ai');
+ // A bare count of 1 was stale: the proxy now checks OpenRouter's model
+ // catalog (/api/v1/models, via isLiveFreeModel) before forwarding, because
+ // `:free` endpoints get retired without notice and a saved conversation can
+ // name a dead one for months. So a healthy request makes TWO upstream
+ // calls, catalog then completion. Pin the contract that matters: exactly
+ // one completion is spent, and it goes to OpenRouter.
+ const completions = fetchMock.mock.calls.filter(([url]) => String(url).includes('/chat/completions'));
+ expect(completions).toHaveLength(1);
+ expect(completions[0][0]).toContain('openrouter.ai');
});
it('rejects non-:free models without calling upstream', async () => {
diff --git a/tests/api/forge-gameready.test.js b/tests/api/forge-gameready.test.js
index ae7489bb9..d93737243 100644
--- a/tests/api/forge-gameready.test.js
+++ b/tests/api/forge-gameready.test.js
@@ -38,7 +38,7 @@ vi.mock('../../api/_providers/gcp.js', () => ({
// Stub R2 so the mirror writes to memory instead of a real bucket.
const putObject = vi.fn(async () => {});
-const publicUrl = vi.fn((key) => `https://cdn.three.ws/${key}`);
+const publicUrl = vi.fn((key) => `https://three.ws/cdn/${key}`);
vi.mock('../../api/_lib/r2.js', () => ({
putObject,
publicUrl,
@@ -272,7 +272,7 @@ describe('GET /api/forge-gameready?job=', () => {
expect(body.quad_ratio).toBe(0.92);
expect(body.textured).toBe(true);
// Both formats present and rehosted on our CDN.
- expect(body.outputs.glb.url).toMatch(/^https:\/\/cdn\.three\.ws\/forge\/gameready\//);
+ expect(body.outputs.glb.url).toMatch(/^https:\/\/three\.ws\/cdn\/forge\/gameready\//);
expect(body.outputs.fbx.url).toMatch(/\.fbx$/);
// Each finished artifact was written to R2.
expect(putObject).toHaveBeenCalledTimes(2);
diff --git a/tests/api/forge-selfhost-recovery.test.js b/tests/api/forge-selfhost-recovery.test.js
index 6f3501caa..5069086c9 100644
--- a/tests/api/forge-selfhost-recovery.test.js
+++ b/tests/api/forge-selfhost-recovery.test.js
@@ -10,7 +10,7 @@ import {
// all image→3D — that the router used to treat as terminal on the first poll.
describe('decideSelfhostMissing — never dead-end on a recoverable 404', () => {
- const glbUrl = 'https://cdn.three.ws/forge/abc.glb';
+ const glbUrl = 'https://three.ws/cdn/forge/abc.glb';
it('passes through any result that is not the recoverable 404 class', () => {
expect(decideSelfhostMissing({ code: undefined, ageMs: 0 }).action).toBe('passthrough');
diff --git a/tests/api/forge-trellis-selfhost.test.js b/tests/api/forge-trellis-selfhost.test.js
index 33f671783..536890019 100644
--- a/tests/api/forge-trellis-selfhost.test.js
+++ b/tests/api/forge-trellis-selfhost.test.js
@@ -129,7 +129,7 @@ describe('gcp provider — trellis mode wire contract', () => {
const fetchMock = vi.fn(async (url, opts) => {
expect(url).toBe('https://trellis.example.run.app/infer');
const body = JSON.parse(opts.body);
- expect(body.images).toEqual(['https://cdn.three.ws/photo.png']);
+ expect(body.images).toEqual(['https://three.ws/cdn/photo.png']);
expect(body.body_type).toBe('neutral');
expect(opts.headers.authorization).toBe('Bearer secret');
return new Response(JSON.stringify({ task_id: 'task-123', status: 'queued' }), {
@@ -142,8 +142,8 @@ describe('gcp provider — trellis mode wire contract', () => {
const provider = createRegenProvider();
const submitted = await provider.submit({
mode: 'trellis',
- sourceUrl: 'https://cdn.three.ws/photo.png',
- params: { images: ['https://cdn.three.ws/photo.png'] },
+ sourceUrl: 'https://three.ws/cdn/photo.png',
+ params: { images: ['https://three.ws/cdn/photo.png'] },
});
expect(fetchMock).toHaveBeenCalledTimes(1);
expect(submitted.extJobId).toBeTruthy();
@@ -181,8 +181,8 @@ describe('gcp provider — trellis mode wire contract', () => {
const provider = createRegenProvider();
const submitted = await provider.submit({
mode: 'trellis',
- sourceUrl: 'https://cdn.three.ws/photo.png',
- params: { images: ['https://cdn.three.ws/photo.png'] },
+ sourceUrl: 'https://three.ws/cdn/photo.png',
+ params: { images: ['https://three.ws/cdn/photo.png'] },
});
const status = await provider.status(submitted.extJobId);
expect(status.status).toBe('done');
@@ -260,8 +260,8 @@ describe('gcp provider — trellis quality forwarding', () => {
const quality = { ss_steps: 45, slat_steps: 45, simplify: 0.85, texture_size: 2048 };
await gcp.submit({
mode: 'trellis',
- sourceUrl: 'https://cdn.three.ws/ref.png',
- params: { images: ['https://cdn.three.ws/ref.png'], seed: 7, quality },
+ sourceUrl: 'https://three.ws/cdn/ref.png',
+ params: { images: ['https://three.ws/cdn/ref.png'], seed: 7, quality },
});
expect(calls).toHaveLength(1);
expect(calls[0].url).toContain('/infer');
@@ -287,13 +287,13 @@ describe('gcp provider — trellis quality forwarding', () => {
const gcp = mk();
await gcp.submit({
mode: 'trellis',
- sourceUrl: 'https://cdn.three.ws/ref.png',
- params: { images: ['https://cdn.three.ws/ref.png'], matte: true },
+ sourceUrl: 'https://three.ws/cdn/ref.png',
+ params: { images: ['https://three.ws/cdn/ref.png'], matte: true },
});
await gcp.submit({
mode: 'trellis',
- sourceUrl: 'https://cdn.three.ws/ref.png',
- params: { images: ['https://cdn.three.ws/ref.png'] },
+ sourceUrl: 'https://three.ws/cdn/ref.png',
+ params: { images: ['https://three.ws/cdn/ref.png'] },
});
expect(bodies[0].matte).toBe(true);
expect(bodies[1]).not.toHaveProperty('matte');
@@ -317,8 +317,8 @@ describe('gcp provider — trellis quality forwarding', () => {
const gcp = mk();
await gcp.submit({
mode: 'trellis',
- sourceUrl: 'https://cdn.three.ws/ref.png',
- params: { images: ['https://cdn.three.ws/ref.png'] },
+ sourceUrl: 'https://three.ws/cdn/ref.png',
+ params: { images: ['https://three.ws/cdn/ref.png'] },
});
expect(calls[0].body).not.toHaveProperty('quality');
expect(calls[0].body).not.toHaveProperty('seed');
diff --git a/tests/api/material-restyle-store.test.js b/tests/api/material-restyle-store.test.js
index 84740afc4..394d6e5b2 100644
--- a/tests/api/material-restyle-store.test.js
+++ b/tests/api/material-restyle-store.test.js
@@ -35,8 +35,8 @@ describe('recordMaterialRestyle', () => {
const id = await recordMaterialRestyle({
userId: 'user-1',
action: 'restyle',
- sourceUrl: 'https://cdn.three.ws/src.glb',
- resultUrl: 'https://cdn.three.ws/out.glb',
+ sourceUrl: 'https://three.ws/cdn/src.glb',
+ resultUrl: 'https://three.ws/cdn/out.glb',
instruction: 'make it chrome',
});
expect(typeof id).toBe('string');
@@ -56,8 +56,8 @@ describe('recordMaterialRestyle', () => {
const id = await recordMaterialRestyle({
userId: 'user-1',
action: 'variants',
- sourceUrl: 'https://cdn.three.ws/src.glb',
- resultUrl: 'https://cdn.three.ws/variant-1.glb',
+ sourceUrl: 'https://three.ws/cdn/src.glb',
+ resultUrl: 'https://three.ws/cdn/variant-1.glb',
preset: 'chrome',
seed: 42,
});
@@ -78,8 +78,8 @@ describe('listRestylesByUser / countRestylesByUser', () => {
id: 'r1',
action: 'restyle',
label: null,
- source_url: 'https://cdn.three.ws/src.glb',
- result_url: 'https://cdn.three.ws/out.glb',
+ source_url: 'https://three.ws/cdn/src.glb',
+ result_url: 'https://three.ws/cdn/out.glb',
instruction: 'make it wooden',
preset: null,
created_at: '2026-07-23T00:00:00Z',
@@ -89,7 +89,7 @@ describe('listRestylesByUser / countRestylesByUser', () => {
expect(rows).toHaveLength(1);
expect(rows[0]).toMatchObject({
type: 'restyle',
- glbUrl: 'https://cdn.three.ws/out.glb',
+ glbUrl: 'https://three.ws/cdn/out.glb',
prompt: 'make it wooden',
category: 'AI restyle',
});
diff --git a/tests/api/persona.test.js b/tests/api/persona.test.js
index f27f5fd56..a1608c15c 100644
--- a/tests/api/persona.test.js
+++ b/tests/api/persona.test.js
@@ -27,10 +27,10 @@ vi.mock('../../api/_lib/db.js', () => ({
}));
vi.mock('../../api/_lib/r2.js', () => ({
- publicUrl: (key) => `https://cdn.three.ws/${key}`,
+ publicUrl: (key) => `https://three.ws/cdn/${key}`,
// thumbnailUrl mirrors r2.js: null for a missing key or the legacy *_og.png form.
thumbnailUrl: (key) =>
- !key || /^https?:\/\/.*_og\.png$/i.test(key) ? null : `https://cdn.three.ws/${key}`,
+ !key || /^https?:\/\/.*_og\.png$/i.test(key) ? null : `https://three.ws/cdn/${key}`,
}));
vi.mock('../../api/_lib/crypto.js', () => ({
@@ -169,7 +169,7 @@ describe('POST /api/auth/persona/issue', () => {
expect(body.avatar).toEqual({
id: 'a-1',
name: 'My Avatar',
- url: 'https://cdn.three.ws/u/1/a.glb',
+ url: 'https://three.ws/cdn/u/1/a.glb',
thumbnail_url: null,
});
expect(body.alg).toBe('HS256');
@@ -192,7 +192,7 @@ describe('POST /api/auth/persona/issue', () => {
});
expect(status).toBe(200);
expect(body.avatar.id).toBe('a-2');
- expect(body.avatar.thumbnail_url).toBe('https://cdn.three.ws/u/1/other.png');
+ expect(body.avatar.thumbnail_url).toBe('https://three.ws/cdn/u/1/other.png');
});
});
@@ -298,7 +298,7 @@ describe('GET /api/auth/persona/me', () => {
expect(status).toBe(200);
expect(body.user.email).toBe('[email protected]');
expect(body.avatars).toHaveLength(2);
- expect(body.avatars[1].thumbnail_url).toBe('https://cdn.three.ws/u/1/b.png');
+ expect(body.avatars[1].thumbnail_url).toBe('https://three.ws/cdn/u/1/b.png');
});
});
diff --git a/tests/api/providers-nvidia.test.js b/tests/api/providers-nvidia.test.js
index 361177b8e..7d5bc07b3 100644
--- a/tests/api/providers-nvidia.test.js
+++ b/tests/api/providers-nvidia.test.js
@@ -33,7 +33,7 @@ const ORIGINAL_KEY = process.env.NVIDIA_API_KEY;
// assert the decoded GLB bytes flow through to storage and the public URL flows
// back out, without touching real object storage.
const putObjectMock = vi.fn(async () => ({}));
-const publicUrlMock = vi.fn((key) => `https://cdn.three.ws/${key}`);
+const publicUrlMock = vi.fn((key) => `https://three.ws/cdn/${key}`);
vi.mock('../../api/_lib/r2.js', () => ({
putObject: (...args) => putObjectMock(...args),
publicUrl: (...args) => publicUrlMock(...args),
@@ -221,7 +221,7 @@ describe('nvidia provider — synchronous 200 completion persists the GLB', () =
// Provider hands back the durable public URL, no poll handle.
expect(job.kind).toBe('text-to-3d');
expect(job.taskId).toBeNull();
- expect(job.resultGlbUrl).toBe(`https://cdn.three.ws/${putArg.key}`);
+ expect(job.resultGlbUrl).toBe(`https://three.ws/cdn/${putArg.key}`);
});
});
@@ -245,7 +245,7 @@ describe('nvidia provider — 202-then-poll loop', () => {
expect(res.status).toBe('done');
expect(putObjectMock).toHaveBeenCalledTimes(1);
expect(putObjectMock.mock.calls[0][0].body.equals(glbBytes)).toBe(true);
- expect(res.resultGlbUrl).toBe(`https://cdn.three.ws/${putObjectMock.mock.calls[0][0].key}`);
+ expect(res.resultGlbUrl).toBe(`https://three.ws/cdn/${putObjectMock.mock.calls[0][0].key}`);
});
it('reports failed when a finished poll carries no GLB artifact', async () => {
diff --git a/tests/api/v1-text-to-3d.test.js b/tests/api/v1-text-to-3d.test.js
index 963865dbc..206262551 100644
--- a/tests/api/v1-text-to-3d.test.js
+++ b/tests/api/v1-text-to-3d.test.js
@@ -121,7 +121,7 @@ const DONE_FIXTURE = {
job_id: null,
creation_id: 'a1b2c3d4-0000-4000-8000-000000000001',
status: 'done',
- glb_url: 'https://cdn.three.ws/forge/anon/a1b2c3d4.glb',
+ glb_url: 'https://three.ws/cdn/forge/anon/a1b2c3d4.glb',
durable: true,
backend: 'nvidia',
tier: 'draft',
@@ -140,7 +140,7 @@ describe('shapeResult — lane boundary contract', () => {
const out = shapeResult(DONE_FIXTURE, 'https://three.ws');
expect(out).toEqual({
status: 'done',
- glb_url: 'https://cdn.three.ws/forge/anon/a1b2c3d4.glb',
+ glb_url: 'https://three.ws/cdn/forge/anon/a1b2c3d4.glb',
viewer_url: 'https://three.ws/viewer?src=' + encodeURIComponent(DONE_FIXTURE.glb_url),
creation_id: 'a1b2c3d4-0000-4000-8000-000000000001',
backend: 'nvidia',
diff --git a/tests/api/x402-forge.test.js b/tests/api/x402-forge.test.js
index 0676f2faa..f9a6b69b7 100644
--- a/tests/api/x402-forge.test.js
+++ b/tests/api/x402-forge.test.js
@@ -199,7 +199,7 @@ describe('POST /api/x402/forge — free NVIDIA NIM text lane', () => {
textTo3d: vi.fn(async () => ({
kind: 'text-to-3d',
taskId: null,
- resultGlbUrl: 'https://cdn.three.ws/forge/nvidia/abc.glb',
+ resultGlbUrl: 'https://three.ws/cdn/forge/nvidia/abc.glb',
})),
});
const res = makeRes();
@@ -211,7 +211,7 @@ describe('POST /api/x402/forge — free NVIDIA NIM text lane', () => {
const body = JSON.parse(res.body);
expect(body.backend).toBe('nvidia');
expect(body.status).toBe('done');
- expect(body.glb_url).toBe('https://cdn.three.ws/forge/nvidia/abc.glb');
+ expect(body.glb_url).toBe('https://three.ws/cdn/forge/nvidia/abc.glb');
expect(body.job_id).toBeNull();
// Settlement still ran — the buyer paid and received a model.
expect(res.headers['x-payment-response']).toBe('stub-payment-response');
diff --git a/tests/api/x402-pipeline.test.js b/tests/api/x402-pipeline.test.js
index 6e5584395..26ecdf52c 100644
--- a/tests/api/x402-pipeline.test.js
+++ b/tests/api/x402-pipeline.test.js
@@ -25,8 +25,8 @@ import { Readable } from 'node:stream';
// A real rigged GLB fixture (Khronos BrainStem — 1 skin, 1 animation). Used as
// the mocked final stage output so the end-to-end test can inspect a real asset.
const RIGGED_GLB_PATH = resolve(process.cwd(), 'public/avatars/brainstem.glb');
-const RIGGED_GLB_URL = 'https://cdn.three.ws/forge/fixture/brainstem.glb';
-const GENERATE_GLB_URL = 'https://cdn.three.ws/forge/fixture/generated.glb';
+const RIGGED_GLB_URL = 'https://three.ws/cdn/forge/fixture/brainstem.glb';
+const GENERATE_GLB_URL = 'https://three.ws/cdn/forge/fixture/generated.glb';
beforeAll(() => {
Object.assign(process.env, {
@@ -61,8 +61,8 @@ vi.mock('../../api/_lib/x402-spec.js', async (importActual) => {
// synchronous done GLB so `generate` completes inline at submit time.
const nvidiaMock = vi.hoisted(() => ({
createNvidiaProvider: vi.fn(() => ({
- textTo3d: vi.fn(async () => ({ resultGlbUrl: 'https://cdn.three.ws/forge/fixture/generated.glb' })),
- status: vi.fn(async () => ({ status: 'done', resultGlbUrl: 'https://cdn.three.ws/forge/fixture/generated.glb' })),
+ textTo3d: vi.fn(async () => ({ resultGlbUrl: 'https://three.ws/cdn/forge/fixture/generated.glb' })),
+ status: vi.fn(async () => ({ status: 'done', resultGlbUrl: 'https://three.ws/cdn/forge/fixture/generated.glb' })),
})),
}));
vi.mock('../../api/_providers/nvidia.js', () => nvidiaMock);
@@ -181,8 +181,8 @@ describe('POST /api/x402/pipeline — grammar validation matrix (pre-payment 400
{ name: 'empty stages', body: { stages: [] }, code: 'invalid_stages' },
{ name: 'unknown stage', body: { stages: ['generate', 'teleport'], prompt: 'a cat' }, code: 'unknown_stage' },
{ name: 'duplicate stage', body: { stages: ['generate', 'generate'], prompt: 'a cat' }, code: 'duplicate_stage' },
- { name: 'generate not first', body: { stages: ['rig', 'generate'], prompt: 'a cat', glb_url: 'https://cdn.three.ws/x.glb' }, code: 'invalid_order' },
- { name: 'out-of-canonical-order', body: { stages: ['stylize', 'rig'], glb_url: 'https://cdn.three.ws/x.glb' }, code: 'invalid_order' },
+ { name: 'generate not first', body: { stages: ['rig', 'generate'], prompt: 'a cat', glb_url: 'https://three.ws/cdn/x.glb' }, code: 'invalid_order' },
+ { name: 'out-of-canonical-order', body: { stages: ['stylize', 'rig'], glb_url: 'https://three.ws/cdn/x.glb' }, code: 'invalid_order' },
{ name: 'generate without prompt', body: { stages: ['generate', 'rig'] }, code: 'missing_prompt' },
{ name: 'no generate, no glb_url', body: { stages: ['rig'] }, code: 'missing_glb_url' },
{ name: 'bad glb_url', body: { stages: ['rig'], glb_url: 'ftp://nope' }, code: 'invalid_glb_url' },
diff --git a/tests/ar-quicklook-banner.test.js b/tests/ar-quicklook-banner.test.js
index 245851f54..e7d326413 100644
--- a/tests/ar-quicklook-banner.test.js
+++ b/tests/ar-quicklook-banner.test.js
@@ -13,13 +13,13 @@ import { withQuickLookBanner, QUICK_LOOK_BANNER_TAPPED } from '../src/ar/quicklo
describe('withQuickLookBanner', () => {
it('appends all three banner fields as encoded fragment params', () => {
- const out = withQuickLookBanner('https://cdn.three.ws/a.usdz', {
+ const out = withQuickLookBanner('https://three.ws/cdn/a.usdz', {
title: 'Scout the Fox',
subtitle: 'Living agent on three.ws',
callToAction: 'Pin it here for people nearby',
});
expect(out).toBe(
- 'https://cdn.three.ws/a.usdz' +
+ 'https://three.ws/cdn/a.usdz' +
'#checkoutTitle=Scout%20the%20Fox' +
'&checkoutSubtitle=Living%20agent%20on%20three.ws' +
'&callToAction=Pin%20it%20here%20for%20people%20nearby'
@@ -27,22 +27,22 @@ describe('withQuickLookBanner', () => {
});
it('skips blank fields and emits only what is present', () => {
- const out = withQuickLookBanner('https://cdn.three.ws/a.usdz', {
+ const out = withQuickLookBanner('https://three.ws/cdn/a.usdz', {
title: ' ',
callToAction: 'Meet this agent',
});
- expect(out).toBe('https://cdn.three.ws/a.usdz#callToAction=Meet%20this%20agent');
+ expect(out).toBe('https://three.ws/cdn/a.usdz#callToAction=Meet%20this%20agent');
});
it('returns the URL untouched when no usable fields are given', () => {
- expect(withQuickLookBanner('https://cdn.three.ws/a.usdz')).toBe('https://cdn.three.ws/a.usdz');
- expect(withQuickLookBanner('https://cdn.three.ws/a.usdz', {})).toBe('https://cdn.three.ws/a.usdz');
- expect(withQuickLookBanner('https://cdn.three.ws/a.usdz', { title: '' })).toBe('https://cdn.three.ws/a.usdz');
+ expect(withQuickLookBanner('https://three.ws/cdn/a.usdz')).toBe('https://three.ws/cdn/a.usdz');
+ expect(withQuickLookBanner('https://three.ws/cdn/a.usdz', {})).toBe('https://three.ws/cdn/a.usdz');
+ expect(withQuickLookBanner('https://three.ws/cdn/a.usdz', { title: '' })).toBe('https://three.ws/cdn/a.usdz');
});
it('joins onto an existing fragment with & instead of a second #', () => {
- const out = withQuickLookBanner('https://cdn.three.ws/a.usdz#allowsContentScaling=0', { title: 'Scout' });
- expect(out).toBe('https://cdn.three.ws/a.usdz#allowsContentScaling=0&checkoutTitle=Scout');
+ const out = withQuickLookBanner('https://three.ws/cdn/a.usdz#allowsContentScaling=0', { title: 'Scout' });
+ expect(out).toBe('https://three.ws/cdn/a.usdz#allowsContentScaling=0&checkoutTitle=Scout');
});
it('works on blob: object URLs from the in-browser bake', () => {
@@ -51,14 +51,14 @@ describe('withQuickLookBanner', () => {
});
it('encodes characters that would break the fragment', () => {
- const out = withQuickLookBanner('https://cdn.three.ws/a.usdz', { title: 'a #1 fox & friend?' });
- expect(out).toBe('https://cdn.three.ws/a.usdz#checkoutTitle=a%20%231%20fox%20%26%20friend%3F');
+ const out = withQuickLookBanner('https://three.ws/cdn/a.usdz', { title: 'a #1 fox & friend?' });
+ expect(out).toBe('https://three.ws/cdn/a.usdz#checkoutTitle=a%20%231%20fox%20%26%20friend%3F');
});
it('clamps runaway fields to 80 characters before encoding', () => {
const long = 'x'.repeat(200);
- const out = withQuickLookBanner('https://cdn.three.ws/a.usdz', { title: long });
- expect(out).toBe(`https://cdn.three.ws/a.usdz#checkoutTitle=${'x'.repeat(80)}`);
+ const out = withQuickLookBanner('https://three.ws/cdn/a.usdz', { title: long });
+ expect(out).toBe(`https://three.ws/cdn/a.usdz#checkoutTitle=${'x'.repeat(80)}`);
});
it('passes non-string and empty urls through unchanged', () => {
diff --git a/tests/ar-studio-scene.test.js b/tests/ar-studio-scene.test.js
index 68f7989fa..e1d4d2513 100644
--- a/tests/ar-studio-scene.test.js
+++ b/tests/ar-studio-scene.test.js
@@ -101,7 +101,7 @@ describe('twistDelta / touchAngle', () => {
describe('normalizeGlbUrl', () => {
it('accepts https URLs and site-relative paths', () => {
- expect(normalizeGlbUrl('https://cdn.three.ws/m.glb')).toBe('https://cdn.three.ws/m.glb');
+ expect(normalizeGlbUrl('https://three.ws/cdn/m.glb')).toBe('https://three.ws/cdn/m.glb');
expect(normalizeGlbUrl('/avatars/default.glb')).toBe('/avatars/default.glb');
expect(normalizeGlbUrl(' https://x.co/a.glb ')).toBe('https://x.co/a.glb');
});
@@ -118,7 +118,7 @@ describe('normalizeGlbUrl', () => {
describe('scene (de)serialization', () => {
const placement = (over = {}) => ({
- src: 'https://cdn.three.ws/m.glb', title: 'crate', x: 1.5, z: -2, yaw: 0.5, scale: 1.2, ...over,
+ src: 'https://three.ws/cdn/m.glb', title: 'crate', x: 1.5, z: -2, yaw: 0.5, scale: 1.2, ...over,
});
it('round-trips a valid scene', () => {
diff --git a/tests/asset-host-liveness.test.js b/tests/asset-host-liveness.test.js
new file mode 100644
index 000000000..f6e647686
--- /dev/null
+++ b/tests/asset-host-liveness.test.js
@@ -0,0 +1,77 @@
+// No source file may point at an asset host that does not exist.
+//
+// `cdn.three.ws` has no DNS record and never has. It appeared in 181 places
+// across 55 files: API output examples served live through the service catalog
+// and discovery endpoints, every code sample in docs/3d-api.md, docs/mcp.md and
+// docs/api-reference.md, the embed skill agents read to build <agent-3d> tags,
+// package READMEs, and test fixtures. Anyone who copy-pasted one of those got a
+// DNS failure, and an agent following the skill emitted a dead body URL.
+//
+// The real first-party CDN is the `/cdn/<r2-key>` route (api/cdn-object.js),
+// which streams the same R2 namespace through three.ws with
+// `access-control-allow-origin: *` and a 30-day edge cache. It exists precisely
+// because the bucket's public `*.r2.dev` origin is Cloudflare rate-limited and
+// "not meant for production traffic" — so that origin is also not a valid
+// substitute in anything user- or developer-facing.
+//
+// Scope note, so nobody widens this into a sweep it should not be: `*.r2.dev` is
+// deliberately NOT policed here. Every occurrence in the repo is legitimate —
+// generic placeholders that document the bucket-origin shape (`pub-<hash>.r2.dev`),
+// `.r2.dev` as a suffix in api/ibm/vision.js's host allowlist, presigned-download
+// examples whose signatures are elided so they cannot be pasted anyway, and
+// api/_lib/r2.js computing real URLs from S3_PUBLIC_DOMAIN. Those hosts resolve
+// and those uses are honest. Only the host that does not exist is a defect.
+
+import { describe, it, expect } from 'vitest';
+import { execFileSync } from 'node:child_process';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+
+const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
+
+/**
+ * Every tracked file containing `pattern`, via git grep so the search honours
+ * .gitignore and never walks node_modules or dist.
+ * @param {string} pattern a fixed string
+ * @returns {string[]} repo-relative paths
+ */
+function filesContaining(pattern) {
+ try {
+ const out = execFileSync('git', ['grep', '-l', '--fixed-strings', pattern], {
+ cwd: ROOT,
+ encoding: 'utf8',
+ maxBuffer: 32 * 1024 * 1024,
+ });
+ return out.split('\n').filter(Boolean);
+ } catch (err) {
+ // git grep exits 1 with no output when there are no matches.
+ if (err.status === 1 && !err.stdout?.trim()) return [];
+ throw err;
+ }
+}
+
+// Generated aggregates and build artifacts mirror their sources; fixing the
+// source is the fix. docs/ALL.md is regenerated by scripts/combine-docs.mjs and
+// public/chat/assets/* is compiled output.
+const DERIVED = [/^docs\/ALL\.md$/, /^public\/chat\/assets\//, /\.min\.js$/, /^package-lock\.json$/];
+const isDerived = (file) => DERIVED.some((re) => re.test(file));
+
+describe('asset hosts that actually resolve', () => {
+ it('no source file references the dead cdn.three.ws host', () => {
+ const offenders = filesContaining('cdn.three.ws')
+ .filter((file) => !isDerived(file))
+ // This test names the host to forbid it, so it matches itself.
+ .filter((file) => file !== 'tests/asset-host-liveness.test.js')
+ // One historical note is allowed to name it: the generator comment that
+ // explains why the sample manifest points elsewhere.
+ .filter((file) => file !== 'scripts/build-discovery-cards.mjs');
+ expect(offenders, 'use https://three.ws/cdn/<r2-key> (api/cdn-object.js)').toEqual([]);
+ });
+
+ it('the first-party CDN route that replaced it still exists', () => {
+ // If this route is ever removed or renamed, every URL the sweep above
+ // rewrote breaks at once, so the guard and the route are one unit.
+ const routed = filesContaining('/api/cdn-object?key=$1');
+ expect(routed).toContain('vercel.json');
+ });
+});
diff --git a/tests/auto-rig-completion.test.js b/tests/auto-rig-completion.test.js
index 88d8f470f..a0c2c37c9 100644
--- a/tests/auto-rig-completion.test.js
+++ b/tests/auto-rig-completion.test.js
@@ -48,8 +48,8 @@ vi.mock('../api/_lib/r2.js', () => ({
r2State.puts.push(opts);
return { key: opts.key };
}),
- publicUrl: vi.fn((key) => `https://cdn.three.ws/${key}`),
- presignGet: vi.fn(async ({ key }) => `https://cdn.three.ws/${key}?signed=1`),
+ publicUrl: vi.fn((key) => `https://three.ws/cdn/${key}`),
+ presignGet: vi.fn(async ({ key }) => `https://three.ws/cdn/${key}?signed=1`),
}));
vi.mock('../api/_lib/avatars.js', () => ({
diff --git a/tests/forge-avatar-rig-degrade.test.js b/tests/forge-avatar-rig-degrade.test.js
index 7b90019f9..5a133f768 100644
--- a/tests/forge-avatar-rig-degrade.test.js
+++ b/tests/forge-avatar-rig-degrade.test.js
@@ -50,7 +50,7 @@ describe('runForgeAvatar — rig-stage kill-test', () => {
expect(body.tier).toBe('high');
return jsonResponse({
status: 'done',
- glb_url: 'https://cdn.three.ws/mesh/kill-test.glb',
+ glb_url: 'https://three.ws/cdn/mesh/kill-test.glb',
creation_id: 'mesh-kill-test',
backend: 'hunyuan3d',
});
@@ -80,7 +80,7 @@ describe('runForgeAvatar — rig-stage kill-test', () => {
expect(result.rigError).toBeTruthy();
expect(result.rigError.code).toBe('rig_failed');
// ...and the real, finished mesh asset still attached and usable.
- expect(result.meshGlbUrl).toBe('https://cdn.three.ws/mesh/kill-test.glb');
+ expect(result.meshGlbUrl).toBe('https://three.ws/cdn/mesh/kill-test.glb');
expect(result.viewerUrl).toContain(encodeURIComponent(result.meshGlbUrl));
expect(result.riggedGlbUrl).toBeNull();
diff --git a/tests/forge-frame.test.js b/tests/forge-frame.test.js
index ebc6a7e15..2b7b0bf39 100644
--- a/tests/forge-frame.test.js
+++ b/tests/forge-frame.test.js
@@ -100,7 +100,7 @@ describe('finalForgeFrame ↔ parseForgeFrame round-trip', () => {
it('packs the GLB url + viewer link into the sidecar and reads it back', () => {
const frame = finalForgeFrame({
prompt: 'a glossy white robot mascot',
- glbUrl: 'https://cdn.three.ws/forge/abc.glb',
+ glbUrl: 'https://three.ws/cdn/forge/abc.glb',
viewerUrl: 'https://three.ws/viewer?src=x',
tier: 'draft',
backend: 'nvidia',
@@ -111,7 +111,7 @@ describe('finalForgeFrame ↔ parseForgeFrame round-trip', () => {
const parsed = parseForgeFrame(frame);
expect(parsed).not.toBeNull();
- expect(parsed.glbUrl).toBe('https://cdn.three.ws/forge/abc.glb');
+ expect(parsed.glbUrl).toBe('https://three.ws/cdn/forge/abc.glb');
expect(parsed.viewerUrl).toBe('https://three.ws/viewer?src=x');
expect(parsed.prompt).toBe('a glossy white robot mascot');
expect(parsed.tier).toBe('draft');
@@ -143,7 +143,7 @@ describe('sanitizeFrameMeta', () => {
it('keeps a valid forge sidecar and caps lengths', () => {
const out = sanitizeFrameMeta({
kind: 'forge',
- glbUrl: 'https://cdn.three.ws/a.glb',
+ glbUrl: 'https://three.ws/cdn/a.glb',
viewerUrl: 'https://three.ws/viewer?src=a',
prompt: 'x'.repeat(1000),
tier: 'draft',
@@ -151,7 +151,7 @@ describe('sanitizeFrameMeta', () => {
durable: false,
injected: 'should be dropped',
});
- expect(out.glbUrl).toBe('https://cdn.three.ws/a.glb');
+ expect(out.glbUrl).toBe('https://three.ws/cdn/a.glb');
expect(out.prompt.length).toBe(320);
expect(out.tier).toBe('draft');
expect('injected' in out).toBe(false);
diff --git a/tests/player-store.test.js b/tests/player-store.test.js
index a2fdc837d..1296c69b2 100644
--- a/tests/player-store.test.js
+++ b/tests/player-store.test.js
@@ -55,7 +55,7 @@ function sampleProfile() {
activeSlot: 2,
xp: { combat: 1500, woodcutting: 3000, mining: 200, fishing: 75, cooking: 640 },
hp: 88, maxHp: 100, mount: 'horse',
- cosmetic: 'https://cdn.three.ws/avatars/nico.glb',
+ cosmetic: 'https://three.ws/cdn/avatars/nico.glb',
},
cosmetics: { owned: ['hat_red', 'cape_blue', 'crown_gold'], equipped: 'crown_gold' },
lastRealm: 'whisperwood',
@@ -91,7 +91,7 @@ describe('PlayerStore — synchronous cache API', () => {
expect(typeof got.savedAt).toBe('number');
expect(s.hasPlayer('acct')).toBe(true);
// avatar URL, last position, placed structures all round-trip
- expect(got.profile.cosmetic).toBe('https://cdn.three.ws/avatars/nico.glb');
+ expect(got.profile.cosmetic).toBe('https://three.ws/cdn/avatars/nico.glb');
expect(got.lastRealm).toBe('whisperwood');
expect(got.lastTx).toBe(12);
expect(got.lastTy).toBe(7);
@@ -110,7 +110,7 @@ describe('PlayerStore — synchronous cache API', () => {
// structures, last position, avatar survive the merge
expect(s.loadPlayer('acct').structures.whisperwood[0].kind).toBe('shack');
expect(s.loadPlayer('acct').lastRealm).toBe('whisperwood');
- expect(s.loadPlayer('acct').profile.cosmetic).toBe('https://cdn.three.ws/avatars/nico.glb');
+ expect(s.loadPlayer('acct').profile.cosmetic).toBe('https://three.ws/cdn/avatars/nico.glb');
});
});
@@ -142,7 +142,7 @@ describe('PlayerStore (durable / Upstash)', () => {
expect(b.loadPlayer('wallet:0xABC').cosmetics.equipped).toBe('crown_gold');
expect(b.loadPlayer('wallet:0xABC').quests.tutorial.done).toBe(true);
// The three new fields survive a restart too.
- expect(b.loadPlayer('wallet:0xABC').profile.cosmetic).toBe('https://cdn.three.ws/avatars/nico.glb');
+ expect(b.loadPlayer('wallet:0xABC').profile.cosmetic).toBe('https://three.ws/cdn/avatars/nico.glb');
expect(b.loadPlayer('wallet:0xABC').lastRealm).toBe('whisperwood');
expect(b.loadPlayer('wallet:0xABC').lastTx).toBe(12);
expect(b.loadPlayer('wallet:0xABC').structures.whisperwood[0].kind).toBe('shack');
diff --git a/tests/studio-room.test.js b/tests/studio-room.test.js
index 7c464ecf2..73ecc0195 100644
--- a/tests/studio-room.test.js
+++ b/tests/studio-room.test.js
@@ -38,7 +38,7 @@ function join(room, client) {
room.state.viewers.set(client.sessionId, { id: client.sessionId, ownerId: client.userData.ownerId, tsServer: Date.now() });
}
-const HTTPS = 'https://cdn.three.ws/model.glb';
+const HTTPS = 'https://three.ws/cdn/model.glb';
describe('StudioRoom — model:spawn', () => {
let room, alice;
diff --git a/tests/tokenize-3d.test.js b/tests/tokenize-3d.test.js
index 514ce9bbb..80682fa62 100644
--- a/tests/tokenize-3d.test.js
+++ b/tests/tokenize-3d.test.js
@@ -17,8 +17,8 @@ import {
import { mintTokenized3dAsset } from '../api/_lib/tokenize-3d.js';
const OWNER = 'So11111111111111111111111111111111111111112';
-const GLB = 'https://cdn.three.ws/tokenized/abc/model.glb';
-const IMG = 'https://cdn.three.ws/tokenized/abc/thumb.png';
+const GLB = 'https://three.ws/cdn/tokenized/abc/model.glb';
+const IMG = 'https://three.ws/cdn/tokenized/abc/thumb.png';
const VIEWER = 'https://three.ws/viewer?src=' + encodeURIComponent(GLB);
describe('tokenize-3d metadata shape', () => {
@@ -226,7 +226,7 @@ function makeDeps(store, counters) {
counters.promote++;
return { glbUrl: GLB, imageUrl: IMG, glbIpfs: null, imageIpfs: null };
},
- uploadMetadataJson: async () => ({ uri: 'https://cdn.three.ws/tokenized/abc/metadata.json', ipfs: null }),
+ uploadMetadataJson: async () => ({ uri: 'https://three.ws/cdn/tokenized/abc/metadata.json', ipfs: null }),
mintCoreAsset: async () => {
counters.mint++;
return { mint: 'MintAsset1111111111111111111111111111111111', signature: 'Sig111' };
diff --git a/tests/x402-avatar-search-warmup.test.js b/tests/x402-avatar-search-warmup.test.js
index eb9a99023..a4639c7f4 100644
--- a/tests/x402-avatar-search-warmup.test.js
+++ b/tests/x402-avatar-search-warmup.test.js
@@ -11,7 +11,7 @@ const avatar = (over = {}) => ({
id: '11111111-1111-1111-1111-111111111111',
name: 'Robo',
slug: 'robo',
- thumbnail_url: 'https://cdn.three.ws/t/robo.png',
+ thumbnail_url: 'https://three.ws/cdn/t/robo.png',
...over,
});
@@ -37,8 +37,8 @@ describe('avatar search warmup — MCP response parsing', () => {
expect(out.topResults).toHaveLength(3);
// Only non-null thumbnails are surfaced (validates the pipeline resolved imagery).
expect(out.thumbnails).toEqual([
- 'https://cdn.three.ws/t/robo.png',
- 'https://cdn.three.ws/t/robo.png',
+ 'https://three.ws/cdn/t/robo.png',
+ 'https://three.ws/cdn/t/robo.png',
]);
expect(out.topResults[0]).toMatchObject({ id: avatar().id, name: 'Robo', slug: 'robo' });
});
diff --git a/tests/x402-model-metadata-enrichment.test.js b/tests/x402-model-metadata-enrichment.test.js
index c5d39fc43..088eb555a 100644
--- a/tests/x402-model-metadata-enrichment.test.js
+++ b/tests/x402-model-metadata-enrichment.test.js
@@ -9,7 +9,7 @@ import { getFullRegistry } from '../api/_lib/x402/autonomous-registry.js';
// A minimal inspect_model structuredContent shape (matches src/gltf-inspect.js).
const inspection = (over = {}) => ({
- url: 'https://cdn.three.ws/u/x/model.glb',
+ url: 'https://three.ws/cdn/u/x/model.glb',
filename: 'model.glb',
container: 'glb',
generator: 'Khronos Blender glTF 2.0 exporter',
@@ -88,11 +88,11 @@ describe('model metadata enrichment — parseInspectResult', () => {
describe('model metadata enrichment — inspectModelRpcBody', () => {
it('builds a tools/call envelope for inspect_model with the GLB url', () => {
- const body = inspectModelRpcBody('https://cdn.three.ws/a.glb');
+ const body = inspectModelRpcBody('https://three.ws/cdn/a.glb');
expect(body).toMatchObject({
jsonrpc: '2.0',
method: 'tools/call',
- params: { name: 'inspect_model', arguments: { url: 'https://cdn.three.ws/a.glb' } },
+ params: { name: 'inspect_model', arguments: { url: 'https://three.ws/cdn/a.glb' } },
});
});
});
diff --git a/tests/x402-registry-contracts.test.js b/tests/x402-registry-contracts.test.js
new file mode 100644
index 000000000..279006881
--- /dev/null
+++ b/tests/x402-registry-contracts.test.js
@@ -0,0 +1,68 @@
+// Every autonomous-loop entry that targets a three.ws endpoint must match that
+// endpoint's real contract.
+//
+// The loop pays for its own calls, so a misconfigured entry is not a cosmetic
+// bug: it burns loop budget, pollutes the error metrics every monitor reads,
+// and leaves the "health" canaries proving nothing about the endpoints they are
+// named for. In the 24h before this test the registry was losing 339 calls a
+// day to five of our own endpoints:
+// token-intel 405 x109 (canary POSTed a GET-only endpoint)
+// agent-reputation 400 x90 (GET mode needs ?subject=)
+// symbol-availability 400 x71 (batch mode takes `symbols`, not `symbol`)
+// cosmetic-purchase 400 x38 (GET-only, reads ?id= and ?account=)
+// agent-bouncer 404 x31 (unregistered id answered with an error)
+//
+// This pins the shape of each fixed entry so the same class of drift fails here
+// instead of in production telemetry.
+
+import { describe, it, expect } from 'vitest';
+import { getSelfRegistry } from '../api/_lib/x402/autonomous-registry.js';
+
+const AUTONOMOUS_REGISTRY = getSelfRegistry();
+
+const byId = (id) => AUTONOMOUS_REGISTRY.find((e) => e.id === id);
+
+describe('autonomous registry entries match endpoint contracts', () => {
+ it('health-token-intel calls the GET-only endpoint with GET + a mint', () => {
+ const e = byId('health-token-intel');
+ expect(e.method).toBe('GET');
+ expect(e.body).toBeNull();
+ expect(e.path).toMatch(/^\/api\/x402\/token-intel\?mint=[1-9A-HJ-NP-Za-km-z]{32,44}$/);
+ });
+
+ it('health-agent-reputation supplies the required subject', () => {
+ const e = byId('health-agent-reputation');
+ expect(e.method).toBe('GET');
+ expect(e.path).toMatch(/^\/api\/x402\/agent-reputation\?subject=.+/);
+ });
+
+ it('health-symbol-avail sends the batch field the endpoint reads', () => {
+ const e = byId('health-symbol-avail');
+ expect(e.method).toBe('POST');
+ expect(Array.isArray(e.body.symbols)).toBe(true);
+ expect(e.body.symbols.length).toBeGreaterThan(0);
+ expect(e.body.symbol).toBeUndefined();
+ });
+
+ it('cosmetic-purchase-test uses the GET query contract', () => {
+ const e = byId('cosmetic-purchase-test');
+ expect(e.method).toBe('GET');
+ expect(e.body).toBeNull();
+ expect(e.path).toMatch(/[?&]id=/);
+ expect(e.path).toMatch(/[?&]account=/);
+ });
+
+ it('no three.ws entry sends a body on a GET', () => {
+ const offenders = AUTONOMOUS_REGISTRY.filter(
+ (e) => e.method === 'GET' && e.body != null && String(e.path || '').startsWith('/api/'),
+ ).map((e) => e.id);
+ expect(offenders).toEqual([]);
+ });
+
+ it('every three.ws entry declares an explicit method', () => {
+ const missing = AUTONOMOUS_REGISTRY.filter(
+ (e) => String(e.path || '').startsWith('/api/') && !['GET', 'POST'].includes(e.method),
+ ).map((e) => e.id);
+ expect(missing).toEqual([]);
+ });
+});
diff --git a/workers/garment-forge/README.md b/workers/garment-forge/README.md
index cbadeced6..f938fc3f6 100644
--- a/workers/garment-forge/README.md
+++ b/workers/garment-forge/README.md
@@ -69,6 +69,14 @@ pure glTF work in between:
stripped back out. The binary buffer is rebuilt from scratch (only the
garment's geometry, skin matrices, and textures survive), and joint names
are canonicalized (`mixamorig:LeftArm` → `LeftArm`).
+ Placement also enforces a **size envelope** (`max_extent` in `SLOT_BOXES`).
+ The fit axis pins the invariant dimension, but nothing else bounds the
+ others, and a generator asked for "long straight hair" can return a mesh
+ 1.4 m deep whose width is still a perfect 0.30 (live defect 2026-07-27: it
+ floated 36 cm above the crown and measured 78 cm off the body in the gait
+ audit). That mesh is malformed, not mis-scaled, so the job fails with the
+ measurement instead of publishing it. Hair additionally anchors its TOP to
+ the crown, so length hangs down the back rather than straddling the head.
6. **Validate + publish**: skin-weight statistics produce the bind coverage,
the `occludes` declaration (any REGION_BONES region carrying ≥ 10% of the
garment's skin weight, then clamped to the slot's plausible region set,
@@ -144,10 +152,46 @@ One-time infra the service depends on (already applied):
policy, satisfying the manifest spec's CORS requirement; job records and
rig staging stay in `three-ws-avatar-reconstructions`.
+## Job durability: the record IS the queue
+
+A job's record in GCS (`garment-jobs/<id>.json`) is not just status for
+pollers, it is the work queue. Work is **claimed at execution time**: an
+instance only owns a job once it holds a concurrency slot AND wins an atomic
+generation-matched write on the record (`status: running`, `attempts+1`,
+`owner`). Everything the pipeline needs (prompt, slot, tier, yaw) is persisted
+at submit, so any instance can drive a job it never saw submitted.
+
+This exists because the obvious design silently loses work. Handing every
+submission to the instance's FastAPI background queue means jobs past
+`MAX_CONCURRENT` wait on an in-memory semaphore, and Cloud Run reclaiming that
+instance (idle scale-down, revision rollout, crash) takes them with it while
+their records sit at `queued`. A 22-piece catalog batch lost 12 that way on
+2026-07-26; the same pieces resubmitted two at a time all published.
+
+Recovery paths, in order of speed:
+
+1. **A freed slot drains the backlog.** When a job finishes, the instance
+ immediately looks for one more claimable job.
+2. **`POST /sweep`** (bearer `API_KEY`) claims up to `MAX_CONCURRENT`
+ orphaned jobs and drives them. Called every 10 minutes by
+ [api/cron/garment-job-sweep.js](../../api/cron/garment-job-sweep.js) via
+ Cloud Scheduler. Overlapping sweeps are safe: the claim is atomic, so a job
+ can never be double-run or double-published.
+3. **The read-path watchdog** (`GET /jobs/:id`) requeues a job whose owner
+ went silent past `JOB_STALE_S` instead of burying it, and only declares
+ terminal failure once `JOB_MAX_ATTEMPTS` (default 3) is spent, so a
+ reclaimed instance costs an attempt rather than the job.
+
+The claim policy is pure and unit-tested in
+[job_queue.py](job_queue.py) / [test_job_queue.py](test_job_queue.py) (22
+checks, a Docker build gate): who may claim, who may never be stolen, and
+what a stale record becomes.
+
## Local tests (no GPU, no network)
```bash
-python3 workers/garment-forge/test_garment_glb.py
+python3 workers/garment-forge/test_garment_glb.py # pure glTF pipeline
+python3 workers/garment-forge/test_job_queue.py # durable-queue policy
```
## Catalog quality audit
diff --git a/workers/garment-forge/garment_glb.py b/workers/garment-forge/garment_glb.py
index b46879a54..1f5433893 100644
--- a/workers/garment-forge/garment_glb.py
+++ b/workers/garment-forge/garment_glb.py
@@ -104,12 +104,30 @@ RIG_BONES_MIN_SHARE = 0.001
# The walk-gait audit (npm run audit:garments) is the detector if any of these
# ever drifts: 2026-07-27 baseline has all three comfortably inside their
# ceilings (hair p95 13.4 of 20 cm, glasses 10.9 of 12, accessory 8.0 of 25).
+# `max_extent` (optional) is the plausibility envelope for the FINISHED,
+# placed mesh, in the same meters. The fit axis pins the invariant dimension
+# but nothing else bounds the others, so a generator that renders hair
+# streaming dramatically produced a mesh 1.43 m DEEP whose width was still a
+# perfect 0.30 (live defect 2026-07-27: it floated 36 cm above the crown and
+# measured p95 53 cm / max 78 cm off the body in the gait audit). A mesh that
+# far outside its envelope is malformed, not mis-scaled, and no placement math
+# rescues it, so the job FAILS with the numbers instead of publishing it. This
+# is the geometric sibling of the MIN_BIND_COVERAGE gate.
+#
+# `anchor` (optional, per axis) controls how the mesh lands in the box.
+# Hair hangs DOWN from the crown, so centering a tall hairstyle on the box
+# center pushes half of it above the head; anchoring its top to the top of the
+# box is what "sits on the head" actually means.
SLOT_BOXES = {
"top": {"center": (0.0, 1.14, 0.03), "size": (0.90, 0.56, 0.45), "fit": 1},
"outerwear": {"center": (0.0, 1.05, 0.03), "size": (1.00, 0.80, 0.50), "fit": 1},
"bottom": {"center": (0.0, 0.50, 0.02), "size": (0.50, 0.90, 0.35), "fit": 1},
"footwear": {"center": (0.0, 0.09, 0.07), "size": (0.60, 0.18, 0.30), "fit": 2},
- "hair": {"center": (0.0, 1.58, 0.03), "size": (0.30, 0.25, 0.30), "fit": 0},
+ # Hair: width tracks head width (fit 0), the envelope allows everything
+ # from a pixie to waist-length (0.80 m tall), and the top anchors to the
+ # crown so length hangs down the back instead of floating overhead.
+ "hair": {"center": (0.0, 1.58, 0.03), "size": (0.30, 0.25, 0.30), "fit": 0,
+ "max_extent": (0.34, 0.80, 0.40), "anchor_y": "top"},
# Headwear is CONTAIN-fit (bounded on every axis): generated caps carry
# deep brims, so scaling by width alone let a 2:1 depth:width cap jut some
# 30 cm past the face (walk-gait audit 2026-07-26: cap p95 21-23 cm vs the
@@ -124,6 +142,53 @@ SLOT_BOXES = {
# placed shoe pair onto the actual stance. Measured with the box numbers above.
FOOT_CENTERS_X = (-0.222, 0.222)
+# ── Proportion envelope: the publish gate for a malformed mesh ──────────────
+# Maximum plausible extent (w, h, d) in reference-body meters for a finished
+# garment in each slot. Placement scales along ONE axis (or contains, for
+# headwear), which sizes a well-formed mesh correctly but cannot save a
+# badly-proportioned one: a generated "long straight hair" arrived as a 1.43 m
+# DEEP curtain on a 1.667 m body, poking 36 cm above the skull, and published
+# because every other gate (bind coverage, manifest rules) passed. Scaling it
+# down would have made a tiny clump; the mesh itself is wrong, so the job must
+# fail and be regenerated rather than pollute the catalog.
+#
+# Set from measurement, not taste: `node scripts/measure-garment-extents.mjs`
+# prints per-slot maxima over the live catalog. Baseline 2026-07-27 (31 sane
+# pieces) sits comfortably inside every value below, and the one malformed
+# piece exceeds its slot on two axes at once. Re-run that script and widen a
+# value here if a legitimately-shaped garment is ever refused.
+SLOT_ENVELOPE = {
+ "top": (0.90, 0.80, 0.45), # observed max 0.59, 0.56, 0.27
+ "outerwear": (1.00, 1.10, 0.55), # observed max 0.74, 0.80, 0.37
+ "bottom": (0.75, 1.15, 0.55), # observed max 0.52, 0.90, 0.36
+ "footwear": (0.75, 0.35, 0.45), # observed max 0.53, 0.10, 0.30
+ "hair": (0.45, 0.75, 0.45), # sane max 0.30, 0.32, 0.30; hair may hang to the hips
+ "headwear": (0.45, 0.40, 0.45), # observed max 0.29, 0.22, 0.30
+ "glasses": (0.28, 0.20, 0.42), # observed max 0.18, 0.06, 0.33 (long temples)
+ "accessory": (0.55, 0.75, 0.55), # observed max 0.35, 0.55, 0.35
+}
+_AXIS_NAMES = ("width", "height", "depth")
+
+
+def proportion_failures(glb_bytes: bytes, slot: str) -> list[str]:
+ """Reasons this finished garment is too big to be what it claims to be.
+
+ Empty list = plausible. Any entry = a malformed mesh that must not be
+ published (see SLOT_ENVELOPE). Measured on the extracted garment, so it
+ reflects exactly what a wearer would load."""
+ envelope = SLOT_ENVELOPE.get(slot)
+ if envelope is None:
+ return [f"unknown slot '{slot}'"]
+ lo, hi = _bounds(_scene_meshes(glb_bytes))
+ extent = hi - lo
+ failures = []
+ for axis, limit in enumerate(envelope):
+ if extent[axis] > limit:
+ failures.append(
+ f"{_AXIS_NAMES[axis]} {extent[axis]:.2f}m exceeds the {slot} "
+ f"envelope of {limit:.2f}m (malformed mesh; regenerate)")
+ return failures
+
GARMENT_PREFIX = "garment"
REFBODY_PREFIX = "refbody"
@@ -190,12 +255,56 @@ def garment_placement(meshes: list[trimesh.Trimesh], slot: str, yaw_deg: float =
center = (lo + hi) / 2.0
target = np.array(box["center"], dtype=np.float64)
- move = trimesh.transformations.translation_matrix(target - center * scale)
+ offset = target - center * scale
+ if box.get("anchor_y") == "top":
+ # Land the mesh's top on the top of the box rather than its center on
+ # the center: hair hangs down from the crown, it does not straddle it.
+ box_top = box["center"][1] + box["size"][1] / 2.0
+ offset[1] = box_top - hi[1] * scale
+ move = trimesh.transformations.translation_matrix(offset)
scale_m = np.eye(4)
scale_m[:3, :3] *= scale
return move @ scale_m @ rot
+def assert_plausible_extents(meshes: list[trimesh.Trimesh], slot: str,
+ placement: np.ndarray) -> np.ndarray:
+ """Reject a placed mesh that falls outside its slot's size envelope.
+
+ The fit axis pins one dimension; a generator can still hand back geometry
+ whose OTHER axes are wildly out of proportion (dramatically streaming
+ hair, a prop rendered with its packaging). Such a mesh is malformed rather
+ than mis-scaled: rescaling it to fit would shrink the invariant dimension
+ into uselessness, so the honest response is to fail the job with the
+ measurement, exactly as a sub-threshold bind coverage does.
+
+ Returns the placed extents (for logging) or raises ValueError.
+ """
+ box = SLOT_BOXES[slot]
+ placed = [m.copy() for m in meshes]
+ for m in placed:
+ m.apply_transform(placement)
+ lo, hi = _bounds(placed)
+ extent = hi - lo
+ limit = box.get("max_extent")
+ if limit is None:
+ return extent
+ limit = np.asarray(limit, dtype=np.float64)
+ over = extent > limit + 1e-9
+ if np.any(over):
+ axes = "xyz"
+ detail = ", ".join(
+ f"{axes[i]}={extent[i]:.3f}m (max {limit[i]:.3f}m)"
+ for i in range(3) if over[i]
+ )
+ raise ValueError(
+ f"generated {slot} mesh is out of proportion for its slot: {detail}. "
+ "The mesh is malformed rather than mis-scaled (rescaling it to fit "
+ "would shrink the fitted dimension into uselessness); regenerate."
+ )
+ return extent
+
+
def compose_scene(garment_bytes: bytes, refbody_bytes: bytes, slot: str,
yaw_deg: float = 0.0) -> bytes:
"""One GLB holding the reference body plus the garment placed into its
@@ -207,6 +316,9 @@ def compose_scene(garment_bytes: bytes, refbody_bytes: bytes, slot: str,
body = _scene_meshes(refbody_bytes)
placement = garment_placement(garment, slot, yaw_deg)
+ # Fail here, before a malformed mesh burns GPU minutes in the rigger and
+ # lands in the public catalog.
+ assert_plausible_extents(garment, slot, placement)
placed_garment = []
for m in garment:
placed = m.copy()
diff --git a/workers/garment-forge/test_garment_glb.py b/workers/garment-forge/test_garment_glb.py
index 4ba22c942..97d178401 100644
--- a/workers/garment-forge/test_garment_glb.py
+++ b/workers/garment-forge/test_garment_glb.py
@@ -245,6 +245,39 @@ single = trimesh.creation.box(extents=(0.1, 0.1, 0.3))
check("single component is not snapped",
snap_pair_to_feet([single.copy()])[0].centroid[0] == single.centroid[0])
+# Hair anchors its TOP to the crown, so length hangs down the back instead of
+# floating above the head, and a wildly out-of-proportion mesh is REFUSED
+# rather than published. Both reproduce the live 2026-07-27 defect: a
+# "long straight black hair" mesh that came out 1.43 m deep and reached 36 cm
+# above the crown (gait p95 53 cm off the body).
+from garment_glb import assert_plausible_extents # noqa: E402
+
+hair_box = SLOT_BOXES["hair"]
+crown = hair_box["center"][1] + hair_box["size"][1] / 2
+
+long_hair = trimesh.creation.box(extents=(0.30, 0.60, 0.20))
+hp = garment_placement([long_hair], "hair")
+placed_hair = long_hair.copy()
+placed_hair.apply_transform(hp)
+check("hair top anchors to the crown",
+ abs(placed_hair.bounds[1][1] - crown) < 1e-6, f"top={placed_hair.bounds[1][1]}")
+check("hair length hangs below the crown",
+ placed_hair.bounds[0][1] < crown, f"bottom={placed_hair.bounds[0][1]}")
+check("in-envelope hair is accepted",
+ assert_plausible_extents([long_hair], "hair", hp) is not None)
+
+# The real defect: width-fit is satisfied exactly, but depth is ~5x its
+# envelope, so the mesh must be refused with the measurement.
+runaway = trimesh.creation.box(extents=(0.30, 0.90, 1.45))
+runaway_place = garment_placement([runaway], "hair")
+try:
+ assert_plausible_extents([runaway], "hair", runaway_place)
+ check("runaway hair is refused", False, "no exception raised")
+except ValueError as exc:
+ check("runaway hair is refused", "out of proportion" in str(exc))
+ check("refusal names the offending axis and number",
+ "z=" in str(exc) and "max" in str(exc), str(exc)[:90])
+
# Headwear is contain-fit: a cap with a deep brim (depth 2x width) must be
# bounded by the box on EVERY axis, so depth becomes the limiting dimension
# and the width scales down with it instead of blowing the brim past the face.