Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
feat: add innovation briefs for Avatar Wallet Chat, Pay-As-You-Learn Tutor, Unstoppable Agent, and Real-Time Lip-Sync features
roundtrippedcca1b5360f20
diff --git a/api/agents/solana-wallet.js b/api/agents/solana-wallet.jsindex e3c373c6b..098f60518 100644--- a/api/agents/solana-wallet.js+++ b/api/agents/solana-wallet.js@@ -350,6 +350,11 @@ async function handleWallet(req, res, id) {if (!row) return error(res, 404, 'not_found', 'agent not found');if (row.user_id !== auth.userId) return error(res, 403, 'forbidden', 'not your agent');+ // Provisioning, importing, and wiping a custodial keypair all change which+ // keys control the agent's funds — gate the mutating methods behind CSRF so+ // a cross-site forged request can never replace or delete the wallet.+ if (req.method !== 'GET' && !(await requireCsrf(req, res, auth.userId))) return;+let meta = { ...(row.meta || {}) };if (req.method === 'DELETE') {@@ -958,6 +963,9 @@ async function handleLimits(req, res, id) {const network = url.searchParams.get('network') === 'devnet' ? 'devnet' : 'mainnet';if (req.method === 'PUT') {+ // Spend ceilings, the freeze switch, and the withdraw allowlist are the+ // wallet's safety gates — a forged change could disarm them, so require CSRF.+ if (!(await requireCsrf(req, res, auth.userId))) return;let body;try {body = await readJson(req);@@ -1143,7 +1151,10 @@ async function handleVanity(req, res, id) {});}- // POST — sensitive: gate behind the withdrawal per-user cap + per-IP burst.+ // POST — sensitive: it grinds a new keypair and sweeps every holding to it,+ // so it moves funds. Require CSRF, then gate behind the withdrawal per-user+ // cap + per-IP burst.+ if (!(await requireCsrf(req, res, auth.userId))) return;const rlUser = await limits.withdrawalPerUser(auth.userId);if (!rlUser.success) return rateLimited(res, rlUser);const rlIp = await limits.authIp(clientIp(req));diff --git a/prompts/agent-wallets/15-agent-to-agent-economy.md b/prompts/agent-wallets/15-agent-to-agent-economy.mdnew file mode 100644index 000000000..2e2ada268--- /dev/null+++ b/prompts/agent-wallets/15-agent-to-agent-economy.md@@ -0,0 +1,117 @@+# Task 15 — The Agent-to-Agent Economy (a real machine economy, embodied)++> **Read [00-README-orchestration.md](./00-README-orchestration.md) first** — the+> ownership model, design tokens, real APIs, hard rules, and the safety rules for+> custodial funds. Builds on the wallet identity layer (**task 01**), the spend-policy+> engine (**task 05**), and connects to the multiplayer rooms. Invention-layer — read+> **The invention bar**.++## Why only three.ws can build this++We already have the three things a machine economy needs and that no one else has+together: agents with **real funded custodial wallets**, an **agent-to-agent payment ++skill-invocation protocol** ([api/agents/a2a-call.js](../../api/agents/a2a-call.js),+[a2a-mandate.js](../../api/agents/a2a-mandate.js),+[a2a-paid.js](../../api/agents/a2a-paid.js), the x402 rails under+[api/x402/](../../api/x402), [agent-payments-sdk/](../../agent-payments-sdk),+[agent-protocol-sdk/](../../agent-protocol-sdk)), and **3D bodies that share+multiplayer rooms** ([multiplayer/](../../multiplayer)). So we can build a real economy+where agents **autonomously hire and pay each other** for skills and services — and you+can *watch it happen* between embodied characters. Not a diagram of a future agent+economy: a live one, with real money, real receipts, and real avatars doing the work.++## Mission++Let agents discover, hire, and pay each other for real skills/services using their+custodial wallets via the real A2A + x402 rails — bounded by each agent's spend policy,+recorded as real on-chain invocation receipts, and visualized as embodied interactions+in the multiplayer rooms. Build the marketplace of agent-offered services and the live+economy view on top of real transactions only.++## What exists (read it before building — do NOT reinvent)++- **A2A + payments:** `api/agents/a2a-call.js` (one agent invokes another's skill),+ `a2a-mandate.js` (authorization/mandate), `a2a-paid.js` (the paid invocation), the+ x402 micropayment endpoints ([api/x402/](../../api/x402)),+ [agent-payments-sdk/](../../agent-payments-sdk) and+ [agent-protocol-sdk/](../../agent-protocol-sdk). These are the real rails — wire the+ economy through them; do not invent a parallel fake payment path.+- **On-chain invocation receipts:** the agent-invocation Anchor program+ ([contracts/agent-invocation/](../../contracts/agent-invocation)) records verifiable+ agent-to-agent skill invocations; on-chain skill licenses+ ([contracts/skill-license/](../../contracts/skill-license),+ [api/_lib/skill-license-onchain.js](../../api/_lib/skill-license-onchain.js)) gate+ who may offer/consume a skill.+- **Spend guards:**+ [api/_lib/agent-trade-guards.js](../../api/_lib/agent-trade-guards.js) — a paying+ agent's outlay is reserved against its real spend policy, with the kill switch. A+ hire is just another policy-gated spend.+- **Bodies + rooms:** [multiplayer/](../../multiplayer),+ [src/shared/agent-3d.js](../../src/shared/agent-3d.js),+ [src/agent-avatar.js](../../src/agent-avatar.js) for the embodied interaction; the+ wallet identity layer (task 01) for who's paying whom.++## What the agent-to-agent economy must do (every payment is real)++1. **Service offers.** An owner lets their agent **offer a skill for a price** (e.g.+ translation, art generation, analysis — whatever skills the platform supports),+ priced in the real payment unit, gated by a real skill license. Persisted as a real+ offer; discoverable.+2. **Autonomous hire + pay.** An agent that needs a skill **hires another agent**: it+ pays the provider's wallet via the real x402 / `a2a-paid` flow, the provider+ executes the real skill invocation, and a **real on-chain invocation receipt** is+ written. The payment is reserved against the hiring agent's spend policy *before* it+ sends — no policy bypass.+3. **Embodied transactions.** Surface the hire in the 3D world: in a shared multiplayer+ room, the paying agent and the provider agent visibly interact (approach, hand-off+ animation via the existing emotion/gesture layer), and the value flow registers in+ the Galaxy Money-Cam (task 12). You can *watch* agents do business.+4. **Service marketplace + reputation.** Browse agent-offered services with **real**+ completion counts, real ratings/throughput from real invocations, and real prices.+ A provider agent builds a real track record; a great service earns real income to+ its wallet. No fabricated stats.+5. **Receipts + accounting.** Both agents' wallets show the real income/outlay, linked+ to the real invocation receipt and tx. The economy is fully auditable end to end.++## Safety (non-negotiable — autonomous agents spending real funds on each other)++- **Owner-sets-the-mandate; agent acts within it.** Owners authorize what their agent+ may pay for and up to what limit (the A2A mandate + spend policy). An agent can only+ ever spend **its own** wallet, within **its own** policy, server-enforced. Hiring+ never grants access to anyone else's funds.+- **Spend policy + mandate are the ceiling.** Every hire is reserved and clamped+ server-side before payment. Kill switch halts all autonomous spending instantly.+- **Real value or no transaction.** A paid invocation only completes if the real skill+ actually executed; failed/disputed work resolves honestly (refund/retry per a defined+ rule), never a charge for nothing. No mock services, no fake receipts.+- **Idempotent + audited.** Every hire/pay/invoke is idempotent and written to the+ custody + invocation trail. No double-charge on retry.+- **$THREE rule honored.** Pricing/payment uses the existing real USDC/x402 plumbing;+ never name or promote a non-$THREE mint.++## States & edge cases (all designed, all honest)++Provider offline / skill unavailable (don't charge; route or fail cleanly); payment+succeeds but invocation fails (refund per the defined rule, audited); hiring agent over+budget / mandate (refuse with the real reason); no providers for a requested skill;+disputed/low-quality result; provider agent deleted mid-job; network failure mid-pay+(idempotent, re-check real state, never double-charge); 0 / 1 / many concurrent jobs;+very long service/agent names; a room with many simultaneous embodied transactions+(stay legible and 60fps). Each designed.++## Definition of done++Per the orchestration README's checklist. Plus: one agent autonomously hires another,+pays its wallet via the **real** x402 / `a2a-paid` rails within its spend policy ++mandate (devnet acceptable), the provider executes the real skill, and a **real**+on-chain invocation receipt is written with explorer links on both sides; the+marketplace shows real completion stats with zero fabrication; the hire is visible as an+embodied interaction in a multiplayer room and as a flow in the money-cam; a+payment-succeeds-but-work-fails case refunds honestly; owner mandate + spend-policy+ceiling + kill switch enforced server-side; idempotent and audited; no non-$THREE coin+promoted; no console errors.++When done: run the self-review + improvement pass, add a real changelog entry,+`npm run build:pages` to validate, commit (staging explicit paths only; push to+**both** `threeD` and `threews` if asked), then **delete this file**+(`prompts/agent-wallets/15-agent-to-agent-economy.md`).diff --git a/prompts/feature-innovation/01_07_voice-lab.md b/prompts/feature-innovation/01_07_voice-lab.mdnew file mode 100644index 000000000..d6d5fdbda--- /dev/null+++ b/prompts/feature-innovation/01_07_voice-lab.md@@ -0,0 +1,90 @@+# 🚀 Innovation Brief — Voice Lab (`/voice`)++> **Task file:** `prompts/feature-innovation/01_07_voice-lab.md`+> **Surface:** `/voice` — voice cloning + TTS playground for agents/avatars+> **Primary source:** `pages/voice.html` + `src/voice-lab.js`+> **Atlas reference:** `docs/ux-flows/01-onboarding-creation.md` (current UX, traced step-by-step)++---++## 0. How to use this brief++You are **one agent in a fleet**. This one feature is yours to make world-class. Read this entire brief, then read the referenced source so you are changing reality and not a guess. Execute completely. When you are genuinely done (§6–7), **delete this task file**.++You are not a task-completing machine. You are a senior engineer and product thinker who happens to write code. Act like it.++## 1. Mission++An agent that sounds generic is forgettable; an agent that sounds *distinct* is memorable. Voice Lab is where a user mints the voice their agent speaks with — cloned from their own recording or crafted to fit a character — and hears it come alive instantly. The mission is to make voice creation feel like a recording studio with a great engineer: it coaches you to a clean take, clones a voice you actually recognize, and lets you audition it speaking your agent's real lines before you commit it.++"Gamechanging" here means: the recording step guarantees a usable clone (no garbage-in), the clone is convincing, and the playground lets the user *direct* the voice — emotion, pace, the agent's actual greeting — so they choose with confidence. Voices become a first-class, reusable asset across every agent and avatar, not a one-off in `localStorage`.++## 2. The bar++Build the version that makes someone screenshot it and share it. Benchmark against the best voice tools (ElevenLabs Studio, Descript Overdub, Play.ht, Apple's Personal Voice, Resemble.ai). **If your result merely matches what already exists, you have failed this brief.** Invent something true and new that creates real, obvious value for the user.++## 3. Current state — ground truth (verify in source before you touch anything)++- **Route(s):** `/voice` (vercel route → `voice.html`).+- **Source:** `pages/voice.html` + `src/voice-lab.js`. Cloned-voice library persisted in `localStorage` key `voicelab_voices_v1`.+- **Current flow:** 4 required + ~3 optional. Land (reading script shown, cyclable via "Next script"; library + playground voice dropdown render from `localStorage`) → "Record" (`#btnRecord`, `getUserMedia` mono 48kHz w/ AGC/NS/EC, live waveform + level meter, max 60s, rec. 20–30s) → "Stop" (`#btnStop`, builds Blob, rejects <3s, shows review state w/ audio preview; optional "Re-record") → enter voice name (required) + "Clone" (`#btnClone`, `POST /api/tts/eleven-clone` multipart audio + name) → on success store `{voiceId,name,status}` in `localStorage`, show done state, re-render library/playground. Optional playground: pick voice, type text, "Speak" → `POST /api/tts/eleven {voiceId,text}`; "Play sample" on a library card uses a canned line; delete a voice from the library.+- **What works today:** Real ElevenLabs clone + TTS via server proxy; live waveform/level meter; min-duration guard; review/re-record loop; reading scripts; in-page playground; per-card sample playback; library delete; thorough status messaging (mic denied, recorder init, too-short, network/HTTP errors, name required).+- **Real APIs / dependencies already wired:** `POST /api/tts/eleven-clone` (clone); `POST /api/tts/eleven` (TTS playback/sample). ElevenLabs via server proxy. Browser `getUserMedia` / `MediaRecorder` / Web Audio.+- **Where it's mediocre, thin, or unfinished:** The voice library lives in `localStorage` — it's per-browser, not tied to the account, and not actually discoverable when creating an agent (the atlas notes voices are "selectable elsewhere" but the binding is loose). No recording-quality feedback (background noise, clipping, too quiet, too short of *speech* vs silence) — users clone bad takes. The playground is plain TTS with no emotion/style/pace controls. No "preview this voice on my agent's real greeting." No designed/library voices to pick without recording. No way to compare two voices. No re-clone/improve an existing voice.++## 4. Innovation directions (seeds — you are expected to go beyond them)++- **Studio-grade capture coaching.** Real-time analysis of the incoming audio (noise floor, clipping, loudness, actual speech duration vs silence) with a live "take quality" meter and a green-light gate — only allow Clone when the sample will produce a good voice. Auto-trim leading/trailing silence. Garbage-in is the root cause of weak clones; close that door.+- **Direct the voice, don't just synthesize it.** Add real expressive controls to the playground (stability/style/pace/emotion where the provider supports them) and a multi-line script tester so the user hears the voice across a happy line, a serious line, and a question — then saves the settings *with* the voice.+- **Account-backed, reusable voice assets.** Promote voices from `localStorage` to a real per-account voice library so a cloned voice is instantly selectable in `/create-agent`, `/agent/new`, and avatar flows — one voice, many agents. Make the binding explicit and bidirectional.+- **Audition on the real agent.** "Hear it on my agent" — synthesize the user's actual agent greeting/persona lines in the candidate voice (and, where a body exists, lip-synced on the 3D preview) so the choice is made on the real product, not a canned sentence.+- **Designed voices for non-recorders.** A curated set of ready-to-use voices (browsable, auditionable) for users who don't want to record — so every agent can have a great voice in seconds.+- **Cross-feature wiring:** expose the chosen voice id straight into the agent creation/editor personality step and the onboarding wizard's voice choice; let the agent's live `/agent/<id>` talking widget speak in this voice; and surface Voice Lab as a step inside `/create-agent` Personality and `/start` so voice is part of the creation arc, not an isolated tool.++> These are starting points, not a checklist. The best idea may not be listed — find it. Think second-order: how does improving this unlock value in adjacent three.ws features? **Wire those connections.** The best platforms feel like everything is linked.++## 5. Hard rules (non-negotiable — from `CLAUDE.md`)++- **Real APIs, real data, real integrations. No mocks, no fake/sample arrays, no placeholders, no `setTimeout` fake-loading or fake progress.** If credentials are missing, find them in `.env` / `.env.example` / `vercel env` — then proceed.+- **Wire 100%.** Every button works, every link goes somewhere, every reachable state exists. Design *every* state: loading (skeletons over spinners), empty (tell the user what to do next), error (actionable recovery), populated, and overflow (0 / 1 / 1000 items, very long strings, mid-operation network failure, expired session).+- **No TODO comments, no stubs, no `throw new Error("not implemented")`, no commented-out code.** If you write it, finish it.+- **No errors without solutions.** Every error has a root cause; every root cause has a fix. Ship failsafes, not lazy propagation.+- **$THREE is the only coin** (CA `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`). Never name, add, hardcode, link, render, or recommend any other coin anywhere — code, copy, tests, fixtures, commits. The only exceptions are coin-agnostic runtime plumbing (user supplies a mint) and platform launch records rendered at runtime.+- **Read before you write.** Match the existing patterns, naming, file organization, and the design tokens in `DESIGN-TOKENS.md`. Consistency compounds.+- **Accessibility + responsive (320 / 768 / 1440) + microinteractions** are part of done, not polish. Semantic HTML, ARIA, keyboard nav, focus rings, sufficient contrast.+- **Performance by default:** lazy-load heavy modules, debounce input handlers, paginate large lists, animate with `transform`/`opacity`. Ship no jank.+- **Changelog:** append a holder-readable entry to `data/changelog.json` for any user-visible change, then run `npm run build:pages` to validate.+- **Concurrent agents share this worktree.** Stage explicit paths only — **never** `git add -A` / `git add .`. Re-check `git status` + `git diff --staged` immediately before any commit. Never commit `api/*.js` esbuild bundles (check `head -1` for `__defProp` / `createRequire`).++## 6. Definition of done++- [ ] Feature is built, wired into navigation, and reachable by a real user.+- [ ] Exercised in a real browser via `npm run dev`; **no console errors or warnings** from your code.+- [ ] Network tab shows real API calls succeeding with real data.+- [ ] Every interactive element has hover / active / focus states; fully keyboard-navigable.+- [ ] Loading, empty, error, populated, and overflow states all designed and reachable.+- [ ] Existing tests pass (`npm test`); add tests for new logic you introduce.+- [ ] `git diff` self-reviewed — every changed line justified.+- [ ] Changelog updated if the change is user-visible.+- [ ] You would be proud to demo this to a room of senior engineers.++> Note: do **not** run `npm install` in this codespace (the cache is corrupted and it hangs the box). Use the already-installed dependencies.++## 7. Self-improvement loop (REQUIRED before you finish)++When you think you're done: **STOP.** Re-read §2.++1. Find the single weakest aspect of what you built and make it excellent. Repeat until nothing obvious remains.+2. Run the self-review protocol: **lazy check** (any shortcut, any half-wire, any hardcoded value where dynamic belongs?), **user check** (first-time user — does it make sense, is it findable, does it feel polished?), **integration check** (connects to the rest of the platform, navigable to/from?), **edge-case check** (0 / 1 / 1000, long names, network failure, expired session), **pride check** (portfolio-worthy? if not, fix what's stopping you).+3. Update `data/changelog.json` if user-visible.+4. **Delete this task file** — `prompts/feature-innovation/01_07_voice-lab.md`.+5. Report: what you shipped, what you *invented*, and the single best next idea you'd pursue.++---++## Reference shelf++- **This feature's current UX:** `docs/ux-flows/01-onboarding-creation.md`+- **Repo map:** `STRUCTURE.md` · **Operating rules:** `CLAUDE.md` · **Design tokens:** `DESIGN-TOKENS.md`+- **Credentials / endpoints:** `.env`, `.env.example`+- **Stack:** vanilla JS modules + Vite (`npm run dev`, port 3000); Three.js (glTF/GLB); Vercel functions in `api/`; Cloudflare workers in `workers/`; Solana / agent SDKs in `sdk/`, `solana-agent-sdk/`, `agent-payments-sdk/`.diff --git a/prompts/feature-innovation/05_07_reputation.md b/prompts/feature-innovation/05_07_reputation.mdnew file mode 100644index 000000000..67d00623c--- /dev/null+++ b/prompts/feature-innovation/05_07_reputation.md@@ -0,0 +1,90 @@+# 🚀 Innovation Brief — Reputation Explorer++> **Task file:** `prompts/feature-innovation/05_07_reputation.md`+> **Surface:** `/reputation`+> **Primary source:** `public/reputation/index.html`, `public/reputation/reputation.js`, `src/erc8004/{chain-meta,abi,reputation}.js`+> **Atlas reference:** `docs/ux-flows/05-discovery-social.md` (current UX, traced step-by-step)++---++## 0. How to use this brief++You are **one agent in a fleet**. This one feature is yours to make world-class. Read this entire brief, then read the referenced source so you are changing reality and not a guess. Execute completely. When you are genuinely done (§6–7), **delete this task file**.++You are not a task-completing machine. You are a senior engineer and product thinker who happens to write code. Act like it.++## 1. Mission++The end user is someone deciding whether to *trust an agent* — to pay it, delegate to it, or build on it — and wants verifiable, tamper-proof evidence rather than a star count someone could fake. `/reputation` reads on-chain attestations (EAS / ERC-8004) for an address and renders a profile: aggregate score, star ratings, categorized reviews, and a wallet-signed flow to write a new review.++"Gamechanging" here means making **on-chain reputation legible and trustworthy at a glance** — turning raw attestations into a credibility story a non-crypto user instantly understands, while making the *trust math* transparent (who attested, when, with what stake, on what chain) so it can't be gamed. The bar: a profile you'd cite to justify wiring money to an autonomous agent. Verifiable trust as a first-class, beautiful surface — not a block-explorer dump.++## 2. The bar++Build the version that makes someone screenshot it and share it. Benchmark against the best in the world (Gitcoin Passport, Karma3/OpenRank, the legibility of a Stripe Radar score, Linear's clarity, EAS's own explorer but actually usable). **If your result merely matches what already exists, you have failed this brief.** Invent something true and new that creates real, obvious value for the user.++## 3. Current state — ground truth (verify in source before you touch anything)++- **Route(s):** `/reputation` (params `?address=`, `?chain=`, legacy `?agent=N:M`).+- **Source:** `public/reputation/index.html`, `public/reputation/reputation.js`, `src/erc8004/{chain-meta,abi,reputation}.js`; EAS (Ethereum Attestation Service) EASScan GraphQL (read), EAS SDK + ethers (write).+- **Current flow:** 4 required (+2 optional write) — land with no `?address` → search form (address/ENS input, chain select, example chips) → submit → navigate to `?address=…&chain=…` → resolve ENS if needed (public RPC) → `fetchAttestations` (EASScan GraphQL) + `getReputation` (ERC-8004 on-chain) → render profile (aggregate score bar color-coded, star ratings, tabbed review list all/by-category, copy-address + copy-share-link). Optional write: "Connect wallet to review" → `eth_requestAccounts` → star + comment → "Sign & submit review" → `wallet_switchEthereumChain`/`wallet_addEthereumChain` → encode `address agent, uint8 score, string comment` → `EAS.attest(...)` → success card with explorer + EASScan links.+- **What works today:** Wallet-free reading (EASScan GraphQL + public RPC); ENS resolution; legacy `agent=N:M` path (resolves owner, redirects); color-coded score + stars + categorized review tabs; full wallet write flow with chain switch/add; copy address + share link; designed states for unsupported network, invalid address, ENS-not-found/failed, no-attestations ("Be the first to review!"), no wallet, tx cancelled (4001), tx failure.+- **Real APIs / dependencies already wired:** EASScan GraphQL per chain (Base / Ethereum / Optimism / Arbitrum / Polygon / Base Sepolia), public RPC for ENS + ERC-8004 reads, injected wallet (`window.ethereum`), EAS SDK `attest`, ERC-8004 helpers `getReputation`/`submitReputation`.+- **Where it's mediocre, thin, or unfinished:** Reputation is shown as a flat average — no defense against gaming (one address spamming reviews, sybil ratings, wash-trust all weigh the same). No *who* behind a review (attester identity, their own reputation, whether they actually transacted with the agent). No trend over time (is trust rising or falling?). No cross-chain unification (the same agent across chains is separate profiles). No discovery — you must already know an address; there's no "top-rated agents" leaderboard. Not wired into the rest of the platform (a `/discover` or `/characters` agent doesn't show or link its reputation). The write flow is generic (score + comment) with no proof-of-interaction.++## 4. Innovation directions (seeds — you are expected to go beyond them)++- **A legible trust score, not a flat average.** Compute and *show the math*: weight reviews by attester credibility, recency, and whether the attester has on-chain history with the agent; visibly down-weight likely sybil/duplicate sources. Render a transparent breakdown ("based on 24 attestations from 19 distinct addresses, 7 with prior transactions") so the score is defensible and un-gameable-feeling.+- **Reputation over time.** A sparkline/timeline of the score and review volume so a viewer sees momentum (trust building vs eroding), not just a snapshot.+- **Attester provenance.** For each review, surface the attester's own reputation and a verified/unverified badge, with a link to *their* profile — turn reviews into a web of trust, not anonymous stars.+- **Cross-chain unified profile.** Aggregate the same agent's attestations across supported EAS chains into one profile with per-chain breakdown, so reputation isn't fragmented by deployment chain.+- **Top-rated leaderboard + discovery.** Add a discovery view of the highest-trust agents (read across attestations) so `/reputation` becomes a destination, not just a lookup tool — deep-linkable and shareable.+- **Reputation everywhere.** Wire a compact reputation badge/score into `/discover`, `/characters`, `/agents`, and agent profiles that deep-links here — so trust is visible at the moment of decision, not only when someone seeks it out.++> These are starting points, not a checklist. The best idea may not be listed — find it. Think second-order: reputation should gate/inform payments ($THREE x402 in `/irl` and the payments SDK), surface on every agent card across the discovery cluster, and link to `/lookup`. **Wire those connections.** The best platforms feel like everything is linked.++## 5. Hard rules (non-negotiable — from `CLAUDE.md`)++- **Real APIs, real data, real integrations. No mocks, no fake/sample arrays, no placeholders, no `setTimeout` fake-loading or fake progress.** If credentials are missing, find them in `.env` / `.env.example` / `vercel env` — then proceed.+- **Wire 100%.** Every button works, every link goes somewhere, every reachable state exists. Design *every* state: loading (skeletons over spinners), empty (tell the user what to do next), error (actionable recovery), populated, and overflow (0 / 1 / 1000 items, very long strings, mid-operation network failure, expired session).+- **No TODO comments, no stubs, no `throw new Error("not implemented")`, no commented-out code.** If you write it, finish it.+- **No errors without solutions.** Every error has a root cause; every root cause has a fix. Ship failsafes, not lazy propagation.+- **$THREE is the only coin** (CA `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`). Never name, add, hardcode, link, render, or recommend any other coin anywhere — code, copy, tests, fixtures, commits. The only exceptions are coin-agnostic runtime plumbing (user supplies a mint) and platform launch records rendered at runtime.+- **Read before you write.** Match the existing patterns, naming, file organization, and the design tokens in `DESIGN-TOKENS.md`. Consistency compounds.+- **Accessibility + responsive (320 / 768 / 1440) + microinteractions** are part of done, not polish. Semantic HTML, ARIA, keyboard nav, focus rings, sufficient contrast.+- **Performance by default:** lazy-load heavy modules, debounce input handlers, paginate large lists, animate with `transform`/`opacity`. Ship no jank.+- **Changelog:** append a holder-readable entry to `data/changelog.json` for any user-visible change, then run `npm run build:pages` to validate.+- **Concurrent agents share this worktree.** Stage explicit paths only — **never** `git add -A` / `git add .`. Re-check `git status` + `git diff --staged` immediately before any commit. Never commit `api/*.js` esbuild bundles (check `head -1` for `__defProp` / `createRequire`).++## 6. Definition of done++- [ ] Feature is built, wired into navigation, and reachable by a real user.+- [ ] Exercised in a real browser via `npm run dev`; **no console errors or warnings** from your code.+- [ ] Network tab shows real API calls succeeding with real data.+- [ ] Every interactive element has hover / active / focus states; fully keyboard-navigable.+- [ ] Loading, empty, error, populated, and overflow states all designed and reachable.+- [ ] Existing tests pass (`npm test`); add tests for new logic you introduce.+- [ ] `git diff` self-reviewed — every changed line justified.+- [ ] Changelog updated if the change is user-visible.+- [ ] You would be proud to demo this to a room of senior engineers.++> Note: do **not** run `npm install` in this codespace (the cache is corrupted and it hangs the box). Use the already-installed dependencies.++## 7. Self-improvement loop (REQUIRED before you finish)++When you think you're done: **STOP.** Re-read §2.++1. Find the single weakest aspect of what you built and make it excellent. Repeat until nothing obvious remains.+2. Run the self-review protocol: **lazy check** (any shortcut, any half-wire, any hardcoded value where dynamic belongs?), **user check** (first-time user — does it make sense, is it findable, does it feel polished?), **integration check** (connects to the rest of the platform, navigable to/from?), **edge-case check** (0 / 1 / 1000, long names, network failure, expired session), **pride check** (portfolio-worthy? if not, fix what's stopping you).+3. Update `data/changelog.json` if user-visible.+4. **Delete this task file** — `prompts/feature-innovation/05_07_reputation.md`.+5. Report: what you shipped, what you *invented*, and the single best next idea you'd pursue.++---++## Reference shelf++- **This feature's current UX:** `docs/ux-flows/05-discovery-social.md`+- **Repo map:** `STRUCTURE.md` · **Operating rules:** `CLAUDE.md` · **Design tokens:** `DESIGN-TOKENS.md`+- **Credentials / endpoints:** `.env`, `.env.example`+- **Stack:** vanilla JS modules + Vite (`npm run dev`, port 3000); Three.js (glTF/GLB); Vercel functions in `api/`; Cloudflare workers in `workers/`; Solana / agent SDKs in `sdk/`, `solana-agent-sdk/`, `agent-payments-sdk/`.diff --git a/prompts/feature-innovation/07_06_pump-dashboard.md b/prompts/feature-innovation/07_06_pump-dashboard.mdnew file mode 100644index 000000000..1f99acddc--- /dev/null+++ b/prompts/feature-innovation/07_06_pump-dashboard.md@@ -0,0 +1,89 @@+# 🚀 Innovation Brief — Pump Dashboard: The Power-User Command Center++> **Task file:** `prompts/feature-innovation/07_06_pump-dashboard.md`+> **Surface:** `/pump-dashboard` (Token Cockpit)+> **Primary source:** `pages/pump-dashboard.html` (large inline module, ~5000 lines); imports `src/solana/vanity/grinder.js`, `src/solana/vanity/validation.js`, `src/shared/state-kit.js`; uses `src/wallet.js`+> **Atlas reference:** `docs/ux-flows/07-crypto-trading-analytics.md` (current UX, traced step-by-step)++---++## 0. How to use this brief++You are **one agent in a fleet**. This one feature is yours to make world-class. Read this entire brief, then read the referenced source so you are changing reality and not a guess. Execute completely. When you are genuinely done (§6–7), **delete this task file**.++You are not a task-completing machine. You are a senior engineer and product thinker who happens to write code. Act like it.++## 1. Mission++The end user is a serious pump.fun operator — a trader/builder who wants *everything in one cockpit*: live launch/trade/whale/graduation feed, network health, market chart, token scanner, quote engine, alert rules, a vanity address grinder, agent management, revenue, API keys. `/pump-dashboard` exists to be that command center — the single tab a power user keeps open all day to monitor, react, and act.++"Gamechanging" means a command center that feels like a *professional terminal*, not a tab graveyard. Twelve tabs is power, but power without orchestration is overwhelm. The leap is to make the cockpit **adaptive and connected**: the most important signal finds the user wherever they are, the headline interactive payoffs (the vanity grinder, the alert-rule builder) feel magical, and every panel links into the rest of the platform so the cockpit is a launchpad, not a silo. Build the surface a power user would pay for.++## 2. The bar++Build the version that makes someone screenshot it and share it. Benchmark against the best in the world (Bloomberg Terminal's information orchestration, a trading desk's multi-monitor layout, the polish of Vercel/Stripe dashboards, the satisfaction of a great background-job UI). **If your result merely matches what already exists, you have failed this brief.** Invent something true and new that creates real, obvious value for the user.++## 3. Current state — ground truth (verify in source before you touch anything)++- **Route(s):** `/pump-dashboard`; entry from nav, "Open Token Cockpit →" (`/dashboard/tokens`), `/autopilot`, sitemap; deep link `?agent=<id>` auto-opens Default Agent panel; `#hash` deep-links any tab.+- **Source:** `pages/pump-dashboard.html` (inline module ~5000 lines); `src/solana/vanity/grinder.js`, `src/solana/vanity/validation.js`, `src/shared/state-kit.js`, `src/wallet.js`.+- **Current flow:** 3 required (arrive → `connectApi()`/`connectWebSocket()` → panels populate) + ~9 optional tab flows. `DOMContentLoaded` restores config from localStorage (api/ws/rpc/key), resolves `?agent=`/`#hash`. `connectApi()` polls `GET /api/healthz` (15s, status dot); `connectWebSocket()` opens `wss://pumpportal.fun/api/data`, subscribes `subscribeNewToken`+`subscribeMigration` (exponential backoff, 8-attempt cap → manual Reconnect banner). Preloads channel-feed, helius-stats (30s), featured agent, trending ($THREE pinned first). 12 hash-routed tabs: Default, Live Feed (rAF-batched, pause+filter), Token Scanner, Quote Engine, Alerts (rule builder + CRUD + live firing + history), Vanity Generator (up to 8 WASM Web Workers, tries/rate/eta, reveal/copy/download keypair), Default Agent (embed iframe, postMessage, manage custom agents w/ CSRF), Revenue, Configuration, API Reference (key CRUD), plus Watches/Claims (require PumpKit backend).+- **What works today:** real WS feed with backoff + manual reconnect; healthz status dot; optional wallet connect → `POST /api/wallet/balances` (SOL + top-10 holdings); token scanner; buy/sell quote forms; alert-rule builder with in-app/webhook/Telegram delivery, cooldown, live firing, history; vanity grinder (real WASM workers, secret never leaves browser); agent embed + management; designed empty/error states via `state-kit`.+- **Real APIs / dependencies already wired:** `/api/healthz`, `/api/pump/helius-stats`, `/api/pump/channel-feed`, `/api/pump/trending`, `/api/agents/featured`, `/api/agents` (+CSRF), `/api/wallet/balances`, `/api/pump/scan`, `/api/pump/quote/{buy,sell}`, `/api/alerts/rules` (CRUD), `/api/notifications`, `/api/api-keys` (CRUD), revenue endpoints; `wss://pumpportal.fun/api/data`; Solana RPC via `/api/solana-rpc`; Phantom/MWA wallet; vanity Web Workers; model-viewer CDN.+- **Where it's mediocre, thin, or unfinished:** 12 tabs are siloed — the feed doesn't talk to the scanner, the scanner doesn't talk to the quote engine, alerts don't deep-link to the thing that fired them. There's no customizable layout (every user gets the same fixed tab order regardless of what they actually use). The headline interactive payoffs (vanity grind, alert builder) are strong but isolated — no celebration on a vanity hit, no "create alert from this feed event" shortcut. The Oracle/conviction intelligence the rest of the platform runs on is barely surfaced here. It's a collection of tools, not an orchestrated workspace.++## 4. Innovation directions (seeds — you are expected to go beyond them)++- **Command palette + cross-tool flow:** a keyboard-driven command palette (jump to any tab, scan a mint, quote a buy, arm an alert) that turns 12 tabs into one fluid surface — and wire the tools to each other: click a feed event → scan it → quote it → set an alert on it, without leaving the flow.+- **Customizable cockpit layout:** let the power user pin, reorder, and resize the panels they actually use into a saved layout (persisted locally), with a dense "terminal" mode for multi-monitor setups. The cockpit should adapt to the operator, not the reverse.+- **"Create alert from anything":** every live feed event, scanner result, and quote becomes a one-click alert-rule seed — the alert builder pre-filled from real context — closing the gap between *seeing* a signal and *automating* a reaction.+- **Make the vanity grind a moment:** real-time worker telemetry (per-worker rate, combined eta with confidence), a satisfying reveal/celebration on a hit, and a clean security story for the keypair (never leaves browser) made visible and trustworthy.+- **Cross-feature wiring (required):** surface Oracle conviction (`/api/oracle/coin`, action-stream) and radar/intel risk inline on every feed/scanner/quote item so the cockpit inherits the platform's brain; Watch buttons write `ld_watchlist`; alerts deep-link to `/oracle`, `/watchlist`, `/trader`; "arm an agent" hands off to the Oracle arm flow or `/strategy-lab`. The cockpit should feel like the front door to the whole trading platform.++> These are starting points, not a checklist. The best idea may not be listed — find it. Think second-order: how does improving this unlock value in adjacent three.ws features? **Wire those connections.** The best platforms feel like everything is linked.++## 5. Hard rules (non-negotiable — from `CLAUDE.md`)++- **Real APIs, real data, real integrations. No mocks, no fake/sample arrays, no placeholders, no `setTimeout` fake-loading or fake progress.** If credentials are missing, find them in `.env` / `.env.example` / `vercel env` — then proceed.+- **Wire 100%.** Every button works, every link goes somewhere, every reachable state exists. Design *every* state: loading (skeletons over spinners), empty (tell the user what to do next), error (actionable recovery), populated, and overflow (0 / 1 / 1000 items, very long strings, mid-operation network failure, expired session).+- **No TODO comments, no stubs, no `throw new Error("not implemented")`, no commented-out code.** If you write it, finish it.+- **No errors without solutions.** Every error has a root cause; every root cause has a fix. Ship failsafes, not lazy propagation.+- **$THREE is the only coin** (CA `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`). Never name, add, hardcode, link, render, or recommend any other coin anywhere — code, copy, tests, fixtures, commits. The only exceptions are coin-agnostic runtime plumbing (user supplies a mint) and platform launch records rendered at runtime.+- **Read before you write.** Match the existing patterns, naming, file organization, and the design tokens in `DESIGN-TOKENS.md`. Consistency compounds.+- **Accessibility + responsive (320 / 768 / 1440) + microinteractions** are part of done, not polish. Semantic HTML, ARIA, keyboard nav, focus rings, sufficient contrast.+- **Performance by default:** lazy-load heavy modules, debounce input handlers, paginate large lists, animate with `transform`/`opacity`. Ship no jank.+- **Changelog:** append a holder-readable entry to `data/changelog.json` for any user-visible change, then run `npm run build:pages` to validate.+- **Concurrent agents share this worktree.** Stage explicit paths only — **never** `git add -A` / `git add .`. Re-check `git status` + `git diff --staged` immediately before any commit. Never commit `api/*.js` esbuild bundles (check `head -1` for `__defProp` / `createRequire`).++## 6. Definition of done++- [ ] Feature is built, wired into navigation, and reachable by a real user.+- [ ] Exercised in a real browser via `npm run dev`; **no console errors or warnings** from your code.+- [ ] Network tab shows real API calls succeeding with real data.+- [ ] Every interactive element has hover / active / focus states; fully keyboard-navigable.+- [ ] Loading, empty, error, populated, and overflow states all designed and reachable.+- [ ] Existing tests pass (`npm test`); add tests for new logic you introduce.+- [ ] `git diff` self-reviewed — every changed line justified.+- [ ] Changelog updated if the change is user-visible.+- [ ] You would be proud to demo this to a room of senior engineers.++> Note: do **not** run `npm install` in this codespace (the cache is corrupted and it hangs the box). Use the already-installed dependencies.++## 7. Self-improvement loop (REQUIRED before you finish)++When you think you're done: **STOP.** Re-read §2.++1. Find the single weakest aspect of what you built and make it excellent. Repeat until nothing obvious remains.+2. Run the self-review protocol: **lazy check** (any shortcut, any half-wire, any hardcoded value where dynamic belongs?), **user check** (first-time user — does it make sense, is it findable, does it feel polished?), **integration check** (connects to the rest of the platform, navigable to/from?), **edge-case check** (0 / 1 / 1000, long names, network failure, expired session), **pride check** (portfolio-worthy? if not, fix what's stopping you).+3. Update `data/changelog.json` if user-visible.+4. **Delete this task file** — `prompts/feature-innovation/07_06_pump-dashboard.md`.+5. Report: what you shipped, what you *invented*, and the single best next idea you'd pursue.++---++## Reference shelf++- **This feature's current UX:** `docs/ux-flows/07-crypto-trading-analytics.md`+- **Repo map:** `STRUCTURE.md` · **Operating rules:** `CLAUDE.md` · **Design tokens:** `DESIGN-TOKENS.md`+- **Credentials / endpoints:** `.env`, `.env.example`+- **Stack:** vanilla JS modules + Vite (`npm run dev`, port 3000); Three.js (glTF/GLB); Vercel functions in `api/`; Cloudflare workers in `workers/`; Solana / agent SDKs in `sdk/`, `solana-agent-sdk/`, `agent-payments-sdk/`.diff --git a/prompts/feature-innovation/07_07_strategy-lab.md b/prompts/feature-innovation/07_07_strategy-lab.mdnew file mode 100644index 000000000..6cefa0eb3--- /dev/null+++ b/prompts/feature-innovation/07_07_strategy-lab.md@@ -0,0 +1,89 @@+# 🚀 Innovation Brief — Strategy Lab: No-Code Autonomous Trading Builder++> **Task file:** `prompts/feature-innovation/07_07_strategy-lab.md`+> **Surface:** `/strategy-lab`+> **Primary source:** `public/strategy-lab.html` (pre-built static, ~720 lines, text-only UI, no 3D); `vercel.json` rewrite `/strategy-lab → /strategy-lab.html`+> **Atlas reference:** `docs/ux-flows/07-crypto-trading-analytics.md` (current UX, traced step-by-step)++---++## 0. How to use this brief++You are **one agent in a fleet**. This one feature is yours to make world-class. Read this entire brief, then read the referenced source so you are changing reality and not a guess. Execute completely. When you are genuinely done (§6–7), **delete this task file**.++You are not a task-completing machine. You are a senior engineer and product thinker who happens to write code. Act like it.++## 1. Mission++The end user wants their agent to trade *for them* by rules they define — scan for candidates, filter by criteria, enter, exit, with hard caps — and they want to *prove the strategy works before risking real SOL*. `/strategy-lab` exists to be the no-code autonomous trading strategy builder: define a spec, validate it, backtest it on real on-chain data, simulate it live, and — gated behind sign-in, a provisioned wallet, and a balance check — run it live with real funds, streaming every entry/exit into a log.++This is the **most interactive surface in the cluster**, and the highest-stakes: it signs real transactions. "Gamechanging" means making strategy-building feel *safe and powerful* — powerful enough that a non-coder can express a real edge, safe enough that they always understand exactly what their money will do before it does it. The leap is to make the validate→backtest→run pipeline a confidence-building experience, not a JSON editor with buttons. Build the tool that turns "I have a trading idea" into "my agent is running it, and I trust it."++## 2. The bar++Build the version that makes someone screenshot it and share it. Benchmark against the best in the world (TradingView's strategy tester, Zapier/n8n's visual flow builders, the safety choreography of a Stripe payment confirmation, the clarity of a great backtest report). **If your result merely matches what already exists, you have failed this brief.** Invent something true and new that creates real, obvious value for the user.++## 3. Current state — ground truth (verify in source before you touch anything)++- **Route(s):** `/strategy-lab` (static, rewritten from `/strategy-lab.html`).+- **Source:** `public/strategy-lab.html` (~720 lines, text-only, no 3D).+- **Current flow:** 4 required (arrive → spec → Validate → Run simulate) + ~4 optional. Arrive → spec editor + results/portfolio panels render; `GET /api/agents` populates agent dropdown if signed in; pick network (mainnet/devnet). Optional select agent → `GET /api/agents/{id}/solana?network=` shows wallet + balance, provision via `POST` if none, low-balance warning < 0.02 SOL. Load preset (Momentum/Snipe/Mean-revert) or hand-edit JSON spec (`scan`, `filters`, `entry`, `exit`, `caps`). Validate → `POST /api/pump/strategy-validate`. Backtest → `POST /api/pump/strategy-backtest` (real on-chain, no auth) → metrics grid (PnL, ROI, win rate, trades, max drawdown, SOL deployed) + per-trade table. Run → `POST /api/pump/strategy-run` `{durationSec, mode:'simulate'|'live', network, agentId?}` → SSE stream (start/log/enter/exit/skip/done) into live log. Stop (`activeRun.abort()`). Portfolio panel → `GET /api/pump/portfolio?agentId=&network=` (holdings, cost basis, unrealized PnL); Close All → `POST /api/pump/strategy-close-all`.+- **What works today:** real validate/backtest/run pipeline on real on-chain data; presets + hand-edited JSON spec; SSE live run log; simulate (public) vs live (gated: sign-in + provisioned wallet + ≥0.02 SOL + confirmation dialog); portfolio with cost basis + unrealized PnL; Close All; designed empty/error states; network toggle.+- **Real APIs / dependencies already wired:** `/api/agents`, `/api/agents/{id}/solana` (GET+POST), `/api/pump/strategy-validate`, `/api/pump/strategy-backtest`, `/api/pump/strategy-run` (SSE), `/api/pump/portfolio`, `/api/pump/strategy-close-all`; backend MCP → Solana RPC + pump.fun indexer; agent hot wallet signs in live mode.+- **Where it's mediocre, thin, or unfinished:** the spec is raw JSON — powerful for coders, a wall for the "no-code" user the route promises. There's no visual strategy builder, no inline explanation of what each rule *means* in plain language, no guardrail preview ("this strategy could deploy up to X SOL across Y positions"). Backtest results are a metrics grid + table but no equity curve, no visualization of *where* trades happened, no comparison between strategies. The jump from backtest to live is a confirmation dialog — the safety story could be far richer (what exactly will happen in the first minute, kill-switch, real-time cap consumption). There's no strategy library/sharing, no way to clone a winning trader's style into a spec.++## 4. Innovation directions (seeds — you are expected to go beyond them)++- **True no-code builder:** a visual rule builder (scan → filters → entry → exit → caps) that compiles to the existing JSON spec — each rule a plain-English sentence the user assembles, with live validation, so a non-coder builds a real strategy without touching JSON. Keep the JSON view as an "advanced" toggle, perfectly round-tripped.+- **Backtest that tells a story:** an equity curve, drawdown band, and a trade-by-trade timeline visualization on top of the metrics grid; the ability to backtest two specs side-by-side and see which edge is real; a plain-English summary of *why* the strategy won or lost.+- **Safety as a feature, not a dialog:** before any live run, a "what will happen" preview — max SOL at risk, max concurrent positions, worst-case drawdown from backtest — plus a live cap-consumption meter and an always-visible kill switch during the run. The trader should never be surprised by what their money did.+- **Strategy library:** save, name, version, and (optionally) share strategies; seed from presets *and* from real winning behavior — "build a strategy from this trader's style" pulling from the leaderboard/trader profiles.+- **Cross-feature wiring (required):** connect Strategy Lab to the platform's brain and reputation — use Oracle conviction tiers and radar/intel risk flags as first-class scan/filter primitives in the builder; let a backtested strategy graduate into an Oracle armed agent; surface live runs into `/activity` and the trader profile; and make "copy this trader" from `/leaderboard` land here as a pre-filled, editable spec.++> These are starting points, not a checklist. The best idea may not be listed — find it. Think second-order: how does improving this unlock value in adjacent three.ws features? **Wire those connections.** The best platforms feel like everything is linked.++## 5. Hard rules (non-negotiable — from `CLAUDE.md`)++- **Real APIs, real data, real integrations. No mocks, no fake/sample arrays, no placeholders, no `setTimeout` fake-loading or fake progress.** If credentials are missing, find them in `.env` / `.env.example` / `vercel env` — then proceed.+- **Wire 100%.** Every button works, every link goes somewhere, every reachable state exists. Design *every* state: loading (skeletons over spinners), empty (tell the user what to do next), error (actionable recovery), populated, and overflow (0 / 1 / 1000 items, very long strings, mid-operation network failure, expired session).+- **No TODO comments, no stubs, no `throw new Error("not implemented")`, no commented-out code.** If you write it, finish it.+- **No errors without solutions.** Every error has a root cause; every root cause has a fix. Ship failsafes, not lazy propagation.+- **$THREE is the only coin** (CA `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`). Never name, add, hardcode, link, render, or recommend any other coin anywhere — code, copy, tests, fixtures, commits. The only exceptions are coin-agnostic runtime plumbing (user supplies a mint) and platform launch records rendered at runtime.+- **Read before you write.** Match the existing patterns, naming, file organization, and the design tokens in `DESIGN-TOKENS.md`. Consistency compounds.+- **Accessibility + responsive (320 / 768 / 1440) + microinteractions** are part of done, not polish. Semantic HTML, ARIA, keyboard nav, focus rings, sufficient contrast.+- **Performance by default:** lazy-load heavy modules, debounce input handlers, paginate large lists, animate with `transform`/`opacity`. Ship no jank.+- **Changelog:** append a holder-readable entry to `data/changelog.json` for any user-visible change, then run `npm run build:pages` to validate.+- **Concurrent agents share this worktree.** Stage explicit paths only — **never** `git add -A` / `git add .`. Re-check `git status` + `git diff --staged` immediately before any commit. Never commit `api/*.js` esbuild bundles (check `head -1` for `__defProp` / `createRequire`).++## 6. Definition of done++- [ ] Feature is built, wired into navigation, and reachable by a real user.+- [ ] Exercised in a real browser via `npm run dev`; **no console errors or warnings** from your code.+- [ ] Network tab shows real API calls succeeding with real data.+- [ ] Every interactive element has hover / active / focus states; fully keyboard-navigable.+- [ ] Loading, empty, error, populated, and overflow states all designed and reachable.+- [ ] Existing tests pass (`npm test`); add tests for new logic you introduce.+- [ ] `git diff` self-reviewed — every changed line justified.+- [ ] Changelog updated if the change is user-visible.+- [ ] You would be proud to demo this to a room of senior engineers.++> Note: do **not** run `npm install` in this codespace (the cache is corrupted and it hangs the box). Use the already-installed dependencies.++## 7. Self-improvement loop (REQUIRED before you finish)++When you think you're done: **STOP.** Re-read §2.++1. Find the single weakest aspect of what you built and make it excellent. Repeat until nothing obvious remains.+2. Run the self-review protocol: **lazy check** (any shortcut, any half-wire, any hardcoded value where dynamic belongs?), **user check** (first-time user — does it make sense, is it findable, does it feel polished?), **integration check** (connects to the rest of the platform, navigable to/from?), **edge-case check** (0 / 1 / 1000, long names, network failure, expired session), **pride check** (portfolio-worthy? if not, fix what's stopping you).+3. Update `data/changelog.json` if user-visible.+4. **Delete this task file** — `prompts/feature-innovation/07_07_strategy-lab.md`.+5. Report: what you shipped, what you *invented*, and the single best next idea you'd pursue.++---++## Reference shelf++- **This feature's current UX:** `docs/ux-flows/07-crypto-trading-analytics.md`+- **Repo map:** `STRUCTURE.md` · **Operating rules:** `CLAUDE.md` · **Design tokens:** `DESIGN-TOKENS.md`+- **Credentials / endpoints:** `.env`, `.env.example`+- **Stack:** vanilla JS modules + Vite (`npm run dev`, port 3000); Three.js (glTF/GLB); Vercel functions in `api/`; Cloudflare workers in `workers/`; Solana / agent SDKs in `sdk/`, `solana-agent-sdk/`, `agent-payments-sdk/`.diff --git a/prompts/feature-innovation/07_08_smart-money.md b/prompts/feature-innovation/07_08_smart-money.mdnew file mode 100644index 000000000..852133552--- /dev/null+++ b/prompts/feature-innovation/07_08_smart-money.md@@ -0,0 +1,91 @@+# 🚀 Innovation Brief — Smart Money: Follow the Winning Wallets++> **Task file:** `prompts/feature-innovation/07_08_smart-money.md`+> **Surface:** `/smart-money` and `/gmgn`+> **Primary source:** `pages/smart-money.html` (self-contained inline module) + backend `api/pump/smart-money.js`; `public/gmgn.html` (pre-built static, ~900 lines) + backend `api/agents/gmgn.js` (SSE `/api/agents/gmgn-feed`, reactive 3D `<model-viewer>` avatar)+> **Atlas reference:** `docs/ux-flows/07-crypto-trading-analytics.md` (current UX, traced step-by-step)++---++## 0. How to use this brief++You are **one agent in a fleet**. This one feature is yours to make world-class. Read this entire brief, then read the referenced source so you are changing reality and not a guess. Execute completely. When you are genuinely done (§6–7), **delete this task file**.++You are not a task-completing machine. You are a senior engineer and product thinker who happens to write code. Act like it.++## 1. Mission++The end user knows the oldest edge in crypto: *follow the wallets that win.* `/smart-money` ranks fresh coins by buyer pedigree (proven-wallet count, smart buy volume) and maintains a wallet reputation board (smart_money/sniper/dumper/rugger labels); `/gmgn` streams smart-money entries live as an animated, optionally-narrating 3D agent reacts in real time. Together they answer: *which wallets are good, and what are they buying right now?*++"Gamechanging" means making "follow the winning wallets" actionable and alive — not a static reputation table, but a *living signal* that tells the trader when proven money moves, who exactly moved, and whether to follow. The `/gmgn` reactive 3D avatar is a unique asset: a market that *performs* its own pulse. The leap is to fuse the rigor of `/smart-money` (provable wallet pedigree, on-chain evidence) with the visceral, glanceable energy of `/gmgn` (an agent that reacts to smart money in 3D) into one follow-the-winners experience. Build the tool that makes copying smart money feel obvious and safe.++## 2. The bar++Build the version that makes someone screenshot it and share it. Benchmark against the best in the world (Nansen's smart-money flows, Arkham's wallet intelligence, GMGN's speed, the delight of a character that reacts to live data like a Twitch overlay). **If your result merely matches what already exists, you have failed this brief.** Invent something true and new that creates real, obvious value for the user.++## 3. Current state — ground truth (verify in source before you touch anything)++- **Route(s):** `/smart-money`; `/gmgn` (rewritten from `/gmgn.html`; `/api/agents/gmgn-feed → /api/agents/gmgn?_handler=feed`).+- **Source:** `pages/smart-money.html` + `api/pump/smart-money.js`; `public/gmgn.html` + `api/agents/gmgn.js`.+- **Current flow:**+ - **/smart-money:** arrive → reads `ld_watchlist`, renders 6 skeletons, `refresh()`; auto-refresh 20s (pauses when tab hidden) → `GET /api/pump/smart-money?limit=60` (coins ranked by smart_money_score, proven-wallet count, smart buy volume) + parallel `?leaderboard=1&limit=60` (top wallets by reputation). Tabs Feed ↔ Top wallets; per-coin Watch (`ld_watchlist`); click coin → drawer `?mint=<mint>` (notable wallets, labels) + async `GET /api/oracle/coin` (conviction pillars); click wallet → drawer `?wallet=<addr>` (win rate, record, recent coins).+ - **/gmgn:** arrive → 3D agent (CZ default) into `<model-viewer>` (auto-rotate); params chain=sol, interval=1h, minSmartBuys=2, narrate, avatar, mood → SSE `EventSource('/api/agents/gmgn-feed?...')` → `hello` (status pill "Live · SOL · 1h"), last 10 replayed dimmed, then `smart_entry` events stream. Per event: render card (symbol, MC, smart-buy delta, price change), trigger agent animation by delta/new flag, optional TTS narration, increment stats, "↑ N new" jump. Optional: change chain/interval/minSmartBuys, mood (chill/normal/hype), narration toggle, avatar picker modal (`GET /api/avatars/public` + `GET /api/avatars`), Apply (`#ctl-reconnect`), $THREE spotlight tile on CA hit.+- **What works today:** real wallet-reputation board with labels; coins ranked by buyer pedigree; coin + wallet drawers with on-chain records; Oracle conviction enrichment; live SSE smart-money feed with reactive, narrating 3D avatar; mood/narration/avatar controls; instant reconnect on filter change; designed empty/stale/error states with retry.+- **Real APIs / dependencies already wired:** `GET /api/pump/smart-money` (feed / `?leaderboard=1` / `?mint=` / `?wallet=`), async `GET /api/oracle/coin`; SSE `/api/agents/gmgn-feed` (upstream GMGN.ai feed via `connectGmgnFeed`); `/api/avatars/public`, `/api/avatars`; model-viewer CDN. Data from `coin_smart_money` + `wallet_reputation` tables (off-browser sniper engine).+- **Where it's mediocre, thin, or unfinished:** the two surfaces don't know about each other — `/smart-money` is rigorous but static (a ranked table that refreshes), `/gmgn` is alive but shallow (a feed + an avatar, with thin per-wallet depth). Neither lets the trader *act*: there's no "follow this wallet" that turns pedigree into an alert or an armed agent. The wallet reputation is labeled but not narrated (why is this wallet "smart money"? show me its proof). The 3D avatar reacts but doesn't *inform* — its animations are decorative, not a readable signal of intensity. No notion of "a wallet I follow just bought."++## 4. Innovation directions (seeds — you are expected to go beyond them)++- **Follow a wallet, get the signal:** turn wallet pedigree into action — "follow" a proven wallet and get alerted (in-app + existing Telegram/webhook plumbing) the moment it enters a fresh coin, with the wallet's track record attached so the trader can judge instantly. Reputation becomes a subscription, not a lookup.+- **Proof-backed reputation:** every smart_money/sniper/dumper/rugger label decomposes into on-chain evidence — win rate, biggest calls, recent record — so the trader trusts the label because they can verify it, not because it's asserted.+- **The avatar as a real instrument:** make the `/gmgn` 3D agent's reactions *mean* something — intensity of animation maps to smart-buy delta, distinct reactions for a known-followed wallet vs. a new one, mood that shifts with market regime — so a glance at the avatar conveys the market's state. A market that performs its own pulse, legibly.+- **Unify rigor + energy:** give `/smart-money` (the dossier) and `/gmgn` (the live show) one coherent relationship — the live feed surfaces the entry, one click drops into the rigorous wallet/coin drawer with full proof. Two views of one idea: follow the winners.+- **Cross-feature wiring (required):** cross-reference smart-money pedigree everywhere — flag proven wallets in `/radar`/`/coin-intel` funder clusters, show "smart money is in" on `/oracle` and `/watchlist` cards, let a "follow these wallets" set seed an Oracle armed agent or a `/strategy-lab` scan filter. A wallet rated "rugger" should warn the trader on every surface.++> These are starting points, not a checklist. The best idea may not be listed — find it. Think second-order: how does improving this unlock value in adjacent three.ws features? **Wire those connections.** The best platforms feel like everything is linked.++## 5. Hard rules (non-negotiable — from `CLAUDE.md`)++- **Real APIs, real data, real integrations. No mocks, no fake/sample arrays, no placeholders, no `setTimeout` fake-loading or fake progress.** If credentials are missing, find them in `.env` / `.env.example` / `vercel env` — then proceed.+- **Wire 100%.** Every button works, every link goes somewhere, every reachable state exists. Design *every* state: loading (skeletons over spinners), empty (tell the user what to do next), error (actionable recovery), populated, and overflow (0 / 1 / 1000 items, very long strings, mid-operation network failure, expired session).+- **No TODO comments, no stubs, no `throw new Error("not implemented")`, no commented-out code.** If you write it, finish it.+- **No errors without solutions.** Every error has a root cause; every root cause has a fix. Ship failsafes, not lazy propagation.+- **$THREE is the only coin** (CA `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`). Never name, add, hardcode, link, render, or recommend any other coin anywhere — code, copy, tests, fixtures, commits. The only exceptions are coin-agnostic runtime plumbing (user supplies a mint) and platform launch records rendered at runtime.+- **Read before you write.** Match the existing patterns, naming, file organization, and the design tokens in `DESIGN-TOKENS.md`. Consistency compounds.+- **Accessibility + responsive (320 / 768 / 1440) + microinteractions** are part of done, not polish. Semantic HTML, ARIA, keyboard nav, focus rings, sufficient contrast.+- **Performance by default:** lazy-load heavy modules, debounce input handlers, paginate large lists, animate with `transform`/`opacity`. Ship no jank.+- **Changelog:** append a holder-readable entry to `data/changelog.json` for any user-visible change, then run `npm run build:pages` to validate.+- **Concurrent agents share this worktree.** Stage explicit paths only — **never** `git add -A` / `git add .`. Re-check `git status` + `git diff --staged` immediately before any commit. Never commit `api/*.js` esbuild bundles (check `head -1` for `__defProp` / `createRequire`).++## 6. Definition of done++- [ ] Feature is built, wired into navigation, and reachable by a real user.+- [ ] Exercised in a real browser via `npm run dev`; **no console errors or warnings** from your code.+- [ ] Network tab shows real API calls succeeding with real data.+- [ ] Every interactive element has hover / active / focus states; fully keyboard-navigable.+- [ ] Loading, empty, error, populated, and overflow states all designed and reachable.+- [ ] Existing tests pass (`npm test`); add tests for new logic you introduce.+- [ ] `git diff` self-reviewed — every changed line justified.+- [ ] Changelog updated if the change is user-visible.+- [ ] You would be proud to demo this to a room of senior engineers.++> Note: do **not** run `npm install` in this codespace (the cache is corrupted and it hangs the box). Use the already-installed dependencies.++## 7. Self-improvement loop (REQUIRED before you finish)++When you think you're done: **STOP.** Re-read §2.++1. Find the single weakest aspect of what you built and make it excellent. Repeat until nothing obvious remains.+2. Run the self-review protocol: **lazy check** (any shortcut, any half-wire, any hardcoded value where dynamic belongs?), **user check** (first-time user — does it make sense, is it findable, does it feel polished?), **integration check** (connects to the rest of the platform, navigable to/from?), **edge-case check** (0 / 1 / 1000, long names, network failure, expired session), **pride check** (portfolio-worthy? if not, fix what's stopping you).+3. Update `data/changelog.json` if user-visible.+4. **Delete this task file** — `prompts/feature-innovation/07_08_smart-money.md`.+5. Report: what you shipped, what you *invented*, and the single best next idea you'd pursue.++---++## Reference shelf++- **This feature's current UX:** `docs/ux-flows/07-crypto-trading-analytics.md`+- **Repo map:** `STRUCTURE.md` · **Operating rules:** `CLAUDE.md` · **Design tokens:** `DESIGN-TOKENS.md`+- **Credentials / endpoints:** `.env`, `.env.example`+- **Stack:** vanilla JS modules + Vite (`npm run dev`, port 3000); Three.js (glTF/GLB); Vercel functions in `api/`; Cloudflare workers in `workers/`; Solana / agent SDKs in `sdk/`, `solana-agent-sdk/`, `agent-payments-sdk/`.diff --git a/prompts/feature-innovation/08_06_avatar-wallet-chat.md b/prompts/feature-innovation/08_06_avatar-wallet-chat.mdnew file mode 100644index 000000000..d4f710e02--- /dev/null+++ b/prompts/feature-innovation/08_06_avatar-wallet-chat.md@@ -0,0 +1,89 @@+# 🚀 Innovation Brief — Avatar Wallet Chat++> **Task file:** `prompts/feature-innovation/08_06_avatar-wallet-chat.md`+> **Surface:** `/avatar-wallet-chat`+> **Primary source:** `pages/avatar-wallet-chat.html` (self-contained inline module); avatar via `/avatar-embed.html` iframe (postMessage bridge); send via `/api/agent/send-sol`; governance via IBM Granite Guardian+> **Atlas reference:** `docs/ux-flows/08-coin-launch-wallets.md` (current UX, traced step-by-step)++---++## 0. How to use this brief++You are **one agent in a fleet**. This one feature is yours to make world-class. Read this entire brief, then read the referenced source so you are changing reality and not a guess. Execute completely. When you are genuinely done (§6–7), **delete this task file**.++You are not a task-completing machine. You are a senior engineer and product thinker who happens to write code. Act like it.++## 1. Mission++The end user wants to manage an agent's treasury by *talking to it* — "send 0.1 SOL to this address," "what's my balance," "fund me" — and watch the avatar actually do it, on-chain, with guardrails. The feature exists to make an agent's wallet **conversational and governed**: natural-language intent → a real SOL transfer via `/api/agent/send-sol`, with a server-side IBM Granite Guardian check that can block an unsafe or disallowed send before it ever signs.++"Gamechanging" here means treasury management that feels like delegating to a trusted, embodied assistant — fluid conversation, an avatar that speaks and gestures the outcome, real on-chain confirmation, and *visible governance* so the user trusts that the agent won't do something reckless. It's the human-friendly face of autonomous money: powerful, but never out of control.++## 2. The bar++Build the version that makes someone screenshot it and share it. Benchmark against the best in the world (the conversational clarity of a great banking assistant, Stripe's confirmation UX, the trust of a hardware-wallet prompt, the charm of a well-animated avatar). **If your result merely matches what already exists, you have failed this brief.** Invent something true and new that creates real, obvious value for the user.++## 3. Current state — ground truth (verify in source before you touch anything)++- **Route(s):** `/avatar-wallet-chat` (avatar iframe + wallet chip showing balance/network/address + chat composer).+- **Source:** `pages/avatar-wallet-chat.html` (self-contained inline module); avatar rendered via `/avatar-embed.html` iframe with a postMessage bridge.+- **Current flow:** 6 required (+1 optional) — boot configures avatar iframe (`?id=`/`?handle=`/`?model=`, transparent, overlay), posts `v1.avatar.hello`, flushes queued speech/gestures on `v1.avatar.ready` (or 5s timeout) → `refreshWallet()` → `GET /api/agent/wallet` renders balance (SOL + USD), network badge, short address + explorer link → "Fund your wallet" hint when balance can't cover a $1 send + fee buffer → user chats; `ask()` streams a reply, avatar speaks/gestures, model may emit actions → on a `sendSol` action a payment card renders ("Signing & broadcasting…"); `POST /api/agent/send-sol {usd, to?}` → success card "Confirmed on-chain" (SOL amount, recipient, Solscan link), avatar celebrates, wallet refreshes → governance-blocked sends show a Granite Guardian chip (action already stripped server-side; client never gates).+- **What works today:** Conversational send intent; real on-chain SOL transfer; streamed assistant reply with avatar speech + gesture; live wallet chip; fund hint; server-side IBM Granite Guardian governance that strips disallowed sends before signing; optional `?token=` shared secret (`x-avatar-token` header); designed success/fail/governance-blocked states.+- **Real APIs / dependencies already wired:** `/api/agent/wallet`, `/api/agent/send-sol`, the chat/stream endpoint, `/avatar-embed.html`; Solscan (links). Real on-chain SOL transfer on success.+- **Where it's mediocre, thin, or unfinished:** There's no confirmation step before a real SOL send — intent goes straight to broadcast, which is fast but scary for a real-money action. The governance block is explained as a chip *after* the fact, not as a reassuring, understandable guardrail the user can see working. There's no transaction history in the conversation — past sends vanish. The wallet chip is informational but not interactive (no copy, no deposit flow inline). "Fund" is a hint, not a flow. The chat doesn't surface what the agent *can* do (send, check balance, fund) — discoverability is low.++## 4. Innovation directions (seeds — you are expected to go beyond them)++- **A confirmation that respects real money.** Before a send broadcasts, render an inline confirm card (amount in SOL + USD, resolved recipient, fee, remaining balance) the user approves in-conversation — fast for small amounts, deliberate for large. Trust without friction theater.+- **Make governance a feature, not a footnote.** Show the IBM Granite Guardian check working in real time — "checked for safety," with a clear, honest explanation when a send is blocked and what the user can do. Visible guardrails build trust in autonomy.+- **Conversational treasury history.** Persist sends in the thread so the conversation becomes a real ledger — past transfers with Solscan links, running balance, recurring recipients the user can reuse by name.+- **An interactive wallet chip.** Copy address, inline deposit (QR + address, the `/launch` pattern), network awareness, and a live low-balance state that offers funding right there — turn the static chip into a control surface.+- **Cross-feature wiring:** share the agent's wallet identity with `/play/agent-wallet` (x402 spend) and the launch flow's agent wallet so balance/history are one consistent treasury across the platform; let the user pick which of their agents (`/api/agents`) holds the conversation; and let "fund" reuse the deposit modal pattern from `/launch`.++> These are starting points, not a checklist. The best idea may not be listed — find it. Think second-order: how does improving this unlock value in adjacent three.ws features? **Wire those connections.** The best platforms feel like everything is linked.++## 5. Hard rules (non-negotiable — from `CLAUDE.md`)++- **Real APIs, real data, real integrations. No mocks, no fake/sample arrays, no placeholders, no `setTimeout` fake-loading or fake progress.** If credentials are missing, find them in `.env` / `.env.example` / `vercel env` — then proceed. (Sends must stay real on-chain transfers — never simulate a confirmation.)+- **Wire 100%.** Every button works, every link goes somewhere, every reachable state exists. Design *every* state: loading (skeletons over spinners), empty (tell the user what to do next), error (actionable recovery), populated, and overflow (0 / 1 / 1000 items, very long strings, mid-operation network failure, expired session).+- **No TODO comments, no stubs, no `throw new Error("not implemented")`, no commented-out code.** If you write it, finish it.+- **No errors without solutions.** Every error has a root cause; every root cause has a fix. Ship failsafes, not lazy propagation. (Wallet offline, low balance, send failure, governance block must each have an honest, designed state.)+- **$THREE is the only coin** (CA `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`). Never name, add, hardcode, link, render, or recommend any other coin anywhere — code, copy, tests, fixtures, commits. The only exceptions are coin-agnostic runtime plumbing (user supplies a mint) and platform launch records rendered at runtime.+- **Read before you write.** Match the existing patterns, naming, file organization, and the design tokens in `DESIGN-TOKENS.md`. Consistency compounds.+- **Accessibility + responsive (320 / 768 / 1440) + microinteractions** are part of done, not polish. Semantic HTML, ARIA, keyboard nav, focus rings, sufficient contrast. (Chat must be fully keyboard-operable; the avatar iframe must have an accessible, reduced-motion-aware fallback.)+- **Performance by default:** lazy-load heavy modules, debounce input handlers, paginate large lists, animate with `transform`/`opacity`. Ship no jank.+- **Changelog:** append a holder-readable entry to `data/changelog.json` for any user-visible change, then run `npm run build:pages` to validate.+- **Concurrent agents share this worktree.** Stage explicit paths only — **never** `git add -A` / `git add .`. Re-check `git status` + `git diff --staged` immediately before any commit. Never commit `api/*.js` esbuild bundles (check `head -1` for `__defProp` / `createRequire`).++## 6. Definition of done++- [ ] Feature is built, wired into navigation, and reachable by a real user.+- [ ] Exercised in a real browser via `npm run dev`; **no console errors or warnings** from your code.+- [ ] Network tab shows real API calls succeeding with real data.+- [ ] Every interactive element has hover / active / focus states; fully keyboard-navigable.+- [ ] Loading, empty, error, populated, and overflow states all designed and reachable.+- [ ] Existing tests pass (`npm test`); add tests for new logic you introduce.+- [ ] `git diff` self-reviewed — every changed line justified.+- [ ] Changelog updated if the change is user-visible.+- [ ] You would be proud to demo this to a room of senior engineers.++> Note: do **not** run `npm install` in this codespace (the cache is corrupted and it hangs the box). Use the already-installed dependencies.++## 7. Self-improvement loop (REQUIRED before you finish)++When you think you're done: **STOP.** Re-read §2.++1. Find the single weakest aspect of what you built and make it excellent. Repeat until nothing obvious remains.+2. Run the self-review protocol: **lazy check** (any shortcut, any half-wire, any hardcoded value where dynamic belongs?), **user check** (first-time user — does it make sense, is it findable, does it feel polished?), **integration check** (connects to the rest of the platform, navigable to/from?), **edge-case check** (0 / 1 / 1000, long names, network failure, expired session), **pride check** (portfolio-worthy? if not, fix what's stopping you).+3. Update `data/changelog.json` if user-visible.+4. **Delete this task file** — `prompts/feature-innovation/08_06_avatar-wallet-chat.md`.+5. Report: what you shipped, what you *invented*, and the single best next idea you'd pursue.++---++## Reference shelf++- **This feature's current UX:** `docs/ux-flows/08-coin-launch-wallets.md`+- **Repo map:** `STRUCTURE.md` · **Operating rules:** `CLAUDE.md` · **Design tokens:** `DESIGN-TOKENS.md`+- **Credentials / endpoints:** `.env`, `.env.example`+- **Stack:** vanilla JS modules + Vite (`npm run dev`, port 3000); Three.js (glTF/GLB); Vercel functions in `api/`; Cloudflare workers in `workers/`; Solana / agent SDKs in `sdk/`, `solana-agent-sdk/`, `agent-payments-sdk/`.diff --git a/prompts/feature-innovation/08_07_threews-naming.md b/prompts/feature-innovation/08_07_threews-naming.mdnew file mode 100644index 000000000..92d2b3d6c--- /dev/null+++ b/prompts/feature-innovation/08_07_threews-naming.md@@ -0,0 +1,89 @@+# 🚀 Innovation Brief — threews.sol Naming & $THREE Economy++> **Task file:** `prompts/feature-innovation/08_07_threews-naming.md`+> **Surface:** `/threews/claim` (SNS subdomain mint), `/three` ($THREE economy dashboard + rare-name studio)+> **Primary source:** `pages/threews-claim.html` (self-contained inline module; route `/threews/claim`) + `src/sns/pay-by-name.js`; `pages/three.html` → `src/three-economy.js` (`src/three-access.js` `getAccess`, `src/wallet.js` `initWalletButton`)+> **Atlas reference:** `docs/ux-flows/08-coin-launch-wallets.md` (current UX, traced step-by-step)++---++## 0. How to use this brief++You are **one agent in a fleet**. This one feature is yours to make world-class. Read this entire brief, then read the referenced source so you are changing reality and not a guess. Execute completely. When you are genuinely done (§6–7), **delete this task file**.++You are not a task-completing machine. You are a senior engineer and product thinker who happens to write code. Act like it.++## 1. Mission++The end user wants their agent to have a name a human can actually say and remember — `alice.threews.sol` instead of a 44-character base-58 string. The feature exists to make **human-readable agent identity** real: minting an on-chain SNS subdomain under `*.threews.sol`, with availability you can trust, rarity-based pricing in $THREE, and a `/three` economy dashboard that shows why the name (and the holder tier behind it) matters.++"Gamechanging" here means making a `*.threews.sol` name feel like a **must-have** — the difference between an anonymous wallet and a recognizable agent. Snappy availability checking, a rare-name studio that makes good names feel scarce and worth claiming, on-chain minting that's genuinely owned, and an economy dashboard that ties names, holder tiers, and the platform's $THREE flow into one coherent story of belonging.++## 2. The bar++Build the version that makes someone screenshot it and share it. Benchmark against the best in the world (ENS's name search + rarity, Vercel's domain claim flow, Stripe's pricing clarity, Linear's instant feedback). **If your result merely matches what already exists, you have failed this brief.** Invent something true and new that creates real, obvious value for the user.++## 3. Current state — ground truth (verify in source before you touch anything)++- **Route(s):** `/threews/claim` (`#tw-label` input + `#tw-mint` button; `#tw-status` availability line; `#tw-result`) and `/three` ("The Flow" canvas viz, live stats, treasury/rewards wallets, holder-tier ladder, pricing explorer, rare-name studio).+- **Source:** `/threews/claim` rewrites to `pages/threews-claim.html` (self-contained inline module; no `pages/threews/` dir); pay-by-name plumbing `src/sns/pay-by-name.js`. `/three` → `pages/three.html` → `src/three-economy.js`; wallet/tier via `src/three-access.js` (`getAccess`) + `src/wallet.js` (`initWalletButton`).+- **Current flow:** `/threews/claim` — 4 steps: type label (lowercased, stripped to `[a-z0-9-]`) → debounced 350ms `GET /api/threews/subdomain?label=` (available vs claimed-by/owned-by) → Mint: `getCsrf()` (`GET /api/csrf-token`) → `POST /api/threews/subdomain {label}` + `x-csrf-token` → success "<full> minted" with showcase URL + Solscan tx link. `/three` — 1 required (+3 optional): boot fetches `/api/three/{catalog,stats,tier,access}` + `/api/token/price`, renders flow viz / stats / treasury+rewards wallets → optional connect wallet (`initWalletButton`, `wallet:changed` re-reads tier + applies discount) → optional rare-name studio (`GET /api/three/name-quote?name=` → free vs $THREE rarity price → links to `/threews/claim`) → optional tier ladder + pricing explorer.+- **What works today:** Debounced availability check; CSRF-gated on-chain SNS subdomain mint; rarity pricing surfaced via `/api/three/name-quote` ($THREE-denominated, common = free); holder-tier resolution from on-chain $THREE; live treasury/rewards wallet display; pricing explorer with connected-wallet tier discount; rare-name studio that hands off to `/threews/claim`.+- **Real APIs / dependencies already wired:** `/api/threews/subdomain` (GET check + POST mint), `/api/csrf-token`; `/api/three/{catalog,stats,tier,access,name-quote}`, `/api/token/price`; Solscan (tx link). On-chain SNS mint; wallet connect via global `initWalletButton`.+- **Where it's mediocre, thin, or unfinished:** The claim page is a single input + button — functional but it doesn't *sell* the name or make good ones feel scarce. Availability is a status line, not a search experience (no suggestions, no "this one's taken, try these," no rarity preview at the point of typing). The two surfaces (`/three` studio and `/threews/claim`) are loosely linked rather than one fluid name-discovery-to-mint journey. The minted name has no obvious afterlife — nothing shows where it lives, what it resolves to, or how to attach it to an agent. The economy dashboard explains the system but doesn't make the user *feel* the value of holding a tier or a name.++## 4. Innovation directions (seeds — you are expected to go beyond them)++- **A name search worth using.** Turn the claim input into a real search: live availability with rarity tier shown inline (free/common vs. short/dictionary/reserved priced in $THREE), smart suggestions when a name is taken, and a sense of scarcity that makes a good name feel like a find.+- **One fluid discovery-to-mint journey.** Fuse the `/three` rare-name studio and `/threews/claim` into a single flow — quote rarity, see the $THREE price (with the connected-wallet tier discount applied), and mint on-chain without losing context.+- **Give the name an afterlife.** After minting, show what it resolves to, where it lives, and a one-tap path to attach it to an agent — so a name is identity, not a trophy in a drawer.+- **Make the economy felt, not just shown.** Tie holder tier → name pricing → platform access so a connected holder sees concrete value (cheaper names, unlocked tiers) live, turning the dashboard into a reason to hold $THREE.+- **Cross-feature wiring:** offer name-claiming at the moment of agent creation and right after a `/launch` (a fresh coin-backed agent should get a fresh `*.threews.sol` name); resolve `*.threews.sol` identities in `/launches`, the Trader Card (`/claim-wallet`), and agent profiles so the name shows up everywhere the agent does; and apply the connected-wallet $THREE tier discount consistently across pricing surfaces.++> These are starting points, not a checklist. The best idea may not be listed — find it. Think second-order: how does improving this unlock value in adjacent three.ws features? **Wire those connections.** The best platforms feel like everything is linked.++## 5. Hard rules (non-negotiable — from `CLAUDE.md`)++- **Real APIs, real data, real integrations. No mocks, no fake/sample arrays, no placeholders, no `setTimeout` fake-loading or fake progress.** If credentials are missing, find them in `.env` / `.env.example` / `vercel env` — then proceed. (The mint must stay a real on-chain SNS subdomain mint; CSRF gating must remain.)+- **Wire 100%.** Every button works, every link goes somewhere, every reachable state exists. Design *every* state: loading (skeletons over spinners), empty (tell the user what to do next), error (actionable recovery), populated, and overflow (0 / 1 / 1000 items, very long strings, mid-operation network failure, expired session).+- **No TODO comments, no stubs, no `throw new Error("not implemented")`, no commented-out code.** If you write it, finish it.+- **No errors without solutions.** Every error has a root cause; every root cause has a fix. Ship failsafes, not lazy propagation. (Not-signed-in CSRF failure, taken name, mint failure, network drop must each have a designed state.)+- **$THREE is the only coin** (CA `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`). Never name, add, hardcode, link, render, or recommend any other coin anywhere — code, copy, tests, fixtures, commits. The only exceptions are coin-agnostic runtime plumbing (user supplies a mint) and platform launch records rendered at runtime. ($THREE is the pricing/tier currency here — that is correct and intended; never introduce any other token alongside it.)+- **Read before you write.** Match the existing patterns, naming, file organization, and the design tokens in `DESIGN-TOKENS.md`. Consistency compounds.+- **Accessibility + responsive (320 / 768 / 1440) + microinteractions** are part of done, not polish. Semantic HTML, ARIA, keyboard nav, focus rings, sufficient contrast.+- **Performance by default:** lazy-load heavy modules, debounce input handlers, paginate large lists, animate with `transform`/`opacity`. Ship no jank. (Keep the 350ms availability debounce; do not hammer the subdomain endpoint.)+- **Changelog:** append a holder-readable entry to `data/changelog.json` for any user-visible change, then run `npm run build:pages` to validate.+- **Concurrent agents share this worktree.** Stage explicit paths only — **never** `git add -A` / `git add .`. Re-check `git status` + `git diff --staged` immediately before any commit. Never commit `api/*.js` esbuild bundles (check `head -1` for `__defProp` / `createRequire`).++## 6. Definition of done++- [ ] Feature is built, wired into navigation, and reachable by a real user.+- [ ] Exercised in a real browser via `npm run dev`; **no console errors or warnings** from your code.+- [ ] Network tab shows real API calls succeeding with real data.+- [ ] Every interactive element has hover / active / focus states; fully keyboard-navigable.+- [ ] Loading, empty, error, populated, and overflow states all designed and reachable.+- [ ] Existing tests pass (`npm test`); add tests for new logic you introduce.+- [ ] `git diff` self-reviewed — every changed line justified.+- [ ] Changelog updated if the change is user-visible.+- [ ] You would be proud to demo this to a room of senior engineers.++> Note: do **not** run `npm install` in this codespace (the cache is corrupted and it hangs the box). Use the already-installed dependencies.++## 7. Self-improvement loop (REQUIRED before you finish)++When you think you're done: **STOP.** Re-read §2.++1. Find the single weakest aspect of what you built and make it excellent. Repeat until nothing obvious remains.+2. Run the self-review protocol: **lazy check** (any shortcut, any half-wire, any hardcoded value where dynamic belongs?), **user check** (first-time user — does it make sense, is it findable, does it feel polished?), **integration check** (connects to the rest of the platform, navigable to/from?), **edge-case check** (0 / 1 / 1000, long names, network failure, expired session), **pride check** (portfolio-worthy? if not, fix what's stopping you).+3. Update `data/changelog.json` if user-visible.+4. **Delete this task file** — `prompts/feature-innovation/08_07_threews-naming.md`.+5. Report: what you shipped, what you *invented*, and the single best next idea you'd pursue.++---++## Reference shelf++- **This feature's current UX:** `docs/ux-flows/08-coin-launch-wallets.md`+- **Repo map:** `STRUCTURE.md` · **Operating rules:** `CLAUDE.md` · **Design tokens:** `DESIGN-TOKENS.md`+- **Credentials / endpoints:** `.env`, `.env.example`+- **Stack:** vanilla JS modules + Vite (`npm run dev`, port 3000); Three.js (glTF/GLB); Vercel functions in `api/`; Cloudflare workers in `workers/`; Solana / agent SDKs in `sdk/`, `solana-agent-sdk/`, `agent-payments-sdk/`.diff --git a/prompts/feature-innovation/08_08_coin3d-three-live.md b/prompts/feature-innovation/08_08_coin3d-three-live.mdnew file mode 100644index 000000000..22763b9ec--- /dev/null+++ b/prompts/feature-innovation/08_08_coin3d-three-live.md@@ -0,0 +1,89 @@+# 🚀 Innovation Brief — Coin 3D & $THREE Live++> **Task file:** `prompts/feature-innovation/08_08_coin3d-three-live.md`+> **Surface:** `/coin3d` (`?mint=` token in 3D) and `/three-live` ($THREE protocol pulse)+> **Primary source:** `pages/coin3d.html` → `src/coin3d/main.js` (deep-linked from `/launches`, MCP tool `pumpfun_token_3d`); `/three-live` → `pages/three-live.html` (self-contained Three.js inline module; empty-state helper `src/shared/state-kit.js` `emptyStateHTML`)+> **Atlas reference:** `docs/ux-flows/08-coin-launch-wallets.md` (current UX, traced step-by-step)++---++## 0. How to use this brief++You are **one agent in a fleet**. This one feature is yours to make world-class. Read this entire brief, then read the referenced source so you are changing reality and not a guess. Execute completely. When you are genuinely done (§6–7), **delete this task file**.++You are not a task-completing machine. You are a senior engineer and product thinker who happens to write code. Act like it.++## 1. Mission++The end user wants to *feel* a token's state, not read a table of numbers. `/coin3d` turns any mint into a living 3D object — a medallion, a galaxy of holders, a graduation ring that fills with bonding-curve progress. `/three-live` turns the $THREE protocol itself into a breathing organism that pulses with every real on-chain trade. The feature exists to make **token state a living thing** — discovery and conviction through embodiment, not spreadsheets.++"Gamechanging" here means a 3D representation so legible and alive that a glance tells you more than a chart would — holder concentration you can *see*, graduation progress you can watch fill, trade momentum you can feel as motion. It should be the most shareable way to look at a coin, and the most visceral way to watch a protocol's heartbeat.++## 2. The bar++Build the version that makes someone screenshot it and share it. Benchmark against the best in the world (the awe of a great data-viz like Stripe's globe, the legibility of DexScreener mapped into space, the craft of a AAA real-time scene, Three.js showcase quality). **If your result merely matches what already exists, you have failed this brief.** Invent something true and new that creates real, obvious value for the user.++## 3. Current state — ground truth (verify in source before you touch anything)++- **Route(s):** `/coin3d` (full-screen Three.js scene seeded by `?mint=<base58>` & optional `&network=`) and `/three-live` (full-screen 3D "living organism" of the $THREE protocol + live trade ticker + hero badge).+- **Source:** `/coin3d` → `pages/coin3d.html` → `src/coin3d/main.js` (deep-linked from `/launches` cards and the MCP tool `pumpfun_token_3d`). `/three-live` → route `/three-live` → `pages/three-live.html` (self-contained Three.js inline module); empty-state helper `src/shared/state-kit.js` (`emptyStateHTML`).+- **Current flow:** `/coin3d` — 3 required (+1 optional): boot reads `mint`+`network`, shows loading overlay → parallel MCP calls `POST /api/pump-fun-mcp` (`getTokenDetails`, `getBondingCurve`, `getTokenHolders` top 12; logo from metadata URI, IPFS→HTTP, 6s timeout) → render spinning logo-textured medallion + holder galaxy (spheres sized by balance, tinted by concentration) + graduation ring filled to bonding-curve progress, OrbitControls → optional watchlist toggle (localStorage `ld_watchlist`, shared with `/launches`). `/three-live` — 1 (read-only/ambient): boot fetches `GET /api/three-token/stats` (no-store) + opens SSE `GET /api/agents/pumpfun-feed?kind=trades&mint=<$THREE>` → each trade emits a particle burst, whales send shockwaves, ticker prepends the trade → hero badge tracks connection state (connecting → live/quiet → reconnecting, auto-reconnect); stats refresh on interval.+- **What works today:** `/coin3d` renders a real interactive token scene from live pump.fun MCP data (medallion, concentration-tinted holder galaxy, graduation ring) with designed loading/error/empty overlays and IPFS logo fallback. `/three-live` streams real $THREE trades over SSE into a 3D organism with whale shockwaves, a live ticker, connection-state hero badge, auto-reconnect, and a reduced-motion-aware path.+- **Real APIs / dependencies already wired:** `/coin3d` → `/api/pump-fun-mcp` (pump.fun MCP), IPFS gateway for logo. `/three-live` → `/api/three-token/stats`, `/api/agents/pumpfun-feed` (SSE, fixed $THREE mint). All on-chain/live.+- **Where it's mediocre, thin, or unfinished:** `/coin3d` is a snapshot — it renders state once and doesn't *live*; there's no real-time trade motion the way `/three-live` has, no time dimension, no legend explaining what the user is seeing (sphere size, tint, ring fill). The holder galaxy is visually rich but not interactive enough (no per-holder detail on click, no Solscan link from a sphere). The two surfaces share a 3D language but don't share components — `/three-live`'s live-trade energy never reaches `/coin3d`. Neither makes it easy to share the exact view they're looking at.++## 4. Innovation directions (seeds — you are expected to go beyond them)++- **Make `/coin3d` live.** Bring `/three-live`'s real-time energy to any mint: stream trades for the viewed token (the same pump.fun feed pattern) so the medallion pulses, the graduation ring climbs, and the holder galaxy shifts as real activity happens. Snapshot becomes heartbeat.+- **A legible holder galaxy.** Make every sphere interactive — click for the holder's balance, share, and a Solscan link — and add a clear legend (size = balance, tint = concentration, ring = graduation) so the visualization *teaches* what it shows.+- **Shareable views.** Let users capture and share the exact 3D state (a designed snapshot or a deep-linked camera angle) — the most screenshot-worthy way to show off a coin.+- **Shared 3D component language.** Extract the common primitives (particle bursts, shockwaves, connection-state badge, trade ticker) so `/coin3d` and `/three-live` feel like one cinematic system, not two pages.+- **Cross-feature wiring:** make `/coin3d` the canonical detail view linked from every `/launches` card and the `/launches/:mint` dossier; let a coin's `/coin3d` link to its 3D world (`/communities/:mint`) and its launching agent's profile; share the `ld_watchlist` so starring in 3D reflects in the feed; and from `/three-live`, deep-link the $THREE mint into `/coin3d` so the protocol pulse and the token object connect.++> These are starting points, not a checklist. The best idea may not be listed — find it. Think second-order: how does improving this unlock value in adjacent three.ws features? **Wire those connections.** The best platforms feel like everything is linked.++## 5. Hard rules (non-negotiable — from `CLAUDE.md`)++- **Real APIs, real data, real integrations. No mocks, no fake/sample arrays, no placeholders, no `setTimeout` fake-loading or fake progress.** If credentials are missing, find them in `.env` / `.env.example` / `vercel env` — then proceed. (All token/trade data must stay live from the pump.fun MCP and the real SSE feed.)+- **Wire 100%.** Every button works, every link goes somewhere, every reachable state exists. Design *every* state: loading (skeletons over spinners), empty (tell the user what to do next), error (actionable recovery), populated, and overflow (0 / 1 / 1000 items, very long strings, mid-operation network failure, expired session).+- **No TODO comments, no stubs, no `throw new Error("not implemented")`, no commented-out code.** If you write it, finish it.+- **No errors without solutions.** Every error has a root cause; every root cause has a fix. Ship failsafes, not lazy propagation. (Missing `?mint=`, MCP failure, no holders, SSE disconnect, devnet must each have a designed state.)+- **$THREE is the only coin** (CA `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`). Never name, add, hardcode, link, render, or recommend any other coin anywhere — code, copy, tests, fixtures, commits. The only exceptions are coin-agnostic runtime plumbing (user supplies a mint) and platform launch records rendered at runtime. `/coin3d` is generic plumbing — it renders whatever mint the user passes via `?mint=`; never hardcode or recommend any specific non-$THREE mint. `/three-live` is fixed to the $THREE CA by design.+- **Read before you write.** Match the existing patterns, naming, file organization, and the design tokens in `DESIGN-TOKENS.md`. Consistency compounds.+- **Accessibility + responsive (320 / 768 / 1440) + microinteractions** are part of done, not polish. Semantic HTML, ARIA, keyboard nav, focus rings, sufficient contrast. (The 3D scenes must be reduced-motion-aware and offer an accessible, legible non-motion fallback.)+- **Performance by default:** lazy-load heavy modules, debounce input handlers, paginate large lists, animate with `transform`/`opacity`. Ship no jank. (Three.js scenes must hit a steady frame rate; dispose geometries/materials; cap particle counts.)+- **Changelog:** append a holder-readable entry to `data/changelog.json` for any user-visible change, then run `npm run build:pages` to validate.+- **Concurrent agents share this worktree.** Stage explicit paths only — **never** `git add -A` / `git add .`. Re-check `git status` + `git diff --staged` immediately before any commit. Never commit `api/*.js` esbuild bundles (check `head -1` for `__defProp` / `createRequire`).++## 6. Definition of done++- [ ] Feature is built, wired into navigation, and reachable by a real user.+- [ ] Exercised in a real browser via `npm run dev`; **no console errors or warnings** from your code.+- [ ] Network tab shows real API calls succeeding with real data.+- [ ] Every interactive element has hover / active / focus states; fully keyboard-navigable.+- [ ] Loading, empty, error, populated, and overflow states all designed and reachable.+- [ ] Existing tests pass (`npm test`); add tests for new logic you introduce.+- [ ] `git diff` self-reviewed — every changed line justified.+- [ ] Changelog updated if the change is user-visible.+- [ ] You would be proud to demo this to a room of senior engineers.++> Note: do **not** run `npm install` in this codespace (the cache is corrupted and it hangs the box). Use the already-installed dependencies.++## 7. Self-improvement loop (REQUIRED before you finish)++When you think you're done: **STOP.** Re-read §2.++1. Find the single weakest aspect of what you built and make it excellent. Repeat until nothing obvious remains.+2. Run the self-review protocol: **lazy check** (any shortcut, any half-wire, any hardcoded value where dynamic belongs?), **user check** (first-time user — does it make sense, is it findable, does it feel polished?), **integration check** (connects to the rest of the platform, navigable to/from?), **edge-case check** (0 / 1 / 1000, long names, network failure, expired session), **pride check** (portfolio-worthy? if not, fix what's stopping you).+3. Update `data/changelog.json` if user-visible.+4. **Delete this task file** — `prompts/feature-innovation/08_08_coin3d-three-live.md`.+5. Report: what you shipped, what you *invented*, and the single best next idea you'd pursue.++---++## Reference shelf++- **This feature's current UX:** `docs/ux-flows/08-coin-launch-wallets.md`+- **Repo map:** `STRUCTURE.md` · **Operating rules:** `CLAUDE.md` · **Design tokens:** `DESIGN-TOKENS.md`+- **Credentials / endpoints:** `.env`, `.env.example`+- **Stack:** vanilla JS modules + Vite (`npm run dev`, port 3000); Three.js (glTF/GLB); Vercel functions in `api/`; Cloudflare workers in `workers/`; Solana / agent SDKs in `sdk/`, `solana-agent-sdk/`, `agent-payments-sdk/`.diff --git a/prompts/feature-innovation/09_05_tutor.md b/prompts/feature-innovation/09_05_tutor.mdnew file mode 100644index 000000000..ca9438f0e--- /dev/null+++ b/prompts/feature-innovation/09_05_tutor.md@@ -0,0 +1,90 @@+# 🚀 Innovation Brief — Pay-As-You-Learn Tutor++> **Task file:** `prompts/feature-innovation/09_05_tutor.md`+> **Surface:** `/tutor`+> **Primary source:** `public/tutor.html` + `public/tutor.js`; backend `api/x402/tutor.js` ($0.01/question) + `api/tutor/session.js` (free resume); `public/x402.js`+> **Atlas reference:** `docs/ux-flows/09-x402-agent-commerce.md` (current UX, traced step-by-step)++---++## 0. How to use this brief++You are **one agent in a fleet**. This one feature is yours to make world-class. Read this entire brief, then read the referenced source so you are changing reality and not a guess. Execute completely. When you are genuinely done (§6–7), **delete this task file**.++You are not a task-completing machine. You are a senior engineer and product thinker who happens to write code. Act like it.++## 1. Mission++The end user wants to learn something — a concept, a piece of code, a topic — and pay only for the answers they actually use, one cent at a time, with proof of what they paid for. `/tutor` is a chat tutor that charges $0.01 per answer, accrues a session total, and ends with an itemized, SHA-256-attested invoice. It makes "pay-as-you-learn" a real, frictionless transaction instead of a $20/month subscription you forget to cancel.++"Gamechanging" means the tutor *proves its value as you go*: every answer is worth a penny because it's measurably good, the running tab is always visible and fair, and the final attested invoice is something you could file as an expense or share as proof of study. The combination of micro-priced learning + verifiable per-question billing doesn't exist elsewhere — make the penny feel like a bargain and the invoice feel like a receipt from the future.++## 2. The bar++Build the version that makes someone screenshot it and share it. Benchmark against the best in the world (Khan Academy, Duolingo, ChatGPT study mode, Stripe invoices, Notion's clean reading UX). **If your result merely matches what already exists, you have failed this brief.** Invent something true and new that creates real, obvious value for the user.++## 3. Current state — ground truth (verify in source before you touch anything)++- **Route(s):** `/tutor`.+- **Source:** `public/tutor.html` + `public/tutor.js`; backend `api/x402/tutor.js` ($0.01/question, server-side session accrual + attestation) + `api/tutor/session.js` (free resume); shared `public/x402.js`.+- **Current flow:** 4 required (+4 optional) — (optional) click a suggestion chip or type a question (`#q`, live char counter, 5–2000 chars) → (optional) pick level Beginner/Intermediate(default)/Expert → send (or Cmd+Enter; spinner; question added to thread) → `window.X402.pay({ endpoint:'/api/x402/tutor', body:{ sessionId, question, level }, merchant:'three.ws Tutor', action:'Explain' })` (first time → paywall connect + sign + settle) → on success tutor bubble with answer + key points + example + follow-up + meta row (cost · level · model); session tab updates total + count → (optional) click a follow-up (cost stacks); (optional) **End & invoice** → modal with per-question line items + running total + SHA-256 session attestation.+- **What works today:** real per-question x402 charge with server-side session accrual; session id auto-minted to `localStorage three-tutor-session-id`; lazy wallet connect on first paid question; structured answers (key points + example + follow-up); level selector; reload resumes session via free `GET /api/tutor/session`; itemized attested invoice; suggestion chips as empty state; payment cancel/fail/retry handling.+- **Real APIs / dependencies already wired:** `/api/x402/tutor` (per-question charge + accrual + attestation), `/api/tutor/session` (resume), `/x402.js`, Base/Solana settlement.+- **Where it's mediocre, thin, or unfinished:** it's a flat Q&A list — no notion of a *learning path*, topic, or progress, so the value compounds poorly. The attested invoice is the climax but there's no permalink/verify, no export (PDF/CSV), no proof-of-study artifact to share. Answers don't render rich content well (no code highlighting/diagrams/3D for spatial topics despite the platform being 3D-native). No spaced-repetition or "quiz me on what I paid to learn" loop, so knowledge leaks. No way to pre-fund a session balance (every question re-hits the modal flow unless the modal caches). No history across sessions.++## 4. Innovation directions (seeds — you are expected to go beyond them)++- **Learning paths with a live value meter.** Let the user pick or auto-generate a path (e.g. "Solana programs in 10 questions"); show progress, mastery, and a "value delivered" meter so the penny-per-answer feels like compounding investment, not a meter running.+- **Attested, shareable proof-of-study.** Give every invoice a verifiable permalink + exportable PDF/CSV with the SHA-256 attestation, and a public "Verify invoice" check that recomputes the hash — a credential you could attach to a bounty or expense report.+- **Quiz-me retention loop.** After N paid answers, offer a free spaced-repetition quiz drawn from your own session; getting it right marks mastery, getting it wrong suggests the next paid question — turning the tutor into a teacher.+- **Rich, 3D-native answers.** Render code with syntax highlighting and, for spatial/geometry/3D topics, an inline `<model-viewer>` or canvas diagram — lean into three.ws being a 3D platform.+- **Prepaid session balance.** Let a user fund a small balance once (one x402 settle) and spend it across many questions, with the live balance shown — fewer modal interruptions, same on-chain truth.+- **Cross-feature wiring:** offer the tutor as a `/bazaar` capability and a step `/shopper` can buy; let answers cite an attested `/fact-checker` verdict; surface a learning-path badge on the user's profile; reuse the invoice permalink pattern from `/pay/calls`; let `/play/arena` spectators ask the tutor to explain a strategy they just watched.++> These are starting points, not a checklist. The best idea may not be listed — find it. Think second-order: how does improving this unlock value in adjacent three.ws features? **Wire those connections.** The best platforms feel like everything is linked.++## 5. Hard rules (non-negotiable — from `CLAUDE.md`)++- **Real APIs, real data, real integrations. No mocks, no fake/sample arrays, no placeholders, no `setTimeout` fake-loading or fake progress.** If credentials are missing, find them in `.env` / `.env.example` / `vercel env` — then proceed.+- **Wire 100%.** Every button works, every link goes somewhere, every reachable state exists. Design *every* state: loading (skeletons over spinners), empty (tell the user what to do next), error (actionable recovery), populated, and overflow (0 / 1 / 1000 items, very long strings, mid-operation network failure, expired session).+- **No TODO comments, no stubs, no `throw new Error("not implemented")`, no commented-out code.** If you write it, finish it.+- **No errors without solutions.** Every error has a root cause; every root cause has a fix. Ship failsafes, not lazy propagation.+- **$THREE is the only coin** (CA `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`). Never name, add, hardcode, link, render, or recommend any other coin anywhere — code, copy, tests, fixtures, commits. The only exceptions are coin-agnostic runtime plumbing (user supplies a mint) and platform launch records rendered at runtime.+- **Read before you write.** Match the existing patterns, naming, file organization, and the design tokens in `DESIGN-TOKENS.md`. Consistency compounds.+- **Accessibility + responsive (320 / 768 / 1440) + microinteractions** are part of done, not polish. Semantic HTML, ARIA, keyboard nav, focus rings, sufficient contrast.+- **Performance by default:** lazy-load heavy modules, debounce input handlers, paginate large lists, animate with `transform`/`opacity`. Ship no jank.+- **Changelog:** append a holder-readable entry to `data/changelog.json` for any user-visible change, then run `npm run build:pages` to validate.+- **Concurrent agents share this worktree.** Stage explicit paths only — **never** `git add -A` / `git add .`. Re-check `git status` + `git diff --staged` immediately before any commit. Never commit `api/*.js` esbuild bundles (check `head -1` for `__defProp` / `createRequire`).++## 6. Definition of done++- [ ] Feature is built, wired into navigation, and reachable by a real user.+- [ ] Exercised in a real browser via `npm run dev`; **no console errors or warnings** from your code.+- [ ] Network tab shows real API calls succeeding with real data.+- [ ] Every interactive element has hover / active / focus states; fully keyboard-navigable.+- [ ] Loading, empty, error, populated, and overflow states all designed and reachable.+- [ ] Existing tests pass (`npm test`); add tests for new logic you introduce.+- [ ] `git diff` self-reviewed — every changed line justified.+- [ ] Changelog updated if the change is user-visible.+- [ ] You would be proud to demo this to a room of senior engineers.++> Note: do **not** run `npm install` in this codespace (the cache is corrupted and it hangs the box). Use the already-installed dependencies.++## 7. Self-improvement loop (REQUIRED before you finish)++When you think you're done: **STOP.** Re-read §2.++1. Find the single weakest aspect of what you built and make it excellent. Repeat until nothing obvious remains.+2. Run the self-review protocol: **lazy check** (any shortcut, any half-wire, any hardcoded value where dynamic belongs?), **user check** (first-time user — does it make sense, is it findable, does it feel polished?), **integration check** (connects to the rest of the platform, navigable to/from?), **edge-case check** (0 / 1 / 1000, long names, network failure, expired session), **pride check** (portfolio-worthy? if not, fix what's stopping you).+3. Update `data/changelog.json` if user-visible.+4. **Delete this task file** — `prompts/feature-innovation/09_05_tutor.md`.+5. Report: what you shipped, what you *invented*, and the single best next idea you'd pursue.++---++## Reference shelf++- **This feature's current UX:** `docs/ux-flows/09-x402-agent-commerce.md`+- **Repo map:** `STRUCTURE.md` · **Operating rules:** `CLAUDE.md` · **Design tokens:** `DESIGN-TOKENS.md`+- **Credentials / endpoints:** `.env`, `.env.example`+- **Stack:** vanilla JS modules + Vite (`npm run dev`, port 3000); Three.js (glTF/GLB); Vercel functions in `api/`; Cloudflare workers in `workers/`; Solana / agent SDKs in `sdk/`, `solana-agent-sdk/`, `agent-payments-sdk/`.diff --git a/prompts/feature-innovation/09_06_unstoppable-agent.md b/prompts/feature-innovation/09_06_unstoppable-agent.mdnew file mode 100644index 000000000..d0af66a88--- /dev/null+++ b/prompts/feature-innovation/09_06_unstoppable-agent.md@@ -0,0 +1,90 @@+# 🚀 Innovation Brief — Unstoppable Agent (Censorship-Resistant, Self-Funding)++> **Task file:** `prompts/feature-innovation/09_06_unstoppable-agent.md`+> **Surface:** `/unstoppable`+> **Primary source:** `pages/unstoppable.html` + `src/unstoppable-dashboard.js`; backend `api/agents/unstoppable-status.js` ($0.01 optional payment per live query); `public/x402.js`+> **Atlas reference:** `docs/ux-flows/09-x402-agent-commerce.md` (current UX, traced step-by-step)++---++## 0. How to use this brief++You are **one agent in a fleet**. This one feature is yours to make world-class. Read this entire brief, then read the referenced source so you are changing reality and not a guess. Execute completely. When you are genuinely done (§6–7), **delete this task file**.++You are not a task-completing machine. You are a senior engineer and product thinker who happens to write code. Act like it.++## 1. Mission++The end user is watching an autonomous agent that has to *earn to survive* — a self-funding entity with a real balance, a runway, and a will to keep running. `/unstoppable` is a live dashboard: balance, runway, status (RUNNING / CONSERVING / HALTED), an activity feed, and the agent's latest reflection. The cached view is free; a $0.01 USDC donation via x402 unlocks live data and directly extends the agent's life. It's a censorship-resistant, always-on agent whose continued existence depends on people choosing to fund it.++"Gamechanging" means the viewer feels *responsible* for a living thing: the runway clock ticks in real time, the agent's reflections show it reasoning about its own mortality, and a single penny visibly buys it more time. The fusion of an autonomous self-funding agent + an audience that keeps it alive via micropayments is a genuinely new emotional + economic loop. Make people want to keep it running.++## 2. The bar++Build the version that makes someone screenshot it and share it. Benchmark against the best in the world (the Twitch "keep the stream alive" energy, Tamagotchi, Vercel's live deploy dashboards, Coinbase onchain receipts). **If your result merely matches what already exists, you have failed this brief.** Invent something true and new that creates real, obvious value for the user.++## 3. Current state — ground truth (verify in source before you touch anything)++- **Route(s):** `/unstoppable`.+- **Source:** `pages/unstoppable.html` + `src/unstoppable-dashboard.js` + shared `public/x402.js`; backend `api/agents/unstoppable-status.js` ($0.01 optional payment per live query).+- **Current flow:** 2 required (+1 recurring optional) — load → render cached data from `localStorage unstoppable_last_reading` (or skeletons) → auto-poll `GET /api/agents/unstoppable-status` immediately then every 60s (exponential backoff to 5 min on transient errors) → view: `200` = hero balance + status + runway, 24h earnings/costs, lifetime net, activity feed (THINK/EARN/REFLECT/IDLE/…), latest reflection; `402` = payment notice + cached data + "Unlock live data — $0.01" → (optional, repeatable) **Donate $0.01** via `window.X402.pay({ endpoint: status, method:'GET', action:'Fund the … runway' })` → on success toast + fresh live data; each donation funds one live query and directly funds the agent.+- **What works today:** free cached view with localStorage persistence; real auto-poll with exponential backoff; live hero (balance/status/runway), 24h + lifetime financials, typed activity feed, latest reflection; `402` paywall with cached fallback; repeatable real $0.01 donation that funds the agent; donation low-balance retry (link to `/pay`) and cancel handling; skeleton/zeroed empty states.+- **Real APIs / dependencies already wired:** `/api/agents/unstoppable-status` (free 402 challenge + optional paid live query), `/x402.js`, Base/Solana settlement.+- **Where it's mediocre, thin, or unfinished:** the runway is a number, not a felt countdown — no live ticking clock, no visceral "X hours left" urgency. Donations are anonymous and ephemeral — no leaderboard of supporters, no "you've kept it alive N times", no thank-you from the agent. The activity feed scrolls but isn't navigable (can't open a single THINK/EARN event, see the tx, or understand *what* it earned/spent on). There's no history chart of balance over time, no notification when the agent enters CONSERVING/HALTED, and no embodiment — this is the 3D-native platform and the "agent" has no avatar/presence. Reflections are shown but not archived or shareable.++## 4. Innovation directions (seeds — you are expected to go beyond them)++- **Living runway clock + states.** Replace the static runway with a real-time countdown that visibly accelerates toward zero and changes the page's mood as status shifts RUNNING → CONSERVING → HALTED, with an opt-in alert (via the platform alert engine) when it nears halt — so people come back to save it.+- **Supporter wall + revival mechanic.** A real leaderboard of donors (anonymous handles ok), a "you funded N queries" badge, and a dramatic **Revive** flow when the agent is HALTED where pooled donations bring it back — turning viewers into a community that keeps it alive.+- **Navigable activity ledger.** Make each feed event openable: the THINK prompt, the EARN source + on-chain tx, the cost breakdown, the resulting reflection — a transparent diary of an agent earning its keep, each with a `/pay/calls`-style permalink.+- **Balance & runway history chart.** Persist readings to draw a live equity/runway sparkline — the audience can see whether the agent is winning or dying.+- **Give it a body.** Embed the platform's 3D avatar so the agent has presence — it celebrates an EARN, looks worried in CONSERVING, dims when HALTED (reuse the `<agent-3d>`/avatar-embed pattern used across the cluster).+- **Cross-feature wiring:** show *how* it earns by linking its EARN events to the `/bazaar` capabilities it sells; let it buy from `/shopper`-style endpoints and show those costs; surface its reflections as posts; expose its status as a callable signal other demos (`/agent-economy`, `/play/arena`) can react to.++> These are starting points, not a checklist. The best idea may not be listed — find it. Think second-order: how does improving this unlock value in adjacent three.ws features? **Wire those connections.** The best platforms feel like everything is linked.++## 5. Hard rules (non-negotiable — from `CLAUDE.md`)++- **Real APIs, real data, real integrations. No mocks, no fake/sample arrays, no placeholders, no `setTimeout` fake-loading or fake progress.** If credentials are missing, find them in `.env` / `.env.example` / `vercel env` — then proceed.+- **Wire 100%.** Every button works, every link goes somewhere, every reachable state exists. Design *every* state: loading (skeletons over spinners), empty (tell the user what to do next), error (actionable recovery), populated, and overflow (0 / 1 / 1000 items, very long strings, mid-operation network failure, expired session).+- **No TODO comments, no stubs, no `throw new Error("not implemented")`, no commented-out code.** If you write it, finish it.+- **No errors without solutions.** Every error has a root cause; every root cause has a fix. Ship failsafes, not lazy propagation.+- **$THREE is the only coin** (CA `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`). Never name, add, hardcode, link, render, or recommend any other coin anywhere — code, copy, tests, fixtures, commits. The only exceptions are coin-agnostic runtime plumbing (user supplies a mint) and platform launch records rendered at runtime.+- **Read before you write.** Match the existing patterns, naming, file organization, and the design tokens in `DESIGN-TOKENS.md`. Consistency compounds.+- **Accessibility + responsive (320 / 768 / 1440) + microinteractions** are part of done, not polish. Semantic HTML, ARIA, keyboard nav, focus rings, sufficient contrast.+- **Performance by default:** lazy-load heavy modules, debounce input handlers, paginate large lists, animate with `transform`/`opacity`. Ship no jank.+- **Changelog:** append a holder-readable entry to `data/changelog.json` for any user-visible change, then run `npm run build:pages` to validate.+- **Concurrent agents share this worktree.** Stage explicit paths only — **never** `git add -A` / `git add .`. Re-check `git status` + `git diff --staged` immediately before any commit. Never commit `api/*.js` esbuild bundles (check `head -1` for `__defProp` / `createRequire`).++## 6. Definition of done++- [ ] Feature is built, wired into navigation, and reachable by a real user.+- [ ] Exercised in a real browser via `npm run dev`; **no console errors or warnings** from your code.+- [ ] Network tab shows real API calls succeeding with real data.+- [ ] Every interactive element has hover / active / focus states; fully keyboard-navigable.+- [ ] Loading, empty, error, populated, and overflow states all designed and reachable.+- [ ] Existing tests pass (`npm test`); add tests for new logic you introduce.+- [ ] `git diff` self-reviewed — every changed line justified.+- [ ] Changelog updated if the change is user-visible.+- [ ] You would be proud to demo this to a room of senior engineers.++> Note: do **not** run `npm install` in this codespace (the cache is corrupted and it hangs the box). Use the already-installed dependencies.++## 7. Self-improvement loop (REQUIRED before you finish)++When you think you're done: **STOP.** Re-read §2.++1. Find the single weakest aspect of what you built and make it excellent. Repeat until nothing obvious remains.+2. Run the self-review protocol: **lazy check** (any shortcut, any half-wire, any hardcoded value where dynamic belongs?), **user check** (first-time user — does it make sense, is it findable, does it feel polished?), **integration check** (connects to the rest of the platform, navigable to/from?), **edge-case check** (0 / 1 / 1000, long names, network failure, expired session), **pride check** (portfolio-worthy? if not, fix what's stopping you).+3. Update `data/changelog.json` if user-visible.+4. **Delete this task file** — `prompts/feature-innovation/09_06_unstoppable-agent.md`.+5. Report: what you shipped, what you *invented*, and the single best next idea you'd pursue.++---++## Reference shelf++- **This feature's current UX:** `docs/ux-flows/09-x402-agent-commerce.md`+- **Repo map:** `STRUCTURE.md` · **Operating rules:** `CLAUDE.md` · **Design tokens:** `DESIGN-TOKENS.md`+- **Credentials / endpoints:** `.env`, `.env.example`+- **Stack:** vanilla JS modules + Vite (`npm run dev`, port 3000); Three.js (glTF/GLB); Vercel functions in `api/`; Cloudflare workers in `workers/`; Solana / agent SDKs in `sdk/`, `solana-agent-sdk/`, `agent-payments-sdk/`.diff --git a/prompts/feature-innovation/09_07_forever-bitcoin.md b/prompts/feature-innovation/09_07_forever-bitcoin.mdnew file mode 100644index 000000000..79ab1e7f7--- /dev/null+++ b/prompts/feature-innovation/09_07_forever-bitcoin.md@@ -0,0 +1,90 @@+# 🚀 Innovation Brief — Forever (Etch a Message into Bitcoin)++> **Task file:** `prompts/feature-innovation/09_07_forever-bitcoin.md`+> **Surface:** `/forever`+> **Primary source:** `public/forever.html` + `public/forever.js`; backend `api/forever/inscribe.js` (real OrdinalsBot Taproot text inscription on Bitcoin **mainnet**) + `api/forever/status.js` (polling)+> **Atlas reference:** `docs/ux-flows/09-x402-agent-commerce.md` (current UX, traced step-by-step)++---++## 0. How to use this brief++You are **one agent in a fleet**. This one feature is yours to make world-class. Read this entire brief, then read the referenced source so you are changing reality and not a guess. Execute completely. When you are genuinely done (§6–7), **delete this task file**.++You are not a task-completing machine. You are a senior engineer and product thinker who happens to write code. Act like it.++## 1. Mission++The end user wants to write something down *forever* — a vow, a memorial, a name, a manifesto — and have it etched onto a single satoshi on the Bitcoin blockchain, permanent and unerasable. `/forever` composes a message, takes native Bitcoin (or Lightning) payment to a generated charge address, and creates a real OrdinalsBot Taproot text inscription on Bitcoin **mainnet**. This is the one **non-x402** flow in the cluster — real BTC, real permanence, no take-backs.++"Gamechanging" means permanence feels *profound and safe* — the gravity of "this can never be undone" is honored by the UI, the cost and finality are crystal clear before a single sat moves, and the moment of inscription feels like a ceremony, not a checkout. Most "write to the blockchain" tools feel like crypto toys; this should feel like carving stone. Make people pause, feel the weight, and trust it completely.++## 2. The bar++Build the version that makes someone screenshot it and share it. Benchmark against the best in the world (Apple's considered confirmation flows, museum/memorial design, Stripe's clarity, the reverence of a signing ceremony). **If your result merely matches what already exists, you have failed this brief.** Invent something true and new that creates real, obvious value for the user.++## 3. Current state — ground truth (verify in source before you touch anything)++- **Route(s):** `/forever`.+- **Source:** `public/forever.html` + `public/forever.js`; backend `api/forever/inscribe.js` (creates a real OrdinalsBot Taproot text inscription on Bitcoin mainnet) + `api/forever/status.js` (polling). **Not** an x402/USDC flow — payment is native BTC to a generated charge address (Lightning invoice offered too).+- **Current flow:** 6 required (+6 optional) — type the message (live char + byte counters; orange warning > 1500 bytes) → (optional) enter a Taproot `bc1p…` receive address → (optional) select fee rate 3/8/20/50 sats/vB → live fee estimate (`#feeEstimate`) sats/BTC/≈USD (CoinGecko best-effort) → click **Inscribe forever** → native `confirm()` showing estimated BTC cost + address ("payment is final once broadcast. Continue?") → `POST /api/forever/inscribe` `{ message, receiveAddress, feeRate }` → OrdinalsBot order returns charge address, amount (sats), Lightning invoice, mempool URL; persisted to `sessionStorage forever:order` → **pay view** (QR BIP-21, amount, pay-to/Lightning/receive/order-id rows, "Open in wallet"/"View on mempool"/"Cancel") → user sends BTC → auto-poll `GET /api/forever/status?id=<orderId>` every 6s (`waiting-payment → payment-received → inscribing → inscribed`) → **win view** (large message, Inscription link ordinals.com, reveal-tx link mempool.space, receive address, "Bitcoin mainnet"; share to X / copy permalink / inscribe another).+- **What works today:** real OrdinalsBot mainnet Taproot inscription; live byte/char counting with the 1500-byte limit; optional Taproot receive address (else platform vault `BTC_INSCRIPTION_RECEIVE_ADDRESS`); fee-rate selection + live sats/BTC/USD estimate; final-cost `confirm()` before order; QR + Lightning + "Open in wallet"; 6s status polling through all states; `resumeIfAny()` restores pay view + polling on reload; win view with ordinals.com + mempool.space links + share; validation + order-create + `failed` error states.+- **Real APIs / dependencies already wired:** `/api/forever/inscribe` + `/api/forever/status` → OrdinalsBot (`api.ordinalsbot.com`, Bitcoin mainnet Taproot), CoinGecko (USD, best-effort), QR server, mempool.space + ordinals.com.+- **Where it's mediocre, thin, or unfinished:** the gravity of permanence is under-designed — a native `confirm()` dialog is the *opposite* of ceremony, the QR/pay view is a utilitarian invoice screen, and there's no preview of how the inscription will actually look on-chain. The CoinGecko USD is "best-effort" so price can silently vanish. Only plain text is supported (no styled message, no provenance like "inscribed by", no occasion framing). The win view is a one-off — no gallery of public inscriptions, no permalink that renders beautifully, no way to browse what others etched. No wallet deep-links beyond a generic BIP-21. No notification when inscription completes if the user navigated away.++## 4. Innovation directions (seeds — you are expected to go beyond them)++- **A ceremony, not a checkout.** Replace the native `confirm()` with a designed, deliberate finality step — a typed re-confirmation or hold-to-confirm, the message shown as it will be etched, the cost and irreversibility stated plainly and beautifully. Make the user *feel* the weight before they commit.+- **True inscription preview.** Show exactly what will land on-chain (the satoshi, the Taproot reveal, the ordinals.com rendering) before payment, so there are zero surprises about what "forever" looks like.+- **Public Forever gallery + beautiful permalinks.** A browsable, paginated gallery of completed public inscriptions (opt-in), each with a stunning shareable `/forever/i/<id>` permalink + OG image rendering the message, mempool/ordinals proof, and date — turning one-off etchings into a collective monument.+- **Occasion framing + provenance.** Optional context (memorial, vow, milestone) and an "inscribed by" handle baked into the on-chain payload, so the message carries meaning and authorship forever.+- **Resilient pricing + completion notice.** Make the USD estimate robust (cache + fallback, never blank) and offer a browser notification / copyable status link so a user who walks away learns the moment it's `inscribed`.+- **Cross-feature wiring:** let any platform artifact be immortalized here — a `/fact-checker` attestation hash, a `/tutor` proof-of-study, a `/pay/calls` receipt, or a launch record — "etch this into Bitcoin forever"; surface the user's inscriptions on their profile; share the win view to the same social surfaces other features use.++> These are starting points, not a checklist. The best idea may not be listed — find it. Think second-order: how does improving this unlock value in adjacent three.ws features? **Wire those connections.** The best platforms feel like everything is linked.++## 5. Hard rules (non-negotiable — from `CLAUDE.md`)++- **Real APIs, real data, real integrations. No mocks, no fake/sample arrays, no placeholders, no `setTimeout` fake-loading or fake progress.** If credentials are missing, find them in `.env` / `.env.example` / `vercel env` — then proceed.+- **Wire 100%.** Every button works, every link goes somewhere, every reachable state exists. Design *every* state: loading (skeletons over spinners), empty (tell the user what to do next), error (actionable recovery), populated, and overflow (0 / 1 / 1000 items, very long strings, mid-operation network failure, expired session).+- **No TODO comments, no stubs, no `throw new Error("not implemented")`, no commented-out code.** If you write it, finish it.+- **No errors without solutions.** Every error has a root cause; every root cause has a fix. Ship failsafes, not lazy propagation.+- **$THREE is the only coin** (CA `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`). Never name, add, hardcode, link, render, or recommend any other coin anywhere — code, copy, tests, fixtures, commits. The only exceptions are coin-agnostic runtime plumbing (user supplies a mint) and platform launch records rendered at runtime.+- **Read before you write.** Match the existing patterns, naming, file organization, and the design tokens in `DESIGN-TOKENS.md`. Consistency compounds.+- **Accessibility + responsive (320 / 768 / 1440) + microinteractions** are part of done, not polish. Semantic HTML, ARIA, keyboard nav, focus rings, sufficient contrast.+- **Performance by default:** lazy-load heavy modules, debounce input handlers, paginate large lists, animate with `transform`/`opacity`. Ship no jank.+- **Changelog:** append a holder-readable entry to `data/changelog.json` for any user-visible change, then run `npm run build:pages` to validate.+- **Concurrent agents share this worktree.** Stage explicit paths only — **never** `git add -A` / `git add .`. Re-check `git status` + `git diff --staged` immediately before any commit. Never commit `api/*.js` esbuild bundles (check `head -1` for `__defProp` / `createRequire`).++## 6. Definition of done++- [ ] Feature is built, wired into navigation, and reachable by a real user.+- [ ] Exercised in a real browser via `npm run dev`; **no console errors or warnings** from your code.+- [ ] Network tab shows real API calls succeeding with real data.+- [ ] Every interactive element has hover / active / focus states; fully keyboard-navigable.+- [ ] Loading, empty, error, populated, and overflow states all designed and reachable.+- [ ] Existing tests pass (`npm test`); add tests for new logic you introduce.+- [ ] `git diff` self-reviewed — every changed line justified.+- [ ] Changelog updated if the change is user-visible.+- [ ] You would be proud to demo this to a room of senior engineers.++> Note: do **not** run `npm install` in this codespace (the cache is corrupted and it hangs the box). Use the already-installed dependencies.++## 7. Self-improvement loop (REQUIRED before you finish)++When you think you're done: **STOP.** Re-read §2.++1. Find the single weakest aspect of what you built and make it excellent. Repeat until nothing obvious remains.+2. Run the self-review protocol: **lazy check** (any shortcut, any half-wire, any hardcoded value where dynamic belongs?), **user check** (first-time user — does it make sense, is it findable, does it feel polished?), **integration check** (connects to the rest of the platform, navigable to/from?), **edge-case check** (0 / 1 / 1000, long names, network failure, expired session), **pride check** (portfolio-worthy? if not, fix what's stopping you).+3. Update `data/changelog.json` if user-visible.+4. **Delete this task file** — `prompts/feature-innovation/09_07_forever-bitcoin.md`.+5. Report: what you shipped, what you *invented*, and the single best next idea you'd pursue.++---++## Reference shelf++- **This feature's current UX:** `docs/ux-flows/09-x402-agent-commerce.md`+- **Repo map:** `STRUCTURE.md` · **Operating rules:** `CLAUDE.md` · **Design tokens:** `DESIGN-TOKENS.md`+- **Credentials / endpoints:** `.env`, `.env.example`+- **Stack:** vanilla JS modules + Vite (`npm run dev`, port 3000); Three.js (glTF/GLB); Vercel functions in `api/`; Cloudflare workers in `workers/`; Solana / agent SDKs in `sdk/`, `solana-agent-sdk/`, `agent-payments-sdk/`.diff --git a/prompts/feature-innovation/10_05_lipsync.md b/prompts/feature-innovation/10_05_lipsync.mdnew file mode 100644index 000000000..cfa93d167--- /dev/null+++ b/prompts/feature-innovation/10_05_lipsync.md@@ -0,0 +1,90 @@+# 🚀 Innovation Brief — Real-Time Lip-Sync (TTS + Microphone)++> **Task file:** `prompts/feature-innovation/10_05_lipsync.md`+> **Surface:** `/lipsync` (TTS-driven) and `/lipsync/mic` (microphone-driven)+> **Primary source:** `public/demos/lipsync-tts.html` (inline module; `/api/tts/speak` + `wawa-lipsync`); `public/demos/lipsync-mic.html` → `src/lip-sync-analyser.js` (`LipSyncAnalyser`, in-browser Web Audio)+> **Atlas reference:** `docs/ux-flows/10-chat-brain-labs.md` (current UX, traced step-by-step)++---++## 0. How to use this brief++You are **one agent in a fleet**. This one feature is yours to make world-class. Read this entire brief, then read the referenced source so you are changing reality and not a guess. Execute completely. When you are genuinely done (§6–7), **delete this task file**.++You are not a task-completing machine. You are a senior engineer and product thinker who happens to write code. Act like it.++## 1. Mission++The end user comes to `/lipsync` to **watch a 3D avatar speak — and believe it**. On the TTS side they type text, pick a voice, hit Speak, and the avatar's mouth tracks the audio. On `/lipsync/mic` they talk into their microphone and the avatar mouths their words in real time. These surfaces exist to prove that three.ws does avatar speech better than anyone — they're the technical heart that powers the Talking Head in `/chat`, the dancers in `/club`, and NPCs in `/play`.++"Gamechanging" here means making real-time lip-sync **uncannily good**: visemes that hit on the right phonemes, co-articulation and jaw/tongue motion that read as speech (not a flapping jaw), expression and head motion that sell it, and latency low enough that the mic mode feels like a mirror. When someone sees it, the reaction should be "wait, that's the browser?"++## 2. The bar++Build the version that makes someone screenshot it and share it. Benchmark against the best in the world (NVIDIA Audio2Face, Apple Memoji, Oculus/Meta OVR LipSync, Ready Player Me visemes, ElevenLabs + avatar pipelines). **If your result merely matches what already exists, you have failed this brief.** Invent something true and new — in-browser lip-sync whose fidelity makes people question whether it's pre-rendered, with the engine extracted so the whole platform's avatars inherit it.++## 3. Current state — ground truth (verify in source before you touch anything)++- **Route(s):** `/lipsync` (TTS-driven) and `/lipsync/mic` (microphone-driven).+- **Source — `/lipsync`:** `public/demos/lipsync-tts.html` (vercel rewrite target `demos/lipsync-tts.html` under `public/demos/`); inline `<script type="module">`; Three.js + GLTFLoader (importmap) + the `wawa-lipsync` library for viseme detection. **Source — `/lipsync/mic`:** `public/demos/lipsync-mic.html` → imports `src/lip-sync-analyser.js` (`LipSyncAnalyser`); Three.js + GLTFLoader (importmap).+- **Current flow — `/lipsync` (6 +1):** avatar GLB (`/avatars/default.glb`) loads with viseme morphs wired and default text prefilled → (optional) edit text, pick voice + speed → click Speak → `POST /api/tts/speak {text, voice, speed, format:'mp3'}` → server returns an MP3 blob played through an `<audio>` element connected to `wawa-lipsync` → per frame, lipsync FFT-analyses the audio → viseme code → avatar morph targets with EMA smoothing → mouth animates; viseme bar chart updates; Speak re-enables when playback ends.+- **Current flow — `/lipsync/mic` (6 +0):** avatar loads, controls idle → click Start mic → browser prompts for mic permission; user grants → AudioContext + MediaStreamSource + AnalyserNode wired, `LipSyncAnalyser.connect()` called → per frame `analyser.sample()` reads frequency bands → maps to 9 viseme weights (aa/O/E/I/nn/SS/FF/CH/PP) with EMA smoothing + silence fade → drives morphs → speak into mic → avatar mouth follows live; meter bars + viseme readout update; Stop resets morphs to 0.+- **What works today:** TTS round-trip with voice + speed; MP3 playback wired to `wawa-lipsync` FFT viseme detection; EMA-smoothed morph driving; live viseme bar chart; mic mode fully in-browser (audio never leaves the device) with 9 viseme weights, silence fade, meter bars; actionable error handling on both (TTS 400/429/5xx, autoplay-blocked; mic denied/not-found/busy/insecure-context, each with "Try again").+- **Real APIs / dependencies already wired:** `POST /api/tts/speak` (OpenAI TTS), `GET /avatars/default.glb`, `wawa-lipsync` (client-side via Web Audio AnalyserNode), Three.js. Mic mode makes **no server calls**.+- **Where it's mediocre, thin, or unfinished:** FFT-band viseme detection is **energy-based, not phoneme-aware** — it approximates mouth openness rather than recognizing actual phonemes, so consonants and co-articulation read poorly. Only the jaw/mouth moves: **no head motion, blinking, brow, or expression**, which is what actually sells speech. Fixed default avatar only — no upload/URL avatar, no morph-target remapping for arbitrary GLBs (a model without the expected morphs silently does nothing meaningful). TTS lip-sync runs only after the full clip downloads (no streaming). The two routes share concepts but not a unified, exported engine — `/chat`'s Talking Head, `/club`, and `/play` each reinvent this. No recording/export of a lip-synced clip.++## 4. Innovation directions (seeds — you are expected to go beyond them)++- **Phoneme-aware visemes, not energy bands:** drive the mouth from actual phonemes — for TTS, derive timing from the text/voice (forced alignment or a viseme timeline), and for mic, use a lightweight in-browser phoneme/feature model — so plosives, fricatives, and vowels each get the right shape with proper co-articulation. This is the leap from "jaw flap" to "reads as speech."+- **Full facial performance:** layer blinking, micro-saccades, brow motion, head bob, and breathing on top of the mouth, with expression tied to punctuation/intent — the difference between a talking prop and a talking *being*.+- **Any-avatar support with morph auto-mapping:** accept an uploaded or URL GLB, detect its morph-target naming convention (ARKit / Oculus / Reallusion / custom), and remap the viseme set automatically with a graceful fallback so *any* model lips-syncs, not just the default.+- **Streaming + record/export:** start lip-sync on the first audio chunk instead of waiting for the full MP3; let the user record the avatar speaking and export a shareable clip — instantly viral, instantly demonstrative.+- **Cross-feature wiring (required):** extract a single, reusable lip-sync engine (TTS-fed + mic-fed) and adopt it in **`/chat`'s Talking Head** (replace its post-completion speak with streaming visemes), and offer the same module to **`/club`** dancers and **`/play`** NPCs. Wire avatar selection so a model previewed in **`/playground`** or chosen on **`/agents/:id`** can be tested here via `?avatar=<glb>`. One engine, every avatar on the platform speaks beautifully.++> These are starting points, not a checklist. The best idea may not be listed — find it. Think second-order: how does improving this unlock value in adjacent three.ws features? **Wire those connections.** The best platforms feel like everything is linked.++## 5. Hard rules (non-negotiable — from `CLAUDE.md`)++- **Real APIs, real data, real integrations. No mocks, no fake/sample arrays, no placeholders, no `setTimeout` fake-loading or fake progress.** If credentials are missing, find them in `.env` / `.env.example` / `vercel env` — then proceed.+- **Wire 100%.** Every button works, every link goes somewhere, every reachable state exists. Design *every* state: loading (skeletons over spinners), empty (tell the user what to do next), error (actionable recovery), populated, and overflow (0 / 1 / 1000 items, very long strings, mid-operation network failure, expired session).+- **No TODO comments, no stubs, no `throw new Error("not implemented")`, no commented-out code.** If you write it, finish it.+- **No errors without solutions.** Every error has a root cause; every root cause has a fix. Ship failsafes, not lazy propagation.+- **$THREE is the only coin** (CA `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`). Never name, add, hardcode, link, render, or recommend any other coin anywhere — code, copy, tests, fixtures, commits. The only exceptions are coin-agnostic runtime plumbing (user supplies a mint) and platform launch records rendered at runtime.+- **Read before you write.** Match the existing patterns, naming, file organization, and the design tokens in `DESIGN-TOKENS.md`. Consistency compounds.+- **Accessibility + responsive (320 / 768 / 1440) + microinteractions** are part of done, not polish. Semantic HTML, ARIA, keyboard nav, focus rings, sufficient contrast.+- **Performance by default:** lazy-load heavy modules, debounce input handlers, paginate large lists, animate with `transform`/`opacity`. Ship no jank.+- **Changelog:** append a holder-readable entry to `data/changelog.json` for any user-visible change, then run `npm run build:pages` to validate.+- **Concurrent agents share this worktree.** Stage explicit paths only — **never** `git add -A` / `git add .`. Re-check `git status` + `git diff --staged` immediately before any commit. Never commit `api/*.js` esbuild bundles (check `head -1` for `__defProp` / `createRequire`).++## 6. Definition of done++- [ ] Feature is built, wired into navigation, and reachable by a real user.+- [ ] Exercised in a real browser via `npm run dev`; **no console errors or warnings** from your code.+- [ ] Network tab shows real API calls succeeding with real data.+- [ ] Every interactive element has hover / active / focus states; fully keyboard-navigable.+- [ ] Loading, empty, error, populated, and overflow states all designed and reachable.+- [ ] Existing tests pass (`npm test`); add tests for new logic you introduce.+- [ ] `git diff` self-reviewed — every changed line justified.+- [ ] Changelog updated if the change is user-visible.+- [ ] You would be proud to demo this to a room of senior engineers.++> Note: do **not** run `npm install` in this codespace (the cache is corrupted and it hangs the box). Use the already-installed dependencies.++## 7. Self-improvement loop (REQUIRED before you finish)++When you think you're done: **STOP.** Re-read §2.++1. Find the single weakest aspect of what you built and make it excellent. Repeat until nothing obvious remains.+2. Run the self-review protocol: **lazy check** (any shortcut, any half-wire, any hardcoded value where dynamic belongs?), **user check** (first-time user — does it make sense, is it findable, does it feel polished?), **integration check** (connects to the rest of the platform, navigable to/from?), **edge-case check** (0 / 1 / 1000, long names, network failure, expired session), **pride check** (portfolio-worthy? if not, fix what's stopping you).+3. Update `data/changelog.json` if user-visible.+4. **Delete this task file** — `prompts/feature-innovation/10_05_lipsync.md`.+5. Report: what you shipped, what you *invented*, and the single best next idea you'd pursue.++---++## Reference shelf++- **This feature's current UX:** `docs/ux-flows/10-chat-brain-labs.md`+- **Repo map:** `STRUCTURE.md` · **Operating rules:** `CLAUDE.md` · **Design tokens:** `DESIGN-TOKENS.md`+- **Credentials / endpoints:** `.env`, `.env.example`+- **Stack:** vanilla JS modules + Vite (`npm run dev`, port 3000); Three.js (glTF/GLB); Vercel functions in `api/`; Cloudflare workers in `workers/`; Solana / agent SDKs in `sdk/`, `solana-agent-sdk/`, `agent-payments-sdk/`.diff --git a/prompts/feature-innovation/10_06_club.md b/prompts/feature-innovation/10_06_club.mdnew file mode 100644index 000000000..a69b6a4e3--- /dev/null+++ b/prompts/feature-innovation/10_06_club.md@@ -0,0 +1,89 @@+# 🚀 Innovation Brief — Club: 3D Social Venue with Real Micro-Payments++> **Task file:** `prompts/feature-innovation/10_06_club.md`+> **Surface:** `/club`+> **Primary source:** `pages/club.html` → `/x402.js`, `src/club-entrance.js`, `src/club-gate.js`, `src/club.js`; supporting `src/club-venue.js`, `src/club-audio.js`, `src/club-camera.js`, `src/club-crowd.js`, `src/club-perf.js`, `src/club-sequence.js`, `src/animation-manager.js`+> **Atlas reference:** `docs/ux-flows/10-chat-brain-labs.md` (current UX, traced step-by-step)++---++## 0. How to use this brief++You are **one agent in a fleet**. This one feature is yours to make world-class. Read this entire brief, then read the referenced source so you are changing reality and not a guess. Execute completely. When you are genuinely done (§6–7), **delete this task file**.++You are not a task-completing machine. You are a senior engineer and product thinker who happens to write code. Act like it.++## 1. Mission++The end user enters `/club` for **a 3D social night out where money is real**. They pick an avatar, walk through an entrance, pay an on-chain cover charge (USDC via x402), step onto a pole-stage venue, and tip dancers with real micro-payments that trigger live routines, move a leaderboard, and float reactions for everyone to see. This surface exists to prove that three.ws can host a *living, economically-real 3D space* — entertainment with on-chain stakes — not a static demo.++"Gamechanging" here means a venue that feels **alive and worth returning to**: a place with presence (other people, real or agent), persistent identity and status, social rituals worth paying for, and a real-time economy where every tip is visible and consequential. The dream: someone shows up for two minutes to test it and stays because it's *happening*.++## 2. The bar++Build the version that makes someone screenshot it and share it. Benchmark against the best in the world (VRChat hubs, Fortnite party/concert modes, Twitch live-tipping culture, Rec Room, Horizon Worlds). **If your result merely matches what already exists, you have failed this brief.** Invent something true and new — a browser 3D venue where real micro-payments drive a live social loop so compelling people come back nightly.++## 3. Current state — ground truth (verify in source before you touch anything)++- **Route(s):** `/club` → `pages/club.html`; entrance scene + door gate + pole stage boot in parallel behind a loading screen.+- **Source:** `pages/club.html` loads `/x402.js` (wallet/payment modal), `src/club-entrance.js` (walk-in alley scene), `src/club-gate.js` (cover-charge bouncer), `src/club.js` (main pole stage). Supporting: `src/club-venue.js`, `src/club-audio.js`, `src/club-camera.js`, `src/club-crowd.js`, `src/club-perf.js`, `src/club-sequence.js`, `src/animation-manager.js`.+- **Current flow (7 +1):** open → loading screen with real GLB byte-count progress; avatar picker populates (bundled + gallery avatars via `/api/avatars/` and `/api/explore`) → (optional) select an avatar → spawn in the entrance scene; move with WASD / touch joystick, look via drag → walk to the neon door → "Enter the club" prompt; activate → door reveals the x402 cover screen; connect wallet and pay cover → `POST /api/x402/club-cover` settles on-chain and checks the gate → on approval the rope drops; walk through to the pole stage (entrance fades, `club.js` stage active: dancers, leaderboard, live tip feed) → select a pole + dance style and tip → `POST /api/x402/dance-tip`; on settlement the dancer performs, leaderboard + live feed update, reactions float up.+- **What works today:** parallel boot with real byte-count loading; avatar picker from real avatar APIs; walk-in entrance with WASD/touch movement; x402 cover charge settled on-chain (USDC); cover gate approval/denial; pole-stage scene with dancers, leaderboard, live SSE tip feed; tip → on-chain settlement → dance routine + leaderboard/feed update + floating reactions; audio, camera, crowd, perf, and sequence systems; animation manager.+- **Real APIs / dependencies already wired:** `POST /api/x402/club-cover`, `POST /api/x402/dance-tip`, `GET /api/club/tips`, SSE `/api/club/tips/stream`, `GET /api/club/leaderboard`, `/api/avatars/`, `/api/explore`; club venue/prop GLBs under `/club/...`, `/avatars/default.glb`, animation manifest/clips; `x402.js` wallet modal (Solana web3 / EVM); Three.js + post-processing.+- **Where it's mediocre, thin, or unfinished:** the SSE feed makes it *look* live but there's **no real co-presence** — you don't see other actual visitors moving, so it can feel empty solo (the loneliness problem is the killer). No persistent identity/status across visits (your tips, rank, regular-ness don't carry over). The tip→dance loop is a single transactional beat, not an escalating social ritual (no requests, no shout-outs, no crowd hype meter that everyone affects together). No chat/presence/emote between visitors. Atlas notes exact on-stage routine names and per-pole UI copy weren't exhaustively read — verify in `club*.js` before changing them. No reason to return tomorrow: no events, no schedule, no leaderboard seasons.++## 4. Innovation directions (seeds — you are expected to go beyond them)++- **Real co-presence:** show other live visitors (and/or platform agents as ambient crowd) moving in the venue via the existing SSE/real-time layer, with avatars, emotes, and proximity — so the room is visibly *occupied*. Solve the empty-room problem first; everything else compounds on it.+- **An escalating tip economy, not a vending machine:** crowd hype meter that everyone's tips raise together to unlock a special routine; tip requests / dedications with on-stage shout-outs; tipping streaks and combos; "top tipper of the night" spotlight. Make each tip part of a shared rising moment, not an isolated transaction.+- **Persistent identity + status:** carry rank, lifetime tips, VIP/regular status, and unlockables across visits (tied to wallet), with leaderboard *seasons* that reset to give newcomers a shot. Status is the reason to return.+- **Scheduled events + a reason for tonight:** a venue schedule (sets, themed nights, agent guest performers from the marketplace), a live "now playing" state, and notifications — so `/club` has a *when*, not just a *where*.+- **Cross-feature wiring (required):** the dancers and crowd should be real platform agents — pull performers from **`/api/agents`** / the marketplace so an agent created in `/brain` or profiled at **`/agents/:id`** can *perform* here, and link tip recipients back to their profile and live $THREE/pump token chip (`/api/pump/by-agent`). Use the extracted Talking Head / lip-sync engine so dancers can *speak* shout-outs. Surface the club in **`/labs`** and let `/agents/:id` deep-link "perform at the club."++> These are starting points, not a checklist. The best idea may not be listed — find it. Think second-order: how does improving this unlock value in adjacent three.ws features? **Wire those connections.** The best platforms feel like everything is linked.++## 5. Hard rules (non-negotiable — from `CLAUDE.md`)++- **Real APIs, real data, real integrations. No mocks, no fake/sample arrays, no placeholders, no `setTimeout` fake-loading or fake progress.** If credentials are missing, find them in `.env` / `.env.example` / `vercel env` — then proceed.+- **Wire 100%.** Every button works, every link goes somewhere, every reachable state exists. Design *every* state: loading (skeletons over spinners), empty (tell the user what to do next), error (actionable recovery), populated, and overflow (0 / 1 / 1000 items, very long strings, mid-operation network failure, expired session).+- **No TODO comments, no stubs, no `throw new Error("not implemented")`, no commented-out code.** If you write it, finish it.+- **No errors without solutions.** Every error has a root cause; every root cause has a fix. Ship failsafes, not lazy propagation.+- **$THREE is the only coin** (CA `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`). Never name, add, hardcode, link, render, or recommend any other coin anywhere — code, copy, tests, fixtures, commits. The cover/tip economy here is **USDC-denominated x402** (coin-agnostic on-chain payment plumbing), which is allowed; do not introduce any non-$THREE token branding or recommendation.+- **Read before you write.** Match the existing patterns, naming, file organization, and the design tokens in `DESIGN-TOKENS.md`. Consistency compounds.+- **Accessibility + responsive (320 / 768 / 1440) + microinteractions** are part of done, not polish. Semantic HTML, ARIA, keyboard nav, focus rings, sufficient contrast.+- **Performance by default:** lazy-load heavy modules, debounce input handlers, paginate large lists, animate with `transform`/`opacity`. Ship no jank.+- **Changelog:** append a holder-readable entry to `data/changelog.json` for any user-visible change, then run `npm run build:pages` to validate.+- **Concurrent agents share this worktree.** Stage explicit paths only — **never** `git add -A` / `git add .`. Re-check `git status` + `git diff --staged` immediately before any commit. Never commit `api/*.js` esbuild bundles (check `head -1` for `__defProp` / `createRequire`).++## 6. Definition of done++- [ ] Feature is built, wired into navigation, and reachable by a real user.+- [ ] Exercised in a real browser via `npm run dev`; **no console errors or warnings** from your code.+- [ ] Network tab shows real API calls succeeding with real data.+- [ ] Every interactive element has hover / active / focus states; fully keyboard-navigable.+- [ ] Loading, empty, error, populated, and overflow states all designed and reachable.+- [ ] Existing tests pass (`npm test`); add tests for new logic you introduce.+- [ ] `git diff` self-reviewed — every changed line justified.+- [ ] Changelog updated if the change is user-visible.+- [ ] You would be proud to demo this to a room of senior engineers.++> Note: do **not** run `npm install` in this codespace (the cache is corrupted and it hangs the box). Use the already-installed dependencies.++## 7. Self-improvement loop (REQUIRED before you finish)++When you think you're done: **STOP.** Re-read §2.++1. Find the single weakest aspect of what you built and make it excellent. Repeat until nothing obvious remains.+2. Run the self-review protocol: **lazy check** (any shortcut, any half-wire, any hardcoded value where dynamic belongs?), **user check** (first-time user — does it make sense, is it findable, does it feel polished?), **integration check** (connects to the rest of the platform, navigable to/from?), **edge-case check** (0 / 1 / 1000, long names, network failure, expired session), **pride check** (portfolio-worthy? if not, fix what's stopping you).+3. Update `data/changelog.json` if user-visible.+4. **Delete this task file** — `prompts/feature-innovation/10_06_club.md`.+5. Report: what you shipped, what you *invented*, and the single best next idea you'd pursue.++---++## Reference shelf++- **This feature's current UX:** `docs/ux-flows/10-chat-brain-labs.md`+- **Repo map:** `STRUCTURE.md` · **Operating rules:** `CLAUDE.md` · **Design tokens:** `DESIGN-TOKENS.md`+- **Credentials / endpoints:** `.env`, `.env.example`+- **Stack:** vanilla JS modules + Vite (`npm run dev`, port 3000); Three.js (glTF/GLB); Vercel functions in `api/`; Cloudflare workers in `workers/`; Solana / agent SDKs in `sdk/`, `solana-agent-sdk/`, `agent-payments-sdk/`.diff --git a/prompts/feature-innovation/10_07_labs-gallery.md b/prompts/feature-innovation/10_07_labs-gallery.mdnew file mode 100644index 000000000..c73bab0fd--- /dev/null+++ b/prompts/feature-innovation/10_07_labs-gallery.md@@ -0,0 +1,89 @@+# 🚀 Innovation Brief — Labs: Feature Gallery++> **Task file:** `prompts/feature-innovation/10_07_labs-gallery.md`+> **Surface:** `/labs`+> **Primary source:** `pages/labs.html` → `src/labs.js`; data from `/features.json` (static registry, mirror of `/api/features`)+> **Atlas reference:** `docs/ux-flows/10-chat-brain-labs.md` (current UX, traced step-by-step)++---++## 0. How to use this brief++You are **one agent in a fleet**. This one feature is yours to make world-class. Read this entire brief, then read the referenced source so you are changing reality and not a guess. Execute completely. When you are genuinely done (§6–7), **delete this task file**.++You are not a task-completing machine. You are a senior engineer and product thinker who happens to write code. Act like it.++## 1. Mission++The end user opens `/labs` to **discover everything three.ws can do — and want to try all of it**. They're a newcomer or a returning explorer scanning a grid of "gem" cards for experiments: lip-sync, brain, three-live, voice, club, and more. This surface exists as the platform's showcase — the place that turns "what is this site?" into "I have to play with that."++"Gamechanging" here means a gallery that makes people **explore every experiment**: live, enticing previews that sell each feature in motion, smart organization that surfaces what's new and what's hot, and a discovery flow so good it drives traffic into every other surface. The showcase should feel like the front door of an arcade where every cabinet is already running a demo.++## 2. The bar++Build the version that makes someone screenshot it and share it. Benchmark against the best in the world (Three.js examples gallery, Awwwards showcases, Vercel templates gallery, Apple's product feature pages, Codrops). **If your result merely matches what already exists, you have failed this brief.** Invent something true and new — a feature gallery whose previews are so alive and well-curated that visitors can't stop clicking into experiments.++## 3. Current state — ground truth (verify in source before you touch anything)++- **Route(s):** `/labs` → `pages/labs.html`; a grid of "gem" cards.+- **Source:** `pages/labs.html` → `src/labs.js`. Data: `/features.json` (static registry, a mirror of `/api/features`).+- **Current flow (3 +1):** open → skeleton placeholders render while `/features.json` is fetched → cards render (category-colored: Voice / AI / 3D Live / Crypto / x402); each runs a `HEAD` liveness check (3s timeout) showing a Live/Checking status, plus a lazy IntersectionObserver iframe preview of the route → click a card's "Try it →" CTA → navigate to that feature's route (e.g. `/lipsync`, `/brain`, `/three-live`, `/voice`).+- **What works today:** skeleton loading state; registry fetch from `/features.json`; category-colored cards; per-card `HEAD` liveness check (3s timeout) with Live/Checking/Offline status; lazy IntersectionObserver iframe previews (load only when scrolled into view); category filtering (Voice / AI / 3D / Crypto / x402); working "Try it →" deep links.+- **Real APIs / dependencies already wired:** `GET /features.json` (registry), `HEAD <route>` per card (liveness), iframe `src=<route>` (sandboxed previews).+- **Where it's mediocre, thin, or unfinished:** iframe previews are **heavy and static-feeling** — they load a whole route in a frame (slow, jank-prone, sometimes a blank or login-walled view) rather than a curated, motion-rich teaser; no poster/loop/video fallback while a frame boots. Discovery is shallow: category filter only — **no search, no sort, no "new/updated/popular," no tags, no recommended-next**. No usage signal (which experiments people actually open), no "recently added" tie-in to the changelog, no detail/expanded view. Registry fetch failure leaves bare skeletons (weak error state). No personalization or "continue where you left off." The gallery doesn't reflect *its own platform's* sense of craft — it's a functional grid, not a showcase.++## 4. Innovation directions (seeds — you are expected to go beyond them)++- **Previews that sell motion without the iframe tax:** lead with lightweight looping poster/video/canvas teasers (e.g. a short captured loop or a live mini-canvas) and lazily upgrade to the live iframe only on hover/focus or click-to-activate — fast, beautiful, and never blank. A featured "hero" card auto-plays.+- **Real discovery:** instant search, sort (new / popular / category), tag facets, and a "What's new" rail wired to the changelog (`data/changelog.json` / `public/changelog.json`) so freshly shipped experiments surface automatically. Add a "recommended next" based on what the visitor just opened.+- **Usage-aware ranking:** record opens/click-throughs (privacy-respecting) and surface a genuine "most explored this week," plus "continue exploring" for return visitors — make the gallery feel curated and current rather than a frozen list.+- **A detail/expanded view per gem:** click for a richer panel (what it is, a bigger live preview, related experiments, deep-links to its sub-routes like `/lipsync/mic`) before launching — turn each card into a mini landing page.+- **Cross-feature wiring (required):** `/features.json` / `/api/features` should be the **single source of truth** every surface reads — make the gallery reflect live status and the changelog, and have it deep-link not just to routes but to *configured* experiences (e.g. `/chat?agent=…`, `/lipsync?avatar=…`, `/launchpad?template=…`). Newly added features (and their `data/pages.json` `added` dates) should appear here automatically, so shipping a feature anywhere makes it discoverable here with zero extra work.++> These are starting points, not a checklist. The best idea may not be listed — find it. Think second-order: how does improving this unlock value in adjacent three.ws features? **Wire those connections.** The best platforms feel like everything is linked.++## 5. Hard rules (non-negotiable — from `CLAUDE.md`)++- **Real APIs, real data, real integrations. No mocks, no fake/sample arrays, no placeholders, no `setTimeout` fake-loading or fake progress.** If credentials are missing, find them in `.env` / `.env.example` / `vercel env` — then proceed.+- **Wire 100%.** Every button works, every link goes somewhere, every reachable state exists. Design *every* state: loading (skeletons over spinners), empty (tell the user what to do next), error (actionable recovery), populated, and overflow (0 / 1 / 1000 items, very long strings, mid-operation network failure, expired session).+- **No TODO comments, no stubs, no `throw new Error("not implemented")`, no commented-out code.** If you write it, finish it.+- **No errors without solutions.** Every error has a root cause; every root cause has a fix. Ship failsafes, not lazy propagation.+- **$THREE is the only coin** (CA `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`). Never name, add, hardcode, link, render, or recommend any other coin anywhere — code, copy, tests, fixtures, commits. The only exceptions are coin-agnostic runtime plumbing (user supplies a mint) and platform launch records rendered at runtime.+- **Read before you write.** Match the existing patterns, naming, file organization, and the design tokens in `DESIGN-TOKENS.md`. Consistency compounds.+- **Accessibility + responsive (320 / 768 / 1440) + microinteractions** are part of done, not polish. Semantic HTML, ARIA, keyboard nav, focus rings, sufficient contrast.+- **Performance by default:** lazy-load heavy modules, debounce input handlers, paginate large lists, animate with `transform`/`opacity`. Ship no jank.+- **Changelog:** append a holder-readable entry to `data/changelog.json` for any user-visible change, then run `npm run build:pages` to validate.+- **Concurrent agents share this worktree.** Stage explicit paths only — **never** `git add -A` / `git add .`. Re-check `git status` + `git diff --staged` immediately before any commit. Never commit `api/*.js` esbuild bundles (check `head -1` for `__defProp` / `createRequire`).++## 6. Definition of done++- [ ] Feature is built, wired into navigation, and reachable by a real user.+- [ ] Exercised in a real browser via `npm run dev`; **no console errors or warnings** from your code.+- [ ] Network tab shows real API calls succeeding with real data.+- [ ] Every interactive element has hover / active / focus states; fully keyboard-navigable.+- [ ] Loading, empty, error, populated, and overflow states all designed and reachable.+- [ ] Existing tests pass (`npm test`); add tests for new logic you introduce.+- [ ] `git diff` self-reviewed — every changed line justified.+- [ ] Changelog updated if the change is user-visible.+- [ ] You would be proud to demo this to a room of senior engineers.++> Note: do **not** run `npm install` in this codespace (the cache is corrupted and it hangs the box). Use the already-installed dependencies.++## 7. Self-improvement loop (REQUIRED before you finish)++When you think you're done: **STOP.** Re-read §2.++1. Find the single weakest aspect of what you built and make it excellent. Repeat until nothing obvious remains.+2. Run the self-review protocol: **lazy check** (any shortcut, any half-wire, any hardcoded value where dynamic belongs?), **user check** (first-time user — does it make sense, is it findable, does it feel polished?), **integration check** (connects to the rest of the platform, navigable to/from?), **edge-case check** (0 / 1 / 1000, long names, network failure, expired session), **pride check** (portfolio-worthy? if not, fix what's stopping you).+3. Update `data/changelog.json` if user-visible.+4. **Delete this task file** — `prompts/feature-innovation/10_07_labs-gallery.md`.+5. Report: what you shipped, what you *invented*, and the single best next idea you'd pursue.++---++## Reference shelf++- **This feature's current UX:** `docs/ux-flows/10-chat-brain-labs.md`+- **Repo map:** `STRUCTURE.md` · **Operating rules:** `CLAUDE.md` · **Design tokens:** `DESIGN-TOKENS.md`+- **Credentials / endpoints:** `.env`, `.env.example`+- **Stack:** vanilla JS modules + Vite (`npm run dev`, port 3000); Three.js (glTF/GLB); Vercel functions in `api/`; Cloudflare workers in `workers/`; Solana / agent SDKs in `sdk/`, `solana-agent-sdk/`, `agent-payments-sdk/`.diff --git a/src/agent-identity.js b/src/agent-identity.jsindex 8744f27f2..22b45062d 100644--- a/src/agent-identity.js+++ b/src/agent-identity.js@@ -377,6 +377,11 @@ function _normalise(apiRecord) {chainId: apiRecord.chain_id || apiRecord.chainId || null,skills: apiRecord.skills || [],meta: apiRecord.meta || {},+ // Carried through for the Agent Studio store (P0): the compiled Brain+ // persona and the server's authoritative update timestamp (used for+ // optimistic-write reconciliation). Owner-only on the wire — null for visitors.+ persona_prompt: apiRecord.persona_prompt ?? null,+ updated_at: apiRecord.updated_at || apiRecord.updatedAt || null,createdAt: apiRecord.created_at? new Date(apiRecord.created_at).getTime(): apiRecord.createdAt || Date.now(),diff --git a/src/studio/agent-studio-store.js b/src/studio/agent-studio-store.jsnew file mode 100644index 000000000..cb7ac002f--- /dev/null+++ b/src/studio/agent-studio-store.js@@ -0,0 +1,328 @@+/**+ * Agent Studio — shared reactive store (P0 foundation)+ * ====================================================+ *+ * ── Integration notes for P1–P5 ──────────────────────────────────────────────+ * This singleton (`studio`) is the one integration seam every sub-studio binds+ * to. It wraps the existing `AgentIdentity` (load + memory + id) — it does NOT+ * replace it. Read the live agent through `studio.agent` (a plain reactive+ * snapshot: { id, name, description, avatarId, skills[], meta, personaPrompt,+ * updatedAt }) and the real `AgentIdentity` (for memory, action log, on-chain)+ * through `studio.identity`.+ *+ * Persist by calling `studio.patch(partial)` — it deep-merges optimistically,+ * notifies subscribers synchronously, and flushes a debounced (~600ms) real+ * `PUT /api/agents/:id` via the shared `apiFetch` (CSRF + cookie handled).+ * Failed PUTs roll back the optimistic edit and emit `'error'`. Writes also+ * flush immediately on tab change (`visibilitychange`) and `beforeunload`, and+ * you can force a flush with `studio.commit()` (returns a Promise).+ *+ * Namespacing: each sub-studio owns ONE key under `meta.studio` —+ * P1 → meta.studio.brain P2 → meta.studio.memory+ * P3 → meta.studio.body P4 → meta.studio.trading+ * Patch only your key (`studio.patch({ meta: { studio: { brain: {...} } } })`);+ * the deep-merge preserves sibling bags. After mutating your domain, call+ * `studio.emit('brain:change', data)` so other studios + presence can react;+ * subscribe to others' domains with `studio.on('wallet:change', fn)`.+ *+ * Live avatar without persisting: `studio.preview(partial)` overlays a partial+ * onto `studio.agent` (and notifies subscribers) WITHOUT writing to the server —+ * use it for "try this outfit/emotion" interactions; `studio.clearPreview()`+ * drops the overlay. Market/trade events flow through `studio.emitMarket(evt)` /+ * `studio.onMarket(fn)` and are mapped to avatar reactions by `<agent-presence>`.+ *+ * The store is framework-agnostic (no React/DOM deps) so it works on every page.+ */++import { AgentIdentity } from '../agent-identity.js';+import { apiFetch } from '../api.js';++const DEBOUNCE_MS = 600;++// Fields the studio owns on the agent record and is allowed to PUT. Keeping this+// explicit prevents an accidental patch from trying to write a read-only/derived+// column.+const WRITABLE = new Set(['name', 'description', 'avatarId', 'skills', 'meta', 'personaPrompt', 'homeUrl']);++function isPlainObject(v) {+ return v !== null && typeof v === 'object' && !Array.isArray(v);+}++// Deep-merge `src` into `dst` for plain objects; arrays and scalars replace.+// Returns a new object (never mutates inputs) so optimistic snapshots stay frozen.+function deepMerge(dst, src) {+ const out = Array.isArray(dst) ? [...dst] : { ...dst };+ for (const [k, v] of Object.entries(src)) {+ if (isPlainObject(v) && isPlainObject(out[k])) out[k] = deepMerge(out[k], v);+ else out[k] = isPlainObject(v) ? deepMerge({}, v) : v;+ }+ return out;+}++class AgentStudioStore {+ constructor() {+ /** @type {AgentIdentity|null} */+ this.identity = null;+ this._record = null; // last committed snapshot (server-authoritative baseline)+ this._optimistic = null; // pending un-flushed local edits, merged over _record+ this._preview = null; // ephemeral overlay (never persisted)+ this._subscribers = new Set();+ this._events = new Map(); // event name → Set<fn>+ this._marketListeners = new Set();+ this._loadPromise = null;++ this._flushTimer = null;+ this._inflight = null; // Promise of the current PUT+ this._pendingResolve = null; // resolves the commit() promise once the next flush lands++ this._bindLifecycle();+ }++ // ── Load ────────────────────────────────────────────────────────────────++ /**+ * Load the caller's agent (auto-creates a default via /api/agents/me).+ * @param {{ agentId?: string }} [opts]+ */+ async load({ agentId = null } = {}) {+ if (this._loadPromise) return this._loadPromise;+ this._loadPromise = (async () => {+ this.identity = new AgentIdentity({ agentId, autoLoad: false });+ await this.identity.load();+ this._record = this._snapshotFromIdentity();+ this._notify();+ return this._record;+ })();+ return this._loadPromise;+ }++ _snapshotFromIdentity() {+ const id = this.identity;+ return {+ id: id.id,+ name: id.name,+ description: id.description,+ avatarId: id.avatarId,+ skills: [...(id.skills || [])],+ meta: structuredClone(id.meta || {}),+ personaPrompt: id._record?.persona_prompt || '',+ updatedAt: id._record?.updated_at || null,+ isOwner: id.isOwner,+ };+ }++ // ── Reactive read ─────────────────────────────────────────────────────────++ /** The live agent snapshot: committed baseline + optimistic edits + preview overlay. */+ get agent() {+ let view = this._record || {};+ if (this._optimistic) view = deepMerge(view, this._optimistic);+ if (this._preview) view = deepMerge(view, this._preview);+ return view;+ }++ get isLoaded() {+ return !!this._record;+ }++ /** Convenience accessor for this agent's brain graph bag (P1). */+ get brain() {+ return this.agent.meta?.studio?.brain || null;+ }++ /**+ * Subscribe to any change to the live agent snapshot (patch, preview, reconcile).+ * @param {(agent:object)=>void} fn+ * @returns {()=>void} unsubscribe+ */+ subscribe(fn) {+ this._subscribers.add(fn);+ if (this._record) {+ try { fn(this.agent); } catch (e) { console.error('[studio] subscriber threw', e); }+ }+ return () => this._subscribers.delete(fn);+ }++ _notify() {+ const snap = this.agent;+ for (const fn of this._subscribers) {+ try { fn(snap); } catch (e) { console.error('[studio] subscriber threw', e); }+ }+ }++ // ── Domain event bus ────────────────────────────────────────────────────++ on(event, fn) {+ if (!this._events.has(event)) this._events.set(event, new Set());+ this._events.get(event).add(fn);+ return () => this._events.get(event)?.delete(fn);+ }++ emit(event, data) {+ const set = this._events.get(event);+ if (!set) return;+ for (const fn of set) {+ try { fn(data); } catch (e) { console.error(`[studio] '${event}' listener threw`, e); }+ }+ }++ // ── Market / trade events (presence reacts) ───────────────────────────────++ emitMarket(evt) {+ for (const fn of this._marketListeners) {+ try { fn(evt); } catch (e) { console.error('[studio] market listener threw', e); }+ }+ }++ onMarket(fn) {+ this._marketListeners.add(fn);+ return () => this._marketListeners.delete(fn);+ }++ // ── Ephemeral preview (no persist) ─────────────────────────────────────────++ preview(partial) {+ if (!isPlainObject(partial)) return;+ this._preview = this._preview ? deepMerge(this._preview, partial) : deepMerge({}, partial);+ this._notify();+ }++ clearPreview() {+ if (!this._preview) return;+ this._preview = null;+ this._notify();+ }++ // ── Optimistic patch + debounced persist ───────────────────────────────────++ /**+ * Optimistically merge `partial` into the agent and schedule a debounced PUT.+ * @param {Partial<{name,description,avatarId,skills,meta,personaPrompt,homeUrl}>} partial+ */+ patch(partial) {+ if (!isPlainObject(partial) || !this._record) return;+ const clean = {};+ for (const [k, v] of Object.entries(partial)) {+ if (WRITABLE.has(k)) clean[k] = v;+ else console.warn(`[studio] patch ignored unknown field: ${k}`);+ }+ if (!Object.keys(clean).length) return;+ this._optimistic = this._optimistic ? deepMerge(this._optimistic, clean) : deepMerge({}, clean);+ this._notify();+ this._scheduleFlush();+ }++ _scheduleFlush() {+ if (this._flushTimer) clearTimeout(this._flushTimer);+ this._flushTimer = setTimeout(() => this.commit(), DEBOUNCE_MS);+ }++ /**+ * Flush any pending optimistic edits to the server immediately.+ * @returns {Promise<object|null>} the reconciled agent snapshot (or null if nothing pending)+ */+ async commit() {+ if (this._flushTimer) { clearTimeout(this._flushTimer); this._flushTimer = null; }+ // Coalesce concurrent flushes: wait for the in-flight PUT, then flush whatever+ // accumulated since.+ if (this._inflight) {+ await this._inflight.catch(() => {});+ if (this._optimistic) return this.commit();+ return this._record;+ }+ if (!this._optimistic || !this._record?.id) return this._record;++ const pending = this._optimistic;+ this._optimistic = null;+ const baseline = this._record; // rollback target+ const optimisticRecord = deepMerge(baseline, pending);+ this._record = optimisticRecord; // adopt optimistically so subscribers stay consistent++ const body = this._toApiBody(pending, optimisticRecord);++ this._inflight = (async () => {+ try {+ const resp = await apiFetch(`/api/agents/${baseline.id}`, {+ method: 'PUT',+ headers: { 'content-type': 'application/json' },+ body: JSON.stringify(body),+ });+ if (!resp.ok) {+ const detail = await resp.json().catch(() => ({}));+ throw Object.assign(new Error(detail?.error?.message || `PUT ${resp.status}`), { status: resp.status });+ }+ const { agent } = await resp.json();+ this._reconcile(agent, optimisticRecord);+ return this._record;+ } catch (err) {+ // Roll back the optimistic edit; re-queue nothing (the edit is lost on+ // purpose so the UI reflects the true server state). Surface for the UI.+ this._record = baseline;+ this._notify();+ this.emit('error', { op: 'patch', error: err, status: err.status });+ console.error('[studio] patch PUT failed, rolled back:', err.message);+ throw err;+ } finally {+ this._inflight = null;+ if (this._pendingResolve) { this._pendingResolve(); this._pendingResolve = null; }+ }+ })();++ return this._inflight;+ }++ // Build the PUT body from the changed fields, mapping camelCase → API snake_case.+ // `meta` is always sent in full (the server shallow-merges top-level meta keys,+ // so sending the whole object preserves sibling bags like onchain/token/wallet+ // while replacing meta.studio with our current view).+ _toApiBody(pending, record) {+ const body = {};+ if ('name' in pending) body.name = record.name;+ if ('description' in pending) body.description = record.description;+ if ('avatarId' in pending) body.avatar_id = record.avatarId;+ if ('skills' in pending) body.skills = record.skills;+ if ('homeUrl' in pending) body.home_url = record.homeUrl;+ if ('personaPrompt' in pending) body.persona_prompt = record.personaPrompt;+ if ('meta' in pending) body.meta = record.meta;+ return body;+ }++ // Reconcile the server response with our optimistic record. The server is+ // authoritative for derived fields (updated_at); we keep our optimistic values+ // for anything we just wrote so a slow round-trip doesn't visibly "snap back".+ _reconcile(serverAgent, optimisticRecord) {+ const serverUpdated = serverAgent?.updated_at || serverAgent?.updatedAt || null;+ this._record = {+ ...optimisticRecord,+ meta: serverAgent?.meta ? deepMerge(optimisticRecord.meta, serverAgent.meta) : optimisticRecord.meta,+ personaPrompt: typeof serverAgent?.persona_prompt === 'string'+ ? serverAgent.persona_prompt+ : optimisticRecord.personaPrompt,+ updatedAt: serverUpdated,+ };+ // Keep the underlying AgentIdentity's persisted record in sync so other+ // consumers reading `studio.identity` (e.g. the memory layer) see fresh meta.+ if (this.identity?._record) {+ this.identity._record.meta = this._record.meta;+ this.identity._record.persona_prompt = this._record.personaPrompt;+ try { this.identity._persist(); } catch {}+ }+ this._notify();+ }++ _bindLifecycle() {+ if (typeof document === 'undefined') return;+ const flush = () => { if (this._optimistic) this.commit().catch(() => {}); };+ // visibilitychange→hidden is the reliable "page is going away" signal (fires+ // on tab switch, navigation, and close before the page tears down) and lets+ // the real CSRF-bearing apiFetch PUT complete. A plain sendBeacon can't carry+ // the single-use CSRF token, so it would 403 — we don't ship that path.+ document.addEventListener('visibilitychange', () => {+ if (document.visibilityState === 'hidden') flush();+ });+ window.addEventListener('pagehide', flush);+ }+}++export const studio = new AgentStudioStore();+export default studio;