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
Complete IRL, wallet, IBM x402, and avatar planning backlogs
nirholas21aee87fd842
diff --git a/prompts/avatar-animation-hardening/05-embed-and-home-avatar-ux.md b/prompts/avatar-animation-hardening/05-embed-and-home-avatar-ux.mdnew file mode 100644index 000000000..85ba31a44--- /dev/null+++ b/prompts/avatar-animation-hardening/05-embed-and-home-avatar-ux.md@@ -0,0 +1,80 @@+# Task 5 — The embed & home-page avatar UX++> Read [00-README.md](./00-README.md) first. Can run in **parallel** with Tasks 1/3. Follow+> [CLAUDE.md](../../CLAUDE.md) — every state designed, accessibility, verify in a real browser.++This is the "best possible UX" mandate, on the exact surface the bug appeared. The home page+renders live `<agent-3d>` mini-avatars in the door cards / bento / hero+(`initLiveFeatures()` in [pages/home.html](../../pages/home.html), ~line 6004+). Today they pop in+without a loading state, can be mis-framed, and force a one-shot clip to loop. Make every embedded+avatar feel intentional and polished — the thing someone screenshots and shares.++## What to build++### 1. Designed states for every embedded avatar+- **Loading:** a skeleton/shimmer in the card frame while the GLB streams (skeleton preferred over+ a spinner, per CLAUDE.md). The `.door-screenshot` frame already exists — fill it.+- **Error:** if the GLB or rig fails, show a tasteful static fallback (e.g. a poster/silhouette or+ a calm message), never an empty void or a broken canvas. Wire to the `agent-3d` error events+ from [src/element.js](../../src/element.js).+- **Reduced motion:** honor `prefers-reduced-motion` — hold a clean idle/static pose instead of+ looping motion. (The earn-viz count-up already checks this; mirror it.)++### 2. Correct, seamless playback+- Honor the clip's `loop` field from+ [public/animations/manifest.json](../../public/animations/manifest.json). `celebrate` is+ `loop:false` (one-shot) — the door card currently forces `loop:true`, which **hard-snaps** at+ the loop boundary. Either pick clips meant to loop, or play the one-shot then settle into idle+ (crossfade via `AnimationManager.crossfadeTo`). No visible snap, ever.+- Pick per-card clips that read well as a small, silent, looping thumbnail (idle/breath/wave/+ subtle gesture) — review the `LIVE_SPOTS` choices and upgrade any that read awkwardly at+ thumbnail size.++### 3. Framing & composition+- Frame each avatar so it sits centered and correctly scaled in its card (head-to-mid-thigh or+ full-body as appropriate), not tiny-and-low or cropped. Use the viewer's camera-fit/framing API+ (read [src/viewer.js](../../src/viewer.js)); if a per-embed frame hint is needed, add it through+ the existing `agent-3d` attributes rather than hard-coding magic numbers in `home.html`.+- Responsive: verify framing holds at 320px, 768px, 1440px.++### 4. Performance+- The `IntersectionObserver` already lazy-spawns on scroll-in. Extend it to **pause** rendering+ when a card scrolls out of view and **resume** on re-entry, so multiple live avatars don't burn+ GPU/CPU off-screen. Confirm the shared-context/perf budgets from the existing avatar perf work+ aren't regressed.++### 5. Make it reusable, not a one-off+- These behaviors (loading skeleton, error fallback, reduced-motion, loop-honoring, framing,+ offscreen-pause) belong to the **embed component**, not to `home.html`. Push them into+ `agent-3d` / the viewer as opt-in attributes/defaults so every embed across the site (and+ third-party embeds) benefits. `home.html` should consume the polished defaults, not reimplement+ them.++## Definition of done+- Every home-page embedded avatar enters with a skeleton, animates seamlessly (no loop snap),+ honors `prefers-reduced-motion`, is correctly framed at 320/768/1440, and pauses when offscreen.+- Error state is designed and reachable (force a bad GLB to confirm).+- The improvements live in the reusable component/viewer with sensible defaults; `home.html` just+ uses them. No magic numbers scattered in the page.+- Zero console errors/warnings; real GLB network calls succeed (Network tab checked). State the+ breakpoints and scenarios you exercised.+- `npm test` green; `npm run typecheck` green. Changelog entry (improvement: embedded avatars get+ polished loading/looping/framing). `completionist` run; findings fixed.+- Handoff note for Task 6 listing the surfaces touched.++Do not push unless the user approves (then both remotes).++<!-- AUTO:self-delete-on-complete -->++---++## ✅ On completion — delete this file++The moment every item above is **built, wired, verified, and committed**, remove it in the same+change:++```bash+git rm "prompts/avatar-animation-hardening/05-embed-and-home-avatar-ux.md"+```++Stage the deletion in the completion commit. A file that still exists is unfinished work.diff --git a/prompts/avatar-animation-hardening/06-final-qa-and-promote.md b/prompts/avatar-animation-hardening/06-final-qa-and-promote.mdnew file mode 100644index 000000000..bb7c8a0ce--- /dev/null+++ b/prompts/avatar-animation-hardening/06-final-qa-and-promote.md@@ -0,0 +1,67 @@+# Task 6 — Final QA across every avatar surface++> Read [00-README.md](./00-README.md) first. **Depends on Tasks 1–5** — read their handoff notes.+> Follow [CLAUDE.md](../../CLAUDE.md). This is the "shipped complete" gate.++Tasks 1–5 fix the math, the ingest path, the regression guard, and the embed UX. This task proves+the whole thing is production-ready end to end: every surface that renders an animated avatar is+correct, polished, and free of console errors, on a representative matrix of avatars and clips.++## What to do++### 1. Build the verification matrix+- **Avatars:** at minimum `cz.glb` (Avaturn), `michelle.glb` (Mixamo), one Ready Player Me /+ Avaturn user avatar, and one platform-generated avatar. Cover the conventions Tasks 1–4 handle.+- **Clips:** the `FEATURED` set (idle, walk, jump, wave, dance, celebrate) plus a couple of+ longer/library clips.+- **Surfaces:** the home page door/bento/hero embeds ([pages/home.html](../../pages/home.html)),+ an avatar profile page, the `/pose` studio, `/walk`, `/irl`, and a bare third-party-style+ `<agent-3d>` embed. (Confirm the surface list against Task 5's handoff.)++### 2. Exercise it for real+- `npm run dev` (port 3000). For each (avatar × surface) cell: load it, play the clip set, and+ confirm: upright, natural limb poses (Task 1), correct travel for locomotion (Task 2), seamless+ looping + designed loading/error/reduced-motion states + correct framing (Task 5), and **zero+ console errors/warnings**. Capture before/after screenshots into `reports/` or the page-audit+ tooling (`scripts/page-audit.mjs`) — do not commit scratch screenshots to the repo.+- Confirm the runtime fallen-pose guard (Task 4) stays silent on all healthy cells.+- Re-ingest one Mixamo avatar through the Task 3 path and confirm it animates with the runtime+ correction reduced to a no-op.++### 3. Close the loop+- Fix any residual jank, mis-framing, or warning you find — no "good enough."+- Verify the public changelog reads coherently for the whole initiative (the entries from Tasks+ 1–5 plus the original lying-down fix). Consolidate/clarify wording if needed; run+ `npm run build:pages` to revalidate.+- Run the full `npm test` suite and `npm run typecheck`. Run the `completionist` subagent over the+ cumulative diff of the initiative; fix everything it flags.++## Definition of done+- The full avatar × clip × surface matrix verified in a real browser with zero console+ errors/warnings; before/after evidence captured (not committed as scratch).+- Locomotion, limb fidelity, framing, state design, reduced-motion, and offscreen-pause all+ confirmed on every surface. Fallen-pose guard silent on healthy rigs.+- A re-ingested Mixamo avatar confirmed needing no runtime correction.+- `npm test` + `npm run typecheck` green; changelog coherent and validated.+- `completionist` clean. Final summary written: what's covered, any known limitations, and the+ recommended catalog-backfill follow-up (from Task 3) if applicable.++When the user approves the push, push to **both** remotes (`git push threeD main` &&+`git push threews main`). Never pull/fetch from `threeD`.++<!-- AUTO:self-delete-on-complete -->++---++## ✅ On completion — delete this file++When the whole initiative is verified, committed, and (if approved) pushed, remove this file and+the now-empty backlog:++```bash+git rm "prompts/avatar-animation-hardening/06-final-qa-and-promote.md"+# If 00-README.md and all NN-*.md tasks are gone, remove the README + dir too:+git rm "prompts/avatar-animation-hardening/00-README.md"+```++A backlog file that still exists is unfinished work; a directory that is gone has shipped.diff --git a/tasks/agent-wallet-trading/07-graduated-position-amm-exit.md b/tasks/agent-wallet-trading/07-graduated-position-amm-exit.mdnew file mode 100644index 000000000..69924e6de--- /dev/null+++ b/tasks/agent-wallet-trading/07-graduated-position-amm-exit.md@@ -0,0 +1,96 @@+# Task: Automatic AMM exit for graduated positions++## Context++When a sniped (or discretionary) position's coin **graduates** off the pump.fun+bonding curve onto the AMM, the current sell path throws `CoinGraduatedError`,+which the executor catches and parks the position: it marks+`error='graduated:awaiting_amm_exit'`, `exit_reason='graduated'`, and leaves it+open indefinitely (`workers/agent-sniper/executor.js:161`). The README flags this+as a known fast-follow. Result: a winning position can become unsellable through+the automated path and sit stuck — unacceptable for "zero error, production ready,"+since real user funds are trapped in an open position with no automatic exit.++The instruction builders already understand both venues: bonding-curve and AMM+(`api/_lib/pump-swap-ix.js`, `api/_lib/pump.js`). What's missing is the executor+detecting graduation and routing the sell through the AMM pool instead of giving up.++## Goal++A position whose coin has graduated is sold automatically through the pump AMM+pool — no position parks in `awaiting_amm_exit`. Exit rules (stop-loss/trailing/+take-profit/timeout) continue to apply post-graduation. The discretionary trade+endpoint (task 03) routes graduated sells the same way.++## Files to Read First++- `workers/agent-sniper/executor.js:140-206` — `executeSell`, the+ `CoinGraduatedError` catch (`:161`), how positions are marked + PnL recorded+- `workers/agent-sniper/positions.js:20-96` — position sweep, re-quote, exit triggers+- `api/_lib/pump.js:130` + `api/_lib/pump-swap-ix.js` — buy/sell builders; confirm+ which already target the AMM (`pump-swap` / pool) vs bonding curve+- `workers/agent-sniper/trade-client.js:29` — `signAndSend` (venue-agnostic submit)+- `@pump-fun/pump-swap-sdk` usage anywhere in the repo (the AMM-side SDK)+- Task 03's shared guardrail module (graduated sells must pass the same guards)+- `api/pump/[action].js` sell-prep/confirm — how the user-driven path already+ handles post-graduation AMM sells (reuse that logic, don't reinvent)++## What to Build / Do++1. **Detect graduation deterministically** — before/within `executeSell`, determine+ whether the mint is on the bonding curve or graduated to the AMM (via the SDK /+ on-chain pool lookup), instead of relying on a thrown error mid-flight. Keep the+ `CoinGraduatedError` catch as a backstop.+2. **AMM exit path** — build and sign the sell against the AMM pool+ (`@pump-fun/pump-swap-sdk` / `pump-swap-ix`), with slippage protection and the+ same `signAndSend` submission. Quote from the pool for the exit price.+3. **Unify the sweep** — `runPositionSweep` must re-quote graduated positions from+ the AMM pool (not the dead bonding curve) so stop-loss / trailing / take-profit /+ timeout still fire and PnL is computed against the real post-graduation price.+4. **Backfill parked positions** — provide a re-runnable path (sweep handles them, or+ a one-shot script under `scripts/`) that picks up existing+ `error='graduated:awaiting_amm_exit'` positions and exits them via the AMM. No+ position should remain parked after this ships.+5. **Wire task 03** — the discretionary `POST /api/agents/:id/trade` sell uses the+ same graduation detection + AMM routing (via the shared builders), so a manual+ sell of a graduated coin also works.+6. **Clear the error semantics** — on successful AMM exit, clear the stale+ `error`/`exit_reason='graduated'` and record the real realized PnL + signature.++## Constraints++- Real AMM quotes + real submission; honor `SNIPER_MODE=simulate` for tests (paper+ exit), live by default. No fabricated exit fills.+- Graduated sells pass the same guardrails (task 03 shared module) as any other+ trade — price-impact breaker especially matters on thin pools.+- Idempotent: re-running the sweep/backfill must not double-sell or double-record.+- Don't regress bonding-curve exits; the common case must still work unchanged.+- Errors handled at the boundary; a failed AMM exit retries with backoff and alerts+ (task 05 alerting) rather than silently re-parking.++## Success Criteria++- On devnet, a position whose coin graduates is sold automatically through the AMM;+ the position closes with real realized PnL + a confirmed signature, not parked.+- `runPositionSweep` re-quotes graduated positions from the AMM and still fires+ stop-loss/trailing/take-profit/timeout.+- The backfill clears all pre-existing `awaiting_amm_exit` positions (verified: zero+ remain).+- The discretionary sell endpoint (task 03) sells a graduated coin correctly.+- Sniper unit tests still pass; new tests cover graduation detection + AMM exit.+- `npm run typecheck` + `npm test` clean. Changelog entry (tag: fix). Run the+ **completionist** subagent on changed files.++<!-- AUTO:self-delete-on-complete -->++---++## ✅ On completion — delete this file++This file is a unit of work, not a permanent doc. The moment every item above is **built, wired, verified, and committed** to the "Definition of done" in the repo-root `CLAUDE.md`, remove it in the same change:++```bash+git rm "tasks/agent-wallet-trading/07-graduated-position-amm-exit.md"+```++Stage the deletion alongside your implementation and include it in the completion commit. This directory is the backlog: a file that still exists is unfinished work; a file that is gone has shipped. Do not delete early, and never leave a completed prompt behind.diff --git a/tasks/agent-wallet-trading/08-x402-per-agent-pay.md b/tasks/agent-wallet-trading/08-x402-per-agent-pay.mdnew file mode 100644index 000000000..2b78c3e04--- /dev/null+++ b/tasks/agent-wallet-trading/08-x402-per-agent-pay.md@@ -0,0 +1,110 @@+# Task: x402 — default to the agent's own wallet + in-product pay affordance & activity++## Context++x402 payments are real: `api/x402-pay.js` negotiates payment requirements+(`api/_lib/x402-spec.js`), builds a Solana USDC payment payload+(`buildSolanaPaymentPayload`, `:320`), signs, and submits. There are two wallet+paths:++- **Per-agent** (`:179` `loadAgentKeypairForUser(agentId, userId)`,+ `:611` routing) — pays from `agent_identities.meta.encrypted_solana_secret` when+ an `agentId` is supplied + authenticated.+- **Platform fallback** (`:266` `loadAgentKeypair()` reading+ `X402_AGENT_SOLANA_SECRET_BASE58`, `:619`) — a **single shared platform wallet**+ used when no `agentId` is passed.++Asset is Solana USDC (`X402_ASSET_MINT_SOLANA`, `:263`). Two problems for the+"each avatar pays from its own wallet" vision: (1) anything that omits `agentId`+silently spends the shared platform wallet instead of the agent's; (2) there is no+in-product affordance for an agent to discover + pay an x402 service from its own+wallet, and no payment activity surfaced in the wallet hub.++Known trap (memory `in-app-x402-import-src-not-dist`): in-app imports of the local+x402-fetch package must use the committed `src/index.js`; `dist/` is gitignored and+404s in Vercel, silently breaking the pay flow.++## Goal++When an agent context is present, x402 payments default to **that agent's own+wallet** (the shared platform wallet becomes an explicit, narrow fallback only).+The wallet hub's **Pay** tab lets the owner find an x402 service (bazaar) and pay it+from the agent wallet, with the payment recorded and shown in activity.++## Files to Read First++- `api/x402-pay.js:179-192` (per-agent load), `:266-308` (platform load),+ `:609-623` (routing), `:320-371` (Solana payload), `:263` (asset mint)+- `api/_lib/x402-spec.js` — payment-requirements negotiation+- `api/_lib/agent-wallet.js:419` — `recoverSolanaAgentKeypair` (the only decrypt path)+- The x402-fetch package import sites — confirm they use `src/` not `dist/`+ (memory `in-app-x402-import-src-not-dist`); the `/irl` pay flow (`src/irl.js`) as a+ working in-app pay precedent+- `search-for-service` / `pay-for-service` / `x402` skills + bazaar search path — the+ discovery surface to reuse+- Task 01 hub shell (Pay tab), `…/solana/activity` for payment history++## What to Build / Do++1. **Default to per-agent.** In `api/x402-pay.js` routing (`:609`), when the request+ carries an agent context (authenticated owner + `agentId`, or the wallet hub+ context), pay from the agent's own wallet via `loadAgentKeypairForUser`. The+ shared `X402_AGENT_SOLANA_SECRET_BASE58` path becomes an explicit fallback used+ only for platform-level/demo calls with no agent — and that case is logged so a+ missing-agentId regression is visible, not silent. Don't break existing callers;+ make the agent path the default when context exists.+2. **Pay tab in the wallet hub** (shell from task 01):+ - Service discovery via the existing bazaar search (`search-for-service` path) —+ browse/search x402 endpoints.+ - A pay action that, for a chosen endpoint, fetches payment requirements+ (`x402-spec`), shows the price (USDC) + what's being bought, and on confirm pays+ **from the agent wallet** via `api/x402-pay.js`, streaming progress (the SSE+ path already exists).+ - Show the result + receipt (settlement/tx reference) and refresh balance.+3. **Payment activity.** Surface the agent's x402 payment history in the hub+ (extend `…/solana/activity` or add an x402 ledger read) so spend is auditable —+ what was paid, to whom, for what, when.+4. **Funding-aware.** USDC funding differs from SOL; if the agent lacks USDC for a+ payment, show a clear state and route to funding (deposit panel / fund skill).+ Don't attempt a payment that will fail for lack of balance.++## Constraints++- Agent keypair decrypted only via `recoverSolanaAgentKeypair`, server-side, after+ auth + ownership, audit-logged. No secret in responses/logs.+- Use the committed `src/` x402-fetch import, never `dist/` (it 404s in prod).+- Real x402 negotiation + settlement on Solana USDC. No simulated payments; the+ receipt reflects a real settlement.+- The shared platform wallet must not be spent on an agent's behalf when an agent+ context exists — verify the routing with a test.+- Errors at the boundary (no requirements, insufficient USDC, settlement failure)+ surface as designed, recoverable states. Owner-only pay controls.+- Coin/asset copy stays $THREE-only where the platform's own token is referenced;+ the x402 asset is USDC by protocol and is fine to name as the payment unit.++## Success Criteria++- With an agent context, an x402 payment is signed + settled from **that agent's**+ wallet (verified on devnet/testnet: the agent's balance decreases, not the+ platform wallet's).+- A missing-agentId platform fallback is logged, not silent.+- `npm run dev`: from the Pay tab, find a bazaar service, view its price, pay from+ the agent wallet, and see the receipt + updated balance + activity entry.+- Insufficient-USDC and settlement-error states render and route to funding.+- Import uses `src/` (grep confirms no `dist/` x402-fetch import). `npm run+ typecheck` + `npm test` clean.+- Changelog entry (tag: feature). Run the **completionist** subagent on changed files.++<!-- AUTO:self-delete-on-complete -->++---++## ✅ On completion — delete this file++This file is a unit of work, not a permanent doc. The moment every item above is **built, wired, verified, and committed** to the "Definition of done" in the repo-root `CLAUDE.md`, remove it in the same change:++```bash+git rm "tasks/agent-wallet-trading/08-x402-per-agent-pay.md"+```++Stage the deletion alongside your implementation and include it in the completion commit. This directory is the backlog: a file that still exists is unfinished work; a file that is gone has shipped. Do not delete early, and never leave a completed prompt behind.diff --git a/tasks/ibm-x402-demo/04-ux-polish-and-motion.md b/tasks/ibm-x402-demo/04-ux-polish-and-motion.mdnew file mode 100644index 000000000..775f4ad80--- /dev/null+++ b/tasks/ibm-x402-demo/04-ux-polish-and-motion.md@@ -0,0 +1,64 @@+# Task 04 — UX polish, microinteractions & motion++## Context++three.ws workspace at `/workspaces/three.ws`. Deliverable + verified facts:+[00-PLAN.md](00-PLAN.md). The page is [`pages/ibm/x402-demo.html`](../../pages/ibm/x402-demo.html).++The page already follows IBM Carbon (Plex, `#0f62fe`, restrained borders). This task raises it+to "screenshot-worthy" without betraying Carbon's restraint. The bar: a senior designer at IBM+would approve it, and a developer would screenshot the success state. Run **after** task 03 so+the states you're polishing are final.++## Do this++1. **Skeleton, not "resolving…".** Replace the plain-text loading line in the 402 preview with a+ tasteful shimmer/skeleton of the rows it will fill, so first paint feels intentional.+2. **Success reveal.** When a payment settles, animate the result panel in (fade + slight rise),+ and draw/scale-in the green check. Make it feel like a confirmation, not a DOM swap.+3. **Button states.** The pay button needs distinct, polished hover / active / focus-visible /+ disabled / in-flight (inline spinner + "Waiting for wallet…") states. Same care for the+ ticker input (focus underline is started — refine) and the copy button.+4. **Live 402 preview as a feature, not a footnote.** It is the "aha" of the demo — the server+ literally quoting a price. Give it subtle emphasis (the green status dot is there; consider a+ one-time pulse when it first resolves) and make the price tag and preview update feel linked+ when the ticker changes (debounced re-fetch already exists — animate the value change).+5. **Motion discipline.** All transitions on `opacity`/`transform` only, 120–220ms, ease-out.+ Honor `@media (prefers-reduced-motion: reduce)` — disable non-essential motion entirely.+6. **Dark mode.** The widget modal already supports `prefers-color-scheme: dark`. Add a matching+ dark theme to the page so it looks deliberate when embedded in a dark IBM context. Keep the+ transparent-background behavior (the page sits on a host background) working in both schemes.+7. **Spacing & rhythm.** Audit vertical rhythm, consistent use of the CSS custom properties+ already defined, and the hierarchy of the three sections (hero → demo → embed). Tighten any+ spacing that feels arbitrary.+8. **Empty/idle copy.** The idle result panel should invite action, and the "how it works" strip+ should read as a 10-second explainer. Refine wording with task 08, but get the layout/visual+ weight right here.++## Method++- `npx http-server pages/ibm -p 8088`, exercise idle → preview → loading → success → error in+ both light and dark, with and without reduced-motion.+- Test at desktop width here; task 05 owns the responsive pass — don't regress it.++## Definition of done++- Loading uses a skeleton; success animates in; the check is satisfying.+- Every interactive element has polished hover / active / focus-visible / disabled states.+- Full light + dark theming; transparent host background preserved in both.+- All motion is transform/opacity, reduced-motion-aware, never janky.+- Looks like something a senior IBM designer signs off on. No console errors. Run the+ **completionist** subagent.++<!-- AUTO:self-delete-on-complete -->++---++## ✅ On completion — delete this file++```bash+git rm "tasks/ibm-x402-demo/04-ux-polish-and-motion.md"+```++Stage the deletion in the same commit as the implementation. A file that still exists is+unfinished work; a file that is gone has shipped. Do not delete early.diff --git a/tasks/ibm-x402-demo/05-responsive-and-mobile-wallets.md b/tasks/ibm-x402-demo/05-responsive-and-mobile-wallets.mdnew file mode 100644index 000000000..336b448b8--- /dev/null+++ b/tasks/ibm-x402-demo/05-responsive-and-mobile-wallets.md@@ -0,0 +1,65 @@+# Task 05 — Responsive (320 / 768 / 1440) + mobile in-wallet browsers++## Context++three.ws workspace at `/workspaces/three.ws`. Deliverable + verified facts:+[00-PLAN.md](00-PLAN.md). The page is [`pages/ibm/x402-demo.html`](../../pages/ibm/x402-demo.html).+Run **after** task 04 (consume its tokens/states; don't regress them).++Two jobs: flawless layout at every width, and correct behavior in the **mobile wallet+reality** — on phones, `window.ethereum` / `window.solana` only exist inside a wallet's in-app+browser, not in mobile Safari/Chrome.++## Layout — test at 320 / 768 / 1440++1. **No horizontal overflow at 320px.** Watch the long mono strings (payTo addresses, tx+ hashes, contract addresses) — they must wrap/ellipsize, not push the layout wide. The repo+ has a documented iOS gotcha: clipped horizontal overflow forces a desktop-width layout+ viewport and breaks `@media`. Verify none of that here.+2. **The 3-up "how it works" strip** collapses to one column cleanly.+3. **The demo card head** (title + price tag) stacks sensibly; the price stays legible.+4. **The field row** (ticker input + pay button) stacks on narrow screens with the button going+ full-width (started — verify and refine). Tap targets ≥ 44×44px.+5. **The receipt grid** and **matches list** reflow without overlap; the raw-JSON `<pre>`+ scrolls horizontally inside its box rather than blowing out the page.+6. **The dark code block** (embed snippet) scrolls internally; never causes page overflow.+7. Use the existing `clamp()`/grid/flex patterns; avoid fixed px widths.++## Mobile wallet behavior++8. On **mobile Safari / Chrome with no injected wallet**, the widget shows "not detected". The+ page must make the next step obvious — add concise guidance: "On mobile, open this page+ inside your MetaMask or Phantom browser to pay." Keep the 402 preview fully functional there+ (read-only) so the demo still communicates even without a wallet.+9. Inside the **MetaMask mobile in-app browser** (Base) and **Phantom mobile in-app browser**+ (Solana), confirm the full pay flow is reachable and the modal is usable on a small screen+ (the widget renders as a bottom-style sheet on mobile — verify it isn't clipped).+10. Confirm wallet approval round-trips work in the in-app browser (these are the most common+ real-world mobile path for x402 demos).++## Method++- `npx http-server pages/ibm -p 8088`; DevTools device toolbar at 320 / 360 / 768 / 1024 / 1440.+- Then a **real phone**: open via the wallet in-app browsers. (If a real device is unavailable,+ document that the in-app-browser legs are unverified and recommend task 07 cover them.)++## Definition of done++- No overflow / overlap / unreadable text at 320 / 768 / 1440. Tap targets ≥ 44px.+- Long addresses/hashes wrap or ellipsize; no element forces a wide viewport.+- Mobile-without-wallet shows clear guidance and a working read-only preview.+- Pay flow verified (or explicitly flagged unverified) inside MetaMask & Phantom mobile+ browsers. No console errors at any width. Run the **completionist** subagent.++<!-- AUTO:self-delete-on-complete -->++---++## ✅ On completion — delete this file++```bash+git rm "tasks/ibm-x402-demo/05-responsive-and-mobile-wallets.md"+```++Stage the deletion in the same commit as the implementation. A file that still exists is+unfinished work; a file that is gone has shipped. Do not delete early.diff --git a/tasks/ibm-x402-demo/06-accessibility-pass.md b/tasks/ibm-x402-demo/06-accessibility-pass.mdnew file mode 100644index 000000000..b314d265d--- /dev/null+++ b/tasks/ibm-x402-demo/06-accessibility-pass.md@@ -0,0 +1,65 @@+# Task 06 — Accessibility pass (WCAG 2.1 AA)++## Context++three.ws workspace at `/workspaces/three.ws`. Deliverable + verified facts:+[00-PLAN.md](00-PLAN.md). The page is [`pages/ibm/x402-demo.html`](../../pages/ibm/x402-demo.html).+Run **after** task 04/05 so you're auditing the final markup. An IBM-hosted page must meet+IBM's own accessibility bar — target **WCAG 2.1 AA**.++## Do this++1. **Semantics & landmarks.** Wrap content in real landmarks (`header`/`main`/`footer`),+ single logical `h1`, correct heading order (no skipped levels). The "how it works" steps+ should be a list; the receipt should be readable as labelled pairs.+2. **The live regions.** The 402 preview and the result panel update asynchronously — they must+ announce. Confirm the preview is `aria-live="polite"` and the result is `role="status"` /+ `aria-live="polite"` (started). Make sure the success and each error state produce a sensible+ spoken announcement (not a wall of mono text).+3. **Form labelling.** The ticker `<input>` has a visible `<label>` and an+ `aria-describedby` hint (started) — verify, and ensure the inline validation error is+ associated (`aria-invalid` + `aria-describedby`) and announced.+4. **Keyboard.** Everything operable without a mouse: Tab order is logical, the pay button and+ retry are reachable and activate on Enter/Space, Enter in the ticker field runs the call+ (started), the `<details>` raw-JSON disclosure toggles via keyboard, the copy button works.+5. **Focus management across the modal.** The widget opens a modal via `window.X402.pay()`. Verify+ focus moves into the modal on open and **returns to `#payBtn` on close/cancel**. If the widget+ doesn't restore focus, compensate on the page (capture the trigger, restore focus when the+ `pay()` promise settles). Ensure no focus is lost to `document.body`.+6. **Visible focus.** Every interactive element needs a clear `:focus-visible` ring that meets+ contrast — don't rely on the browser default being removed by the reset.+7. **Contrast.** Check all text against its background in **both light and dark** themes: the+ muted/subtle greys, the blue links/buttons, the pills (ok/warn/bad), the dark code block, and+ the price tag. All ≥ 4.5:1 for body text, ≥ 3:1 for large text/UI. Fix any that fail —+ Carbon's tokens are AA-safe; custom greys may not be.+8. **Non-color signals.** The availability pill (available/close/taken) must not rely on color+ alone — keep the text label (it does) and ensure the status dot has a text equivalent.+9. **Reduced motion** (from task 04) respected. **Zoom** to 200% without loss of content/function.++## Method++- Run an automated pass (axe DevTools or `npx @axe-core/cli http://localhost:8088/x402-demo.html`)+ — zero serious/critical violations.+- Then a manual keyboard-only walkthrough and a screen-reader pass (VoiceOver or NVDA): load →+ hear the price → run → hear the result; trigger an error → hear it.++## Definition of done++- Zero serious/critical axe violations in light and dark.+- Full keyboard operability; focus enters the modal and returns to the trigger on close.+- All contrast ratios pass AA in both themes; status is never color-only.+- Live regions announce price, success, and errors. 200% zoom is usable. No console errors.+ Run the **completionist** subagent.++<!-- AUTO:self-delete-on-complete -->++---++## ✅ On completion — delete this file++```bash+git rm "tasks/ibm-x402-demo/06-accessibility-pass.md"+```++Stage the deletion in the same commit as the implementation. A file that still exists is+unfinished work; a file that is gone has shipped. Do not delete early.diff --git a/tasks/ibm-x402-demo/07-cross-browser-device-matrix.md b/tasks/ibm-x402-demo/07-cross-browser-device-matrix.mdnew file mode 100644index 000000000..8896ef253--- /dev/null+++ b/tasks/ibm-x402-demo/07-cross-browser-device-matrix.md@@ -0,0 +1,65 @@+# Task 07 — Cross-browser / device matrix++## Context++three.ws workspace at `/workspaces/three.ws`. Deliverable + verified facts:+[00-PLAN.md](00-PLAN.md). The page is [`pages/ibm/x402-demo.html`](../../pages/ibm/x402-demo.html).++Layout (task 05) and a11y (task 06) are done; this task proves the page behaves across the+real browser/engine matrix — especially the parts that only break on specific engines (wallet+injection, font loading, the iOS layout-viewport gotcha). Mostly a **verification** task: fix+only defects you find, and serialize any fix with the editing tasks.++## Matrix++Desktop: **Chrome, Edge, Firefox, Safari**. Mobile: **iOS Safari, Android Chrome**, plus the+**MetaMask** and **Phantom** in-app browsers (the realistic mobile pay path). For each cell+check:++1. Page renders correctly; self-hosted fonts load (no FOUT/FOIT, no Google Fonts request).+2. The **402 preview** populates with the live price/networks.+3. The pay flow is reachable; the wallet modal opens and is usable.+4. **Zero console errors / warnings.**+5. No layout breakage; no horizontal overflow.++## Known engine-specific watch-items++- **iOS Safari:** the documented repo gotcha — a clipped horizontal overflow forces a+ desktop-width layout viewport so `@media` breakpoints stop firing, and a bare element+ selector (e.g. `footer{}`) can leak `display`/layout. Confirm neither happens here. Test on a+ real device or the iOS Simulator — headless Chromium/WebKit does **not** reproduce it.+- **Safari/WebKit:** `backdrop-filter`, `:focus-visible`, and `dvh`/`clamp()` support; the+ widget's modal uses `backdrop-filter` (has `-webkit-` prefix — confirm).+- **Firefox:** no wallet-injection assumptions that only hold in Chromium; EIP-1193/Solana+ provider detection still works.+- **In-app wallet browsers:** the most likely real audience path. Confirm Base pays in MetaMask+ mobile and Solana pays in Phantom mobile (overlaps task 05 — coordinate, don't duplicate the+ fix).++## Output (required)++A matrix report (browser/device × the 5 checks) with `PASS` / `FAIL` / `N/A` and a note per+failure. Save it to `~/.claude/ibm-x402-verify/browser-matrix.md` and report the summary to the+user. If a cell can't be tested (no device available), mark it `UNTESTED` — never `PASS` by+assumption.++## Definition of done++- Every desktop cell `PASS`. Mobile + in-app-wallet cells `PASS` or honestly `UNTESTED` with a+ reason (never assumed).+- No iOS layout-viewport regression; fonts load self-hosted everywhere.+- Any defect found is fixed, committed, and re-verified. Matrix report written. Run the+ **completionist** subagent if you changed code.++<!-- AUTO:self-delete-on-complete -->++---++## ✅ On completion — delete this file++```bash+git rm "tasks/ibm-x402-demo/07-cross-browser-device-matrix.md"+```++Stage the deletion in the same commit as any fix (or on its own if verification-only). A file+that still exists is unfinished work; a file that is gone has shipped. Do not delete early.diff --git a/tasks/ibm-x402-demo/08-copy-brand-compliance.md b/tasks/ibm-x402-demo/08-copy-brand-compliance.mdnew file mode 100644index 000000000..60fdf7a26--- /dev/null+++ b/tasks/ibm-x402-demo/08-copy-brand-compliance.md@@ -0,0 +1,69 @@+# Task 08 — Copy, brand & $THREE-compliance review++## Context++three.ws workspace at `/workspaces/three.ws`. Deliverable + verified facts:+[00-PLAN.md](00-PLAN.md). The page is [`pages/ibm/x402-demo.html`](../../pages/ibm/x402-demo.html).++This page represents both three.ws and IBM. Every word must be accurate, enterprise-clear, and+compliant. Mind the repo's public-copy rule: professional and literal ("3D AI agents", "pay-per-call+API"), never sci-fi metaphor.++## Do this++1. **Technical accuracy.** Verify the x402 explanation is correct and crisp: HTTP `402` →+ machine-readable payment terms → signed stablecoin authorization → retry with `X-PAYMENT` →+ on-chain settlement. No overclaiming ("instant", "free", "no fees" — the network fee is+ sponsored, not nonexistent; say so precisely).+2. **Honesty about real money.** The page must be unambiguous that this spends **real USDC on+ mainnet** (a tenth of a cent) and needs a funded wallet. No dark patterns. The existing note+ is a good start — tighten it.+3. **IBM brand correctness.** The inline IBM mark is a placeholder `<rect>+text` SVG. Replace it+ with a correct treatment (the proper 8-bar IBM logo, or a clean wordmark) and confirm+ "IBM Business Partner" usage matches IBM's brand guidelines (lockup, spacing, the relationship+ wording). If unsure of exact rights, use a neutral, defensible treatment and flag it for the+ user to confirm with IBM. Use IBM Plex + Carbon blue `#0f62fe` (already in place).+4. **$THREE compliance (hard rule).** `$THREE` must be the **only** coin referenced anywhere on+ the page — copy, examples, metadata, comments. The footer line is present; keep it.+ - The default ticker `GRANITE` is IBM's model family, **not a coin** — fine.+ - The `symbol-availability` endpoint can surface real launched tickers at runtime in+ `similar[]` (the allowed launch-directory exception). Decide whether arbitrary+ user-launched tickers appearing on an IBM page is desirable. If not, prefer ticker inputs+ (like `GRANITE`) that return clean/empty results, and ensure nothing in **static** copy+ names another coin.+5. **Endpoint-narrative decision.** `symbol-availability` is pump.fun-flavored. Evaluate whether+ to keep it or swap to a cleaner enterprise data call (e.g. `/api/x402/skill-marketplace`,+ also $0.001 — "query the agent-skill marketplace"). **If you swap:** the price tag + 402+ preview are endpoint-agnostic, but the result-body renderer is symbol-availability-shaped, so+ update the renderer to the new response schema and re-verify with task 01's flow. Record the+ decision and rationale in the completion report. (Default: keep `symbol-availability` unless+ the enterprise narrative clearly improves — don't churn without reason.)+6. **Plain-language & scannability.** Headlines, the 3-step strip, button label, empty/idle copy,+ error copy (coordinate with task 03). Read it as a first-time enterprise visitor who has never+ heard of x402 — does each section land in seconds?+7. **Links & metadata.** Every link resolves (docs, bazaar, changelog). `<title>`,+ `meta description`, and any OG tags are accurate and partnership-appropriate.++## Definition of done++- Copy is accurate, professional, literal, and honest about real-money spend; no overclaiming,+ no metaphor.+- IBM brand treatment is correct (or a defensible neutral treatment flagged for IBM sign-off).+- `$THREE` is the only coin anywhere on the page; static copy names no other coin.+- The endpoint-narrative decision is made and recorded; if swapped, the renderer is updated and+ re-verified.+- All links resolve; title/description/OG accurate. No console errors. Run the **completionist**+ subagent.++<!-- AUTO:self-delete-on-complete -->++---++## ✅ On completion — delete this file++```bash+git rm "tasks/ibm-x402-demo/08-copy-brand-compliance.md"+```++Stage the deletion in the same commit as the implementation. A file that still exists is+unfinished work; a file that is gone has shipped. Do not delete early.diff --git a/tasks/irl-floor-anchor/06-ios-nonwebxr-parity.md b/tasks/irl-floor-anchor/06-ios-nonwebxr-parity.mdnew file mode 100644index 000000000..bef5413b9--- /dev/null+++ b/tasks/irl-floor-anchor/06-ios-nonwebxr-parity.md@@ -0,0 +1,101 @@+# 06 — iOS / non-WebXR parity (AR placement everywhere)++> Epic IRL/floor-anchor · Size **L** · Depends on 01/02/05 being stable.+> The biggest reach gap: today half of mobile (iOS Safari) has no AR placement.++## Goal++Give iOS Safari and other non-WebXR devices the best floor-placement experience+their platform allows — not just the compass+GPS fallback — so "Place on floor"+isn't an Android-only feature. The end state: every modern phone can place an agent+on a real floor surface, and any device that truly can't gets a polished, honest,+non-dead-end alternative.++## Why it matters++iOS Safari has no `immersive-ar`, so `detectFloorAnchorSupport`+([src/irl.js:1542-1550](../../src/irl.js#L1542-L1550)) hides the button entirely+and iPhone users fall back to the gyro+GPS "Pin here" path with no real surface+detection. That's the majority of premium mobile users getting the lesser+experience. Snapchat's equivalent works on iOS via ARKit; our parity story is the+difference between "works on my phone" and "works."++## Current state (real lines)++- Support gate: [src/irl.js:1542-1550](../../src/irl.js#L1542-L1550) — `isSupported()`+ false on iOS ⇒ button stays `hidden`; only the gyro+GPS Pin path remains.+- `WebXRSession.isSupported` probes `navigator.xr.isSessionSupported('immersive-ar')`+ ([src/ar/webxr.js:77-83](../../src/ar/webxr.js#L77-L83)) — always false in iOS Safari.+- The persistence layer is transport-agnostic: any path that yields+ `{ position, quaternion }` can reuse `onFloorAnchored` / `persistFloorAnchor`+ ([src/irl.js:1640-1686](../../src/irl.js#L1640-L1686)) and task 01's module — so a+ new AR backend only needs to produce a floor pose.++## Decision (evaluate, then commit in the task)++Pick the iOS surface-placement backend. Options, with the honest trade-offs:++1. **`<model-viewer>` AR / AR Quick Look (USDZ)** — *free, native, zero-key.* iOS+ ARKit Quick Look places a model on a detected plane. Limitation: it's a separate+ system AR viewer, not our live canvas — it can *place and view* but doesn't feed a+ pose back for our GPS-pin persistence. Best as a "view your agent in your room"+ path; weaker for our shareable-pin model. **Recommended first ship** because it's+ free and genuinely useful on iOS today.+2. **WebXR Viewer app / WebXR polyfill** — only works for users who install Mozilla's+ WebXR Viewer; not a mainstream answer. Skip as a primary.+3. **8th Wall / commercial WebAR SLAM** — *true in-canvas surface placement on iOS+ Safari with pose callbacks*, fully matches our persistence model and UX. Cost: a+ paid SDK + API key + attribution. This is the only option that achieves full+ feature parity (live placement → shareable GPS pin) on iOS. **Recommended target**+ if the product wants real parity and the budget exists — flag the key/cost as a+ decision for the user, do not hardcode a placeholder.++Default plan: ship (1) now for an honest iOS AR experience, and scope (3) behind a+config flag + key so it lights up the moment the credential exists — never a+half-wired stub in between.++## What to build++1. **Capability detection.** Replace the binary WebXR gate with a small resolver+ `src/ar/placement-capability.js` → `'webxr' | 'quicklook' | 'pin'`, choosing the+ richest path the device supports. `detectFloorAnchorSupport` consumes it and shows+ the button (relabeled appropriately) for *both* webxr and quicklook, not just webxr.++2. **iOS path (model-viewer / Quick Look).** Generate/serve a USDZ (or reuse an+ existing GLB→USDZ path if one exists in the repo — search before adding) and wire+ an AR Quick Look launch from the same button. Clearly framed: on iOS the button+ places-and-views in your room; persistence falls back to the gyro+GPS pin with the+ user's confirmed spot. No silent feature gap — the copy states what each platform does.++3. **(Flagged) 8th Wall path.** If pursuing parity: behind `IRL_WEBAR_PROVIDER` ++ key, mount the SLAM session, surface a hit-test reticle matching task 04, and on+ tap emit `{ position, quaternion }` into the *existing* `onFloorAnchored` so+ persistence, occlusion, and UX are shared with the WebXR path. Zero duplicated+ persistence logic.++4. **Unified copy + states.** One mental model across platforms: "Place on floor"+ everywhere, with per-capability hint text. The unsupported-everywhere case keeps+ the existing Pin path with a clear "AR placement isn't available on this+ device — pin with compass + GPS instead."++## Acceptance checklist++- [ ] iOS Safari shows a working AR placement entry (not a hidden button).+- [ ] Capability resolver picks the richest path per device; Android WebXR+ unchanged; true-legacy devices keep the Pin path with honest copy.+- [ ] Any in-canvas backend reuses `onFloorAnchored`/`persistFloorAnchor` — no+ second persistence path.+- [ ] Commercial-SDK path (if built) is fully behind a key/flag — no stub, no dead+ UI when the key is absent; surface the key need to the user as a decision.+- [ ] Copy makes each platform's behavior clear; no console errors on any path.++## Out of scope++Re-implementing SLAM ourselves. The pin-persistence schema (unchanged). Occlusion+on the iOS path beyond what the chosen backend provides natively.++## Verify++Real iPhone (Safari): tap Place on floor → ARKit places the agent on a real plane.+Android (WebXR): unchanged full path. A device with neither: Pin path with the+honest fallback copy. Confirm no path throws and the button is never a dead end.diff --git a/tasks/irl-floor-anchor/07-verification-harness-and-signoff.md b/tasks/irl-floor-anchor/07-verification-harness-and-signoff.mdnew file mode 100644index 000000000..cb3abe48a--- /dev/null+++ b/tasks/irl-floor-anchor/07-verification-harness-and-signoff.md@@ -0,0 +1,90 @@+# 07 — Verification harness + final sign-off++> Epic IRL/floor-anchor · Size **M** · Run last.+> Makes the whole feature provable without a phone, then closes the epic.++## Goal++Build a repeatable way to exercise the floor-anchor flow without physical AR+hardware, use it to verify every prior task, and complete the Definition-of-Done:+clean console across all states, passing tests, a changelog entry, and a written+record of what was confirmed on real hardware versus the harness.++## Why it matters++WebXR can't be driven by the normal headless browser, so without a harness this+feature is only ever "tested on my one Android phone" — which means regressions+ship invisibly. A fake-XR harness turns the session lifecycle and pose math into+something CI and any agent can assert against, and it's the only honest way to+claim "zero error" without hand-waving.++## Current state (real lines)++- The session is structured for injection: `WebXRSession` takes a `viewer` shim and+ callbacks ([src/ar/webxr.js:32-75](../../src/ar/webxr.js#L32-L75)); the IRL host+ builds that shim explicitly ([src/irl.js:1512-1525](../../src/irl.js#L1512-L1525)).+ Hit results flow through `frame.getHitTestResults` / `getPose`+ ([src/ar/webxr.js:165-197](../../src/ar/webxr.js#L165-L197)) — all fakeable.+- Pure math from task 01 (`src/irl/floor-anchor.js`) is already unit-testable.+- Existing patterns to mirror: server test+ [tests/api/irl-pins-anchor-pose.test.js](../../tests/api/irl-pins-anchor-pose.test.js),+ pure-module test [tests/irl-room-anchor.test.js](../../tests/irl-room-anchor.test.js),+ and the headless-Playwright recipe noted in the IRL perf memory.++## What to build++1. **Fake-XR harness** — `tests/helpers/fake-xr.js`: minimal stand-ins for+ `XRSession`, `XRFrame`, `XRHitTestResult`, `XRReferenceSpace`, and `XRAnchor` that+ let a test:+ - feed a scripted sequence of hit poses (no-hit → hit at a known matrix),+ - fire `select` to trigger `_handleSelect`,+ - emit `visibilitychange` and `end`,+ - assert `onHit`/`onAnchored`/`onTracking`/`onEnd` fire with the right payloads.+ Inject by passing a fake `navigator.xr` (or a renderer stub) into `WebXRSession` —+ keep Three.js real where cheap, stub only the XR device layer.++2. **Lifecycle tests** — `tests/ar-webxr-session.test.js`:+ - hit→tap→anchored emits `onAnchored` with the captured tap-moment pose+ ([src/ar/webxr.js:205-221](../../src/ar/webxr.js#L205-L221));+ - `createAnchor` rejection falls back to frozen pose and still fires `onAnchored`+ (task 05 degraded path);+ - OS `end` runs full restoration idempotently;+ - tracking-loss and visibility transitions fire once, on change only.++3. **Pose round-trip test** (extends task 01): a known hit matrix → `_readAnchorPose`+ → `anchorPoseToPin` → expected lat/lng/heading/height, proving the whole write+ path numerically.++4. **Console-audit pass.** Run the route audit from the console-audit baseline against+ `/irl`, exercise the AR entry/exit, and confirm the only logs are intentional.+ Note any known-benign lines explicitly.++5. **Definition-of-Done sweep.** Walk the CLAUDE.md DoD list for the whole feature:+ every state designed, no dead paths, reachable from the UI, tests green,+ `npm run typecheck` clean, `git diff` reviewed.++6. **Changelog.** Append a holder-readable `data/changelog.json` entry (tag+ `feature` or `improvement`) summarizing the upgraded floor placement (occlusion,+ precise facing, iOS support, polish — whatever shipped), run `npm run build:pages`+ to validate, and leave `npm run changelog:push` for post-deploy.++## Acceptance checklist++- [ ] `tests/helpers/fake-xr.js` + `tests/ar-webxr-session.test.js` exercise+ hit/tap/anchor/degrade/visibility/end without hardware; `npm test` green.+- [ ] Write-path pose round-trip is asserted numerically end-to-end.+- [ ] Console audit on `/irl` AR flow is clean (or every line documented benign).+- [ ] DoD list walked and satisfied for the full feature; `typecheck` clean.+- [ ] Changelog entry added and `npm run build:pages` validates it.+- [ ] A short written note records what was verified on a real device vs. the harness.++## Out of scope++New product behavior — this task verifies and documents what tasks 01–06 built. If+verification surfaces a real bug, fix it (no error without a solution) and note it.++## Verify++`npm test` runs the new suites in CI without a device. Then a final manual pass on+real hardware (Android WebXR + iPhone from task 06) confirming the harness's claims+match reality, captured in the sign-off note.diff --git a/tasks/irl-hardening/H6-retention-data-minimization.md b/tasks/irl-hardening/H6-retention-data-minimization.mdnew file mode 100644index 000000000..289609d2e--- /dev/null+++ b/tasks/irl-hardening/H6-retention-data-minimization.md@@ -0,0 +1,102 @@+# H6 — Retention + data-minimization (reaper + interactions)++> Epic IRL-Hardening · Size **S** · Touches `api/cron/irl-reap.js`,+> `api/irl/interactions.js` (`ensureTable`), and the H1 suite.++## Goal++Stop location-bearing data from outliving its purpose. The hourly reaper currently+deletes expired anonymous pins and orphaned reports — but **never touches+`irl_interactions`**, which store a `viewer_device` and the pin's `lat`/`lng` on+every tap/view/message/pay. Those rows linger after their pin is gone, and forever+for permanent pins. Add a retention policy: cascade-delete interactions when their+pin dies, and age out old interaction rows so a place someone visited isn't kept+indefinitely.++## Why it matters++Data minimization is the cheapest, most durable privacy control: data you don't+keep can't leak. An interaction row is a record that *device X was at coordinate+Y at time T* — exactly the kind of trail that should not accumulate. Closing this+gap shrinks the blast radius of any future incident to "live pins only."++## Current state (verified)++- `api/cron/irl-reap.js` (hourly, cron-secret-gated): deletes `irl_pins` with+ `expires_at < NOW() - INTERVAL '1 day'`, and `irl_pin_reports` orphaned by a+ missing pin. **No `irl_interactions` cleanup at all.**+- `api/irl/interactions.js` `ensureTable()` creates `irl_interactions` with+ `pin_id`, `viewer_device`, `lat`, `lng`, `created_at`, etc. and the pay/earnings+ columns. No retention index, no FK cascade.+- Permanent (signed-in) pins never expire, so their interaction trail grows+ unbounded.++## What to build++### 1. Cascade orphaned interactions in the reaper++In `api/cron/irl-reap.js`, after the pin delete, add a guarded delete of+interactions whose pin no longer exists (mirror the `irl_pin_reports` orphan+sweep, with the same `to_regclass` existence guard so a fresh DB never 500s):++```js+const reapedIx = ixTable+ ? await sql`+ DELETE FROM irl_interactions ix+ WHERE NOT EXISTS (SELECT 1 FROM irl_pins p WHERE p.id = ix.pin_id)+ RETURNING ix.id`+ : [];+```++Return `reapedInteractions` in the JSON summary alongside `reapedPins` /+`reapedReports`.++### 2. Age-out window for interactions++Add a retention window (e.g. delete interactions older than 180 days regardless of+pin state — choose and document the number). This bounds the trail even for+permanent pins. Keep `pay` rows if they're needed for earnings history, OR move the+durable earnings aggregate elsewhere and still age out the raw geo-bearing row —+decide explicitly and write the rationale in the file header.++```sql+DELETE FROM irl_interactions+WHERE created_at < NOW() - INTERVAL '180 days'+RETURNING id;+```++Add `CREATE INDEX IF NOT EXISTS irl_interactions_created ON irl_interactions (created_at)`+in `ensureTable()` so the sweep is index-backed.++### 3. Minimize what's stored going forward++Review the columns `irl_interactions` actually needs. The stored `lat`/`lng` are+the *pin's* location (already owned by the pin) — confirm whether duplicating them+on every interaction row earns its keep or can be dropped/joined on read. If kept,+note why. Don't store anything the owner inbox doesn't render.++## Data / API changes++- `api/cron/irl-reap.js`: deletes orphaned + aged-out interactions; richer summary.+- `api/irl/interactions.js`: new `created_at` index; documented retention window.+- No new endpoints. The on-demand cascade for user-initiated deletes lives in **H5**.++## Acceptance checklist++- [ ] Reaper deletes interactions orphaned by a removed pin (existence-guarded).+- [ ] Reaper ages out interactions past the documented window; index-backed.+- [ ] Reaper summary reports `reapedInteractions`; idempotent re-run deletes nothing new.+- [ ] Retention window + any column-minimization decision documented in the file header.+- [ ] H1 suite extended: an orphaned interaction is reaped; a fresh-DB run (no table) doesn't 500.+- [ ] `npm test` + `npm run typecheck` green.++## Out of scope++The user-facing "delete my data / forget device" actions (**H5** — which call the+same cascade on demand). Changing pin expiry windows.++## Verify++Invoke the reaper locally with the cron secret against a DB seeded with an+interaction whose pin was deleted and one older than the window; confirm both are+removed and the summary counts them; re-run and confirm zero further deletions.diff --git a/tasks/irl-hardening/H7-anti-scrape-resilience.md b/tasks/irl-hardening/H7-anti-scrape-resilience.mdnew file mode 100644index 000000000..21aeb29d0--- /dev/null+++ b/tasks/irl-hardening/H7-anti-scrape-resilience.md@@ -0,0 +1,97 @@+# H7 — Anti-scrape resilience, fail-closed reads, anomaly alerting++> Epic IRL-Hardening · Size **M** · Touches `api/irl/pins.js`,+> `api/_lib/rate-limit.js` (read its limiter semantics), `api/_lib/alerts.js`,+> and the H1 suite. Builds on **H3** (proof-of-presence).++## Goal++Prove — with tests and runtime behavior — that the public nearby read cannot be+turned into a bulk location-harvesting tool, and that it **fails closed** under+stress rather than opening the floodgates. Add anomaly detection so sweep-shaped+traffic is surfaced to ops, and document the residual threat model so the team+ships with eyes open.++## Why it matters++A location feed is only as private as its worst day. The dangerous failure mode is+silent: a limiter outage that fails *open*, a radius cap that's accidentally+widened, or a slow methodical sweep that never trips a per-minute counter. "We rate+limit it" is not a guarantee until it's tested at the boundary and the degradation+path is known. This task converts assumptions into asserted, monitored facts.++## Current state (verified)++- `api/irl/pins.js` read path: `radius` clamped `[10,60]`, default 40; IP+ rate-limit `limits.publicIp`; coarse allow-list projection; coords coarsened+ (`roundCoord`, shipped). With **H3**, reads also require a cell-bound fix token.+- `api/_lib/rate-limit.js` limiters return `{ success, reason }`; some buckets+ "fail closed" with `rate_limiter_unavailable`, others fail open (per the+ `redis-quota-incident` + `http.js` `rateLimited` reason handling). **The read+ path's degradation behavior must be verified, not assumed.**+- `api/_lib/alerts.js` `sendOpsAlert` exists (deduped by signature) and is already+ used for IRL pay events — reuse for anomaly alerts.++## What to build++### 1. Verify + enforce fail-closed on the read++Audit which limiter backs the nearby read and what it does when Redis is degraded.+For the **public location read**, a degraded limiter must **fail closed** (reject+with a retryable `rate_limiter_unavailable`, surfaced by the client as "temporarily+unavailable, retrying"), never fail open into an unmetered scrape window. If the+current bucket fails open, switch the read to a fail-closed bucket or add an+explicit guard. Document the decision in the handler.++### 2. Boundary tests (in the H1 suite)++- A request with `radius` > 60 is clamped to 60 (already true — pin it).+- A burst past the per-IP ceiling returns 429 with `Retry-After`.+- With the limiter forced into its degraded state, the read **rejects** (closed),+ not serves.+- With **H3** active: a single fix token can only read its own cell (+ neighbors),+ so a token-per-cell sweep needs a real fix per cell — assert a far-cell read+ with a near-cell token is denied.++### 3. Sweep anomaly detection → ops alert++Add lightweight per-IP/-device counters (Redis, short TTL) tracking **distinct+cells read** within a window. A single caller reading many distinct geocells in a+short time is sweep-shaped (a real user stays in ~1 cell). Past a threshold, fire a+deduped `sendOpsAlert('IRL sweep suspected', …)` with the IP/device hash and cell+count — **never** with any coordinate or token (route through the same discipline+as `redactUrl`). Optionally auto-tighten that caller's limit for a cooldown.++### 4. Document the residual threat model++Add a short, honest `THREAT-MODEL.md` (in this folder or `docs/`) stating what the+read protects against (remote browsing, bulk harvest, deanonymization via owner id,+log/Referer credential leak) and the accepted residual (someone physically present+can, by definition, see the handful of pins right where they stand — that's the+product). No silent caps: if any limit drops coverage, it's written down.++## Data / API changes++- No new public endpoints. New internal Redis counters (short TTL).+- New ops-alert signal `IRL sweep suspected` (coordinate-free).+- New doc: `THREAT-MODEL.md`.++## Acceptance checklist++- [ ] The nearby read fails **closed** under limiter degradation (verified by test).+- [ ] Radius clamp, burst 429, and (with H3) cross-cell denial are asserted in H1.+- [ ] Distinct-cell sweep detection fires a deduped, coordinate-free ops alert past threshold.+- [ ] `THREAT-MODEL.md` documents protections + accepted residual + any coverage caps.+- [ ] No alert/log path emits a coordinate or token (reuse the redaction discipline).+- [ ] `npm test` + `npm run typecheck` green.++## Out of scope++The proof-of-presence mechanism itself (**H3**, a dependency) and per-account+reputation/banning (future). This task verifies, monitors, and documents.++## Verify++Run the boundary tests green. Locally force the limiter degraded and confirm the+read rejects. Simulate a multi-cell sweep against a dev instance and confirm a+single deduped ops alert fires with counts only — no coordinates.diff --git a/tasks/irl-hardening/H8-designed-states-a11y.md b/tasks/irl-hardening/H8-designed-states-a11y.mdnew file mode 100644index 000000000..73be0f34c--- /dev/null+++ b/tasks/irl-hardening/H8-designed-states-a11y.md@@ -0,0 +1,100 @@+# H8 — Designed states, permission onboarding & accessibility++> Epic IRL-Hardening · Size **M** · Touches `src/irl.js`, `pages/irl.html`,+> `src/irl/onboarding.js`, and `src/shared/state-kit.js` usage across IRL surfaces.++## Goal++Every IRL state — especially the privacy- and sensor-related ones — is **designed,+helpful, and accessible.** No blank screens, no dead ends, no mystery permission+prompts. The user always knows what's happening, why a permission is needed, what+their privacy posture is, and how to move forward. This is the polish layer that+makes `/irl` feel like a flagship product instead of a demo.++## Why it matters++A phone-camera AR product lives or dies on its first 30 seconds: camera, motion,+and location permissions, often on iOS Safari (which needs an explicit user+gesture for motion and has no WebXR). Get the onboarding wrong and the user sees a+frozen black screen and leaves. Get the privacy states wrong and they don't trust+it. Best-possible UX means every one of these moments is intentional.++## Current state (verified)++- `src/irl/onboarding.js` exists (permission flow scaffolding); `src/shared/state-kit.js`+ provides skeleton/empty/error/retry shells used elsewhere in the app.+- `src/irl.js` watches GPS, runs the camera passthrough + gyro look, has an+ avatar-load error overlay (`showAvatarLoadError`), and a poll/WS fallback for+ presence (`src/irl-net.js` `unavailable`/`failed` statuses).+- Coverage is uneven: not every sensor-denied / no-fix / offline / privacy state is+ a first-class designed state, and the new privacy surfaces (H3 `fix_required`, H4+ consent, H5 controls) need states too.++## What to build++### 1. The full state matrix — each one designed++For `/irl`, ensure a designed, actionable state for **every** case:++| State | What the user sees / can do |+|---|---|+| Camera permission needed / denied | Why it's needed + how to re-enable (with iOS Safari path), Retry |+| Motion permission (iOS gesture) | A tappable "Enable motion" affordance (iOS requires the gesture) |+| Location permission needed / denied | Why + re-enable steps; degrades gracefully (no crash) |+| Acquiring GPS fix (no fix yet) | A calm "Getting your location…" with a skeleton, not a freeze |+| `fix_required` from the read (H3) | "We need your location to show nearby agents" + enable CTA |+| No nearby agents (empty) | "No agents here yet — be the first" + Place CTA, not a void |+| Offline / realtime unavailable | Presence hidden, discovery still polling; honest pill, not a spinner loop |+| Unsupported device / no WebGL | Clear fallback message; never a blank canvas |+| Privacy posture (always visible) | A small, persistent indicator: "Discovery is local-only · presence is anonymous" linking to H5's privacy center |++Reuse `state-kit.js`; do not hand-roll one-off markup. Loading uses skeletons, not+bare spinners.++### 2. Permission onboarding flow++Harden `src/irl/onboarding.js` into a guided, resumable sequence (camera → motion+→ location), each step explaining *why* before the native prompt, each handling+deny without trapping the user, and the iOS motion step gated behind a real tap.+Re-entrant: a user who denied then changed OS settings can retry without reload.++### 3. Accessibility pass (the whole surface)++- Semantic landmarks; every control has an accessible name (ARIA where needed).+- Full keyboard path: open/close sheets, place, tap a pin, navigate cards, reach+ the privacy center — all without a pointer; visible focus rings.+- Respect `prefers-reduced-motion` (the ghost pulse, transitions, any camera+ easing) — provide a calm static alternative.+- Color contrast ≥ WCAG AA on every chip/badge/state, including over the camera+ feed (use scrims/backplates so text stays legible on any background).+- Screen-reader announces state changes (placed, error, permission needed) via a+ polite live region.++### 4. Microinteraction polish++Hover/active/focus on every interactive element; intentional enter/exit on sheets+and pins (opacity/transform, GPU-friendly); no jarring pops. The privacy indicator+and consent affordances feel native, not bolted on.++## Acceptance checklist++- [ ] Every state in the matrix is a designed `state-kit` state with a working action.+- [ ] iOS Safari: motion permission gated behind a gesture; camera/location denies+ degrade gracefully; tested on a real device or accurate emulation.+- [ ] Persistent, legible privacy indicator linking to the privacy center.+- [ ] Full keyboard operability + visible focus; `prefers-reduced-motion` honored;+ AA contrast over the camera feed; live-region announcements.+- [ ] 320 / 768 / 1440 px clean; no console errors or warnings from our code.+- [ ] `npm test` + `npm run typecheck` green.++## Out of scope++The privacy *backend* (H3/H5) and consent *logic* (H4) — H8 designs and wires their+**states and accessibility**, not their server behavior.++## Verify++`npm run dev` → `/irl` on a throttled mobile profile: deny each permission in turn+and confirm a designed, recoverable state every time; tab through the entire+surface with no mouse; toggle reduced-motion; confirm the privacy indicator is+always visible and links to the privacy center.diff --git a/tasks/irl-location-control/L3-location-privacy-center.md b/tasks/irl-location-control/L3-location-privacy-center.mdnew file mode 100644index 000000000..661553b44--- /dev/null+++ b/tasks/irl-location-control/L3-location-privacy-center.md@@ -0,0 +1,111 @@+# L3 — Location Privacy Center + disclosure++> Epic · Size **M** · Touches `src/irl.js`, `pages/irl.html`, `src/irl/onboarding.js`.+> Owns the controls + copy; **L4** implements the approximate-discovery behavior this toggles.++## Goal++One designed, reachable surface in `/irl` — a **"Location & privacy"** sheet —+that tells the user, in plain language, exactly what is shared and gives them the+controls in one place:++1. **What's stored & who sees it** — honest disclosure: a placed pin's coordinates+ reach another person *only* when they're physically within ≤60 m of it, never as+ a map/roster, never with your account id; anonymous pins auto-expire in 7 days.+2. **Discovery precision** — *Precise* (default) vs *Approximate*: when approximate,+ the coordinate sent to the nearby read is coarsened on-device (L4) so browsing+ doesn't hand the server your exact position.+3. **Appear to others** — surface the existing presence opt-in (`getShareGhost`,+ default off) here so every location-sharing control lives together.+4. **Manage placements** — a link straight into the My-pins sheet (L5).++Plus a **first-run disclosure**: the first time location is granted, a short,+designed explainer (not a wall of text) covering the same three facts, wired into+the existing onboarding so it's shown once and never nags again.++## Why it matters++The user's literal worry — "my actual location is going to leak" — is mostly a+*trust* problem, and trust is built with disclosure and control, not silence. The+privacy posture is already strong (tight radius, no roster, owner-id stripped,+7-day expiry) but it's **invisible**: nothing in the UI tells the user any of it,+and the one real lever (don't broadcast exact position while browsing) doesn't+exist yet. A single honest control center turns an anxious tester into a confident+user and is the difference between "felt creepy" and "felt in control."++## Current state (real lines)++- `src/irl.js:1820` `getShareGhost()` / `setShareGhost()` (localStorage `irl_share_ghost`,+ default off), toggle handler `:2578`, `syncGhostToggle` `:2568`, comment at `:1815`+ documenting count-only presence. The presence control exists but lives alone.+- `src/irl.js:2009` `loadNearbyPins()` sends `gpsState.lat/lng` verbatim (`:2016`) — the+ exact-position-while-browsing vector L4 fixes; L3 provides the toggle that drives it.+- `src/irl/onboarding.js:22` `PERMS.location`, persisted outcomes (`SAVE_KEY`), designed+ state cards via state-kit — the place to attach first-run disclosure.+- `src/irl.js:2561` My-pins button + `openMyPinsSheet` (`:2514`) — link target.++## What to build++### 1. "Location & privacy" sheet++A bottom sheet opened from a small shield/location control in the `/irl` topbar.+Sections, each with microcopy:++- **What others can see** — 2–3 plain sentences with the real facts (≤60 m radius,+ no map/roster, no account id, anonymous pins expire in 7 days). No legalese.+- **Discovery precision** — a segmented control: `Precise · exact` / `Approximate ·+ ~city-block`. Persist to localStorage (`irl_discovery_precision`, default `precise`).+ Expose the chosen mode so `loadNearbyPins` (L4) reads it. Copy explains the+ trade-off: approximate keeps your exact position off the server but may surface+ agents a little less precisely.+- **Appear to others** — move the existing ghost toggle here (keep the topbar pill+ too, or make this the canonical home and have both reflect the same state via+ `syncGhostToggle`). Default off; copy matches `:1815`.+- **Your placements** — a row that opens the My-pins sheet ("Manage / remove the+ agents you've placed →").++All four sections use state-kit styling; the sheet is keyboard-navigable, `Esc`+closes, controls have ARIA roles/labels, and it's clean at 320 / 768 / 1440px.++### 2. First-run disclosure (onboarding)++In `src/irl/onboarding.js`, after location is **granted** for the first time, show+a one-screen disclosure card (reuse the module's card renderer) with the same+three facts + a single "Got it" action, then persist a flag (e.g.+`irl_location_disclosed_v1`) so it never shows again. Do **not** block the flow —+it's informational, dismissible, shown once. If location is denied/unsupported,+skip it (onboarding already handles those states).++### 3. Persistence helpers++Add `getDiscoveryPrecision()` / `setDiscoveryPrecision()` next to the ghost helpers+(`src/irl.js:1820`), localStorage-backed, try/catch-guarded like the existing ones.+Export/expose the getter so L4's `loadNearbyPins` can read it without a circular hop.++## Data / API changes++None server-side. Purely client state (localStorage) + UI. L4 consumes+`getDiscoveryPrecision()`; this task ships the control and the default (`precise`),+so behavior is unchanged until L4 lands the coarsening.++## Acceptance checklist++- [ ] A "Location & privacy" control in the `/irl` topbar opens the sheet.+- [ ] Sheet shows honest "what others can see" copy, a precise/approximate toggle (persisted, default precise), the presence opt-in, and a link into My-pins.+- [ ] Ghost toggle state stays in sync wherever it's shown (`syncGhostToggle`).+- [ ] First location grant shows a one-time disclosure card; it never re-shows; denied/unsupported skip it.+- [ ] `getDiscoveryPrecision()` exists, defaults `precise`, persists across reload.+- [ ] Keyboard + ARIA pass; 320 / 768 / 1440px clean; no console errors/warnings.+- [ ] `data/changelog.json` entry added (`feature`/`improvement`); `npm run build:pages` passes.++## Out of scope++The actual coordinate coarsening on the nearby read (**L4** — this task only ships+the toggle + default). The map placement picker (L2). My-pins internals (L5).++## Verify++`npm run dev` → `/irl`: open Location & privacy, flip to Approximate (persists on+reload), confirm the disclosure copy reads honestly against `api/irl/pins.js`+behavior, follow the link into My-pins. Fresh profile (clear localStorage), grant+location → the one-time disclosure card appears once.diff --git a/tasks/irl-location-control/L4-proximity-read-hardening.md b/tasks/irl-location-control/L4-proximity-read-hardening.mdnew file mode 100644index 000000000..839f36d5d--- /dev/null+++ b/tasks/irl-location-control/L4-proximity-read-hardening.md@@ -0,0 +1,112 @@+# L4 — Proximity-read privacy hardening++> Epic · Size **M** · Touches `src/irl.js` (client coarsening) + `api/irl/pins.js`+> (logging/PII). Consumes the toggle from **L3**. Closes the browsing-leak vector.++## Goal++Make *browsing* `/irl` stop broadcasting the viewer's exact position. Two halves:++1. **Client (Approximate discovery):** when the L3 precision toggle is+ `approximate`, snap the caller's own `lat/lng` to a coarse grid (~75–150 m)+ before the nearby read, so the server only ever receives a fuzzed origin. The+ proximity radius still finds nearby agents; the viewer's precise position never+ leaves the device.+2. **Server (no exact-coordinate logging):** ensure `api/irl/pins.js` never writes+ precise caller coordinates to logs, and document retention. The endpoint already+ strips owner ids from the response and IP-rate-limits scraping — this closes the+ remaining "our own logs know where everyone stood" gap.++## Why it matters++Placement is the obvious leak, but the quieter one is **reads**: every ~10 s,+`loadNearbyPins` sends the viewer's exact GPS to the server to ask "who's near me?"+A user who never places a single pin is still continuously telling the backend+(and any log sink) precisely where they are. For a location product, hardening the+read is as important as hardening the write — and "Approximate" is the concrete+lever L3 promises the user. Coarsening client-side means the precise coordinate is+never transmitted at all, which is strictly stronger than trusting the server to+forget it.++## Current state (real lines)++- `src/irl.js:2009` `loadNearbyPins()` → `src/irl.js:2016`+ `fetch('/api/irl/pins?lat=${gpsState.lat}&lng=${gpsState.lng}&radius=${NEARBY_RADIUS}')`+ — sends full-precision coordinates on every poll.+- `api/irl/pins.js:467` the GET nearby branch parses `lat`/`lng` (`:468`), clamps+ `radius` to ≤60 m (`:473`), IP-rate-limits the read (`:415`), and projects out+ `user_id`/`device_token` (`:504`). No caller-coordinate logging exists today —+ **keep it that way and assert it** (a future `console.log(req.query)` would regress this).+- L3 provides `getDiscoveryPrecision()` (default `precise`).++## What to build++### 1. Client-side coarsening (the Approximate behavior)++In `loadNearbyPins`, when `getDiscoveryPrecision() === 'approximate'`, snap the+origin to a fixed grid before building the URL:++```js+// ~111 m per 0.001° lat. Snap to a ~150 m cell so the exact origin never leaves the device.+const CELL_DEG = 0.0015;+function coarsen(v) { return Math.round(v / CELL_DEG) * CELL_DEG; }++const precise = getDiscoveryPrecision() !== 'approximate';+const qLat = precise ? gpsState.lat : coarsen(gpsState.lat);+const qLng = precise ? gpsState.lng : coarsen(gpsState.lng);+```++Send `qLat/qLng`. Because the snapped origin can sit up to ~one cell from the true+position, **widen the request radius by one cell** in approximate mode (still+clamped server-side to 60 m) so a nearby agent isn't missed, and keep computing the+on-screen distance/threshold against the *true* `gpsState` locally (the server's+`distance_m` is advisory; the client already places pins from the live origin).+Document the precision/recall trade-off in a comment — approximate trades a little+placement precision for not transmitting an exact position.++### 2. Server: assert no exact-coordinate logging + retention note++- Audit the GET path in `api/irl/pins.js` and add a short comment at `:467`+ stating the contract: **caller `lat`/`lng` are used for the proximity query and+ are never logged.** If any debug log of `req.query`/coords exists anywhere on this+ path, remove it.+- Add a one-line note (in the file header or near `ensureTable` `:167`) that+ `irl_pins` stores placement coordinates only; proximity *reads* are not persisted+ beyond the rate-limit counter (which keys on IP, not coordinates).+- Keep the existing IP rate-limit + owner-id-stripped projection exactly as-is.++### 3. No behavior change when precise++Default is `precise`, so unless the user opted into Approximate in L3, the read is+byte-identical to today. This task adds a lever, it doesn't degrade the default+experience.++## Data / API changes++- **No schema or endpoint signature change.** Same `GET /api/irl/pins?lat&lng&radius`.+- Client may send a slightly larger `radius` in approximate mode (server still clamps ≤60 m).+- Documentation/comments only on the server; a possible deletion of any stray+ coordinate log line.++## Acceptance checklist++- [ ] In Approximate mode, the nearby request URL carries a grid-snapped `lat/lng` (verify in Network tab — the exact `gpsState` value is **not** present).+- [ ] In Precise mode, the request is unchanged from today.+- [ ] Nearby agents within the radius still resolve in approximate mode (radius widened by one cell, on-screen distances computed from the true origin).+- [ ] `api/irl/pins.js` GET path provably logs no caller coordinates; contract comment added; retention note added.+- [ ] Existing IP rate-limit + owner-id-stripped projection untouched.+- [ ] No console errors; precise-mode behavior identical to pre-change.++## Out of scope++The toggle UI + persistence (L3). Placement coordinate privacy (L2 — placement is+a deliberate, user-chosen write; this task is only about the passive read).+Server-side geofuzzing of *stored* pins (placement stays precise so the AR walk-up+works).++## Verify++`npm run dev` → `/irl` with a fix (real or L1 mock): in Precise mode confirm the+nearby URL has full-precision coords; flip to Approximate (L3) and confirm the URL+coords are snapped to the grid while nearby agents still render. Grep the server+path to confirm no coordinate is logged.diff --git a/tasks/irl-privacy/05-location-leak-audit.md b/tasks/irl-privacy/05-location-leak-audit.mdnew file mode 100644index 000000000..30e183ab4--- /dev/null+++ b/tasks/irl-privacy/05-location-leak-audit.md@@ -0,0 +1,78 @@+# 05 — Location-leak audit across every sibling surface++> Size **M** · Read-heavy audit of `api/irl/*`, `src/irl.js` deep-links,+> `src/irl/share-frame.js`, `src/dashboard-next/pages/irl-*`, plus any agent-profile+> "View in IRL" link. Output: a written audit + fixes for anything that leaks.++## Goal++Close the *side doors*. The nearby read is locked down — but an agent's location+could still leak through a sibling endpoint, a deep-link, a share image, the+dashboard, or an error/log. Audit every surface that touches a pin and prove none+of them lets you resolve **another** user's agent → its location without physical+presence.++## Why it matters++A privacy guarantee is only as strong as its weakest endpoint. We have a family of+IRL endpoints added around the same time (`agent-card`, `agent-summary`,+`interactions`, `interactions-stream`, `report`) plus deep-links (`?agent=`,+`?highlight=`) and a share-frame generator. Any one of them returning a `lat`/`lng`,+an origin coordinate, or an agent→pin mapping that works from afar reopens exactly+the hole we just closed — quietly.++## Current state / where to look (real files)++- `api/irl/agent-card.js`, `api/irl/agent-summary.js` — do their responses include+ `lat`/`lng`/`origin_*` for an agent the caller isn't near? They must not (an agent+ *card* should describe the agent, not pinpoint it).+- `api/irl/interactions.js`, `api/irl/interactions-stream.js` — the owner SSE inbox.+ Confirm the privacy filter (`publicRow`/`matches`, see [memory: irl-d3-interaction-broadcast])+ never ships an actor's GPS, and that an interaction record doesn't carry pin coords+ to anyone but the owner.+- `api/irl/pins.js` `?mine` / `/mine` feeds — return coordinates, which is correct+ (they're the owner's own pins). Confirm they're strictly owner/device-scoped and+ can't be coerced cross-user (e.g. a guessed `deviceToken`, a missing auth check).+- `src/irl.js` deep-links: `?agent=<id>` (`agentFocusId`) and `?highlight=<pinId>`+ open/flash a pin **only after it loads via the proximity poll**. Confirm neither+ fetches or reveals a location for an agent that isn't already in range — i.e. the+ deep-link is a "focus it *if* you're near it," never a "take me to it."+- `src/irl/share-frame.js` — the share image/card must not embed lat/lng or a map.+- `src/dashboard-next/pages/irl-placements.js` (+ `irl-reputation`, `irl-outfit-editor`)+ — these show the owner *their own* pins (fine); confirm they never fetch others'.+- Logs: grep for any `console.*` that prints pin `lat`/`lng` on a public path+ (client-error reporter, server logs) per [memory: observability-stack].++## What to do++1. For each surface above, document **what it returns/exposes** and whether a+ non-present, non-owner caller can learn a location. Put it in+ `reports/irl-location-leak-audit.md` as a table: surface · exposes coords? ·+ owner-scoped? · verdict.+2. Fix every leak found, smallest change that holds the invariant (e.g. drop+ `lat`/`lng`/`origin_*` from an agent-card response; tighten an owner check). Add a+ focused test for each fix.+3. Re-state the invariant in a one-line code comment at each fixed site so a future+ edit doesn't silently re-add the field.++## Acceptance checklist++- [ ] `reports/irl-location-leak-audit.md` covers every `api/irl/*` endpoint, both+ deep-links, the share frame, and the three dashboard pages, with a verdict each.+- [ ] No public/non-owner surface returns `lat`/`lng`/`origin_*` or an agent→location+ mapping resolvable from afar.+- [ ] `?mine` / `/mine` proven strictly owner/device-scoped (test for the cross-user+ attempt → no data).+- [ ] Deep-links (`?agent`, `?highlight`) only focus an already-in-range pin; verified.+- [ ] Each fix has a regression test; full suite green.++## Out of scope++The nearby feed itself (already locked + covered by `irl-pins-location-guards`).+CI wiring of new tests is fine here or rolled into task 07.++## Verify++For each "exposes coords? = no" verdict, run the actual request unauthenticated /+as a non-owner and confirm the response carries no location. Paste the responses+into the audit doc.diff --git a/tasks/irl-privacy/06-states-permissions-a11y.md b/tasks/irl-privacy/06-states-permissions-a11y.mdnew file mode 100644index 000000000..493946020--- /dev/null+++ b/tasks/irl-privacy/06-states-permissions-a11y.md@@ -0,0 +1,77 @@+# 06 — Every state, permission, and accessibility pass++> Size **M** · `src/irl.js` (`updateNearbyBadge`, `setNetPill`, `updatePresence`,+> rate-limit handling in `loadNearbyPins`), `src/irl/onboarding.js`, `src/irl.css`,+> `pages/irl.html`. The CLAUDE.md "every state is designed" bar, applied to /irl.++## Goal++Make every state a user can reach on /irl deliberate, polished, accessible, and+honest: loading, permission-prompt, permission-denied (camera / motion / location,+each independently), GPS-acquiring, empty, populated, rate-limited, offline/poll,+and error. No raw strings, no dead ends, no jank.++## Why it matters++/irl asks for the three scariest permissions a web app can (camera, motion,+location) and then renders a live AR scene. The difference between a product people+trust and one they close in the first 10 seconds is entirely in how these states+feel. Today several are bare badge text or a generic message. "Best possible UX"+means each state tells the user exactly what's happening and what to do next.++## Current state (real lines)++- `src/irl/onboarding.js` returns per-sensor denial copy (camera / motion / location)+ with "Try again." Good base; needs a designed surface + recovery per browser.+- `src/irl.js` `setNetPill('live'|'connecting'|'idle')` → `#irl-net-pill` (presence+ socket status). `updatePresence` → `#irl-presence-chip` ("N viewing nearby", shown+ only when `_streamOnline && count > 1`). `updateNearbyBadge` → `#irl-nearby-badge`.+- `loadNearbyPins()` sets `_nearbyError = true` on a failed fetch and surfaces it on+ the badge, but a **429 rate-limit** response is not distinguished from a generic+ failure — the user gets no actionable message if they somehow trip the limiter.++## What to build++1. **Permission states** — a designed panel for each of: prompt (why we need it,+ before the browser asks), denied (per-sensor recovery steps, reusing+ `onboarding.js` copy), and unsupported (no camera → "3D scene still works"+ fallback, the existing graceful path). Camera-denied must still allow the+ compass/GPS placement path.+2. **GPS-acquiring** — a distinct "finding your location…" state (skeleton, not a+ spinner) so the gap before the first fix isn't mistaken for "empty."+3. **Rate-limited** — detect `429` in `loadNearbyPins` and show a calm, specific+ message ("Refreshing too fast — catching up…") with auto-recovery on the next+ cycle; never a scary error. Distinct from the generic offline/error badge.+4. **Net pill + presence chip** — final copy + visual states; the pill reflects only+ the presence socket (pins always poll), so its "offline" state must NOT imply+ discovery is broken. Reduced-motion for the connecting pulse.+5. **Accessibility** — semantic roles, `aria-live="polite"` on the state region+ (announce on transition only, not every poll), visible focus rings on all+ controls, ≥4.5:1 contrast over the camera feed (scrim where needed), full keyboard+ path for the Place / mute / share / "?" controls, and `prefers-reduced-motion`+ across all transitions.+6. **Responsive** — verify 320 / 768 / 1440 and notched/safe-area insets on mobile.++## Acceptance checklist++- [ ] Each of camera/motion/location has a designed prompt + denied + recovery state;+ camera-denied still permits compass/GPS placement.+- [ ] GPS-acquiring state is visually distinct from empty.+- [ ] `429` from the nearby read → calm, specific, auto-recovering message.+- [ ] Net pill never implies discovery is down when only presence dropped.+- [ ] aria-live announces transitions once; focus rings + keyboard nav on every+ control; contrast ≥4.5:1 over the camera; reduced-motion honored.+- [ ] Clean at 320/768/1440 with safe-area insets; zero console errors/warnings.+- [ ] Holder changelog entry (improvement) + `build:pages`.++## Out of scope++The empty-state explainer content (task 02) and the arrival cue (task 03) — this+task makes the *surrounding* states match that bar and adds the missing ones.++## Verify++`npm run dev` → /irl: deny each permission in turn (browser site settings) and+confirm each designed state + recovery; throttle the network / force a `429`+(temporarily lower the limiter) and confirm the rate-limited state; run an+accessibility audit (axe or Lighthouse) with zero serious violations.diff --git a/tasks/irl-privacy/07-e2e-and-regression-tests.md b/tasks/irl-privacy/07-e2e-and-regression-tests.mdnew file mode 100644index 000000000..b9a27d621--- /dev/null+++ b/tasks/irl-privacy/07-e2e-and-regression-tests.md@@ -0,0 +1,71 @@+# 07 — E2E + regression coverage that locks the invariant in CI++> Size **M** · `tests/api/*`, `tests/*` (vitest), `tests/e2e/*` (playwright), and a+> tiny dev seam in `src/irl.js` if needed for deterministic GPS in a headless run.++## Goal++Turn the privacy invariant and the new UX behaviors into **automated** guarantees so+no future change can quietly reopen the roster or regress discovery. The Vercel+build is the only automated gate ([memory: github-actions-unavailable]), so these+must run under `vitest run` / `playwright test` locally and in that build.++## Why it matters++Task 01 proves the lockdown *once, by hand*. This makes it permanent. The room-anchor+work already shares these files; a later refactor could re-add a pin broadcast or a+window feed without anyone noticing — unless a test fails. Safety regressions must be+loud.++## Current state (real lines)++- `tests/api/irl-pins-location-guards.test.js` already asserts: no bbox/window feed,+ the hard radius cap (`Math.min(60, …)`), rate-limiting, and no owner-id projection.+ Build on it; don't duplicate.+- `tests/api/irl-pins-room.test.js` covers room-frame persistence + projection.+- Presence/reaction units exist (`tests/irl-*`); `IrlRoom` is presence+reactions only.+- Playwright suite lives under `tests/e2e/`; pre-start a dedicated dev server per+ [memory: vitest-cold-import-contention].++## What to build++1. **Realtime "no pins" regression (unit/integration).** Boot `IrlRoom` (or assert+ on its schema/handlers) and prove `state.pins` is never populated and there is no+ `applyPublish`/`_loadPins`/pin-publish path. A structural test that fails if a pin+ broadcast is reintroduced.+2. **API guards — extend** `irl-pins-location-guards`: add the cross-user `?mine`+ attempt (guessed `deviceToken` → no data) and assert `report`/calibrate/edit no+ longer call any publish module (the modules are gone; assert no import).+3. **Pure-logic units** for the new modules from tasks 03/04:+ `proximity-cue` (new arrivals, debounce, no re-fire on refresh) and the+ hysteresis band (enter 40 / exit ~55 / debounce). These are pure → cheap + fast.+4. **E2E happy path (Playwright, headless).** With a deterministic GPS seam+ (inject fixed `gpsState` or mock `geolocation`), and seeded pins+ (`__irlSeedPins`): assert (a) an out-of-range pin does **not** render, (b) moving+ into range renders it, (c) the empty-state explainer/empty prompt appears with+ zero pins, (d) no console errors. Keep it hermetic (no live network/DB).+5. **E2E privacy assertion.** In the same run, assert the page never holds a list of+ pin coordinates outside the in-range set (inspect the live `nearbyPins`/DOM) and+ that the WS client state exposes no pins.++## Acceptance checklist++- [ ] A structural test fails if `IrlRoom` ever re-syncs pins or a pin-publish path returns.+- [ ] `?mine` cross-user attempt covered → returns no data.+- [ ] `proximity-cue` + hysteresis band unit-tested (pure).+- [ ] Playwright happy-path: out-of-range hidden, in-range renders, empty state shown,+ no console errors — hermetic.+- [ ] Playwright privacy assertion: no out-of-range coordinates in client state/DOM.+- [ ] `vitest run` + `playwright test` green locally; suite stays within the+ calibrated timeouts ([memory: vitest-cold-import-contention]).++## Out of scope++The features themselves (01–06) — this task only *locks them in*. Don't lower any+vitest timeout.++## Verify++`npx vitest run irl` and the new e2e spec both green; then temporarily reintroduce a+fake pin broadcast in a scratch branch and confirm the structural test goes red+(then discard the scratch change).diff --git a/tasks/irl-production/README.md b/tasks/irl-production/README.mdnew file mode 100644index 000000000..133754667--- /dev/null+++ b/tasks/irl-production/README.md@@ -0,0 +1,107 @@+# IRL — Production Hardening Program++Goal: take `three.ws/irl` from "works in a demo" to **100% production-ready, zero+error, shipped complete and professional, with the best possible UX** on real+iOS Safari and Android Chrome devices.++This is a **hardening and polish** program, not a rebuild. The four IRL epics+(`tasks/irl-live` A–E) are built and shipped: world-anchoring (GPS + gyro + WebXR),+camera-aware agents, tap-to-inspect cards, x402 pay, owner dashboard, coarse+anonymous realtime presence + ambient reactions, the perf/LOD system, and the+location-privacy lockdown. This program closes the gap between *shipped* and+*flawless*.++---++## Hard constraints — respect prior product decisions++These were deliberate. **Do not regress them.**++- **$THREE is the only coin** (CA `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`).+ Never reference any other token anywhere — code, copy, tests, fixtures, commits.+- **Location privacy is locked down.** There is no map, list, or feed of agent+ locations. The nearby read is radius-capped and rate-limited so it cannot be+ swept to rebuild a map. Do **not** add a location feed, bulk endpoint, or widen+ the nearby radius.+- **The realtime PIN-broadcast channel was removed** (commit `75f2a6ce`). Pins ride+ a REST proximity read + a shared room-anchor. The realtime room carries only+ coarse, anonymous presence + ambient reactions. Do **not** re-add pin broadcast.+- **No mocks, no placeholders, no fake data.** Real APIs, real RPC, real wallet,+ real DB. Errors handled at boundaries; never a blank screen or silent no-op.++## Ground rules for every task++1. **Verify before you fix.** Each task lists findings with `file:line` refs drawn+ from an audit that read code excerpts. Open the cited code first. If a finding+ is already handled correctly, note that in your summary and move on — do not+ "fix" working code. If the real issue differs from the description, fix the real+ issue.+2. **Self-contained.** Each task file can be handed to a fresh agent and executed+ without reading the others. Some scope overlaps at the edges; stage explicit+ paths and re-check `git status` before committing (concurrent agents share this+ worktree).+3. **Every state designed** — loading / empty / error / permission-denied /+ unsupported-device — via `src/shared/state-kit.js`. No bare toasts for terminal+ states, no infinite "Loading…".+4. **Real-device verification is part of done.** The 3D/AR/sensor paths cannot be+ fully exercised in headless Chromium. Extract pure logic into testable helpers+ and unit-test it; for the rest, document the manual device-test steps you ran or+ that remain (iOS Safari + Android Chrome). Be honest about what you could not verify.+5. **Changelog.** Every user-visible fix gets an entry in `data/changelog.json`+ (tags from: feature, improvement, fix, sdk, infra, docs, security), then+ `npm run build:pages` to validate. Internal-only hardening with no visible+ effect does not.+6. **Keep `npm test` green** and add/extend tests for every fix that has pure logic.++---++## Task index++### Phase 1 — AR correctness (the core experience must never break)+| # | File | Focus | Effort |+|---|------|-------|--------|+| 01 | [01-sensor-robustness.md](01-sensor-robustness.md) | NaN/uncalibrated compass, finite guards, compass-loss detection, 0°/360° + yaw smoothing | M |+| 02 | [02-orientation-resize-fov.md](02-orientation-resize-fov.md) | Landscape / screen-orientation, FOV re-derive on rotate, safe-area, portrait-only math | M |+| 03 | [03-gps-lifecycle-lock-transitions.md](03-gps-lifecycle-lock-transitions.md) | GPS watch retry/zombie, deferred-lock caption race, GPS↔gyro transition smoothing | M |+| 04 | [04-webxr-session-lifecycle.md](04-webxr-session-lifecycle.md) | AR/XR/camera contention guard, overlay tap absorption, clean session teardown | M |+| 05 | [05-tap-raycast-accuracy.md](05-tap-raycast-accuracy.md) | Near-plane clipping, gyro-lock frame, edge taps, nearest-agent focus | S |+| 06 | [06-memory-gpu-hygiene.md](06-memory-gpu-hygiene.md) | Mixer/GLB leaks on swap, impostor RT disposal, load cancel on teleport, WebGL context-loss recovery | M |++### Phase 2 — UX, accessibility, polish (screenshot-worthy)+| # | File | Focus | Effort |+|---|------|-------|--------|+| 07 | [07-accessibility-pass.md](07-accessibility-pass.md) | focus-visible on every control, Escape/keyboard dismiss, ARIA, reduced-motion, contrast | M |+| 08 | [08-designed-states.md](08-designed-states.md) | My Pins / agent-card / radar / nearby-badge loading-empty-error states; no infinite spinners | M |+| 09 | [09-onboarding-copy.md](09-onboarding-copy.md) | First-run guidance (Camera → Pin), caption autofocus, professional/literal copy rewrite | S |+| 10 | [10-mobile-responsive-polish.md](10-mobile-responsive-polish.md) | 320px, notch/safe-area insets, iOS input-zoom, landscape joystick/labels | S |++### Phase 3 — Backend hardening (zero 500s, full observability)+| # | File | Focus | Effort |+|---|------|-------|--------|+| 11 | [11-api-error-boundaries.md](11-api-error-boundaries.md) | null-row checks, JSON-safety, SSE send errors, graceful schema degrade | M |+| 12 | [12-resilience-fail-open.md](12-resilience-fail-open.md) | rate-limiter try-catch, SSE breaker on persistent failure, Guardian degraded-cache, dedupe pruning | M |+| 13 | [13-security-validation.md](13-security-validation.md) | error-message disclosure, report sanitize, id/radius/allow-list validation, expiry + per-pin report caps | M |+| 14 | [14-observability.md](14-observability.md) | moderation/ops alerts, SSE metrics, structured error logging into the client-error/ops pipeline | S |++### Phase 4 — Launch gate+| # | File | Focus | Effort |+|---|------|-------|--------|+| 15 | [15-deploy-verify-and-qa.md](15-deploy-verify-and-qa.md) | Prove all endpoints live in prod (stale-deploy risk), real-device test matrix, end-to-end flow, console-clean audit | M |++---++## Recommended run order++Phase 1 and Phase 3 are independent and can run in parallel. Phase 2 can start+anytime. **Phase 4 (task 15) runs last** — it is the gate that proves the whole+program landed in production.++```+Phase 1 (AR): 01 → 02 → 03 → 04 → 05 → 06+Phase 3 (backend): 11 → 12 → 13 → 14 (parallel with Phase 1)+Phase 2 (UX): 07, 08, 09, 10 (any time; 08 pairs well after 11)+Phase 4 (gate): 15 (after all above)+```++Each task ends with a Definition of Done. The program is complete only when+task 15 passes on real devices with a clean console and all `npm test` green.diff --git a/tasks/irl-room-anchor/R4-production-hardening-and-cleanup.md b/tasks/irl-room-anchor/R4-production-hardening-and-cleanup.mdnew file mode 100644index 000000000..eab625903--- /dev/null+++ b/tasks/irl-room-anchor/R4-production-hardening-and-cleanup.md@@ -0,0 +1,105 @@+# R4 — Production hardening, dead-code/realtime reconcile, Definition-of-done sweep++> Epic R · Size **M** · Touches `src/irl.js`, `api/irl/pins.js`, `multiplayer/*`,+> `src/irl-net.js`, `data/changelog.json`. Runs after R1–R3. See README.++## Goal++Take the room feature from "works" to **100% production-ready, zero-error,+complete**: every state designed, accessibility and performance solid, security+and abuse limits in place, the now-dormant realtime additions reconciled (no dead+code that implies a live pin stream), the deploy verified live, and a clean+changelog. This is the task that earns the user's bar.++## Why it matters++The engine is sound and R1–R3 deliver the UX, but "production-ready, zero error"+is its own discipline: it's the empty states, the failure paths, the keyboard+users, the dense-crowd frame budget, the abuse caps, and proving the code is+actually live (this codebase has shipped features that 404'd behind a stale+deploy). Skipping it is exactly the "good enough" CLAUDE.md forbids.++## What to build / verify++### 1. Reconcile the dormant realtime layer (zero dead code)++The realtime pin transport was removed (rooms ride the REST proximity read). The+room fields added to the realtime path are now inert:++- `multiplayer/src/irl-schemas.js` — `IrlPin` room fields (append-only).+- `src/irl-net.js` — `_pinToObj` room fields (if still present after concurrent edits).+- `src/irl.js` — `normalizeStreamPin` room fields.++**Decision required, then execute it cleanly:** either (a) **remove** these and+the comments that imply a live pin stream, since pins don't sync over the socket;+or (b) **keep** them only if a deliberate, documented plan re-enables room+`pin:update` for live room-calibrate propagation — in which case wire it end to+end and test it. Do not leave ambiguous half-wired code. Coordinate with whoever+owns the IRL privacy lockdown (it actively edits these files). Default to (a)+unless live room sync is explicitly wanted.++- Confirm room-calibrate (R2) propagation matches the chosen transport: under+ REST-only, a calibrated room updates other viewers on their next poll+ (~10 s) — make that latency honest in the UI, or implement the documented live+ path. No silent "instant" claims that aren't true.++### 2. Every state, every surface (R1–R3 sweep)++Audit each new surface (aim HUD, distance control, room badge, management sheet,+room-calibrate, WebXR reticle) for: skeleton/loading, empty, error (actionable),+populated, and overflow (e.g. a room with 40 agents — the per-cell density cap).+Reuse `src/shared/state-kit.js` where the dashboard does. No blank voids, no raw+spinners where a skeleton fits.++### 3. Accessibility + responsive++- Keyboard path through the whole flow (enter mode → aim → place → manage →+ align → exit); visible focus rings; ARIA on reticle/slider/buttons/badge;+ `aria-live` for count + status changes; `prefers-reduced-motion` respected.+- 320 / 768 / 1440 layouts; thumb-zone controls; clear of the iOS home indicator+ and the notch.++### 4. Performance (dense rooms)++- Room pins must ride the existing LOD/impostor/load-queue budget (E2) — they go+ through `spawnNearbyPin`/`enforceLOD` already; confirm a 30-agent room holds+ frame rate via `window.__irlSeedRoom()` + `window.__irlPerf()` and the headless+ recipe. No per-frame allocations in `pinWorldPos`/the ghost-preview loop;+ reuse vectors. Debounce the distance-slider re-projection sensibly.++### 5. Security / abuse / privacy++- Room placements respect the existing per-cell density cap (`MAX_PINS_PER_CELL`)+ and per-owner caps; a single actor cannot carpet a venue under a room id.+- `room_id` is validated (`ROOM_ID_RE`) and never rendered as HTML unescaped+ (use `_escHtml`).+- Room-calibrate is owner-gated server-side for **every** pin in the room (R2);+ re-verify no path lets a non-owner move a cluster.+- No `user_id`/`device_token` in any room projection; bbox stays internal-only.+- $THREE-only guard intact on any new captions/labels.++### 6. Deploy verification (prove it's live)++- After deploy, confirm the six room columns exist (the inline `ALTER` runs on+ first request) and `GET /api/irl/pins?lat&lng` returns the room fields in prod+ — not just locally. The repo has a history of stale deploys masking shipped+ endpoints; check the live deployment actually serves the new code.++### 7. Changelog + final sweep++- Append holder-readable entries to `data/changelog.json` (plain language: "place+ AI agents at fixed spots around a real room"), tags `feature`/`improvement`;+ run `npm run build:pages` (it validates + regenerates). After deploy,+ `npm run changelog:push` (skip silently if creds absent locally).+- Run the full Definition-of-done checklist from the README against the running+ app. `npm run typecheck` clean; `npm test` green; `vite build` clean; no+ console errors/warnings from our code; `git diff` reviewed line-by-line.++## Definition of done++- The dormant realtime layer is resolved (removed or fully wired + tested) — no+ dead/misleading code remains.+- Every new surface has all states; full keyboard + ARIA; responsive; reduced-+ motion safe. A 30-agent room holds frame budget.+- Abuse/ownership/privacy limits verified client + server. Deploy verified live+ (columns + projection serving in prod). Changelog shipped. Full DoD met.diff --git a/tasks/irl-room-anchor/R5-on-device-qa.md b/tasks/irl-room-anchor/R5-on-device-qa.mdnew file mode 100644index 000000000..0d098f16a--- /dev/null+++ b/tasks/irl-room-anchor/R5-on-device-qa.md@@ -0,0 +1,86 @@+# R5 — On-device QA + verification protocol (the proof of "done")++> Epic R · Size **S–M** · No product code by default — this task **verifies** the+> running app on real hardware and files precise defects back to R1–R4. See README.++## Goal++Prove the feature works the way the user described — on real phones, not in a+headless harness — and capture the evidence. This codebase verifies all AR/`/irl`+work post-deploy (the sandbox has no camera/compass/GPS); this task is that step,+made rigorous and repeatable. The feature is **not "done" until this passes**.++## Why it matters++Everything upstream can be green in CI and still feel wrong on a phone: a reticle+that fights the thumb, a ghost that lags the heading, agents that drift as you+walk, an iOS device that shows a dead WebXR button, a room that renders rotated+on a second phone. Only on-device QA catches these — and the user asked for+"best-possible UX," which is a felt property, not a unit test.++## Pre-conditions++- R1–R4 merged and **deployed** (R4 §6 confirms the room columns + projection are+ live in prod). QA runs against the deployed URL, not localhost.+- Two test devices minimum: one **iOS Safari** (no WebXR — fallback path) and one+ **Android Chrome** (WebXR — precision path). A second phone (or a colleague's)+ for the cross-user check.++## The canonical scenario (run it verbatim)++Stand in a room. Facing one wall ("the cup is dead ahead"):++1. Open `/irl`, grant camera/motion/location, enter **Place agents** mode.+2. Turn ~90° right (toward "the couch"), set ~3 m, **Place** an agent. Confirm it+ appears sitting there, facing you.+3. Turn to face behind you (~180°); place **three** agents at ~2–4 m, slightly+ spread. Confirm three distinct agents, none stacked.+4. Turn to the left wall (~270°): confirm **nothing** is there.+5. Slowly rotate a full 360°. Acceptance: each agent **enters and leaves frame at+ its real bearing**, stays locked to its spot (does not ride the screen), and+ the left wall + the cup direction stay empty. This is the user's exact ask —+ it must feel like real people are in those spots.+6. Walk forward 2–3 m and back: agents hold their world positions (parallax is+ correct; they don't swim beyond the honest GPS-confidence amount).+7. Tap an agent → edit caption/avatar, remove. Re-place. All correct.++## Cross-user check++- On a second device at the same spot, open `/irl`. Acceptance: the **same layout+ appears on the same bearings** (within the room-confidence radius). If it's+ shifted/rotated, use **Align this room** (R2) once and confirm the whole cluster+ snaps onto reality and persists for both devices.++## Device matrix++| Path | iOS Safari | Android Chrome |+|---|---|---|+| Permissions (camera/motion/location) gates + recovery | ✓ | ✓ |+| Aim HUD + ghost preview tracks heading smoothly | ✓ | ✓ |+| Place / multi-place / edit / remove | ✓ | ✓ |+| Turn-to-see world lock (the 360° test) | ✓ | ✓ |+| WebXR floor reticle + drop | n/a (must be **absent**, no console noise) | ✓ |+| Room renders cross-device | ✓ | ✓ |+| One-gesture room calibrate (owner) | ✓ | ✓ |+| Loose-lock / denied-permission / POST-error states | ✓ | ✓ |++## What to capture++- A short screen capture of the 360° turn-to-see test on each OS (the+ share-composite path in `src/irl/share-frame.js` can grab frames).+- The browser console from each device (must be free of our errors/warnings).+- Network tab: `GET /api/irl/pins` returns room fields; `POST` sends a valid+ `room` block; no failed requests.+- Any defect filed as a precise, reproducible note against the owning task+ (R1–R4) with device, OS version, steps, and expected vs actual.++## Definition of done++- The canonical scenario passes on both iOS Safari and Android Chrome.+- The cross-user check passes (same layout on two devices; calibrate aligns it).+- The device matrix is fully ✓ (WebXR present only where supported; clean+ fallback elsewhere).+- Evidence captured; zero console errors/warnings from our code; no failed+ network calls. Any defects fixed in the owning task and re-verified.+- Only then is Epic R shipped — delete `tasks/irl-room-anchor/*` per+ `tasks/CLEANUP-PLAN.md`.