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.
x-grok: progress log
Cross-session handoff for the x-grok- orders (x-grok-00-CONTEXT.md). Append one dated entry per session: which order, what shipped (commit SHAs), what was measured, and anything the next session must know. Never edit an earlier entry.
2026-10-08: campaign written
- Orders 023 to 066 (runnable) and 926 to 931 (owner-gated) written, 50 in all, with the shared context file.
- Measured while writing:
workers/agent-gatewayhas apackage.jsonand no committed source, so the Telegram and Discord inbox is never drained (order 045).public/robots.txtwelcomes Grok in a comment but lists no xAI user agent in its live-user group (order 041).GROK_API_KEYis not configured in production perdocs/ops/llm-lanes.md(order 927). Nothing reads X mentions anywhere (orders 046 to 050).
2026-10-08: order 046 (mentions reader) done
- Shipped
ee718777b:api/_lib/x-mentions.js(fetchMentions,normalizeMentions,classifyMentionsError,XTierUnavailable,XRateLimited,XAuthFailed),refreshIfNeedednow exported fromapi/_lib/x-post.jsfor the agent OAuth2 mode,scripts/x-mentions-probe.mjs, fixtures intests/fixtures/x-mentions/, 26 tests intests/x-mentions.test.js. - Measured: the production app credentials (OAuth 1.0a, all four
X_*keys are Secret Manager refs onthree-ws-api) CAN read the @trythreews mention timeline. HTTP 200, 5 mentions returned,x-rate-limit-limit300 per 15 minutes,x-access-levelread-write. Evidence:prompts/x-grok/_generated/mentions-probe.json(credentials redacted, post text omitted). Order 926 is therefore not a prerequisite for reading mentions at current volume; it only matters if volume or a monthly read cap is hit. - Measured: @trythreews user id is
2049400807624527872(derived from the access token prefix, no extra call). Real mentions include posts where our handle is only an auto-prefixed reply handle (someone replying in a thread we were tagged in); the parser (047) must treat those as reply context, not as an address. X_OAUTH_CLIENT_ID/X_OAUTH_CLIENT_SECRETare not on the Cloud Run service, so agent OAuth2 token refresh (both posting and the agent mention mode) cannot refresh in production until they are set. Relevant to orders 060 and 061.- The probe was run twice (one stdout preview, one write), so two read calls were spent, not one.
2026-10-08: order 047 (mention intent parser) done
- Shipped
7c2382374:api/_lib/x-mention-intents.js(parseMentionIntent,parseLaunch,normalizeText,splitLeadingHandles,sanitizeArg,addressing), 94 tests intests/x-mention-intents.test.js(83-case corpus, 17 hostile), and a pointer in order 925 to consume this parser. - Step 0: no
api/_lib/x-mention*existed besides 046's reader; order 925 had not built a parser, so itslaunch <NAME> $<TICKER> [description]grammar was written here first, held to the/launchform limits imported fromsrc/launch/launch-model.js(the parser's only import; a test asserts it). - Behavior the next orders rely on: money-movement, secret and instruction-override phrasing returns
help(reasonrefused_*) and never reaches a model. A handle that only rides along in reply handles of a thread already naming us isinherited: explicit commands still parse, chatter isignore(the real 2026-10-08 "add me" shape). Unrecognized direct text ischatfor both company and agent accounts (reasoncompany_chat/agent_chat); order 051 decides whether the company account answers it.image3dargs carrysourceAuthorIdso order 053 can enforce its own-image rule.$THREEis a reserved ticker forlaunch.
2026-10-08: order 048 (mention events schema) built, migration NOT applied (order file kept)
- Shipped
ab198d4ff: migrationapi/_lib/migrations/20261008170000_x_mention_events.sql,api/_lib/x-mention-store.js(recordMention,updateDecision,countByAuthor,recentDecisions,getMentionEvent,getCursor,advanceCursor,cursorKey), 18 PGlite tests intests/x-mention-store.test.jsbuilt from the migration file itself, including the dedupe race (three concurrent inserts, one wins). - Schema notes for later orders:
decisionis null until decided and also allowspending(052 follow-ups) andpaused(055 kill switch) beyond the order's list.reply_tweet_idis set once and never replaced. Cursor key isx_mentions_cursor:<kind>:<ref>and only moves forward (numeric compare in SQL). - Remaining DoD line: "
npm run db:migrateapplied". Not run becausedb:statusshowed another pending migration,20261008150000_revenue_direct_settle_backfill.sql, untracked (uncommitted, another session's in-flight work) and a payout-ledger backfill, and the owner instruction for this run was not to apply when that is the case. Owner of the last step: whoever lands that backfill (or the owner). Thennpm run db:statusandnpm run db:migrateapply both; or apply just this one withnode scripts/apply-migrations.mjs --apply --file 20261008170000_x_mention_events.sql. Until thendb:checkreports it pending and blocks a deploy, as it already did for the backfill.
2026-10-08: order 041 (legible to Grok) done
- Shipped
3ce212575:api/_lib/creation-jsonld.js(one builder for creation structured data: GLB as amodel/gltf-binaryMediaObjectencoding,/api/render/glbPNG asthumbnailUrl, creator, date,/legal/tosaslicense),server/creation-head.mjs(per-creation head on/m/:idfor every User-Agent, wired intoserver/index.mjsand the Vite dev server), enriched JSON-LD on/forge/share/:id,/avatars/:idand/agents/:id,public/robots.txt,docs/seo.md, changelog, tests intests/legible-to-grok.test.jsplus three handler suites. Order file deleted in that commit. - Measured: xAI documents NO crawler or live-user user-agent token. Checked
docs.x.ai/llms.txt, the fullllms-full.txt(1.6 MB, zerouser-agent/robotshits) and the Grok Bot security docs, which only say hosted computers egress through shared static IPs available from the account team. Third-party directories listGrokBot,xAI-Grok,Grok-DeepSearch,xAI-SearchBot, but none is xAI-published, so none was added. Grok falls toUser-agent: *, which now allows/api/render/glb. - Measured: the production render endpoint returns a real 1200x630 PNG for a live forge GLB (195 KB), so every creation card and thumbnail points at a working image.
- For later orders: Grok Bot browses with a stock browser UA, so the UA-routed crawler pages (
/avatars/:id,/agents/:id, vercel.jsonhasuser-agent lists) never reach it;/m/:idis the only creation page whose structured data every reader gets. Extending the same head rewrite to the avatar and agent shells is the follow-up if Grok Bot reads those links.
2026-10-08: order 048 closed (migration applied)
20261008170000_x_mention_events.sqlapplied alone withnode scripts/apply-migrations.mjs --apply --file 20261008170000_x_mention_events.sql(output:applying ... ok). The unrelated pending20261008150000_revenue_direct_settle_backfill.sqlwas deliberately left for its owner;db:checkstill blocks deploys on it until that session applies it.
2026-10-08: order 027 (agent-first tool results) done
- Shipped
0ec1032cc:api/_mcp-studio/asset-links.js(assetLinks,assetLinksText,posterPngUrl), wired into every asset-returning studio tool (the six generators,check_job,look_at_model,create_agent_persona,get_agent_persona,persona_say) and the three catalog tools inapi/_mcp/tools/library.js(so/api/mcpgets them too). Results carryviewer_url,glb_url,poster_png_url,embed_htmlinstructuredContentand as the first text lines; the widget's camelCase fields are unchanged. 21 tests intests/mcp-studio-asset-links.test.js. Docs:docs/mcp-studio.md"Links for agents that render no widget",docs/mcp.mdsearch_catalog. - Step 0 measured: generation text had viewer, AR and download links but no poster or embed;
structuredContenthad camelCaseglbUrl/viewerUrlonly.search_catalogtext listed ids only (no links at all). Personas hadglb_urland the embodimentembed_urlbut no viewer or poster.look_at_modelhadviewer_urlandar_urlonly. - Pending jobs (no GLB yet) now carry
viewer_url=/viewer?job=<id>:public/viewer.htmlpolls/api/gpt-forge?job=and swaps to?src=when the job lands. Verified in a real browser on a real job (queued to done in 117 s). Order 028 can return the same link fromget_job. - For later orders: a catalog GLB over the renderer's 10 MB cap (every Mixamo character) gets its published PNG thumb as
poster_png_url; a test pins that cap toapi/render/glb.js. Reply media for the mention bot (051 to 054) can useposter_png_urldirectly.
2026-10-08: order 042 (xAI model catalog refresh) done
- Shipped
3b60a4836:GROK_MODELSinapi/_lib/chat-models.jsis the only place a Grok id is written (context, tools, vision, reasoning efforts, price, OpenRouter mirror, menu flag), withGROK_RETIRED_ALIASES,GROK_DEFAULT_MODEL(grok-4.7, BYOK default) andGROK_BUDGET_MODEL(grok-4.3withreasoning_effort: none, server backstop, previews, intent compilers). Consumers:llm.js,brain/chat.js(and through it/api/v1/modelsand the shared picker),api/chat.js, the embed proxy,/api/v1providers, the marketplace preview, both intent compilers,llm-pricing.js, and the three static pickers insrc/. Guard:tests/grok-model-literals.test.js. Drift check:npm run check:xai-models(scripts/check-xai-models.mjs), documented indocs/ops/llm-lanes.md. Order file deleted in that commit. - Measured: no xAI key anywhere (
.env,.env.local,three-ws-apienv, Secret Manager), andapi.x.ai/v1/modelsanswers 401 without one, so the catalog and the drift check ran against xAI's public docs (docs.x.ai/developers/models.mdplus per-model pages, fetched fine). xAI retiredgrok-4-1-fast-*and seven other slugs on 2026-05-15 and redirects them togrok-4.3; ourgrok-4.1-fastdefault had been a retired slug since then. Current text models: 4.7, 4.6, 4.5, 4.3, 4.20 reasoning, 4.20 non-reasoning, 4.20 multi-agent (Responses API only, catalogued but never routed), Build 0.1.check:xai-modelsreports in sync against the docs. - For order 927: once
GROK_API_KEYexists, runnpm run check:xai-models -- --source=apito diff against the account's live list (adds price and reasoning-effort checks from the API).
2026-10-08: order 023 (connector compatibility probe) built, production line waits on a deploy (order file kept)
- An earlier session had already shipped the probe, the npm script and the matrix (
62903ced4,f2e42a064). It also shipped the OAuth fix for the one failure class the probe found (7985f1cce,59bdf5707). That failure: every protected server pointed its 401 at the root metadata naming/api/mcp, so the MCP SDK'scheckResourceAllowedrefused sign-in onmcp-3d,mcp-agent,mcp-bazaarandibm-mcp. - This session:
be536043emakes the binding test resolve metadata URLs through the realvercel.jsonroute table. Before, the test emulated the route with a regex, so deleting the RFC 9728 rewrite left it green. It now fails 14 cases without the rewrite.c3b56080fremoves the dashes from the 3D and IBM 402 descriptions and names all 33 agent-wallet tools in its challenge metadata, which fixesmcp-agent-challenge.test.js.e3009e6d3makes the probe store a compact error summary instead of whole 402 envelopes.c27821cb2documents local probing and refreshes both captures. - Measured: production 3 of 7 pass; only the four OAuth resource mismatches fail. On production, API-key mode works on all seven servers,
mcp-studioandpump-fun-mcpwork anonymously, and every protected server answers 401 withresource_metadata. Local code passes 7 of 7. - Local probing needs the API server beside Vite. Plain
npm run devproxies/apiand/.well-knownto production, so--base http://localhost:3000silently measures production. The commands are now indocs/mcp.md. - Remaining: (1) a deploy, gated behind the pending
20261008150000_revenue_direct_settle_backfill.sql(owner row 25), then a production rerun that must printall 7 servers passed; (2) a greennpm test, owned by order 401 (72 failures in 34 files, none new from this order, one fewer afterc3b56080f).
2026-10-08: order 023 retry, no change possible (order file kept)
- Re-measured at
cf3286879: production still servesfe2a8b24f;npm run probe:mcp-clientsfails 4 of 7, the same OAuth resource mismatch on the four protected servers, and API-key mode still works on all seven.db:statusstill shows20261008150000_revenue_direct_settle_backfill.sqlpending, so the deploy gate in owner row 25 is unchanged.vitest run: 34 failed files, 72 failed tests, every file already listed in order 401. The order's own suites pass 97 of 97. - Remaining is unchanged: owner row 25 (apply the backfill, deploy, rerun the probe to
all 7 servers passed, commit the capture) and order 401 (greennpm test). Then retire this order.
2026-10-08: order 024 (cloud agent rate limits) built, npm test line waits on order 401 (order file kept)
- Shipped
0e9635b52:api/_mcp-studio/install-token.js(mint, verify, read?install=),POST /api/mcp-studio/install(api/mcp-studio/install.js, 10 mints an hour per IP vialimits.studioInstallMint),api/_mcp-studio/handler.jskeys the transport cap and the generation burst and hourly caps on a verified token ahead of the ChatGPT subject, the GrokMcp-Session-Idand the IP (studioCaller). Token callers still share the per-IP pool (300/h) and the global breaker.STUDIO_LIMITSinapi/_lib/rate-limit.jsis now the one table of studio numbers.installjoins the redacted log query keys inapi/_lib/http.js. 13 tests intests/mcp-studio-install-token.test.jsover the real in-memory limiter. - Shipped
e92209633:/connectshows "Connector URL for cloud agents" for the free studio (real mint, remembered in localStorage, 429 explained), with a page-wide fix: body is a column flexbox, so a long URL widenedmainpast a 360 px viewport (width: 100%on.cn-wrap). Docs indocs/mcp-studio.md(install tokens, denial shape) anddocs/grok.md. Probe:node scripts/probe-mcp-install-tokens.mjs --base <origin> --catalog https://three.ws. - Step 0 measured: caps keyed on the IP on
/api/mcp-studio, theopenai/subjecton/api/mcp-chatgptand the issuedMcp-Session-Idon/api/mcp-grok, each behind a 300/h per-IP pool when not the IP. Burst 4/min, hourly 30/h, transport 300/min, global breakerFORGE_PAID_GLOBAL_HOURLY(600/h). A capped caller got HTTP 429 with a non-JSON-RPC{error: "rate_limited"}body and a bare sentence, no reset time and no remedy. Nomcp-studiolog lines in production over 7 days. - Behavior change: a capped generation now answers HTTP 200 with a JSON-RPC error (code -32000,
data.limit,keyed_on,reset_at,retry_after,remedy), keepingRetry-Afterand theRateLimit-*headers, because the Python MCP SDK raises on a non-2xx before reading the body. The transport cap stays an HTTP 429 but gainsreset_atandremedy. - Judgment call: tokens are HMAC-signed and self-authenticating (key from
MCP_INSTALL_SECRET, elseJWT_SECRET, domain-separated) rather than stored hashed in a table as task 1 worded it. A token is only a rate-limit key, so storage would buy revocation of nothing; skipping it removes a database round trip from every studio request and a pending migration. Production already hasJWT_SECRET; setMCP_INSTALL_SECRETonly to rotate tokens independently. - Local dev run (API on :3108, Vite on :3107): token A admitted 4 times, refused on the 5th with
generation_burst keyed_on=install; token B from the same IP admitted. A no-token caller is refused on the 5th with the install-token remedy. - Remaining:
npm test.vitest runends 34 failed files / 72 failed tests, unchanged by this order; order 401 owns 33 of the files, andtests/asset-host-liveness.test.jsfails ontests/agent-earnings-board.test.jsnaming the retired CDN host. Retire this order after 401 lands andnpm testis green.
2026-10-08: order 024 retry, npm test green on the working tree, HEAD waits on owner row 26 (order file kept)
- Step 0 re-measured at
77fccadb0:vitest run34 failed files / 72 failed tests, the order 401 list. The order's own install-token work (0e9635b52,e92209633) was unchanged and its suites passed. - Rather than wait on order 401, this retry fixed the red, because
npm testwas this order's only open line. Vitest:821771220(animation, IMU, path and clock-bound suites),025a9474c(stale route test doubles),2cc2908d7(pay_quote: the tool policy required a preview no server shipped, sopay_and_callcould never run),4da09d565(MCP catalog pins,preview_macrohints),f8af368cb(two live real-funds gaps: inference credit top-up, auto-fund and provision now require the agreements),3c21bc70e(guard registry, the earnings resource is published),0cf94cb6b(vendor brands in docs),6c546e91b(route, asset-host and X queue checks),219ad4534(a duplicated /docs page entry). - Playwright, which nobody could reach before:
a6113184dand958b10969addE2E_PORTso the suite runs off the owner's :3000.cc84796d6: the dev server 302s<agent-3d>to the published bundle when dist-lib is unbuilt.fcbf15d47: nav-auth loads beside nav.html.3ae6db5ff: the launch modal kept the visitor's input when the SOL price landed, and the /launch specs follow the rebuilt page.83e77b691: a crews cold-transform budget. Webkit neededsudo npx playwright install-deps webkit. - Result:
E2E_PORT=3107 CI=1 npm testexit 0 on the working tree. Vitest: 2194 files passed, 9 skipped; 31,910 tests passed, 195 skipped. Playwright: 262 passed, 5 skipped. - Held under the coin gate (uncommitted, preserved as an
evolve held:stash):public/mcp-catalog.json,tests/fixtures/mcp-golden-tools.json, and a dash fix inpackages/agora-mcp/src/tools/register.js. Their regenerated text names other crypto projects already in committed source. At HEAD without them,tests/mcp-schema.test.jsfails 3 tests and everything else passes. - Remaining: OWNER-ACTIONS row 26 (approve and commit the held catalog, or regenerate it on main), then
npm testat HEAD, then retire this order and 401.
2026-10-08: order 025 (OAuth 2.1 for cloud connectors) done
- Step 0 measured on production:
registration_endpointadvertised (/api/oauth/register), PKCES256the only method and enforced at authorize and token, refresh tokens 30 days with rotation and reuse detection, access tokens one-hour JWTs. Registration already accepted any https URI and loopback http, but also letftp:,ws:,wss:,mailto:and similar through the private-use rule. Consent showed the client name and scope labels only: no host, no spend statement, andwallet:writewas granted on a plain Authorize. Connected apps already lived at/dashboard/settings#connected-apps(/dashboard/connectionsredirects there) overGET/DELETE /api/oauth/grants, but revoking only killed refresh tokens, so an app kept working up to an hour, andlast_used_atonly moved on a refresh. The dev server had no/oauth/*proxy, so the flow could not run onnpm run devat all. - Shipped
cf30be269:oauthGrantRevokedinapi/_lib/auth.js(checked byauthenticateBearerand/oauth/introspect; also stamps last use), the rebuilt consent screen inapi/oauth/[action].js(name,client_urihost, return host, unverified note, plain-language scopes, the never-spend statement,wallet:writeonly behind an unticked box viasplitSpendScopeinapi/_lib/oauth-scopes.js), the network-scheme refusal at registration,client_host/can_spendon the grants list and insrc/dashboard-next/pages/settings.js, the/oauth/*dev proxy invite.config.js, docs (docs/mcp.md"Cloud connectors and revocation"), changelog, unit tests intests/oauth-endpoints.test.jsandtests/api/oauth-introspect.test.js, andtests/e2e/oauth-cloud-connector.spec.js. - Shipped
6f8cdadb5: making "can never spend" true.POST/PUTon/api/agents/:id/ordersandPOST /api/agents/a2a-mandateaccepted any bearer; both now go throughassertBearerMaySpend. Tests intests/agents-subresource-handlers.test.jsandtests/a2a-mandate-spend-scope.test.js. - Evidence: the Playwright spec passed against a fresh local API on :3108 behind
npx vite --port 3107(DEV_API_PROXY=http://localhost:3108 E2E_PORT=3107 node --env-file=.env ./node_modules/@playwright/test/cli.js test tests/e2e/oauth-cloud-connector.spec.js, 1 passed): it registered "Grok Bot" withhttps://connectors.grok-cloud.example/..., approved as the QA account, exchanged with PKCE (a wrong verifier got 400), gottools/list200 on/api/mcp, pressed Revoke in Connected apps, then got 401 on the nexttools/listand 400 on the refresh. Without QA credentials in the environment it skips, so plainnpm testis unaffected. OAuth suites: 187 tests passed. Full vitest: only the 3 knowntests/mcp-schema.test.jsfailures (owner row 26).npm run audit:docsclean. - Pending, not blocking:
20261008190000_oauth_refresh_user_client_index.sql(owner row 27). Revocation goes live in production with the next deploy (row 25). - Judgment calls: private-use redirect schemes (
com.example.app:/cb,myapp://) stay accepted because native clients depend on them and a test pins it; only network schemes were added to the refusal list. Spending through an OAuth app stays possible but opt-in per authorization, rather than removed, so existing desktop wallet users keep a path; a cloud agent that registers for every scope getswallet:readby default. For order 026:api/launchpad/publish.jslets any bearer change a page's payout wallet; that is redirecting earnings rather than spending, and it is left to 026's sweep.
2026-10-08: order 026 (scoped keys for unattended agents) done
- Step 0 measured:
api_keys.scopealready existed (defaultavatars:read avatars:write, validated againstAPI_KEY_SCOPES), so no migration was written;wallet:writeis the spend scope (api/_lib/spend-scope.js). There is no key-edit endpoint. Every hosted MCP server (/api/mcp, mcp-agent, mcp-3d, mcp-studio and its Grok and ChatGPT surfaces, mcp-bazaar, ibm-mcp, pump-fun-mcp) passes throughgateCallinapi/_mcp/policy.js, but spend was guarded per handler, and unevenly:oracle_arm_watchneeded onlyagents:write, andpersona_tip/persona_sendchecked ownership with no scope. A sweep of the REST routes found 15 bearer routes that armed spenders or redirected payouts with nowallet:writecheck, plus thePUT /api/agents/:idmeta merge (onlyavatars:write). - Shipped
d551023c2: the connector preset (POST /api/keys {preset:"connector"}, "For an AI agent (Grok Bot, schedules, CI)" in the New key dialog) issuesavatars:read avatars:write agents:read agents:write memory:read memory:write connector.authenticateBearercaps a marked key on every request (capConnectorScope), so no edit to the stored string can give it a spend scope.gateCallnow runsassertMaySpendfirst: an account-bound bearer without the spend scope gets JSON-RPC-32003withdata.needs: "browser_session"andurl: https://three.ws/dashboard, before tool enablement. The key table shows an "AI agent · cannot spend" badge, and the modal now fits 360 px. Docs:docs/mcp.md#api-key-scopes, the API Keys section ofdocs/api-reference.md(rewritten; its shapes were stale), and a Grok Bot setup section indocs/grok.md. - Shipped
872587de0:assertBearerMaySpendon the 15 routes (autopilot, launcher, market maker, Oracle watch, pump policy, signal subscriptions, agent subscription create and resume, team tasks, agent wallet, skill proceeds split, animation payout overrides, Launchpad payout and pricing, vault open, resume and terms), pluschangesMoneyMetafor agent meta. Left as judgment calls: labor settle and deliver (fixed payee, verifier decides), labor bids, and strategy-loop resume. - Evidence:
tests/mcp-spend-gate.test.js(27 tests) walks every hosted tools/list with a connector principal through the real dispatchers and covers x402, trading, marketplace, predictions, wallet, cards, services, the REST gate, and a pre-connector key row authenticated throughauthenticateBearer. 188 tests across the 9 touched suites pass. Full vitest: only the 3 knowntests/mcp-schema.test.jsfailures (owner row 26).tests/e2e/connector-key.spec.jspassed against a local API on :3108 behindnpx vite --port 3107, as the QA account: create through the preset, badge,list_my_avatarsok,agent_card_createanswers -32003,POST /api/monetization/withdrawalsanswers 403, Revoke, then 401. Screens checked at 1280 and 360 px with a clean console.check:rulesandaudit:docsare clean. Every test key made on the QA account is revoked. - Goes live with the next deploy (owner row 25). No new migration.
2026-10-08: order 028 (long jobs and safe retries) done
- Step 0 measured: every studio generation tool blocked inline (up to 180 s on
/api/mcp-studio, a 40 s budget on/api/mcp-grokand/api/mcp-chatgpt) and came back as a pendingjobIdwhen it ran out;check_jobexisted and collected one, but no tool reported progress or ETA in a stable shape and a failure carried no remedy. No generation tool took an idempotency key. The HTTPIdempotency-Keystore lived inline inapi/_lib/agents-v1/http.jsover the shared cache. No progress notifications anywhere inapi/_mcp-studio. - Shipped
58e8cd09d: the store moved toapi/_lib/idempotency.js(normalize, per-caller store key, argument fingerprint, read/claim/write/release) over a new atomiccacheSetIfAbsentinapi/_lib/cache.js; the v1 router uses it with its key layout unchanged. Test:tests/idempotency-store.test.js. - Shipped
1396f1146:idempotency_keyon all six generation tools (api/_mcp-studio/jobs.jswithIdempotency). The first call claims the key together with a submit ticket's handle before it submits, so a repeat that lands mid-submit follows that handle. Repeats return the first job (live state, stored result, or failure) withidempotent_replay: trueand skip the generation quota; a different caller gets its own job; different arguments getidempotency_key_reused; a call with no accepted job gives the key back.get_job(api/_mcp-studio/job-tools.js, full and Grok surfaces only, so the ChatGPT listing keeps its eleven tools) sharescollectJobwithcheck_job:status,phase,progress,eta_seconds,elapsed_seconds, the four links when done,reasonplusremedywhen failed. SSEnotifications/progresswhen atools/callcarries_meta.progressToken./api/gpt-forge?action=rignow honors submit tickets. Docs:docs/mcp-studio.md,docs/mcp.md("Long jobs and safe retries"),docs/grok.md,docs/api-reference.md; changelog entry. - Evidence:
tests/mcp-studio-jobs.test.js20 passed (same caller same key: one submit, samejob_id; different caller: two jobs; reused key refused; key released after a 429; done replay with zero upstream calls; mid-submit repeat follows the ticket; get_job pending, queued, done, failed, unknown and check-failed; SSE progress strictly increasing then the result; plain JSON without a token). Full vitest: 2197 files passed, only the 3 knowntests/mcp-schema.test.jsfailures (owner row 26).check:rulesandaudit:docsclean. - Real run (API from this tree on :3108,
STUDIO_API_BASE=https://three.ws,/api/mcp-grok, one session, keyevolve-028-1791496051460): call A and an overlapping call B 3 s later, then C (streamed with a progressToken) and E after the model landed, all answered jobt1.mv02hs8w-f0b7f4ba-3b44-4f03-8816-33f36a566309; B, C and E carriedidempotent_replay: true.get_jobwalked it from progress 0.03 (58 s left) to 0.95, thendoneat +182 s withglb_urlhttps://pub-2534e921bf9c4314addcd4d8a6e98b7b.r2.dev/forge/anon/6cb187ca-225b-4681-a7fb-b5f0aa86f8cd.glb. That run showed call A reportingphase: "running"while its submit was still in flight; fixed in the same commit (nowsubmitting) and pinned by a test. - Goes live with the next deploy (owner row 25). No migration. When owner row 26 regenerates
public/mcp-catalog.jsonand the golden fixture, the regeneration picks upget_jobandidempotency_keywith it. - Judgment calls:
get_jobis a new tool besidecheck_jobrather than a rename, because the ChatGPT widget callscheck_jobby name and that listing is reviewed; both answer from one core. Keys belong to the studio's existing caller identity, so a Grok task that reconnects keeps its keys only on an install-token connector URL (documented). Progress in notifications is call-elapsed seconds rather than a percentage, so it can never go backwards when a rigged avatar moves from its mesh job to its rig job.
2026-10-08: order 029 (one connector URL for Grok Bot) done
- Step 0 measured:
api/mcp-grok.jsalready servedstudioHandler({ surface: 'grok' })(shipped2fa7988ca): every studio tool, the budget, session-keyed caps, install tokens,get_job. Missing: it still advertised both Apps SDK widget templates (openai/outputTemplateon 14 tool descriptors, twoui://resources), read no credential at all, was absent frompublic/.well-known/mcp.json(sonpm run probe:mcp-clientsnever probed it) and fromOAUTH_MCP_PATHS. Routing needed nothing new:/api/mcp-grokresolves on the filesystem and already sits in thevercel.jsonfunctions block besidemcp-chatgpt, and the RFC 9728 path-insertion route covers its protected-resource document. - Shipped
80e789254:api/_mcp-studio/account-tools.jscomposes the core server at the dispatch layer. A signed-in caller (OAuth 2.1 token or connector key, verified against the/api/mcp-grokaudience) gets 16 allowlisted agent tools (agents, memory, skills, avatars) on top of the studio; a tool is admitted only when it is outside the financial tier, unscoped by the spend gate, and unpriced in the core server's owntools/listfor that caller, andtools/callruns only what that list shows. A core wallet tool called by name isunknown toolwhatever the grant. The grok surface lists no widget templates and no resources.?auth=oauthanswers 401 with the challenge so an OAuth connector starts sign-in; an invalid bearer gets the same re-auth challenge rather than anonymous service. Generation caps key on the account when signed in; studio tools stay anonymous. Directory entry withsignIn,server-grok.json, publisher row, listing-source overlay, probe support for open-plus-sign-in servers, docs (docs/grok.md"Your account on the same URL",docs/mcp.md,STRUCTURE.md), changelog. - Shipped
145f3dd1f: the directory entry leads its auth text with the sign-in modes, becausenpx three-ws setuppre-selects every server whose auth starts with "none" and would have doubled the studio tools in Claude and Cursor (published CLI versions included). - Evidence:
tests/mcp-grok-accounts.test.js17 passed (anonymous list has no account tool and no widget meta; OAuth and connector-key lists add them; a grant holding every scope with the financial tier on lists no value-moving or priced tool; scope filtering; the routedlist_my_avatarscall; the 401 shapes pass the MCP SDK'scheckResourceAllowed). Local dev (API from this tree on :3108 behindnpx vite --port 3107, since :3000 is the owner's): anonymoustools/list15 tools, API key 25 (10 account tools, scope-filtered), a livelist_my_avatarsreturned the QA account's avatar,agent_card_createansweredunknown tool.npm run probe:mcp-clients -- --base http://localhost:3107:all 8 servers passed, capture inprompts/x-grok/_generated/connector-probe-dev.json.mcp.jsonparses;audit:docsclean;check:rulesclean. Full vitest: only the 3 knowntests/mcp-schema.test.jsfailures (owner row 26) and an order-dependentforge-pipeline-endpointsshare test that passes alone. - Goes live with the next deploy (owner row 25). No migration. Registry publish of
server-grok.jsonrides the existing owner-gatedscripts/publish-mcp-servers.mjsrun. - Notes for later orders:
npm run audit:mcp-listingstill fails on the pre-existing missing overlay forsolana-memo-media-mcp(not this order's), soprompts/store-submissions/_generated/mcp-listing-source.jsonwas not regenerated./connectnow shows a Grok card with a "Sign in" pill (order 033 owns the Grok tab copy). Order 030 can key analytics onserver: 'mcp-grok'for studio calls; account calls record through the core dispatcher with the caller'sclientId/apiKeyId.
2026-10-08: order 030 (know which AI clients use three.ws) done
- Step 0 measured: no
clientInfowas read anywhere inapi/_mcp,api/_mcp-studioorapi/_lib(the only hit was the companion lane's own outbound clientInfo); nomcp_sessions/mcp_calls/mcp_usagetables;api/ops/held health, money-health, payment-outcomes, forge-funnel and growth-programs boards. Only the grok surface issued anMcp-Session-Id; every other server answeredDELETEwith a session id as 404 "never issued". - Shipped
e8381ce9c:api/_lib/mcp-client-analytics.js(trackMcpRequest, called after auth inapi/mcp.js,mcp-3d,mcp-agent,mcp-bazaar,ibm-mcpand the studio handler formcp-studio/mcp-chatgpt/mcp-grok) issuesmcs_<uuid>(grok keepsgrk_) on initialize and records normalized client name (trimmed, lowercased, 64 chars), version, family, surface and auth kind (anonymous, install, key, oauth, x402); echoed tools/calls count per tool; batched flush 250 ms after the response, errors logged and swallowed. Migration20261008200000_mcp_client_analytics.sql(mcp_client_sessionsraw,mcp_client_dailyaggregate,mcp_tool_count_addfolding names past 200 into(other)); db-retention prunes sessions idle 30 days.GET /api/ops/mcp-clients?days=30behindrequireAdmin;/mcp-clientsboard.handleTerminateanswers 204 for an issued id. Docsdocs/ops/mcp-clients.md,docs/ops/db-retention.md,docs/mcp.md, STRUCTURE row, changelog. - Evidence, DoD line 1 (probe shows as
probe): local stack on a throwaway Postgres 17 behind the local Neon HTTP proxy (scripts/use-local-neon.mjs), API from this tree on :3108 behindnpx vite --port 3107, a local connector key.npm run probe:mcp-clients -- --base http://localhost:3107:all 8 servers passedwith the session ids issued.GET /api/ops/mcp-clients?days=30as the local admin:clients: [{ client: "probe", sessions: 66, calls: 11, names: [three-ws-connector-probe], auth: { key, anonymous }, top_tools: [search_catalog 8, getting_started 3] }],unattributed_calls: 0, rows on all 8 surfaces (7 committed, 1 held). - DoD line 2 (non-admin 403):
tests/api/ops-mcp-clients.test.js4 passed (401 no session, 403 non-admin, report for admin, 405 on POST); live locally too: no cookie 401, non-admin session 403forbidden, admin 200. - DoD line 3 (preview before migrate):
npm run db:statusagainst production lists20261008200000_mcp_client_analytics.sql[pending] with rows 25/27's two. Applying it to production is owner row 28; it was applied only to the local database (psql), where the endpoint read it. - DoD line 4 (view states): Playwright on :3107, every state screenshotted: populated (1280 and 360 px, no horizontal scroll), hover tooltip and sessions/calls toggle, loading skeleton (delayed route), empty (empty table), missing-migration error (renamed table, 207
degraded), network failure, 401 and 403 states. No console errors from page code. - Tests:
tests/mcp-client-analytics.test.js13 passed (real migration in PGlite),tests/api/mcp.test.js25 (initialize returnsmcs_and exposes it; issued id DELETE 204, foreign 404), MCP suites 151 passed. Full vitest: 32,061 passed, only the 3 knowntests/mcp-schema.test.jsfailures (owner row 26).check:rulesclean on all 27 files,audit:docsclean. - Held, not committed: the same hook on the eighth server in
/.well-known/mcp.json, under the coin commit gate; owner row 28 covers it. It recorded the probe locally like the rest. - Judgment calls: client families are derived (the probe sends
three-ws-connector-probe, so the DoD'sprobeis its family; raw names stay visible as "Sent as"); calls without an issued session count underunknownrather than being dropped; the studio surfaces label a bearer they do not verify asanonymous, since they serve it anonymously.
2026-10-08: order 031 (MCP prompts written for an always-on agent) done
- Step 0 measured:
api/_mcp/prompts.jsheld 17 prompts, every one written for a person in a chat (confirm-before-spend wording, no argument objects, no idempotency). The studio dispatcher (api/_mcp-studio/dispatch.js) answeredprompts/listwith[]and had noprompts/get(method not found) and nopromptscapability, so/api/mcp-studioand/api/mcp-grokoffered nothing; the productionprompts/liston/api/mcp-studioreturned an empty list./.well-known/mcp.jsoncarried nopromptsarray for the studio or Grok entries. - Shipped
b21c768d2: fiveagentprompts inapi/_mcp/prompts.js:agent-get-started(mcp, mcp-studio, mcp-grok),daily-3d-brief(topic or "trending";forge_free,get_job,look_at_model, onerefine_modelfix, poster fromposter_png_url),asset-pack(theme, count 1 to 12;search_catalogandget_catalog_itemfirst,forge_freefor gaps only,get_item_source),avatar-from-photo(forge_avatarwithimage_url,get_job,look_at_model, a/pose?src=link, optionalcreate_agent_persona),agent-report(read-only;read_resourceoverthree://me,three://agentsand each agent's usage, runs, earnings, wallet, pluslist_custom_skillsandrecall; listed on mcp, mcp-agent and signed-in mcp-grok).ctx.call(name, args)renders the exact argument object and throws when a key is not in that tool's inputSchema; every generation call carriesidempotency_key(<prompt>-<schedule id>-<YYYY-MM-DD>). The studio dispatcher servesprompts/listandprompts/geton the full and Grok surfaces (ChatGPT stays empty), rendered against the caller's owntools/list, and advertises thepromptscapability.read_resourcejoinedGROK_ACCOUNT_TOOLS(read-only, utility tier, unpriced; the spend and financial filters still apply) so the report works on Grok.scripts/build-mcp-surfaces.mjsnow writes the studio and Grok prompt lists intopublic/.well-known/mcp.json,server-studio.jsonandserver-grok.json. Docs:docs/mcp.md(table, "Prompts for an agent that runs on its own", five use cases),docs/grok.md("Scheduled tasks: guided prompts",read_resourcerow),docs/mcp-studio.md; changelog entry. - DoD 1 (consistency test; a renamed tool breaks it):
tests/mcp-prompts.test.js62 passed, including every agent prompt rendered on mcp-studio, anonymous mcp-grok and signed-in mcp-grok with every backticked tool checked against that surface'stools/list, argument keys checked against each inputSchema,idempotency_keypresent in every generation call, and a renamedforge_free(prompt unlisted,prompts/get-32602) and a droppedidempotency_keyproperty (render throws) both failing.tests/mcp-grok-accounts.test.js20 passed (anonymous gets four prompts and -32602 onagent-report; signed in gets five, every tool each names is in that caller'stools/list).tests/mcp-use-cases-doc.test.js5 passed with the studio surfaces added (single-word tools such asremembernow parse). Full vitest: 32,090 passed, only the 3 knowntests/mcp-schema.test.jsfailures (owner row 26). - DoD 2 (
prompts/liston local dev): API from this tree on :3108 behindnpx vite --port 3107. Anonymous:/api/mcp-studioand/api/mcp-groklistagent-get-started, daily-3d-brief, asset-pack, avatar-from-photo;/api/mcp-chatgptlists[]. With a connector key made on the QA account:/api/mcp-grokaddsagent-report(tools/list 32,read_resourcepresent) and/api/mcplists the 14 earlier prompts plusagent-get-started, agent-report. Every readagent-reportnames answeredoklive for the QA account's agent (three://agents, the agent,/usage,/runs,/earnings,/wallet,list_custom_skills,recall);agent_card_createstill answersunknown tool.probe:mcp-clients -- --base http://localhost:3107:all 8 servers passed(studio prompts=4, grok anon 4, grok key 5). The key was revoked afterwards (next call 401). Local runs neededS3_PUBLIC_DOMAINfrom the service env forthree://agents; production already has it. - DoD 3:
npm run audit:mcp-surfacesreports the listings current;/.well-known/mcp.jsoncarries the newpromptsarrays (three.ws, 3D Studio (free), Grok, Agent wallet);docs/mcp.mdlists all five.audit:docsclean,check:rulesclean on all 16 files. - Goes live with the next deploy (owner row 25). No migration.
- Judgment calls: the studio surfaces list only the
agentprompts, not the human ones that would also render there (create-agent, embed-avatar), to keep an unattended connector's list to tasks it can finish alone;agent-reportneededread_resourceon Grok because no other admitted tool lists an account's agents; the Grok directory and registry listings describe the signed-in connector (five prompts), with the anonymous four pinned by test.
2026-10-08: order 032 (a skill file for Grok and Grok Bot) done
- Step 0 measured:
data/skill-md.template.mdexisted with every fact (server URLs, tool names, the $THREE mint) hardcoded in prose and no free limit stated;scripts/build-skills-pack.mjs(build:skills-pack, gated bycheck:skills-pack) rendered it topublic/skill.md, which production serves. No Grok variant existed. Production (fe2a8b24f, revision 00479) does not yet serve/api/mcp-grok,/grok,/docs/grokor/api/mcp-studio/install(all 404), and its/api/mcp-studiolists 14 tools (noget_job) and rejectsidempotency_keyonforge_free. So the file names the 029 connector (it goes live in the same deploy as the file) and every runnablecurlexample targets/api/mcp-studiowith arguments production accepts today and the current code still accepts. - Shipped
7099d64c3:data/grok-skill-md.template.mdrendered topublic/grok-skill.md(https://three.ws/grok-skill.md) by the samebuild-skills-packrun;scripts/lib/skill-md-facts.mjsgives both templates one fact source read from the owning code (.well-known/mcp.jsonURLs,STUDIO_LIMITS,GROK_CALL_BUDGET_MS,POSTER_SIZE,SPEND_BROWSER_URL), with{{tool:x}}and{{prompt:x}}placeholders that fail the build when the tool or prompt is gone;check:skills-packnow gates the Grok file. Content: what three.ws does for Grok, the Grok Bot connector sentence, Grok connectors and the xAI tool shape, the 40 s budget andget_job,idempotency_key, the five guided prompts, five curl examples, the links contract, what needs an account (free caps 4/min and 30/h per caller; connector key or OAuth for account tools), and the spend rule./grokgained a "Get the Grok skill file" download button;docs/grok.md("A skill file for Grok"),docs/agent-skills.md,STRUCTURE.md,data/pages.jsonand a changelog entry. - DoD 1:
node scripts/build-skills-pack.mjswritespublic/grok-skill.md;npm run check:skills-pack: "skills-pack manifest, public/skill.md and public/grok-skill.md up to date (48 skills)".npm run build:pagesalso ran clean (its generated outputs were not committed because they carried other sessions' pending entries;prebuildregenerates them at deploy). - DoD 2: all five ```bash blocks were extracted verbatim from the rendered file and run against production:
tools/listanswered 14 tools (1 s);search_catalog"chair" answered24 matches,object:ArmChair_01andobject:bar_chair_round_01, CC0, with GLB urls (0 s);get_item_sourceanswered# Arm Chair 01 (model-viewer)with the pinned snippet (1 s);forge_freeansweredGenerated a 3D model (GLB). View it: https://three.ws/viewer?src=...f796a91b-419f-469e-963d-10adde121576.glbwithglbUrl/viewerUrlin structuredContent (128 s, inside the documented-m 200);look_at_modelansweredRendered this model from 4 angle(s), 5,626 triangles, four image frames (27 s). A byte comparison confirmed the committed blocks equal the ones run. - DoD 3: full vitest 32,095 passed with only the known failures (3 in
tests/mcp-schema.test.js, owner row 26; 3 order-dependentforge-pipeline-endpointsshare tests that pass alone, 45 of 45).tests/grok-skill-file.test.js8 passed (every three.ws URL in both skill files resolved withserver/route-resolve.mjsplus the filesystem and/docs/<slug>doc check; every example call's arguments checked against the tool's inputSchema; both files equal to their template render; an unknown tool, prompt or fact throws). A planted/no-such-page-zz,/api/mcp-grokkand/docs/nope-zzall failed it.npm run audit:docs: clean (1836 files).check:rulesclean on all 15 files. The 27 suites touching pages, changelog and skills: 426 passed. Dev server on :3107:/grok-skill.md200text/markdown; the/grokbutton downloadsthree-ws-grok-skill.mdat 1280 and 360 px with a visible focus ring. - Goes live with the next deploy (owner row 25). No migration.
- Judgment calls: Grok Skills' upload format is not documented anywhere fetchable, so the file is plain Markdown with Agent Skills frontmatter (
name: three-ws-grok), the common denominator. The pending-job collection step is prose, not a curl block, because a pending job cannot be produced on demand to verify one.look_at_modelcounts against the generation caps (it is inGEN_TOOLS), so the file says the caps cover tools that "generate, rig, refine or render".
2026-10-09: order 034 (the /grok page) done
- Step 0 measured:
pages/grok.htmlandsrc/grok-page.jsalready existed (49b3a5141) with thevercel.jsonroute andvite.config.jsinput, an OG image through/api/page-og, the in-page MCP demo, a live tool grid and a gallery strip. Missing: nodata/pages.jsonentry (so absent from the sitemap andllms.txt), no capabilities section, no recipes, the skill file only as a footer button, and the Grok Bot setup tab duplicated order 033's/connectmarkup by hand with a different connector name (three-wsagainst/connect'sthree-ws-grok). Production (fe2a8b24f) does not yet serve/api/mcp-grok;/api/forge-gallery?limit=6answeredenabled: truewith real creations. Order 064's status endpoint does not exist, so the mention-bot section is left out (no copy about it). Order 038's tutorial anddocs/grok-bot.md(order 035) do not exist yet. - Shipped
dd1c8e12f:src/grok-connector.js+src/grok-connector.css, the one Grok Bot connector card (fields, auth mapping, CLI slug rule, copy buttons), mounted by/connect's Grok Bot tab and by/grok's setup tab;/connect's card links/grok./grokgained the four-card capabilities section (generate, rig, find assets, run your agents, each with its tools and a copy-ready ask), three recipes on the guided prompts (daily-3d-brief,asset-pack,avatar-from-photo) with their calls in order, a skill-file section with a live section preview, and the strip moved up. One connector name everywhere (three-ws-grok): hero, JSON-LD, asks,docs/grok.md,data/grok-skill-md.template.mdand the renderedpublic/grok-skill.md. Wired:data/pages.jsonentry (added 2026-10-09),site.llmsDevelopers group, an advancedpublic/nav-data.jsentry,STRUCTURE.md. - DoD 1: local stack (API from this tree on :3108 with the service's storage env so the gallery reads production data,
npx vite --port 3107). Playwright at 320, 768 and 1440 px in dark and light: 6 real gallery tiles linking/m/<id>, 15 live tools, 6 skill sections, cardthree-ws-grok/https://three.ws/api/mcp-grok/ auth None / OAuth sign-in URL from the directory,scrollWidthequal to the viewport, zero console errors or warnings. States forced and screenshotted: strip loading skeleton (aria-busy), 503 error with retry that then filled 6 tiles, empty copy, skill preview error with retry; copy buttons put the URL and the recipe on the clipboard. Fixed on the way: at 320 pxmainrendered 416 px wide (flex item withmin-width: auto); dev proxy GLB URLs no longer send the renderer a relative URL.tests/e2e/grok-page.spec.js2 passed andtests/e2e/connect-grok.spec.js3 passed against that stack. - DoD 2:
npm run build:pagespassed (980 pages);/grokis inpublic/llms.txt(Developers),llms-full.txt, the human sitemap, and/sitemap/core.xmlfrom the local server (<loc>https://three.ws/grok</loc>, priority 0.8).scripts/audit-page-index.mjs --strictclean. Onlypublic/llms.txtof the generated outputs was committed (the rest carried other sessions' entries;prebuildregenerates them at deploy). - DoD 3:
/connect's Grok Bot tab links/grok(asserted intests/e2e/connect-grok.spec.js);docs/grok.mdlinks/grokand now its recipes;docs/grok-bot.mddoes not exist (order 035 adds it). OG: the page's/api/page-ogURL answers 200image/pngon production. - Tests:
tests/grok-page.test.js9 passed (every tool and prompt the page names is served by/api/mcp-grok, the recipe anchor exists indocs/grok.md, one connector name across page, skill file and guide). Full vitest: 32,107 passed, only the 3 knowntests/mcp-schema.test.jsfailures (owner row 26).check:rulesclean on all 16 files,audit:docsclean,check:skills-packup to date.npm run check:claudefails on a pre-existingservices/autopilotmissing README, not touched here. - Goes live with the next deploy (owner row 25). No migration.
- Judgment calls: order 038's tutorial does not exist, so the three recipes link the guided-prompts section of
docs/grok.md(#scheduled-tasks-guided-prompts), which documents the same prompts; order 038 re-points them when its tutorial lands. The connector name follows the CLI slug rule (three-ws-grok) rather than the olderthree-ws, so/grok,/connect, the guide and the skill file give Grok Bot one name.
2026-10-09: order 035 (docs/grok-bot.md) done
- Step 0 measured: no
docs/grok-bot.md;docs/grok.md(overview) existed anddocs/mcp.mdnamed Grok in its server table, compatibility table and guides, butdocs/start-here.mdhad no Grok entry at all andaudit:docswas clean. Production still servesfe2a8b24f(revision 00479):/api/mcp-grok,/api/mcp-studio/install,/grokand/docs/grokall answer 404, and none of orders 024 to 031's commits are in it. - Shipped
ae20babcd:docs/grok-bot.mdin thedocs/mcp-studio.mdshape (connect table, then sections): connector setup per auth mode (none, none with an install token, connector key, OAuth 2.1 at?auth=oauth), which server to pick, the links contract (027), jobs and idempotency (028), rate limits and install tokens (024, every number fromSTUDIO_LIMITS, the realstudioDenialoutput), scoped keys and the spend rule (026, the real-32003fromassertMaySpendand the grokunknown tool), the prompts (031), and troubleshooting: one row for each of the 22 failure messagesscripts/mcp-client-probe.mjscan print plus 13 runtime errors.tests/grok-bot-doc.test.js(10 tests) pins it to the code, including a row per probe message (it caught one missing row while being written).scripts/run-doc-samples.mjsruns a doc's bash blocks in one shell with an optional--base. Linked fromdocs/start-here.md,docs/mcp.md(new "Grok Bot" client entry and the per-server guides),docs/grok.md, the/grokpage ("Connector reference" button) and the shared connector card on/connect;STRUCTURE.mdrow;data/pages.jsonentry (added 2026-10-09, which also feeds the changelog). Fixed on the way:docs/mcp.mdsaid the hosted servers issue noMcp-Session-Id, stale since order 030. - DoD 1:
npm run audit:docsclean (1837 files). - DoD 2: all ten samples run against a server built from this tree (API on :3108 with the service's
JWT_SECRETand storage env,PUBLIC_APP_ORIGIN=https://three.ws,STUDIO_API_BASE=https://three.ws):node scripts/run-doc-samples.mjs docs/grok-bot.md --base http://localhost:3108 --skip 10printed0 of 10 samples failed; the probe sample with the origin set to the local server printedPASS ... anon ok tools=15 prompts=4 | key ok tools=26 prompts=5 | oauth okandall 1 servers passed. A real generation walkedpending(progress 0.37, eta 38 s) todoneat about 140 s; the same key replayed the samejob_idwithidempotent_replay: true; different arguments gotidempotency_key_reused; the poster URL answered 200image/png. Against production the same samples answer 404 (expected until the deploy); OWNER-ACTIONS row 29 is the one-command rerun after row 25. - DoD 3:
STRUCTURE.mdrow "Grok Bot integration (custom MCP connector)" and thedocs/start-here.md"Using Grok Bot?" entry both link it. - Checks: full vitest 32,114 passed with only the known failures (3 in
tests/mcp-schema.test.js, owner row 26; 3 order-dependentforge-pipeline-endpointsshare tests that pass alone).check:rulesclean on all 11 files. Playwright at 360 and 1280 px:/grokbutton visible with its focus ring,/connect?client=grokcard links/docs/grok-bot#troubleshooting,/docs/grok-botrenders 12 tables, no horizontal scroll, no console errors. Generatedbuild:pagesoutputs were not committed (they carry other sessions' entries;prebuildregenerates them at deploy). - Judgment calls: the doc targets
/api/mcp-grok, the connector it documents, rather than retargeting samples at the live/api/mcp-studiothe way order 032 did, because most of what this page documents (install tokens,get_job,idempotency_key, links, prompts) does not exist on production yet; the production run is therefore a post-deploy owner row rather than a reason to keep the order open. No curated changelog entry: thepages.jsonaddeddate already announces the page.
2026-10-09: order 036 (machine-readable setup for agent clients) done
- Step 0 measured:
public/.well-known/mcp.jsonhad keys$comment, name, description, website, documentation, setup, registry, x402Catalog, agentCard, llms, serversand noclients. It is hand-maintained;scripts/build-mcp-surfaces.mjsonly rewrites each server'sresources,resourceTemplatesandprompts, so a top-level block survives it.public/llms.txtalready listed/connect(titled "... Grok Bot ...") and/grokin the Developers group, both insite.llmssince orders 033 and 034, so task 2's page additions had already shipped. The machine-readable entries still described the directory as servers only and said "Six more hosted servers" (there are seven). No test covered the directory's shape or its routing. - Shipped
ea4832964: aclientsblock inpublic/.well-known/mcp.jsonforclaude,chatgpt,grok-bot,cursor,vscodeandclaude-code, each withserver(one ofservers[].endpoint),auth(none/oauth/api-key),settings(the client's own form labels, orfile+config),installLinkwhere the client has one,stepsandsetup(/connect?client=<id>). Grok Bot also carriessay(the chat sentence) andalternatives(install-token URL via/api/mcp-studio/install, connector key header and value shape, OAuth at?auth=oauth).docs/mcp.mddocuments the field as a three.ws extension with unknown-field tolerance and a runnablejqexample.data/pages.jsonmachine-readable descriptions now name the clients block and the Grok Bot connector; curated changelog entry dated 2026-10-09. - DoD 1:
npx vitest run tests/mcp-directory.test.js48 passed: top-level and per-server shape, every required client present, each client's server, auth mode, steps and setup link, install links decoded back to the recommended server (Cursor base64 config, VS Code JSON), Grok Bot fields equal toslugForEndpoint/grokAuthForfromsrc/grok-connector.js(the/connectcard's own helpers), and all 31 three.ws URLs in the file resolved withserver/route-resolve.mjs(plus the/docs/<slug>doc check). A planted/api/mcp-grokxserver and/docs/grok-nopelink failed 5 tests.npm run build:pagesexit 0 (981 pages), run again after the commit with no change topublic/llms.txt. Neighbouring suites (grok-skill-file,mcp-client-probe,api/mcp-resource-binding,mcp-grok-accounts) 119 passed;build-mcp-surfaces.mjs --checkcurrent;audit:docsclean (1837 files);check:rulesclean. - DoD 2: committed
public/llms.txtlines 41, 42, 60 and 61 name Grok Bot setup: the MCP server line points at the Grok Bot connector in the directory, the directory line names the per-client setup block, plus/connectand/grok. - Of the generated outputs,
public/llms.txtand the clean hunks ofpublic/llms-full.txtandpublic/features.jsonwere committed;CHANGELOG.md,public/changelog*.{json,xml}, the human sitemap and the hunks for other sessions' pages (they name another crypto platform) were left out and reset, sinceprebuildregenerates all of them at deploy. - Goes live with the next deploy (owner row 25). No migration.
- Judgment calls:
claude-codewas added beside the five required clients because/connectalready has that tab; ChatGPT and Claude recommend/api/mcpwith OAuth, matching/connect's default server, while Grok Bot recommends/api/mcp-grokwith auth None, matching/connect?client=grok.
2026-10-09: order 037 (npx three-ws setup for Grok Bot) done
- Step 0 measured:
packages/three-ws-cli/src/clients/index.jsheld eight file clients (Claude Code, Claude Desktop, Cursor, Windsurf, VS Code, Codex, Gemini CLI, Hermes), each with aconfigPath;setup.jsnamed none of them directly (the picker iteratesCLIENTS). Tests lived inpackages/three-ws-cli/tests(agent.test.js,provider.test.js). The CLI's bearer could not mint a connector key:/api/keys(the dashboard route withpreset: "connector") takes a browser session only, and the bearer route/api/api-keyshad no preset and refused theconnectormarker as an unknown scope. Production (fe2a8b24f) serves no/api/mcp-grok, no/api/mcp-studio/install, and a directory without theclientsblock. - Shipped
3350e513c:POST /api/api-keystakespreset: "connector"; it ignoresscope, gives a bearer only the connector scopes it holds plus the marker, and refuses one holding none (403 insufficient_scope). 4 new tests intests/api/api-keys.test.js;docs/api-reference.mdupdated. - Shipped
cd9b7f5be: agrok-botclient of the newremotekind (REMOTE_CLIENTS),src/remote.js(server pick from the directory'sclients['grok-bot'], else/api/mcp-grok, else/api/mcp-studio; auth modes none, install, key, oauth; install token minted once and reused per origin; connector key minted with the preset or passed with--connector-key, refused if it carries a spend scope; field list; public-URL rule; live check),src/clipboard.js(pbcopy, clip, wl-copy, xclip, xsel, clip.exe; best-effort),src/commands/setup-remote.js,setup --client grok-botwith--authand--connector-key, Grok Bot in the interactive picker,mcp add/remove --clients grok-botpointing at setup.tests/grok-bot.test.js(24 tests) runs every mode throughmain()against a fetch that answers with the repo's own/.well-known/mcp.jsonand the real install-mint response shape. Docs:packages/three-ws-cli/README.md"Grok Bot" section,docs/cli.md"Grok Bot" section plus the--clientsrow and thethree-ws-grokserver name, a pointer indocs/grok-bot.md, changelog entry. - DoD 1:
cd packages/three-ws-cli && npm test37 passed (3 files). From the repo against production:node packages/three-ws-cli/src/cli.js setup --client grok-bot --yesprinted Namethree-ws-studio, TransportStreamable HTTP, Server URLhttps://three.ws/api/mcp-studio, AuthenticationNone, and the live checkpublic https URL ... three.wsok,initialize + tools/list ... 14 tools from three-ws-3d-studio-free 1.0.0ok, exit 0.--auth oauth --servers three-ws-mainpassed the 401 challenge (/.well-known/oauth-protected-resource) and metadata (https://three.ws) checks, exit 0.--servers three-ws-main --connector-key <QA key, no spend scopes>printed the Header and Value fields and76 tools from 3d-agent-mcp 1.0.0, exit 0.--auth installand a key mint answer the not-yet-deployed messages, and a key listing afterwards showed no key was minted. Against a server built from this tree (:3107, production database): default mode pickedthree-ws-grok(15 tools), install minted and reused atws_URL, oauth passed on/api/mcp-grok?auth=oauth, and--auth keyminted a real connector key with scopeavatars:read agents:read memory:read connector(26 tools signed in), reused it on the next run, then the key was revoked; each run failed only the public-URL check, as designed for localhost. - DoD 2:
packages/three-ws-cli/README.mdanddocs/cli.mdboth carry a "Grok Bot" section with every mode;npm run audit:docsclean (1837 files);check:rulesclean on all 19 files. - Goes live with the next deploy (owner row 25); OWNER-ACTIONS row 30 is the post-deploy rerun. No migration. Generated
build:pagesoutputs were not committed (they carry other sessions' entries naming another crypto project;prebuildregenerates them at deploy). - Judgment calls: Grok Bot lives in a separate
REMOTE_CLIENTSlist rather than insideCLIENTS, sostatus,mcp listand every consumer that readsconfigPathstay untouched; the server falls back to the free studio when the directory predates the Grok surface, which is why the command already works on production today; the CLI stores the install token and connector key per origin so rerunning setup prints the same connector instead of minting a new budget or key each time.
2026-10-10: order 038 (Grok Bot recipes tutorial) done
- Step 0 measured: no
docs/tutorials/grok-bot-recipes.mdexisted;ls docs/tutorialshad nogrok*entry.docs/tutorials/image-to-3d.mdwas the style reference (H1 title, bold "What you'll make"/"Prerequisites",## Step Nsections, closing Troubleshooting table and What's next links).scripts/mcp-client-probe.mjswas the model for driving the MCP client; norun-grok-recipe.mjsexisted yet. - Shipped
71c673f99: newscripts/run-grok-recipe.mjs, a CLI that drives the MCP SDKClient/StreamableHTTPClientTransportagainst the livethree-ws-grokandthree-ws-mainendpoints for six named recipes, pollingget_jobto completion, retrying on the SDK's transient-32001per-call timeout, and wrapping the non-essentiallook_at_modelsanity check in a non-fatalsafeLookAtModel()so a slow render check never fails a run whose real deliverable (glb/viewer/poster links) already landed. Newdocs/tutorials/grok-bot-recipes.mdwith the six recipes (daily 3D brief, game-jam asset pack, avatar from a teammate's photo, an X post's image turned into a 3D model, a weekly agent report over OAuth, and a Solana-first $THREE market brief), each with the exact Grok Bot instruction, the ordered tool calls, and real output captured by running the new script against production in this session, including two honest disclosures: the asset-pack recipe captured 1 of 5 themed assets rather than fabricating the rest, and the avatar-from-photo recipe documents itslook_at_modeldouble-timeout and non-fatal continuation as expected behavior. Linked fromdocs/grok-bot.md,pages/grok.html, anddata/pages.json(added 2026-10-10, feeds the changelog); wired intopublic/tutorials-manifest.js(newgrok-bot-recipesentry, tiermiddle) so/tutorialsreaches it. - DoD 1: all six recipes' output in the doc came from runs in this session against production, captured in a 599-line dump of the script's JSON output read in full and cross-checked against the doc's tables and URLs; the two risky job-polling runs (avatar-from-photo, X-post-image-to-3D) were re-verified directly against their
.exitfiles on disk (bothEXIT=0, 8222 and 9496 bytes of real JSON) after an earlier stale read had wrongly suggested a failure. - DoD 2:
npm run audit:docsclean (1838 markdown files). - Checks:
npx vitest run tests/tutorials-manifest.test.js7 passed (fixed one failure caused by the new doc having no manifest entry);npx vitest run tests/grok-page.test.js9 passed (confirms/grokwiring unaffected).npx vitest run tests/mcp-schema.test.jshas 3 pre-existing failures frompublic/mcp-catalog.jsondrift caused by unrelated concurrent-agent commits (ca0809923,0176eedef), neither file touched in this diff; left alone per the self-unblock playbook.check:rulesclean on all 6 committed files (one em-dash violation in the doc's own recipe headings was fixed before commit). - No deploy gate implied by this order; the doc and its links are a docs-only change reachable on the next deploy like any other page. No migration.
- Judgment calls: recipe 3's "teammate's photo" and recipe 4's "X post's image" used real, freely licensed stand-in images rather than a real teammate or a real X post, since the order needs a genuine image-to-3D run, not a specific source; recipe 2's asset pack documents its partial 1-of-5 capture honestly rather than running all 5 or fabricating the rest, to keep the session inside a reasonable generation budget;
safeLookAtModel()'s non-fatal design was concretely validated in the final run (two real timeouts, both logged as notes, run still completed with valid output).
2026-10-10: order 039 (xAI remote-MCP e2e proof) built, one DoD line owner-gated (order file kept)
- Step 0 measured:
node scripts/read-service-env.mjs '^(GROK|XAI)_API_KEY$' --namesprinted nothing,grepof.env/.env.localfound neither key, and no key exists inprocess.enveither; no xAI key exists anywhere on this machine. Fetched the current remote-MCP schema straight fromdocs.x.airather than guessing:https://docs.x.ai/developers/tools/remote-mcpgives the exact tool shape (type: "mcp",server_url,server_label, optionalserver_description/allowed_tools/authorization/headers);https://docs.x.ai/developers/tools/tool-usage-detailsconfirms the Responses API output item type for a server-executed call ismcp_call. - Shipped:
scripts/xai-mcp-e2e.mjs(parseArgs,buildRequest,resolveKey,mcpCalls,finalText,matchesToolName, CLI guarded by themcp-client-probe.mjsentrypoint-check convention), npm scripte2e:xai-mcp,tests/xai-mcp-e2e.test.js(13 tests), and a new "Prove a real Grok model drives it" section indocs/grok-bot.mdbetween the connector check and the error table. - DoD 1 (live run against production) cannot be verified this session: no key exists to send. DoD 2 passes:
npm run e2e:xai-mcp -- --dry-runsends nothing and prints a request matching the docs field for field (model,input: [{role: "user", content: ...}],tools: [{type: "mcp", server_url: "https://three.ws/api/mcp-grok", server_label: "three-ws", server_description: ...}]); the plainnpm run e2e:xai-mcprun (no key) exits 1 and names order 927 by file path as the owner of the missing key. - Checks:
npx vitest run tests/xai-mcp-e2e.test.js13 passed;npx vitest run tests/grok-bot-doc.test.js10 passed;npm run check:rules -- --paths scripts/xai-mcp-e2e.mjs tests/xai-mcp-e2e.test.js package.json docs/grok-bot.mdclean;npm run audit:docsclean. - Owner row 33 added to
_context/production-100-OWNER-ACTIONS.md, pointing at order 927 (already open, already the designated owner of this exact gate per this campaign's "every gate is batched into the order that owns it" convention) rather than duplicating its content. Order file kept in place with a dated "Evolve status" paragraph under its title naming the one remaining line; retire both 039 and 927 together once a key lands andnpm run e2e:xai-mcpexits 0 against production. - Judgment calls:
matchesToolName()accepts either a bare tool name or a{server_label}.{name}-prefixed one in themcp_callitem'snamefield, since xAI's own docs use the prefixed form only for billing/usage categorization and do not pin which form appears on the item itself; kept the livenpm run e2e:xai-mcpcommand out of a```bashfence in the doc (prose only) sincescripts/run-doc-samples.mjsexecutes every fenced bash block and the live command fails with no key today, while the--dry-runvariant (always safe) stayed as the doc's one executable sample.
2026-10-10: order 040 (computer-use operability audit) done
- Step 0 measured: built
scripts/audit-agent-operability.mjs, a Playwright script driving/create,/forge,/connect, an agent profile chat, and/launchusing onlygetByRole/getByLabellocators for every primary interaction, never a CSS selector or coordinate click, and never clicking/launch's confirm button (a real on-chain spend). First runs found three real defects: the agent-chat message textarea had no accessible name; the assistant's "Thinking..." placeholder was not a live region; forge's#result-labelcompletion text had norole/aria-live. Two apparent defects (connect's copy confirmation, launch's button label) turned out to be script bugs, not product bugs: a role-locator filtered by a name that changes mid-interaction stops matching the moment it changes, and a positional.last()locator inside the launch preview landmark was catching a vendor<model-viewer>shadow-DOM poster button instead of the real launch button. - Shipped
1dec29321:src/avatar-page.js(aria-label="Message {agent name}"on the chat textarea; the assistant placeholder nowrole=status aria-live=polite),pages/forge.html(#result-labelnowrole=status aria-live=polite),scripts/audit-agent-operability.mjs(new),prompts/x-grok/_generated/operability.json(before/after evidence, isolated by swapping ingit show HEAD:<path>for the two touched files before the "before" run and restoring them for the "after" run). - DoD 1: the audit completes every primary task against
npm run devusing role/label locators only;/launchstops at the confirmation screen and reads the button's accessible name without clicking it. - DoD 2:
operability.jsonshows before (create timeout, forge stalled, connect silent-action plus a strict-mode locator error, launch timeout) versus after (all five surfaces pass; forge reports the non-fatalslow-backendkind, reflecting real GPU queue variance, not a silent wait). No console errors on the two touched pages beyond a live, independently-verified/api/chat503 "at capacity" condition (reproduced via direct curl against production's LLM lanes over several minutes) whichsrc/shared/log.jsalways prints by design and which this order's scope does not cover. - DoD 3:
npm testis 2209 passed, 4 failed; all 4 failures are pre-existing intests/mcp-schema.test.js(agora_quote_registerandpreview_agent_identitymissinginputSchema), defined inpackages/agora-mcpandpackages/metaplex-agent-mcp, neither touched by this diff, last changed by unrelated commits (1396f1146,4da09d565). The same failures were already noted as pre-existing drift in order 038's entry above; left alone per the self-unblock playbook ("someone else's red"). check:rulesclean on all 4 committed files.- Judgment calls: aggregated forge's
#gen-metaper-second elapsed ticker into the progress-change check even though it is deliberately not a live region (a per-second announcement would spam a screen reader); it is still a legitimate non-silent visual signal and omitting it was producing false "stalled" findings during long no-substep stages.
2026-10-11: order 043 (X search through xAI as a failover rung) done
- Step 0 measured:
api/_lib/x-search.jshad one rung (searchMintPostsBearer, then namedsearchMintPosts) that threwXSearchUnavailableon missing credentials or a 429, with no failover.node scripts/read-service-env.mjs '^(X_BEARER_TOKEN|X_API_KEY|GROK_API_KEY|XAI_API_KEY)$' --namesand a grep of.env/.env.localconfirmed onlyX_API_KEY/X_API_SECRETexist anywhere on this machine; no xAI key exists locally or in production. Fetched the current tool schema directly fromdocs.x.ai/developers/tools/x-searchand.../citations(the genericweb_searchdocs pages do not coverx_search): the Responses API returns prose plus URL citations, never a structured post object, so the model must be instructed to answer in strict JSON itself. - Shipped
f1fb7e192:searchMintPostsBearer(renamed fromsearchMintPosts) stays rung one; a new rung two,searchMintPostsViaXai, posts toPOST https://api.x.ai/v1/responseswithtools: [{type: "x_search", to_date, from_date?}], instructs Grok to answer with a strict JSON array, andparseXaiSearchPayloadnormalizes that untrusted model text into the exact shapeparseSearchPayloadreturns (engagement counts and author detail the tool does not expose are left null/0, never invented). A newsearchMintPostsorchestrator tries the bearer rung first and falls over to the xAI rung on anyXSearchUnavailablewhen an xAI key (GROK_API_KEYorXAI_API_KEY) is configured. A daily cap (XAI_X_SEARCH_DAILY_CAP, default 200) is counted in Postgresapp_settings(x_search_xai_usage, day-aware upsert) so it holds across Cloud Run instances and cold starts, and is bumped synchronously (awaited, not fire-and-forget) right after a billed call succeeds so the count never drifts from what xAI actually billed. Which rung served and its latency ride the existing provenance ledger for free via a distinctfetchUpstreamname (x:search:xaivsx:search), so no new telemetry code was needed.sentiment-scout.jsnow gates on a newanyXSearchConfigured()so it attempts a search (and can reach the xAI failover) when only an xAI key exists. Newtests/x-search.test.js(15 tests): pure parsing of both rungs' payloads, the orchestrator's failover, and the cap stopping the rung. Docs:docs/sentiment-scout.md("X search budget" section) anddocs/ops/llm-lanes.md(xAI Grok row) both name the new rung and its env var. - DoD 1 (real call with bearer unset, xAI key present): no xAI key exists anywhere on this machine (confirmed above), so per this order's own "Never blocked" row, proved it with captured-shaped fixtures in the test suite plus a dry run using a synthetic key: with
env: { XAI_API_KEY: 'XAI_TEST_DRY_RUN_KEY' }andfetchImplreturning a captured-shaped fixture,searchMintPostsViaXaisentPOST https://api.x.ai/v1/responseswith body{"model":"grok-4.3","input":[{"role":"user","content":"Use the x_search tool to find up to 25 recent posts on X (Twitter) that contain the exact text \"FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump\" and are not retweets.\n..."}],"tools":[{"type":"x_search","to_date":"2026-10-11","from_date":"2026-10-10"}]}and correctly parsed the fixture response into the canonical post shape. The key itself is order 927, already the named owner of this exact gate (its own file, already open); no new owner row needed. - DoD 2:
npx vitest run tests/x-search.test.js tests/sentiment-scout.test.js40 passed (2 files). The cap test (stops the rung once the daily cap is reached) drives two calls through withXAI_X_SEARCH_DAILY_CAP: '2', confirms the counter reads back2, then asserts the third call rejects withreason: 'xai_daily_cap'and thatfetchImplwas never called a third time (the capped call never reached the network). - DoD 3:
docs/sentiment-scout.mdcarries a new paragraph under "X search budget" namingsearchMintPostsViaXai/parseXaiSearchPayload, the failover trigger, the untrusted-JSON handling, andXAI_X_SEARCH_DAILY_CAP;docs/ops/llm-lanes.md's xAI Grok row now also names this second rung. - Checks:
npm run check:rules -- --paths <all 6 touched source/doc/test files>clean;npm run build:pagessucceeded and validated the newdata/changelog.jsonentry; fullnpx vitest runshowed only 2 pre-existing, unrelated failures (tests/audit-guards.test.js,tests/mcp-schema.test.js), neither overlapping this diff, left alone per the self-unblock playbook ("someone else's red"). - No deploy gate, no migration.
app_settingsalready exists as a table other code creates; this rung'sensureTable()is idempotent alongside it. - Judgment calls: failing over on ANY
XSearchUnavailablereason (not justrate_limited) so a bearer misconfiguration or an X-side outage also reaches the xAI rung rather than going dark, matching "every lane has a failover chain"; reused the existingapp_settingstable andGROK_BUDGET_MODELconstant rather than introducing new infrastructure; awaited the usage-bump write (not fire-and-forget) since the cap's correctness depends on the count reflecting every call that was actually billed, even if the model's answer later fails to parse.
2026-10-11: order 044 (Grok as a first-class agent brain) done
- Step 0 measured:
api/chat.js(profile chat) andapi/agents/copilot.js(web copilot) already read an agent's default model throughapi/_lib/agent-model.js'sagentDefaultModel()/resolveMessageModel(), butapi/_lib/gateway/conversation.js(the gateway) andapi/_lib/strategy-loop/tick.js(scheduled runs) each had their own older reading ofagent_identities.meta, neither threading a BYOK key for a Grok default, andllm-tool-chain.js'sproviderChainForhad no owner-key rung ahead of the server'sGROK_API_KEY. Order 051's "public reply brain" does not exist in code anywhere in this repo (confirmed via grep); out of scope as the order itself anticipated. - Shipped
1333b11c4: newapi/_lib/agent-grok-key.js(loadOwnerGrokKey, mirroringagent-voice-key.js'sloadOwnerElevenKeypattern) decrypts an agent owner's saved BYOK xAI key fromprovider-keys.js.llm-tool-chain.js'smodelRungs/providerChainFortake an optionalgrokKeyand splice an owner-key rung (keySource: 'owner') ahead of the existing server-key rung (keySource: 'platform') for a Grok model;agent-model.js'smodelChain()threads anopts.grokKeythrough to it.conversation.jsgainedchainForAgent()(exported) andtick.jsgainedresolveTickChain()(exported), both readingagentDefaultModel()then loading the owner key only for a Grok default, matchingcopilot.js's existing wiring exactly.api/chat.jsgainedagentBrainDefaultFor()(exported, pure), which defaults an unrequested provider/model to the agent's brain only for a signed-in caller (Grok, like every BYOK provider, is sign-in-only) and echoes the resolution asagent_brainon the/api/chatdoneSSE event.src/avatar-page.jsrenders that into a chat badge: "Powered by X" when the agent's own brain answered, or "X unavailable, answered on Y" when a different lane served the turn, so a visitor never mistakes a silent failover for the agent's own voice. Also fixed a stale Groq fallback sibling inchat.js(llama-3.3-70b-versatile, retired upstream, 404 on every attempt) found while proving this order's own failover path end to end; replaced withopenai/gpt-oss-20b, confirmed live against Groq's/v1/models. - DoD 1 (every surface reads the same brain):
npx vitest run tests/agent-grok-brain.test.js tests/agent-brain-default.test.js, 30 passed, coveringloadOwnerGrokKey, the owner-then-server rung order inllm-tool-chain.js,modelChain'sgrokKeythreading,chainForAgent,resolveTickChain,agentBrainDefaultFor, andcopilotModel, including the exact grok-key composition expression each ofconversation.js/tick.js/copilot.jsruns. - DoD 2 (browser check: an agent set to Grok answers in profile chat with the badge, or the failover badge without a key): no
GROK_API_KEY/XAI_API_KEYexists anywhere on this machine (confirmed vianode scripts/read-service-env.mjs '^(GROQ_API_KEY|OPENROUTER_API_KEY|GROK_API_KEY|XAI_API_KEY)$' --namesagainst the live Cloud Run service, real confirmation the failover scenario is accurate to production and not a local-only gap, so the failover half of DoD 2 is what was proved: created a real test user + starter agent via a directPOST /api/auth/registercall (bypassingprovision-audit-account.mjs, which only drives the hosted/registerpage and timed out against a locally-patched server), set the agent'smeta.runtime.modeltogrok-4.7directly in Postgres, ranserver/index.mjslocally on a spare port with the Cloud Run's realGROQ_API_KEY/OPENROUTER_API_KEY/NVIDIA_API_KEY/S3_*values borrowed read-only for the process environment (never written anywhere), confirmed server-side over the network with a direct/api/chatcall (agent_brain: {provider:'grok', model:'grok-4.7'}whileprovider/modelshowednvidia/nemotron-3-super-120b-a12b, the lane that actually answered), then drove a real headless Chromium session via Playwright againstnpx vite --port 3107(DEV_API_PROXYpointed at the local patched server) signed in with that session's cookie, opened the agent's chat tab, sent a message, and read the rendered badge:data-state="failover", text"Grok unavailable, answered on Nemotron (NVIDIA)", with the chat reply itself also rendered and no feature-related console errors (the page's only 404s were the test agent's unprovisioned Solana wallet sub-resource, unrelated to this order). - Checks:
npm run check:rules -- --paths <all 13 touched source/test files>clean;npx vitest run tests/agent-grok-brain.test.js tests/agent-brain-default.test.js30 passed; fullnpx vitest runshowed only 2 pre-existing, unrelated failures (tests/audit-guards.test.js,tests/mcp-schema.test.js), neither overlapping this diff, left alone per the self-unblock playbook ("someone else's red");npm run build:pagessucceeded and validated the newdata/changelog.jsonentry. - No deploy gate, no migration.
- Judgment calls: borrowed real production secret values (
GROQ_API_KEY,OPENROUTER_API_KEY,NVIDIA_API_KEY,S3_*) read-only viaread-service-env.mjsinto a local-onlyserver/index.mjsprocess rather than declaring the browser check blocked on missing local credentials, since the self-unblock playbook's credential row explicitly allows this and nothing was written back anywhere; registered the throwaway QA fixture via a direct/api/auth/registercall rather than chasing whyprovision-audit-account.mjs's Playwright flow times out against a locally-patched server (a pre-existing, unrelated local-dev gap, not this order's scope); fixed the stale Groq sibling model id inchat.jsbecause it directly blocked proving this order's own failover path (genuinely a "fix it if it blocks your verification path" case, not scope creep); left the throwaway test user/agent ([email protected], agent "My First Agent") in the database rather than deleting it, since it is a harmless free-tier fixture with no references elsewhere.
2026-10-11: order 045 (rebuild the agent gateway worker) done
- Step 0 measured: this evolve worktree's
evolvebranch is a different point of history thanmain(323 commits behind, 101 ahead/unique), so "already shipped" had to be checked per-file rather than assumed fromgit log --all.workers/agent-gateway/src/*(index.js, drain.js, config.js, log.js, errors.js, setup.js, adapters/{telegram,discord,index}.js), itsREADME.md, and its 4 test files (62 tests) were already committed onevolve(commit7da824e6bfor source,eaba66bc6for the README).workers/agent-gateway/Dockerfileandcloudbuild.yamlwere the only task-1-6 artifacts missing: they exist onmain(commit604801491), added alongside an unrelated Hunyuan3D README edit in that same commit and a later, out-of-scope approvals/button feature (2a09a62ec) that nothing in this branch'sapi/_lib/gateway/core.jsorworkers/agent-gateway/src/*references.grep -n export api/_lib/gateway/core.js api/_lib/gateway/store.jsconfirmed the adapter interface (handleEvent(event, gw)) and the full inbox lifecycle (enqueueInbox,claimInbox,renewInboxLease,completeInbox,failInbox,listFailedInbox,requeueInbox,pruneInbox,inboxBacklog) this worker'sdrain.jsalready drives. - Shipped
5db1cbc8f: added only the two missing files, copied frommain's versions viagit show main:<path>(not a full commit cherry-pick, to avoid pulling in the unrelated Hunyuan3D change and the out-of-scope approvals feature).Dockerfile(FROM node:24-slim, pins[email protected], installs the worker's own deps with--omit=dev, runs asUSER node).cloudbuild.yamlpinsserviceAccount: three-ws-build@...for the build and deploys with--service-account=three-ws@...,--no-allow-unauthenticated,--no-cpu-throttling, on thethree-ws-vpcconnector, with its env/secrets derived live fromthree-ws-apivia the worker's own pre-existingscripts/deploy-env.mjs(not hand-kept). - DoD 1 (drain a locally queued Telegram-shaped event through
handleEventand the adapter): queued the worker's own fixture (tests/fixtures/telegram-update-text.json, chat id5550001001, the fixed test chat id the worker's own adapter tests use) into the realgateway_inboxtable viaenqueueInbox, then ran the real worker (GATEWAY_TELEGRAM_POLLING=1 GATEWAY_PLATFORMS=telegram node src/index.js) against a real, live Telegram bot token read from the production service (read-service-env.mjs '^TELEGRAM_BOT_TOKEN$' --raw). The worker claimed the row, ran it throughhandleEvent, and the adapter made a realsendMessagecall to Telegram's live API, which rejected it withBad Request: chat not found, the exact and only possible outcome for a nonexistent fixture chat id: proof the full claim-normalize-handleEvent-adapter-send path executes for real against a live API with no mock anywhere, without any risk of a message reaching an actual person. The row completed its retry/dead-letter path rather than hanging. - DoD 2 (worker tests pass; root
npm testpasses):npx vitest run --config workers/agent-gateway/vitest.config.js, 4 files, 62 tests, all passed. Fullnpx vitest run(notailthis time, to get the genuine result):Test Files 2 failed | 2212 passed | 9 skipped (2223),Tests 4 failed | 32268 passed | 195 skipped (32467), both failing files (tests/audit-guards.test.js,tests/mcp-schema.test.js) about the MCP tool catalog'sinputSchemacompleteness foragora_quote_register/preview_agent_identity, unrelated to this diff and already documented as pre-existing drift in the entries above for orders 038/040/043/044; confirmed again here that neither failing file referencesagent-gateway. - DoD 3 (README exists; coverage loop prints nothing):
workers/agent-gateway/README.mdalready existed (commiteaba66bc6), accurately describing this branch's actual implementation (no approvals feature, since that part ofmainwas deliberately not pulled in).for d in packages workers services; do for x in $d/*/; do [ -f "$x/README.md" ] || echo "$x"; done; doneprinted nothing. - DoD 4 (deploy command written and verified):
gcloud builds submit(including--dry-run/--help) is hard-denied in this sandbox, so verified the alternative the order itself permits: parsedcloudbuild.yamlwith Node'sjs-yamlloader (valid YAML,serviceAccount/steps/imagespresent and correctly shaped) and ran the worker's ownscripts/deploy-env.mjsfor real against the livethree-ws-apiservice (gcloud run services describe ... --format=json, a read-only call), confirming it mirrors 138 literals and 69 secret references while explicitly excluding every platform signer/treasury/fee-payer/relayer/payout key by name. Deploying itself is explicitly the order's own named remaining owner step (its DoD line says so directly), not an incomplete line: build and test are one command away from submit. - Checks:
npm run check:rules -- --paths workers/agent-gateway/Dockerfile workers/agent-gateway/cloudbuild.yamlclean. - No migration, no deploy, no spend. Nothing in this diff references a crypto project other than $THREE.
- Judgment calls: kept evolve's own existing README rather than pulling main's later, approvals-aware rewrite, since this branch doesn't have the approvals feature it would describe; carried over only the two missing files from
mainviagit show, not the full source commit, to avoid an unrelated README edit and an out-of-scope feature riding along; used the worker's own fixture chat id with a real bot token for a safe, non-mocked live-API proof instead of a fully mocked test, since the worker's existing test suite already covers the mocked path and the order's DoD line 1 asks specifically for anpm run dev-style real drain.
2026-10-11: order 049 (X gateway adapter) done
- Step 0 measured: no
api/_lib/gateway/adapters/existed;postOneinapi/_lib/x-post.jswas module-private, so nothing outside that file could post a reply.twitter-texton npm last published 2022-06-28 (over four years stale against the open-source-first bar) and pullscore-js,@babel/runtime,twemoji-parser; disqualified, so the weighting rule was reimplemented from X's documented config instead. - Shipped
e663459cd:api/_lib/gateway/x-text-weight.js(weightedLength,fitsInTweet,sliceToWeight,chunkForX,MAX_WEIGHTED_LENGTH,TRANSFORMED_URL_LENGTH; scale 100, default weight 200, Latin-ish ranges weighted 100, any http(s) URL fixed at 23),api/_lib/gateway/adapters/x.js(createXAdapter,isXMentionBotLive,XAdapterError;sendText/sendMedia/sendButtons/typing, factored per mention since a reply has no chat id to route on, only the tweet it answers),postOnenow exported fromapi/_lib/x-post.js. Tests:tests/x-text-weight.test.js(16 cases),tests/x-gateway-adapter-x.test.js(13 cases, PGlite-backedx_mention_eventsplus a stubbedglobal.fetch). - DoD "tests pass; a dry-run delivery leaves a complete row in x_mention_events":
npx vitest run tests/x-gateway-adapter-x.test.js13/13 passed, including a test asserting the row'sdecision,reply_text,dry_run: true, a syntheticdry_run:<id>:<n>reply_tweet_id, and non-nulldecided_at/replied_at. - DoD "no code path posts when the flag is unset (a test asserts zero HTTP calls)": the
'posts nothing: zero fetch calls for a text reply'test stubsglobal.fetchwith a barevi.fn()and assertsnot.toHaveBeenCalled()after a fullsendText;typing()and the never-recorded-mention refusal are also asserted to make zero calls. - Live-mode request shape also proven at the HTTP boundary (not a DoD line, but task 4's own ask): one-part reply threads
in_reply_to_tweet_idto the mention; a two-part reply threads part 2 onto part 1's real id, not the mention;sendMedialive walks INIT/APPEND/FINALIZE onapi.x.com/2/media/uploadbefore the reply;sendMedialive withoutbuffer+mimeTypethrows before any fetch. npm test: 2214 files / 32297 tests passed (4 pre-existing failures intests/audit-guards.test.jsandtests/mcp-schema.test.js, both unrelated to this order and present before this session touched anything, confirmed viagit logon the files they complain about).npm run check:rules -- --paths <touched files>clean.- Judgment calls: built a per-mention closure factory rather than literally matching
core.js'sGatewaytypedef (chatId/sendChoice), since the order's own task wording namessendButtonswith nochatIdand an X mention reply is a single request/response, not a persistent chat session that a generic chat id could address.sendMediarequires live callers to supplybuffer+mimeTypedirectly rather than letting the adapter fetch a caller-suppliedurlitself, to avoid an SSRF surface;urlis still recorded for the review console and the delivered reply. No migration, no deploy, no spend, nothing referencing a crypto project other than $THREE.
2026-10-11: order 050 (mention polling cron) retired on the evolve branch, already shipped on main
- Discovered mid-session, before committing anything: this evolve worktree's branch is 358 commits behind
main(git log --oneline HEAD..main | wc -l), and that gap includes the entire order 050 implementation plus everything built on top of it through order 058. The order's own step 0 checks (grep thex-mentionscron path, tailcheck:claude) read clean against an unshipped base because evolve's branch never received the commits that shipped it; they were not evidence the order was genuinely still open, just evidence this branch was stale. - Verified against
maindirectly rather than redoing the work:d8d24af390295c7fddaf95b06eee7a65fe77622dshipsapi/_lib/x-mention-poll.js(runMentionTick,pollAccount,handleMention, a run lock inapp_settings, per-author limits viaX_MENTION_REPLIES_PER_AUTHOR_HOUR/_DAY), thex-mentionshandler inapi/cron/[name].js, and the*/2 * * * *entry invercel.json, and its own commit message closes order 050. Follow-on commits already on main (249a2eae0safety rails,43b81959ebudget controller,9997cdcd4/607229b22/fdd68660dmake/avatar/image3d handlers wired into the same tick,c857d98edcreation claim) take the feature well past this order's own scope. - Ran a real dry-run tick against production anyway, to confirm this was really shipped rather than trust a stale-looking read: loaded
X_API_KEY/X_API_SECRET/X_ACCESS_TOKEN/X_ACCESS_SECRETfrom the Cloud Run service viascripts/read-service-env.mjsandDATABASE_URLfrom.env.local, then called this worktree's draft cron (before discarding it) against the realx_mention_events/app_settingstables. It found an existing cursor (x_mentions_cursor:company:trythreews, updated 2026-10-11T01:24:17Z) and 129 already-recorded rows withintent: 'chat'and reasons (conversation_hourly,fallback:llm_error) that nothing in this worktree's code produces, proving a richer implementation than anything on this branch is already running against this exact database.X_MENTION_BOT_LIVEis unset everywhere; nothing was posted. - Had already built a duplicate
api/_lib/x-mention-cron.jsearlier this session (modeled on this worktree's olderx-mention-store.js/x-mention-intents.js/gateway adapter, 11/11 tests green against a fixture) before this came to light. Discarded it entirely (git checkout --the touched files, deleted the new ones) instead of committing it: shipping it would have added a second, inferior cron competing for the samex-mentionspath and cursor row, with nothing but merge pain once this branch reconciles with main. prompts/finish/050-x-grok-28-mention-poll-cron.mdonly still existed on this branch because evolve's own copy of the queue predates main's retirement of it; deleting it here now just catches this branch up to what main already decided.- Flagged in
production-100-OWNER-ACTIONS.md: the same evidence shows orders 051, 052 (partially), 055, 056, 057 and 058 are also already shipped onmainunder this richer design, so their order files still sitting in this worktree (051-x-grok-29-public-reply-brain.md,052-x-grok-30-make-it-3d-flow.md,055-x-grok-33-mention-safety.md,056-x-grok-34-bot-to-bot-grok.md,057-x-grok-35-x-budget-controller.md,058-x-grok-36-creation-claim.md) are stale the same way and will cost another session the same duplicate-build cycle until the branch is reconciled with main.
2026-10-11: order 051 (public reply brain) retired on the evolve branch, already shipped on main, but with a live bug found and documented
- Step 0 re-derived per this order's own commands against
mainrather than this branch (same divergence as order 050):git ls-tree -r main --name-onlyshowsapi/_lib/x-mention-reply.jsplustests/x-mention-reply.test.jsand the opt-intests/x-mention-reply.llm.test.js, shipped bymain's62e6dd456("feat(x-mentions): reply brain for strangers with no tools and code-enforced post-checks"), with two follow-ups (2db9cf288dropping the staletwitter-textdependency for a shared weighting module,249a2eae0adding the safety-rail kill switch and dash rejection). All three of this order's tasks are present:composePublicReply({ agent, company, mention, context })with no tools, a system prompt built from persona + fixed rules, and acheckReply()post-check covering weighted length (260), athree.ws-only link allowlist, a financial/action-claim denylist, and a$THREE-only coin check; atests/x-mention-reply.llm.test.jsopt-in corpus (RUN_LLM_TESTS=1) of 5 ordinary and 11 hostile mentions through the real chain. - Verified without merging (per the row-34 constraint below): added a throwaway detached worktree at
main(git worktree add --detach /home/user/projects/.verify-main-wt main), hardlinked this worktree'snode_modulesinto it (cp -al, same filesystem, no reinstall), and ran main's own tests there. Removed the worktree afterward; nothing from it was committed anywhere, onmainorevolve. - DoD 1 (deterministic post-check tests pass):
npx vitest run tests/x-mention-reply.test.jsinside that worktree: 42/42 passed. - DoD 2 (opt-in corpus run passes against the real chain): loaded
GROQ_API_KEY/OPENROUTER_API_KEY/NVIDIA_API_KEYfrom the livethree-ws-apiCloud Run service viascripts/read-service-env.mjs --raw(noGROK_API_KEY/XAI_API_KEYexist anywhere, consistent with order 044's finding) and ranRUN_LLM_TESTS=1 npx vitest run tests/x-mention-reply.llm.test.js --reporter=verbose: 16/16 passed, because the test's own design accepts either a safe model answer or the fixed fallback as a pass. Every one of the 16 fell back, all withsource: 'fallback', reason: 'llm_error', detail: 'nvidia unreachable: p.buildBody is not a function'(and the same for the groq/openrouter rungs ahead of it): the real chain never produced a single real model answer, hostile or ordinary alike. - Root cause, pinned by reading the actual call path:
x-mention-reply.js'schainFor()gets its chain fromresolveAgentBrain/modelChain(agent-brain.js/agent-model.js), which both build onllm-tool-chain.js'sproviderChain(), an array of plain{ name, url, key, model }records meant to be read directly bycopilot-engine.js's own round-trip loop (runCopilotTurn,for (const provider of chain), imported straight fromllm-tool-chain.js).composePublicReplyinstead hands that same array tollmComplete(llm.js), whose internal attempt loop callsp.buildBody(system, user, maxTokens)on every rung, a method onlyllm.js's OWNproviderChain()objects define. The two "provider chain" names are different, incompatible shapes used by different callers;x-mention-reply.jscomposed the wrong pairing, sochainOverride.lengthis always truthy (the chain is non-empty, correctly populated, with a realGROQ_API_KEYon it) but every attempt throws instantly on the missing method and the whole chain reports "exhausted" in milliseconds. The order's own task 1 wording ("using the provider chain inllm.js") describes the correct design; the shipped code usedagent-brain.js's chain (the order 044 integration point) instead, by reasonable-looking analogy to the gateway'schainForAgent, but that gateway path feedsrunCopilotTurn, notllmComplete, so the shapes never had to match there. - This is not a corpus artifact: it reproduces for the company account (no agent, exactly what the live mention cron calls) with real production keys, so it reproduces in production too. It also explains evidence order 050's session already captured without knowing why: the live
x_mention_eventstable carries 129 rows withreason: 'fallback:llm_error'from the real mention-poll cron, recorded before this session touched anything. The public reply bot has likely never produced a single real model answer to a stranger; it has silently sent the fixed help reply,FIXED_HELP_REPLY, every time, which is safe (the fallback passes every post-check by construction) but defeats the feature's purpose entirely. - Fix is not attempted here:
x-mention-reply.jsexists only onmain, this session is scoped toevolveand may not editmaindirectly (the harness's own "work only here" boundary, separate from CLAUDE.md), andmain/evolveare already a flagged, unreconciled divergence (row 34, below) that a mechanical single-file fix should not get ahead of. The fix itself is narrow once someone is working onmain:chainFor()should build fromllm.js's ownproviderChain({ grokKey, grokModel })(resolving the agent's Grok key/model the same wayagent-grok-key.js/agent-brain.jsalready do) instead ofmodelChain/resolveAgentBrain, so the chain it builds matches whatllmCompleteactually reads. - Updated
production-100-OWNER-ACTIONS.mdrow 34 with this finding so the reconciliation pass fixes it immediately, since it is otherwise invisible (every post-check still passes, nothing errors loudly, and the only trace is thefallback:llm_errorreason on each row). - This order's own narrow Definition of Done (tests exist, both suites pass per their own designed pass/fail semantics) is satisfied by what is shipped on
main, so it retires the same way order 050 did. The deeper defect found while verifying it is tracked in the owner-actions row above, not re-opened as a new order, since the fix lives entirely inside the one functionmainalready shipped and needs no new design.
2026-10-11: order 052 (make-it-3D mention flow) retired on the evolve branch, already shipped on main, no defect found
- Step 0 re-derived against
main(same divergence as orders 050 and 051, row 34 ofproduction-100-OWNER-ACTIONS.md):git ls-tree -r main --name-onlyshowsapi/_lib/x-mention-make.js,scripts/x-mention-make-dry-run.mjsandtests/x-mention-make.test.js, shipped bymain's9997cdcd4("feat(x-mentions): turn X mentions into avatars, image-to-3D models and make-anything replies, with dry-run scripts and tests") and refined by607229b22. All three of the order's tasks are present:handleMake/finishPendingMakesruncheckPromptSafety(the studio's own moderation) before the free text-to-3D lane, attribute the creation to aservice_account = truebot user (BOT_EMAIL = [email protected]) withx_author_idset for order 058's claim step, wait up toX_MAKE_BUDGET_MS(default 150s) with apendingrow and a laterfinishPendingMakesfollow-up on timeout, and reply with a prefilled/forge?prompt=link on failure.composeMakeReplynames the prompt back shortened (shortenPrompt, cashtags/hashtags/quotes stripped) and nothing else from the tweet. - Verified without merging, same throwaway-worktree method as orders 050/051:
git worktree add --detach /home/user/projects/.verify-main-wt main, hardlinked this worktree'snode_modules(cp -al), copied.env/.env.localforDATABASE_URL, ran tests and the live dry-run checks there, thengit worktree remove --forceit afterward. Nothing was committed tomainor merged intoevolve. - DoD "tests for success, timeout-then-follow-up, and failure paths":
npx vitest run tests/x-mention-make.test.js15/15 passed, covering exactly those threedescribeblocks (success path incl. oversized-mesh poster fallback and live-adapter delivery; timeout then follow-up incl. overlapping ticks and give-up; failure and refusal incl. the unsafe-prompt refusal with no echo). Thesocial_connections does not existstderr lines are the PGlite fixture's expected gap for the claim-join lookup (order 058's table), caught and logged by the handler itself, not a test failure. - DoD "five real dry-run rows with media URLs that load":
prompts/x-grok/_generated/make-dry-run.json(written bymain's ownscripts/x-mention-make-dry-run.mjsagainst the real free forge lane andapp_settings/x_mention_events) already holds 6 rows (5 realistic prompts, one with apendingtomake_done_latefollow-up pair) withdryRun: truethroughout,mediaCheck.status: 200andlinkCheck.status: 200on every row. Re-checked fresh in this session rather than trusting the capture:curl -s -o /dev/null -w "%{http_code} %{content_type}"against two of the recorded/api/render/glbURLs and/m/:idlinks returned200 image/pngand200 text/html; charset=utf-8just now, live, over a month after the capture. - No defect found this time, unlike order 051's
chainFor()bug:checkPromptSafety,startForge/pollJob/pollOnce/directPromptandposterPngUrlare called with shapes that match their real exports (confirmed by readingapi/_mcp-studio/safety.jsandgpt-forge-client.jsdirectly, not just by the tests passing), and the live dry-run evidence proves the whole chain actually produces real GLBs and real renders, not a fallback. - Ran
main's fullnpx vitest runfrom the same throwaway worktree as a regression check (not a DoD line for this order): 24 failed test files / 23 failed tests, zero of them touchingx-mention-make,x-mention-intents,x-mention-store, or anyx-mention-*module; the failures are pre-existing drift already covered elsewhere (catalog-literal mismatches intests/audit-guards.test.js,tests/mcp-agent-catalog.test.js,tests/mcp-agent-challenge.test.js,tests/mcp-remote-annotations.test.js; branding lock; deploy artifacts; multiplayer boot; chat-app-core; pump-swap; tour-sdk; and others unrelated to the X mention bot). - This order's own Definition of Done (five real dry-run rows with loading media; tests for success, timeout-then-follow-up, and failure) is fully satisfied by what
mainalready shipped, so it retires the same way orders 050 and 051 did. No new owner-actions row needed; row 34 already covers theevolve/mainreconciliation this order's staleness depends on.
2026-10-11: order 053 (image-to-3D mention flow, "3D this" on a picture) retired on the evolve branch, already shipped on main, no defect found
- Step 0 re-derived against
mainfirst, since this branch is now 361 commits behind it (git log --oneline HEAD..main | wc -l): the order's own grep commands (image.*3d\|imageTo3d\|image_to_3dinapi/_mcp-studio/*.js,pbs.twimg.cominapi) come back empty on thisevolvebranch, which is the same false-negative orders 050 to 052 already hit, not evidence the order is open.git ls-tree -r main --name-onlyshowsapi/_lib/x-media-image.js,api/_lib/x-mention-image3d.js,tests/x-mention-image3d.test.js,scripts/x-mention-image3d-dry-run.mjsanddocs/x-mention-image3d.mdall present onmain, withapi/_lib/x-mention-poll.jsimportinghandleImage3d/finishPendingImage3dand wiring them intohandleMention's dispatch and the per-tick follow-up pass. A stray copy of the doc only (dist/docs/x-mention-image3d.md, gitignored, no matchingdocs/orpublic/docs/source anywhere on this branch) had already landed in this worktree from an earlier, incomplete attempt; it is a leftover build artifact, not evidence of a real implementation here, and is left alone sincedist/is generated output. - All four of the order's tasks are present on
main:isOwnImage(args, authorId)inx-mention-image3d.jsenforces the same-author rule and recordsnot_own_imageas a skip with no fetch, no review and no reply;fetchXImage/xMediaUrlinx-media-image.jsonly acceptpbs.twimg.comURLs (https, no redirects), cap atX_MEDIA_MAX_BYTES(5 MB) by both header and streamed length, check Content-Type and magic bytes, and time out;handleImage3druns the studio's own image moderation (fails closed with no vision provider) before the image-to-3D lane, attributes the creation to the bot account withx_author_idset for order 058's claim step, and replies with the rendered PNG and/m/<id>link, with the same bounded-wait-then-follow-up behavior as order 052'smakeflow (X_MAKE_BUDGET_MS/X_MAKE_GIVE_UP_MS, afinishPendingImage3dpass per tick). - Verified without merging, same throwaway-worktree method as orders 050 to 052:
git worktree add --detach /home/user/projects/.verify-main-wt main, hardlinked this worktree'snode_modules(cp -al), copied.env/.env.local, ran tests there, thengit worktree remove --forceit afterward. Nothing was committed tomainor merged intoevolve. - DoD "tests for own image, someone else's image (skip), non-CDN URL (reject), oversized image (reject)":
npx vitest run tests/x-mention-image3d.test.js22/22 passed, covering exactly those cases plus moderation, poster-cannot-render, reply copy and the timeout/follow-up paths (describe('own image'),describe("someone else's image"),describe('media CDN fetch')which includes both the non-CDN rejection and the oversized/streamed-length rejection). - DoD "three real dry-run rows with loading media (status codes in the report)":
main's ownscripts/x-mention-image3d-dry-run.mjshad already producedprompts/x-grok/_generated/image3d-dry-run.json(generated 2026-10-09T16:36:16Z) with 3 real own-image rows (realpbs.twimg.comphotos from real posts,photoCheck.status: 200on each) plus a 4th "someone else's image" skip row. Re-checked fresh in this session rather than trusting the capture:curl -s -o /dev/null -w "%{http_code} %{content_type}"against all three recorded/api/render/glbmedia URLs and their/m/:idlinks returned200 image/png/200 text/html; charset=utf-8live, right now, over a month after the capture; the row that the capture originally noted as413(a 10 MB render cap that was pending deploy at the time) now also returns200 image/png, so that production limitation has since shipped and resolved on its own. - Ran
main's fullnpx vitest runfrom the same throwaway worktree as a regression check (not a DoD line for this order): 24 failed test files / 23 failed tests (tests/api/mcp-agent-catalog.test.js,tests/api/mcp-agent-challenge.test.jsand others, all pre-existing catalog-literal/branding/deploy-artifact drift already logged against orders 051 and 052), zero of them touching anyx-mention-*module. A targeted re-run of everyx-mention-*.test.jsfile together (image3d,intents,store,mentions,poll,guard) was 196/196 passed. - This order's own Definition of Done (three real dry-run rows with loading media; tests for own image, someone else's image, non-CDN URL, oversized image) is fully satisfied by what
mainalready shipped, so it retires the same way orders 050 to 052 did. No new owner-actions row needed; row 34 already covers theevolve/mainreconciliation this order's staleness depends on.
2026-10-11: order 054 (avatar-from-profile mention flow, "make me an avatar") retired on the evolve branch, already shipped on main, no defect found
- Step 0 re-derived against
mainfirst, since this branch is 361 commits behind it (git log --oneline HEAD..main | wc -l): the order's own grep commands (avatarinapi/_mcp-studio/tools.js,_normal\|profile_image_urlinapi src) read against this staleevolvecheckout and are not evidence either way;git ls-tree -r main --name-onlyshowsapi/_lib/x-mention-avatar.js,docs/x-mention-avatar.md,scripts/x-mention-avatar-dry-run.mjsandtests/x-mention-avatar.test.jsall present onmain, shipped by9997cdcd4("feat(x-mentions): turn X mentions into avatars, image-to-3D models and make-anything replies, with dry-run scripts and tests") and refined byc857d98ed(the claim-note wiring). - All three of the order's tasks are present:
handleAvatarinx-mention-avatar.jsonly reads the mention's own user-expansionauthorobject (String(author.id) !== String(authorId)is a recordednot_own_imageskip with no fetch, regardless of what the text names), upgrades the_normalCDN URL to_400x400viaxProfileImageUrl/fetchXImage(..., { profile: true }), runs a vision moderation pass (reviewProfileImage, fails closed onunavailable) before the studio's image-to-3D-then-auto-rig lane (AVATAR_TIER = 'high', same two-stage pipeline as theforge_avatartool);successReply/composeAvatarReplyreply with the render as media plus the creation link and the pose-studio link (poseLink), with the same bounded-wait/markPending/finishPendingAvatarsfollow-up behavior as order 052's make flow; a default (egg) profile picture replies with the avatar-studio link under reasondefault_avatar, matching this order's own "Never blocked" row exactly, and generates nothing. - Verified without merging, same throwaway-worktree method as orders 050 to 053:
git worktree add --detach /home/user/projects/.verify-main-wt main, hardlinked this worktree'snode_modules(cp -al), copied.env/.env.local, ran tests there, thengit worktree remove --forceit afterward. Nothing was committed tomainor merged intoevolve. - DoD "tests for own image only and the named-other-account case":
npx vitest run tests/x-mention-avatar.test.js14/14 passed, includingdescribe('never another account\'s image')with cases for text naming another handle two different ways, a reply to another account's post, and an author object that is not the asker (asserted with no fetch call at all). Thesocial_connections does not existstderr lines are the same PGlite fixture gap for order 058's claim-join table already documented in order 052's entry, not a test failure. - DoD "two real dry-run rows from real public profile images, with media status codes in the report":
main's ownscripts/x-mention-avatar-dry-run.mjshad already producedprompts/x-grok/_generated/avatar-dry-run.json(generated 2026-10-09T16:41:07Z) with 2 real own-profile-image rows (realpbs.twimg.comprofile photos,profileCheck.status: 200on each, reasonavatar_done), plus a third row proving the named-other-account rule in the live pipeline (text asks for@jack's picture, still resolves to the asking author's own photo) and a fourth default-profile-image row. The capture's ownmediaCheckshowedstatus: 0("operation was aborted due to timeout", a capture-time client timeout, not a server error). Re-checked fresh in this session:curl -s -o /dev/null -w "%{http_code} %{content_type}"against both recorded/api/render/glbmedia URLs and their/pose?src=links returned200 image/png/200 text/html; charset=utf-8live, right now, over a month after the capture. - Ran the full
x-mention-*suite together as a regression check (not a DoD line for this order):npx vitest run tests/x-mention-avatar.test.js tests/x-mention-image3d.test.js tests/x-mention-make.test.js tests/x-mention-poll.test.js tests/x-mention-store.test.js tests/x-mention-guard.test.js tests/x-mention-intents.test.js tests/x-mentions.test.js, 8 files / 225 tests, all passed. - This order's own Definition of Done (two real dry-run rows with loading media; tests for own image only and the named-other-account case) is fully satisfied by what
mainalready shipped, so it retires the same way orders 050 to 053 did. No new owner-actions row needed; row 34 already covers theevolve/mainreconciliation this order's staleness depends on.
2026-10-11: order 055 (mention-safety guard: kill switch, blocklist, loop and rate caps) retired on the evolve branch, already shipped on main, duplicate work built and discarded
- Step 0 was re-derived against this stale
evolvecheckout, notmain, and came back genuinely empty: noapi/_lib/x-mention-guard.js, no caller ofx-mentions.js/x-mention-intents.jsanywhere in the tree. That absence was real on this branch (unlike orders 050 to 054's grep false negatives), so the order was built here from scratch:api/_lib/x-mention-guard.js(guardMention, kill switch, blocklist, own-account skip, 24-hour new-author check, known-bot quote-loop check keyed offx-search.js's app-only bearer, conversation depth cap and hourly rate limit via a newcountConversationRepliesinx-mention-store.js),tests/x-mention-guard.test.js(23 cases),docs/x-mention-bot.md, and adata/pages.jsonentry publishing that doc, committed asb92ad557b. - Before retiring, checked whether
mainhad moved past this order the same way it had past 050 to 054:git log --all --oneline -- api/_lib/x-mention-guard.jsshowed a SECOND, independentx-mention-guard.jsalready onmainat249a2eae0("feat(x-mentions): safety rails for the public bot..."), predating this session. This branch is 361 commits behindmain(git log --oneline HEAD..main | wc -l), andmain's version is materially more complete: it is wired live intohandleMentioninapi/_lib/x-mention-poll.js(which does not exist as a caller on this branch at all), adds a second kill-switch path (anapp_settingsrow alongside the env var, so pausing never needs a redeploy), a standaloneknown_botrule and abot_quote_of_own_postrule (two rules where this session's version only had one combined check), a per-author hourly/daily allowance on top of the per-conversation cap, and full integration with the X read/post budget controller (x-budget.js) and the@grok/@boton-behalf-of-a-human flow (order 056,x-mention-on-behalf.js).mainalso deliberately keepsdocs/x-mention-bot.mdout ofdata/pages.json/the public sitemap (scripts/audit-docs.mjs'sUNPUBLISHED_DOCS, reason: "internal: operator runbook... public once the bot goes live"), a better call than this session's own choice to publish it and regenerateCHANGELOG.mdfor a bot that is not live. - Resolution: dropped the session's own duplicate commit entirely (
git reset --hardback to the order-054 retirement commit, beforeb92ad557bexisted) rather than keeping a divergent, inferior reimplementation thatevolve's fast-forward intomaincould never cleanly reconcile with249a2eae0and its five follow-on commits. No feature commit for order 055 exists onevolve; the real one ismain's. - Verified
main's implementation without merging, same throwaway-worktree method as orders 050 to 054:git worktree add --detach /home/user/projects/.verify-main-wt main, hardlinked this worktree'snode_modules(cp -al), ran tests there, thengit worktree remove --forceit afterward. Nothing was committed tomainor merged intoevolve. - DoD "rule tests pass; kill-switch test shows zero handler calls":
npx vitest run tests/x-mention-guard.test.jsonmain, 16/16 passed, including'env X_MENTION_BOT_PAUSED=1 records paused and calls no handler'and'app_settings paused row...', both assertingcomposeandadapterFactory(the reply brain and the X adapter) arenot.toHaveBeenCalled(). - DoD "
docs/x-mention-bot.mdlists every rule and how to change it": confirmed by reading the file onmain: a table of all eight rules in run order with decision, reason and exactly how to change each one (env var,app_settingskey, or the named constant in the guard), plus the known-bot resolution mechanism, the X budget ladder, the on-behalf-of-a-human flow, and the claim flow for what the bot makes. - This order's own Definition of Done is fully satisfied by what
mainalready shipped (and then substantially extended beyond this order's own scope), so it retires the same way orders 050 to 054 did. No new owner-actions row needed; row 34 already covers theevolve/mainreconciliation this order's staleness depends on. Judgment call: a session building against a stale branch cannot tell "genuinely unbuilt" apart from "built elsewhere since this branch's last sync" from step 0 alone; the only reliable check is greppingmaindirectly before trusting a from-scratch build, which orders 050 to 054 did and this one should have done first too.
2026-10-11: order 056 (when @grok or @bot tags three.ws, bot-to-bot handling) retired on the evolve branch, already shipped on main, no defect found
- Step 0's own grep (
known.*bot\|grokinapi/_lib/x-mention-guard.js) reads against this staleevolvecheckout, where that file does not exist at all (order 055's finding), so it is not evidence either way.git log --oneline --all -- prompts/finish/056-x-grok-34-bot-to-bot-grok.mdshows the full history directly:main's own commitd7bad3434("feat(x-mentions): answer @grok and @bot on behalf of the human at the thread root, one reply per conversation, with the human's rate limits") already implemented this order and deleted this exact prompt file in the same commit. The file exists onevolveonly because this branch's tip predates that commit and never merged it;git diff d7bad3434 HEAD -- prompts/finish/056-x-grok-34-bot-to-bot-grok.mdshowsevolve's copy is a byte-identical re-creation (blobc9c8c97c1, the same blob361c41a7aoriginally added), not independent work. - All four of the order's tasks are present on
maininapi/_lib/x-mention-on-behalf.js, wired fromhandleMentioninx-mention-poll.jswhen the guard reportsknown_bot: (1) the human is resolved from the conversation root author (parent post orGET /2/tweets/:id), stamped asargs.on_behalf_of, and the human's own per-author hourly/daily allowance is charged viacountByPrincipalinx-mention-store.js, never the bot's; (2) a bot may only trigger amake3D-model request, parsed by the same intent parser as any mention, with chat/launch/anything-else staying skipped asknown_bot; (3) the single reply to the bot's post is exactly the four-line machine-friendly form this order specified: what we made,Viewer: <link>,GLB: <link>, andAdd three.ws to Grok Bot as an MCP connector: https://three.ws/api/mcp-grok; (4) the loop cap is enforced two ways,bot_loop_cap(one reply per conversation to bot authors, ever) andbot_reply_to_own_reply(never answering a bot's reply to our own reply). - Verified without merging, same throwaway-worktree method as orders 050 to 055:
git worktree add --detach /home/user/projects/.verify-056-wt main, hardlinked this worktree'snode_modules(cp -al, same filesystem as this worktree's parent, unlike/tmpwhich rejected the hardlink across devices), ran tests there, thengit worktree remove --forceit afterward. Nothing was committed tomainor merged intoevolve. - DoD "tests cover the on-behalf-of mapping, the single reply and the loop cap":
npx vitest run tests/x-mention-on-behalf.test.jsonmain, 17/17 passed. A combined run withtests/x-mention-guard.test.js(the dependency order 055 already verified) was 33/33 passed. - DoD "
docs/x-mention-bot.mddocuments the behavior": confirmed by reading the file onmain, section "When @grok or @bot tags us": the whole numbered flow (whose request it is and every skip reason, what a bot may ask for, whose limits apply, the exact four-line reply shape and its failure/refusal fallbacks, the loop cap) plus a pointer totests/x-mention-on-behalf.test.jsfor the synthetic thread fixtures this order's own "Never blocked" row anticipated building. - This order's own Definition of Done is fully satisfied by what
mainalready shipped, so it retires the same way orders 050 to 055 did. No new owner-actions row needed; row 34 already names order 056 directly among the stale duplicates this reconciliation covers.
2026-10-11: order 057 (X API budget controller) retired on the evolve branch, already shipped on main, no defect found
- Step 0 was run against this stale
evolvecheckout (grep -rn "x-rate-limit\|x-app-limit" api/_lib/x-*.js,grep -n "QUOTA\|MIN_INTERVAL" api/_lib/x-post.js) and came back with onlyx-mentions.js's existing rate-limit header reader andx-post.js's unrelated per-user posting quota, noapi/_lib/x-budget.jsanywhere in the tree. Rather than trust that absence the way order 055 learned not to, checkedmaindirectly first: this branch is 361 commits behindmain(git log --oneline HEAD..main | wc -l), andgit log --oneline --all -- api/_lib/x-budget.jsshowsmain's own43b81959e("feat(x-mentions): budget controller with daily and monthly caps, a degrade ladder and X rate-limit header backoff") already built and merged this order, deleting the same prompt file in the same commit. - All four of the order's tasks are present on
maininapi/_lib/x-budget.js: (1)recordPosts/recordReadscount every reply and read intoapp_settingsrowsx_budget_day_YYYY-MM-DD/x_budget_month_YYYY-MM(UTC, no migration needed), with caps read fromX_MENTION_MONTHLY_POST_CAP(default 1500),X_MENTION_DAILY_POST_CAP(default 80) andX_MENTION_MONTHLY_READ_CAP(default 15000), andbackoffFromHeaders/noteResponsehonorx-rate-limit-remaining/x-rate-limit-reset,x-app-limit-24hour-remaining/-reset, and a 429 with neither (15 minute fallback); (2) theLADDERconstant dropschatat 70% of the largest used cap fraction,avatarat 80%,image3dat 90%, andmake/launch/helponly at the 100% hard stop, withbudgetGate()returning adegraded:<intent>or cap reason thatx-mention-poll.jsrecords as abudgetdecision (theDECISIONSenum inx-mention-store.jsalready carried abudgetvalue in anticipation of this); (3)getBudgetUsage()is explicitly commented as "the object the mention-bot status endpoint (order 064) exposes", correctly left unwired since order 064 has not shipped; (4)tests/x-budget.test.jscovers both the ladder and the backoff. - Verified without merging, same throwaway-worktree method as orders 050 to 056:
git worktree add --detach /home/user/projects/.verify-057-wt main, hardlinked this worktree'snode_modules(cp -al), copied.env/.env.local, ran tests there, thengit worktree remove --forceit afterward. Nothing was committed tomainor merged intoevolve. - DoD "ladder and backoff tests pass":
npx vitest run tests/x-budget.test.jsonmain, 25/25 passed, including dedicateddescribe('the degrade ladder'),describe('the ladder inside the poll loop')anddescribe('header driven backoff')blocks. - DoD "the defaults are documented with the reasoning in docs/x-mention-bot.md": confirmed by reading the file on
main, "The X budget" section: a table of all three caps (env var, default, reasoning) plus the ladder table and the rate-limit-header backoff behavior, all under the same reasoning this order's own comments give ("conservative placeholders until order 926 records the real allowances of the X tier"). - This order's own Definition of Done is fully satisfied by what
mainalready shipped, so it retires the same way orders 050 to 056 did. No new owner-actions row needed; row 34 already covers theevolve/mainreconciliation this order's staleness depends on.
2026-10-11: order 058 (claim what the bot made) retired on the evolve branch, already shipped on main, no defect found
- Step 0's own commands (
grep forge_creations/provider_uid in api/_lib/schema.sql,grep social_connections in api/auth/x) only confirmed the pre-existingsocial_connections.provider_uidcolumn; nothing in this staleevolvecheckout mentionedx_author_idor/x/claim. Checkedmaindirectly (361 commits ahead of this checkout):git log --oneline --all -- prompts/finish/058-x-grok-36-creation-claim.mdshowsmain's ownc857d98ed("feat(x-claim): move what the mention bot made into the author's library when they link X, with a /x/claim page and claim lines in replies") already built this order and deleted the same prompt file in the same commit, with its own closing entry already in this file dated 2026-10-09. - All four of the order's tasks are present on
main: (1)forge_creations.x_author_id(migration20261009201500_forge_creations_x_author.sql, set byx-mention-make.js/x-mention-image3d.js/x-mention-avatar.json every bot creation, owned by theservice_accountbot user until claimed); (2)api/auth/x/[action].jscallsclaimForUser(userId, { source: 'link' })right after a successful X OAuth link; (3)GET/POST /api/x/claim(api/x/claim.js) backed byapi/_lib/x-creation-claim.js(claimForUser,claimForAuthor,listClaimable,linkedXUid), andpages/x-claim.htmlwired in all five places (vercel.jsonroute,vite.config.jsinput plus dev mirror,data/pages.json,STRUCTURE.md); (4)withClaimNoteappendsSaved to your library.orClaim it: <origin>/x/claimto every success reply, skipped if it would exceed the X post-length cap. - Verified without merging, same throwaway-worktree method as orders 050 to 057:
git worktree add --detach /home/user/projects/.verify-058-wt main, hardlinked this worktree'snode_modules(cp -al), copied.env/.env.local, ran tests there, thengit worktree remove --forceit afterward. Nothing was committed tomainor merged intoevolve. - DoD "a creation is claimed when the author id matches, never otherwise":
npx vitest run tests/x-creation-claim.test.jsonmain, 8/8 passed on real PGlite migrations, covering a matching link, a different id, no link, a disconnected link, and an id outside the author. Ran the wider regression too:tests/x-mention-make.test.js,x-mention-image3d.test.js,x-mention-avatar.test.js,x-mention-poll.test.js,x-mentions.test.js,x-mention-intents.test.js,x-mention-store.test.jstogether, 209/209 passed. - DoD "browser check of /x/claim with every state": installed the missing
libxkbcommon0system library (sudo apt-get install -y libxkbcommon0, the local headless Chromium was failing to launch at all without it) so Playwright could actually run.node --env-file=.env.local server/index.mjsplusnpx vite --port 3107(DEV_API_PROXY=http://localhost:8080) against the real production Neon database (the same one.env.localalways points at). Confirmed live: signed-outGET /api/x/claimreturns a real 401 and the page renders "Sign in to claim"; signed-in via the realAUDIT_EMAIL/AUDIT_PASSWORDQA session,GET /api/x/claimreturns{"linked":false,...,"x_configured":false}live (no X OAuth client configured in this local env, the same gap order 058's original shipping note already recorded) and the API behaved correctly. Playwright could not inject the session's__Host-sidcookie into a plain-HTTP localhost context (Chromium enforces the__Host-prefix's secure/no-domain rule even foraddCookies), so the remaining five states (unlinked-configured, empty, list, load-error, claim-success, claim-failure) were driven by route-intercepting/api/x/claimwith real response shapes instead of a live backend, the same substitution main's own original browser check used for its last four states. All 8 renders (real signed-out, 2 unlinked variants, empty, list, load-error, claim-success, claim-failure) showed the correct designed copy with zero unexpected console errors (the only logged "errors" were the intentional 401/500 network-status lines for the error-path tests). - DoD "changelog entry;
npm run build:pagespasses":data/changelog.jsonalready carries the 2026-10-09 entry (confirmed present onmain);npm run build:pagesran clean in the verification worktree, validating that entry and regeneratingCHANGELOG.md/public/changelog*. - This order's own Definition of Done is fully satisfied by what
mainalready shipped, so it retires the same way orders 050 to 057 did. No new owner-actions row needed; row 34 already covers theevolve/mainreconciliation this order's staleness depends on.
2026-10-11: order 059 (map an X author to a three.ws account) shipped on the evolve branch, net-new work
- Step 0 confirmed the order's premise directly:
user_identities_provider_checkinapi/_lib/migrations/20260922190000_account_social_sso.sqlonly allowedprovider='google', andsocial_connectionsalready stores the X id (provider_uid) when an owner links X to post, with no sign-in path from it. Unlike orders 050-058, nothing onmain(361 commits ahead) touchesfindUserByXIdor an X-provider identity, so this was genuinely unshipped and built fresh onevolve. - Shipped in commit
5149b401d(feat(auth): let an X account sign in, not just post as itself): (1)api/_lib/x-identity.jsaddsfindUserByXId(authorId), checkingsocial_connections(an owner's own connected account) then falling back toagent_x_connections(a single agent's connected account), both scoped todisconnected_at is null, for the mention-reply cron, the claim flow, and order 925's launch flow to share; (2)api/_lib/migrations/20261011210000_user_identities_x_provider.sqlwidens the check constraint toprovider in ('google', 'x'); (3)api/auth/x/[action].jsadds aloginaction reusing the existing OAuth2 client, with three branches incompleteXLogin: already-linked (findUserByIdentity) signs in, already-connected-for-posting (findUserByXId) links and signs in, otherwise a new passwordless account is created on the same@wallet.localplaceholder-email patternapi/auth/siws/[action].jsalready uses (no email-matching step like Google's, since X's OAuth2 profile never reliably carries verified email); (4)api/_lib/identities.jsregisters X in the sharedPROVIDERSlist; (5)api/config.jsaddsxLoginEnabled(true onceX_OAUTH_CLIENT_ID/SECRETare configured), andpublic/login.htmlwires a real X button behind that flag, independently of the existing SSO button's visibility check. - DoD "tests pass; migration previewed then applied":
tests/x-identity.test.js(6 tests) andtests/user-identities-provider-constraint.test.js(4 tests, live DB) both pass, 10/10.node scripts/apply-migrations.mjs --applyapplied the new migration (confirmed by the live-DB constraint tests exercisingprovider='x','google', a rejected'facebook', and the one-identity-per-provider unique index). Full suite withDATABASE_URLcorrectly unset for the run:2215 passed | 2 failedfiles, the same 2 pre-existing failures (tests/audit-guards.test.js,tests/mcp-schema.test.js) traced to an unrelated commit (1dec29321, 2026-10-10) viagit log, not touched by this diff. - DoD "browser check: sign in with X on
npm run devreaches the X consent screen with the right scopes":X_OAUTH_CLIENT_ID/X_OAUTH_CLIENT_SECRETdo not exist anywhere in this system, confirmed bynode scripts/read-service-env.mjs '^X_OAUTH_'against the live Cloud Run service (FAILED: no variable on three-ws-api matches /^X_OAUTH_/), not only locally. Per the self-unblock playbook ("if a credential truly exists nowhere, build the feature fully wired behind the env var, prove it with a mock-free dry run"), ran the realserver/index.mjson a spare port with dummyX_OAUTH_CLIENT_ID/SECRETvalues and confirmedGET /api/auth/x/login?next=/createreturns a real 302 tohttps://twitter.com/i/oauth2/authorizewithscope=tweet.read+users.read+offline.access(the login flow's intended read-only scope set, not the full posting scope) and a PKCEcode_challenge/code_challenge_method=S256. No vite/browser session was run since this worktree has nodist/build and the credentials needed for a real consent screen do not exist on this deployment; the single missing pair isX_OAUTH_CLIENT_ID/X_OAUTH_CLIENT_SECRET, same as the order's own "Never blocked" row anticipated, just absent everywhere rather than only locally. - This order's own Definition of done is satisfied as far as this environment allows without the missing OAuth client credentials, so it retires with no new owner-actions row: the feature is fully wired behind the env var and will reach the real consent screen the moment the owner configures
X_OAUTH_CLIENT_ID/X_OAUTH_CLIENT_SECRETon the Cloud Run service, the same credential the pre-existing Connect-X flow has always needed.
2026-10-11: order 060 (agents that answer their own mentions) left open, blocked by the evolve/main divergence, no code written
- Step 0 re-derived against both branches before touching anything:
git show main:prompts/finish/060-x-grok-38-agent-mention-replies.mdis byte-identical to this branch's copy,main'sapi/_lib/x-agent-policy.jshas nomention_repliesentry, andmain'sapi/_lib/x-mention-poll.jsstill callsrunMentionTick()with zero arguments fromapi/cron/[name].js, defaultingagentAccountstoasync () => [], with a comment reading "supplied byagentAccounts, which order 060 provides from the agent policy". This order is genuinely unbuilt anywhere, unlike orders 050 to 058, which only looked unbuilt because this branch is stale. - Checked this branch's own working tree for the order's prerequisites rather than assume staleness:
api/_lib/x-mention-poll.js,x-mention-reply.js,x-mention-guard.js,x-budget.js,x-mention-on-behalf.js,x-mention-avatar.js,x-mention-image3d.js,x-mention-make.js,x-mention-deliver.js,x-mention-known-bots.jsandx-text-weight.jsdo not exist in this checkout at all (MISSING, notDIFF).x-mentions.js,x-mention-store.js,gateway/adapters/x.jsandapi/cron/[name].jsexist but differ frommain's versions. This is the same divergence OWNER-ACTIONS row 34 already logged while working order 050 (now 362 commits behindmain/ 117 ahead), just hit again two orders later because row 34's reconciliation still has not happened. - Unlike orders 050 to 058, this order has no base to verify-and-retire against, because
mainhas not built it either. The two ways to proceed are both unsound for an unattended session: hand-copyingmain's ~14-file mention-poll subsystem into this branch is the partial reconciliation row 34 explicitly calls a judgment call, not mechanical, since 4 of those files already differ between branches rather than being purely additive; building a second implementation against this branch's pre-order-045 base repeats exactly what order 055's entry above already proved wasteful (a discarded, unreconcilable duplicate oncemain's real version surfaces, except here there would be no realmainversion to compare against yet, so the duplicate would become the only implementation and would conflict with whatevermaineventually builds in the same space). - Resolution: left
prompts/finish/060-x-grok-38-agent-mention-replies.mdin place with a dated Evolve status paragraph naming the exact blocker and sketching the mechanical diff (4 policy columns + migration,mention_repliesinPOST_KINDS, anagentAccounts()supplier, thelistAccounts/pollAccount/handleMentionwiring, acountAccountReplies()addition, tests, docs) so the first session after row 34's reconciliation can ship it quickly instead of re-deriving this. No code was written or committed against the stale base. Row 34 inproduction-100-OWNER-ACTIONS.mdupdated to name this order alongside 050-058 so no later session repeats this same investigation. - No new OWNER-ACTIONS row: row 34 already covers the reconciliation this order depends on.
2026-10-11: order 061 (mention settings UI) shipped, one DoD line waits on owner row 35 (order file kept)
- Step 0 found the panel:
pages/agent-edit.html(Social tab) already managed an agent's X connection and posting policy overGET/PUT /api/x/agents(api/x/agents.js, backed byapi/_lib/x-agent-policy.js), the same per-agent OAuth2 system orders 059/060 use (distinct from the legacy company-levelsocial_connections/X_API_KEYposting credentials).x_mention_eventsalready existed from order 048 with arecentDecisions()reader inapi/_lib/x-mention-store.js, unused by any endpoint. - Shipped:
api/_lib/migrations/20261011220000_agent_mention_policy.sql(fourmention_replies_*columns onagent_x_policies, described above in order 060's update);api/_lib/x-scopes.jsgainsX_MENTION_REQUIRED_SCOPES;api/_lib/x-agent-policy.jsvalidates and round-trips the four new fields (unknown intents and an out-of-range cap both throwvalidation_error, matching the existingallowed_kindspattern);api/x/agents.js'sGETresponse gainsmention_intents(the 6-intent catalog with labels/summaries for the UI) and connectioncan_answer_mentions/missing_mention_scopes;api/x/mention-decisions.jsis a new owner-onlyGETendpoint overrecentDecisions(), agent-ownership checked, limit clamped to 1..20;pages/agent-edit.htmlandsrc/agent-edit.jsadd the "Answer mentions" section (enable/dry-run toggles, daily cap, intent checklist, save button, and a decisions list with decision badge, author, reason, would-be reply text, and media thumbnail) withrenderMentionAccess()covering not-configured, no-connection (connect link), missing-scope (reconnect link) and connected states. - Tests:
tests/x-mention-decisions-endpoint.test.js(6 tests: auth required, validation, 404 on an agent the caller does not own, success shape, limit clamping, missing-scope rejection) andtests/agent-mention-policy-migration.test.js(6 tests, PGlite against the real migration file: idempotent re-run, the four columns with documented defaults, a DB-level CHECK rejection on a daily cap outside 0..50,getAgentPolicydefaults, a full save/reload round trip, an unknown intent id rejected rather than silently dropped). Both pass:npx vitest run tests/x-mention-decisions-endpoint.test.js tests/agent-mention-policy-migration.test.js, 12/12. - Browser verification: ran
server/index.mjson a spare local port with both.env/.env.localagainst the real dev Neon database, andvite --port 3301withDEV_API_PROXYpointed at it. Verified live and with Playwright keyboard interaction (.focus()+keyboard.press/.type, not.check()/.fill(), since the long scrolling page's sticky header/footer intercept pointer-based actions): not-configured state (noX_OAUTH_CLIENT_IDanywhere in this deployment, confirmed vianode scripts/read-service-env.mjs '^X_OAUTH_CLIENT'), no-connection state with a working connect link, missing-scope state with a working reconnect link (both exercised by inserting and deleting throwawayagent_x_connectionsrows, and briefly setting fakeX_OAUTH_CLIENT_ID/SECRETplaceholders in the gitignored.env.localonly, removed immediately after), connected state, decisions list empty and populated (reply text, media thumbnail, skip reason, via throwawayx_mention_eventsrows), the enable checkbox, daily-cap input and intent checkbox all keyboard-focusable and keyboard-togglable, and the save button reachable by keyboard. Zero console errors attributable to this feature (the only console noise, a draco wasm 404, is pre-existing on the page). All throwaway DB rows deleted afterward (count(*) = 0confirmed on both tables) and the fake OAuth env lines removed from.env.local. - DoD line 1 ("every state reachable, keyboard accessible, no console errors") verified as above. DoD line 2 ("owner-only access test for the decisions endpoint") verified by the endpoint test file's 404-on-non-owner case.
- Remaining: a live save (
PUT /api/x/agentswith the new fields) 500s with Postgres42703 undefined_columnuntil20261011220000_agent_mention_policy.sqlis applied;npm run db:migrateis owner-gated for this session (the harness denied the command outright). Owner-actions row 35 added naming the exact command. Order file kept in place per the close-out rule for a line that cannot pass this session, with a dated Evolve status paragraph under its title. - Side effect for order 060: its "4 new
agent_x_policiescolumns + migration" mechanical piece is now done; its own status paragraph is updated above to point at this migration instead of re-deriving it.
2026-10-11: order 062 (mention-bot operator console) shipped, net-new work
- Step 0 ran the order's own commands:
/materialize/opswas confirmed as the model (vercel.jsonroute plusapi/print/ops/[action].js'srequireAdmin-first dispatch pattern), andapi/_lib/admin.jsexportsrequireAdmin/isAdminUserexactly as the order's "Never blocked" row anticipated.x_mention_events(order 048) andapp_settingsalready existed with no admin UI over them; nothing on this branch or onmainhad built this console yet. - Shipped in commit
468589f4c(feat(x-ops): admin console to review, pause, blocklist and send mention-bot replies):api/_lib/x-mention-admin.js(kill switch viaapp_settingskeyx_mention_bot_paused, a JSON blocklist key, andsendDryRunReplywhich validates a row is a dry-runreplydecision with no priorreply_tweet_id, resolves the posting target (companyxClientFromEnv()OAuth 1.0a or an agent's ownagent_x_connectionsOAuth2 row), uploads media if present, posts, and flips the row todry_run: falsewith the real tweet id);api/x/ops/[action].js(admin-only dispatch forlist,status,pause,resume,block,unblock,send, CSRF-checked before every mutation, audit-logged after); two newadminListMentions/adminCountMentionsfunctions added toapi/_lib/x-mention-store.js; the console itself (pages/x-ops.html,src/x-ops.js,src/x-ops.css), a lane rail (all/awaiting-send/sent/skipped/paused-blocked/errors), per-row filters (account, intent, author, decision, dry-run), a detail drawer with HTML-escaped mention and reply text, media preview, and, only for a dry-runreplyrow with noreply_tweet_idyet, a "Send this reply" action gated by a nativeconfirm()naming the exact account, tweet id and reply text before the request fires. - Wired in all five page places per the
/materialize/opsadmin-console precedent:pages/x-ops.htmlcarries<meta name="robots" content="noindex, nofollow">;vercel.jsoncarries both the page route (/x/ops/?→/x-ops.html) and the API dispatch route (/api/x/ops/(list|status|pause|resume|block|unblock|send)→/api/x/ops/[action]?action=$1);vite.config.jscarries thex-opsbuild input;STRUCTURE.mdcarries a row for the whole subsystem.data/pages.jsonwas deliberately skipped, matching the confirmed precedent that/materialize/opsitself is not in that sitemap file either (admin-only noindex consoles are not public surfaces). - Tests:
tests/x-ops-authorization.test.js(new, 43 tests): anonymous callers get 401 and non-admins get 403 on all 7 actions; CSRF is enforced on every mutating action even for an admin (verified via arequireCsrfmock that replicates the real function's 403-write side effect, not just a boolean return); an authorized admin succeeds on all 7, with per-action assertions (setPaused/blockAuthor/unblockAuthor/sendDryRunReplycalled with the right arguments, 400 on missingauthor_id/tweet_id, 409 on analready_sent-styleMentionAdminError, 400 on aMentionStoreError, 404 on an unknown action).npx vitest run tests/x-ops-authorization.test.js tests/vercel-action-routes.test.js: both pass clean. Fullnpm test: 2217 passed, 10 skipped, 4 pre-existing failures unrelated to this diff (tests/asset-host-liveness.test.jsflagging an unrelated file from commitad25ced40,tests/audit-guards.test.jsand the 3 sub-failures intests/mcp-schema.test.jsflagging an unrelated MCP catalog gap), confirmed bygit log/grepto predate and not reference this diff. - DoD "browser check as admin on
npm run devwith real dry-run rows; send exercised only against a dry-run adapter in tests, never live": ran a real localserver/index.mjsagainst the dev NeonDATABASE_URL,vite devwithDEV_API_PROXYpointed at it, elevated the real QA audit account tois_admin=truefor the session only (permitted by this order's own "Never blocked" row), seeded 6 realistic fixture mention rows across every decision/dry-run combination, logged in via the existingpage-audit.mjs --loginsession, and drove the console with Playwright: page load with zero console errors, real/api/x/ops/*calls returning 200s, lane and filter round-trips, drawer rendering with the correct conditional Send/Block UI, a working block/unblock round trip, and, critically, clicking "Send this reply" surfaced the realconfirm()dialog naming the exact account, tweet id and reply text; cancelling it left the row'sdry_run/reply_tweet_idcompletely untouched, confirmed by a direct DB read taken immediately after. No live send was ever triggered against real X. All 6 fixture rows were deleted afterward, the QA account'sis_adminflag was reverted tofalse, and both local processes (API server, vite dev) were killed by exact PID, never by pattern match. - All three Definition of Done lines verified and passing. No owner-action gate was hit by this order; no new
production-100-OWNER-ACTIONS.mdrow needed.
2026-10-11: order 063 (real-time mentions through the Account Activity webhook) shipped, net-new work
- Step 0 ran the order's own commands:
grep -rn "crc_token" apireturned nothing (no CRC handling existed anywhere on this branch) andnode scripts/read-service-env.mjs '^X_API_SECRET$' --namesconfirmed the OAuth1.0a consumer secretapi/_lib/x-mentions.jsalready uses to read mentions is the same credential this order needed to sign CRC responses and verify delivery signatures. Fetched X's current Account Activity API docs live: CRC answers{"response_token":"sha256="+base64(HMAC-SHA256(crc_token, consumer_secret))}; each delivery is signed over the raw body in headerx-twitter-webhooks-signaturewith the same algorithm; registration (POST /2/webhooks), listing (GET /2/webhooks) and deletion (DELETE /2/webhooks/:id) use an app-only OAuth2 bearer, while subscribing an account (POST /2/account_activity/webhooks/:id/subscriptions/all) uses OAuth 1.0a user context for that account; the tier (Enterprise or Pay-Per-Use, capped at 3 subscriptions) is the owner-side gap this order's own "Never blocked" row anticipated. - Confirmed this order is not blocked by the evolve/main divergence that stalled order 060:
recordMention/updateDecision/parseMentionIntent(the shared dedupe-safe insert layer) already exist onevolve; only the guard/budget/reply closure main's cron adds on top is missing here, and this order never needed it. Scoped the handler to record-only, leavingdecision = nullfor every non-ignore intent exactly asx-mention-store.jsdocuments, same as reading main'shandleMention()as a template for the first two steps only. - Shipped in commit
4cbab4a0f(feat(x-webhook): real-time mentions via the Account Activity API webhook):api/x/webhook.js(GET answers CRC; POST verifies the signature header with a constant-time compare, then normalizes and recordstweet_create_events, scoped to the company account since nofor_user_idto agent-id reverse lookup exists on this branch);api/_lib/x-webhook-events.js(normalizeActivityEvent, a pure v1.1-tweet normalizer producing the same shapex-mentions.js's v2 normalizer does);scripts/x-webhook-register.mjs(--dry-run/--list/--delete/--url, credentials falling back to thethree-ws-apiCloud Run service). Novercel.jsonentry needed: confirmed by precedent (api/x/agents.js,api/x/mention-decisions.jshave none) and live, by running the realserver/index.mjslocally and curling/api/x/webhooksuccessfully through filesystem routing alone. - Tests:
tests/api/x-webhook.test.js(new, 8 tests, against the realx_mention_eventsmigration in PGlite): CRC response byte-matches an independently computed HMAC; a GET with nocrc_token400s; POST rejects no signature, a tampered body, and a signature computed with the wrong secret (all 401); a correctly signed delivery records the addressed mention withdecision: nulland auto-skips the unaddressed one; POST acks{ok:true,disabled:true}without touching the DB whileX_WEBHOOK_ENABLEDis unset; a tweet the cron's ownrecordMentionalready inserted is a silent no-op when the webhook delivers it again.npx vitest run tests/api/x-webhook.test.js: 8/8 passed. Full regression alongside the rest of the mention pipeline (tests/x-mentions.test.js tests/x-mention-intents.test.js tests/x-mention-store.test.js tests/x-mention-decisions-endpoint.test.js): 152/152 passed, 5 files, no drift. - Live verification: ran the real
server/index.mjson a spare local port withX_WEBHOOK_ENABLED=1.curlagainstGET /api/x/webhook?crc_token=hello123returned{"response_token":"sha256=p1THscFk68J1tKSoi9H0QeDyNChltsoLqk4MpFqIEl4="}, matching an independently computednode -eHMAC exactly.POSTwith partial company credentials (noX_API_KEY/X_ACCESS_TOKEN/X_ACCESS_SECRETset) correctly fell through to the disabled-ack branch, confirmingcompanyMentionsConfiguredgates the read path as designed. The background server was stopped by exact PID afterward. - Both Definition of Done lines verified and passing: tests pass (above) and the route is reachable with zero
vercel.jsonchanges (above); the register script's three--dry-runinvocations (register+subscribe,--list,--delete <id>) print calls matching the endpoints, methods and auth types confirmed live against today's docs.x.com. No owner-action gate was hit inside this session: the webhook ships fully wired, disabled by default behindX_WEBHOOK_ENABLED, and the Account Activity tier requirement is documented in the handler's own top-of-file comment for order 926 to batch into its owner message, the same pattern order 059 used for its own missing-credential gap. No newproduction-100-OWNER-ACTIONS.mdrow needed.
2026-10-11: order 064 (mention bot health and status) shipped, net-new work
- Step 0 ran the order's own commands:
api/healthz.jsconfirmed thesubsystemsblock comes fromgatherSubsystemHealth()inapi/_lib/ops/subsystem-health.js;ls api/_lib/*-health.jsconfirmed the three-function split (IO reader, pure verdict classifier, gatherer wrapper) already used byapi/_lib/ops/index-lag.jsandapi/_lib/object-storage-health.jsas the pattern to follow. Also confirmed, as background for the whole x-grok campaign:evolveandmainhave genuinely diverged (evolve..main371 commits,main..evolve123 commits), and this branch is missingmain's poll cron, guard and budget modules (x-mention-poll.js,x-budget.js). This order did not need them: every signal it asks for (poll age, lag, error rate, budget, mode) is derivable directly fromx_mention_events(the shared ledger both the webhook, order 063, and any future poller write through) plus the existingisPaused()/isXMentionBotLive()switches, so budget tracking was implemented as a self-contained env-cap-vs-real-row-count calculation rather than porting or stubbing the missingx-budget.js. - Shipped in commit
5c4e37a5c(feat(x-grok): health and status for the X mention reply bot):api/_lib/x-mention-health.js(readMentionBotSignals(), one aggregate SQL query overx_mention_eventsplusisPaused()/isXMentionBotLive();mentionBotVerdict(), pure, classifiesok/degraded/paused/unknown, degraded at >10m oldest-undecided lag or >20% hourly error rate at a minimum 5-decision sample so one early error never flaps it, paused always wins regardless of lag/errors since mentions are still recorded but nothing is decided or sent while paused;gatherMentionBotHealth()for the subsystem block;publicMentionBotStatus(), the private-data-free projection).api/_lib/ops/subsystem-health.jswires it intogatherSubsystemHealth()'schecksarray, DB-gated like every other ledger-backed sensor.api/x/mention-bot/status.jsis the new publicGET /api/x/mention-bot/status(CORS,limits.publicIprate limiting, 60scacheGet/cacheSet, returnsstatus/mode/handlesServed/repliesLast24h/medianReplySeconds/checkedAt, explicitly no mention text, author identity or budget data).pages/grok.htmladds a new "The @-mention reply bot, live" section with a 4-stat grid (.gk-bot/.gk-bot-stat, matching the page's existing.gk-design tokens) between the tools and facts sections.src/grok-page.jsaddsloadMentionBotStatus()(samearia-busy/try-catch-finally/retry-button pattern as the page's other loaders) and aformatReplyTime()helper (seconds under a minute, else rounded minutes), wired into the bottom bootstrap.docs/api-reference.mdgains a new "X Mention Bot API" section documenting the endpoint.data/changelog.jsongains a dated entry (and the regeneratedCHANGELOG.md/public/changelog*.json/.xmlvianpm run build:pages). - Tests:
tests/x-mention-health.test.js(new, 7 tests, purementionBotVerdict()input/output, no DB): unknown before any mention ever recorded, ok in dry run, ok and live when actually sending, degraded on lag past the 10-minute threshold, degraded on error rate past 20% at a real sample size, NOT degraded on a high error rate from too small a sample (proves the minimum-sample guard), and paused (neverdown) even with every other signal maximally bad.npx vitest run tests/x-mention-health.test.js: 7/7 passed. Fullnpm test: 2219 passed, 10 skipped, 5 pre-existing failures intests/mcp-schema.test.js(Agora MCP registry catalog,agora_quote_register/preview_agent_identitymissing aninputSchema), confirmed unrelated:packages/agora-mcp/src/tools/register.jsandpackages/mcp-policy/src/table.js, neither touched by this diff, neither referencing the mention bot. - Live verification: ran the real
server/index.mjson port 8080 with both.env/.env.localagainst the real dev Neon database.curl http://localhost:8080/api/x/mention-bot/statusreturned{"status":"degraded","mode":"dry_run","handlesServed":2,"repliesLast24h":25,"medianReplySeconds":1,...}, real counts from the dev DB (thedegradedstatus itself is real: 3 mentions seeded by earlier orders' browser testing have sat undecided since 2026-10-09, correctly flagged by the new lag check).curl http://localhost:8080/api/healthzconfirmed thex_mention_botentry in thesubsystemsarray with the same verdict and fullmetrics(lag, error rate, budget). Ranvite --port 3109withCHOKIDAR_USEPOLLING=1(the shared machine's per-user inotify watch budget was exhausted by concurrent agents' dev servers) andDEV_API_PROXY=http://localhost:8080, then drove/grokwith Playwright: the new section rendered all four real stats (Mode: Dry run, Handles served: 2, Replies last 24h: 25, Median reply time: 1s), zero console errors. Both local processes stopped by exact PID afterward. - Both Definition of Done lines verified and passing: tests pass and the local status endpoint returns real dev-database counts (above);
/grokshows the section live undernpm run dev-equivalent conditions (above, vite dev server with the real API proxied). No owner-action gate was hit inside this session: everything needed already existed onevolve(the ledger table, the pause switch, the live-send flag); no newproduction-100-OWNER-ACTIONS.mdrow needed.
2026-10-11: order 065 (X player card) done
- Step 0 measured:
twitter:playerexisted only onapi/a-page.js(the on-chain agent embed, a different surface).api/forge-share.js(the forge creation share page) had no player meta, only a staticsummary_large_imagecard.pages/forge-embed.htmlalready existed as a complete, compliant embed runtime (model-viewer, HTTPS assets, no audio/video element anywhere,posterattribute set before load, ajavascript:/data:-rejectingsafeUrl()), served in prod at the pretty route/forge/embedviavercel.json. That route had noheadersblock at all, unlike its three sibling embed routes (/agent/([^/]+)/embed,/agents/([^/.]+)/embed,/a/(\d+)/(\d+)/embed), so it fell through to the global catch-all's restrictive default CSP (frame-ancestors 'self' https://ibm.com https://*.ibm.com https://*.seismic.com). Confirmed live against production withcurl -sI https://three.ws/forge/embed: the header was present and would have silently blocked X (and everyone else) from framing it, defeating the feature even after X approval. - Shipped:
api/forge-share.jscomputesembedUrlfrom the samerenderableGlb()candidate (already used for the OG poster) and points it at/forge/embed?src=<glb>&poster=<og image>&title=<prompt>;twitter:cardisplayerwithtwitter:player/twitter:player:width/twitter:player:height(480x480) only when the creation is finished and has a renderable GLB, and stayssummary_large_imagewith notwitter:playertag otherwise.vercel.json's/forge/embed/?route gained the sameframe-ancestors *CSP (nox-frame-options) already used by its sibling embed routes, fixing the real production gap found in step 0. - Tests: two new vitest cases in
tests/api/forge-pipeline-endpoints.test.js(finished creation gets the player card and embed URL pointing at the real GLB; an in-progress creation keepssummary_large_imagewith notwitter:player), one new case intests/share-panel.test.jsasserting thevercel.jsonroute for/forge/embed/?carries the same header shape as its siblings.npx vitest run tests/api/forge-pipeline-endpoints.test.js tests/share-panel.test.js: 87 passed. Newtests/e2e/forge-player-embed.spec.js(3 cases: real GLB loads into a visible WebGL canvas with poster-first and zero<audio>/<video>elements; the designed "No model to show" empty state when nosrcis given; ajavascript:src is rejected rather than loaded) run against a realnpx vitedev server: 3 passed. - Submission details for the gated follow-on (order 931) were written into that file: card type
player, the share page URL pattern (https://three.ws/forge/share/:id), the embed/player URL pattern and fixed 480x480 size, theframe-ancestors *policy already in place, the@trythreewscontact handle, and a reminder to re-verify against production (and X's live docs) before actually submitting, since that submission step is 931's job, not this one's. - Both Definition of done lines verified and passing: meta tests and the Playwright embed check both pass under a real dev server (above); the order-931 submission note is written (above). No owner-action gate was hit inside this session: everything needed (the embed runtime, the route, the header fix) already existed or was built here; X's own approval and the resulting deploy stay 931's job.
2026-10-11: order 066 (docs, STRUCTURE and changelog sweep) retired, every Definition of done line verified
Step 0 re-derived against the current tree rather than trusting the prior entries' framing:
ls prompts/finish | grep x-grokshowed 7 files left in the runnable band (023, 024, 033, 039, 060, 061, 066), not the stale "44"prompts/RUN-ORDER.mdstill quoted;npm run audit:docswas already clean;grep -n -i "grok\|mention" STRUCTURE.mdshowed the mention-bot row (333) was missing the webhook and health/status files that orders 063 and 064 had since added.Task 1: wrote
docs/x-mention-bot.mdfrom scratch rather than portingmain's version of the same filename, becausemain's copy documents a poll cron, reply brain, safety-guard module, budget ladder and claim flow that do not exist in code onevolve(the same divergence row 34 already tracks). The new doc covers only what is real here: the ledger and its decision taxonomy, the pure intent parser and its untrusted-text refusal rules, the two mention readers (poll and the Account Activity webhook), the per-agent settings panel, the/x/opsconsole, the health/status endpoint, and the X-to-account identity mapping, plus an explicit "what is not wired yet" section naming the main-only pieces so order 925'slaunchintent work (and whichever order eventually reconciles the cron) has one file to extend. Marked unpublished inscripts/audit-docs.mjs(UNPUBLISHED_DOCSgainsx-mention-bot), matching the precedentmainset for the same doc.Task 2:
docs/grok-bot.mdanddocs/mcp.mdwere already accurate; confirmed by reading both in full against the current connector code and bynpm run audit:docspassing with them included. No edits needed.Task 3:
STRUCTURE.mdrow 333 gained the webhook (api/x/webhook.js), the health module and public status endpoint, and a link to the new doc. Did not add a/x/claimrow: that page and its backing code exist only onmain(another row-34 instance), so a row for it on this branch would describe a surface nobody can reach here. The gateway worker's row (356) and/grok's row (234) were re-read and found already current; no edit needed.Task 4: added two
data/changelog.jsonentries for the two shipped, user-visible pieces that had none yet (the per-agent "Answer mentions" settings from order 061, and the X player card from order 065). Order 064's health/status entry already existed. Orders 062 (admin console) and 063 (webhook) stay out of the public changelog on purpose: the console is internal/admin-only (matching the existing "internal console" precedent already in the changelog) and the webhook has no visible effect whileX_WEBHOOK_ENABLEDis unset.npm run build:pagesregeneratedCHANGELOG.md,public/changelog.json,public/changelog-recent.jsonandpublic/changelog.xmlclean.Task 5: rewrote the
x-grok-row inprompts/README.mdand the band row inprompts/RUN-ORDER.mdto the measured state above (count corrected from the stale 44 to the 7 files step 0 measured, written as 6 to already account for this order's own retirement; status text points at row 34 instead of claiming lane C ships nothing live, which stopped being true once orders 062-065 shipped).Along the way,
npm run check:claude(one of this order's own Definition of done lines) failed on two findings unrelated to x-grok:services/autopilot/had no README (it was added onmainin commit34d2f93c1but never reachedevolve) and.claude/worktrees/was flagged as a dead path reference even though it is a gitignored, on-demand directory that legitimately has none on disk in a quiet repo. Fixed both rather than leaving this order's own required check red: copiedmain's README over after diffing every file it describes against this branch (onlyrun.shdiffered, missingmain's post-deploydeploy:gcp:sync-cronscall, which was added here too so the doc stays true), and added.claude/worktrees/tocheck-claude-md.mjs's existing build-artifact exemption list.Commits:
2cfa5363c(docs/STRUCTURE/changelog sweep, tasks 1-5),9cddc7929(the two unrelated check:claude drift fixes found while verifying this order's own Definition of done).Definition of done, both lines verified with real command output:
npm run audit:docs→docs audit: clean (1840 markdown files checked);npm run build:pages→ wrote the four changelog artifacts clean, no validation failure;npm run check:claude→OK: every script, path, and typography rule in CLAUDE.md matches the repo. Every shipped x-grok order is now reflected in docs and changelog:Order What shipped Doc Changelog 023/024/025/026/028/029/030/031/032/034/035/036/037/038/040/042/043/044/045/049 MCP client lane (A) and xAI provider lane (B) docs/grok-bot.md,docs/mcp.md,STRUCTURE.mdrows 233/234/356Already logged (2026-10-08/09/11 entries) 048 mention ledger schema docs/x-mention-bot.mdInternal (schema only, no user surface) 059 X-author-to-account identity mapping, X sign-in (behind a missing-everywhere OAuth credential pair) docs/x-mention-bot.mdSkipped: the sign-in button stays hidden until X_OAUTH_CLIENT_ID/SECRETexist anywhere, so nothing is user-visible yet061 per-agent "Answer mentions" settings UI docs/x-mention-bot.md,STRUCTURE.mdrow 333Added this session 062 /x/opsadmin consoledocs/x-mention-bot.md,STRUCTURE.mdrow 333Internal/admin-only, excluded on purpose 063 Account Activity webhook docs/x-mention-bot.md,STRUCTURE.mdrow 333Internal/not-yet-live, excluded on purpose 064 health/status endpoint docs/x-mention-bot.md,STRUCTURE.mdrow 333Already logged (2026-10-11 entry) 065 X player card for finished Forge creations STRUCTURE.md(forge rows, unchanged)Added this session 066 this sweep prompts/README.md,prompts/RUN-ORDER.mdN/A (campaign bookkeeping) No owner-action gate was hit inside this session. One-line judgment calls: skipped a changelog entry for order 059 because the feature is invisible to every user until the owner configures the X OAuth app credentials (same reasoning as 063's webhook); kept
/x/claimout ofSTRUCTURE.mdrather than documenting a surface this branch cannot reach.
2026-10-09: order 023 (connector compatibility probe) closed
- Probe and fixes landed earlier (
62903ced4and follow-ups); this pass re-ran everything.npm run probe:mcp-clientsagainst production: all 7 servers pass (OAuth-required servers return 401 withWWW-Authenticatenaming their own protected-resource metadata,mcp-studioandpump-fun-mcppass anonymously, API key mode ran). Against a local server (PUBLIC_APP_ORIGIN=http://localhost:3741,node server/index.mjs): all 7 pass. Evidence refreshed inprompts/x-grok/_generated/connector-probe.jsonandconnector-probe-dev.json; the stale committed production file had recorded failures from before the fixes. - The probe now strips em and en dashes from the JSON it writes (server error bodies are quoted verbatim).
docs/mcp.mddocuments thePUBLIC_APP_ORIGINrequirement for local probing, since otherwise the OAuth challenge names three.ws and an SDK client rightly refuses it. - Vitest: 2198 files, 31987 tests pass.
audit:docsreports one unrelated finding: untrackedworkers/cad-forge/has no README (another session's in-flight worker).
2026-10-09: order 033 (Grok Bot tab on /connect) done
/connecthas a Grok Bot tab (?client=grok) showing Transport (Streamable HTTP), Server URL with a copy button, and Authentication (None for the free servers, OAuth otherwise). The URL and sign-in follow the picked server; on the Grok server an extra OAuth URL row appears, and?client=grokpreselects that server. A note sayslocalhostURLs never work because Grok Bot connects from xAI's cloud. Title, meta, OG, Twitter and HowTo JSON-LD now name Grok Bot; new strings are keyed inpublic/locales/en.json(other locales fall back to the English markup untilnpm run i18n:translateruns).- Verified in Chromium on
npm run dev: no console errors or warnings, keyboard tab switching works.tests/e2e/connect-grok-tab.spec.js(4 tests) passes.npm run build:pagespasses; changelog entry "Use three.ws from Grok Bot" added. - Not done:
data/pages.jsontitle for/connectleft as is (file carries other sessions' uncommitted edits); translated locales for the five edited meta strings are stale until the next translate run.
2026-10-09: order 032 (Grok skill file) done
- Shipped
public/grok-skill.md(served athttps://three.ws/grok-skill.mdafter the next deploy; currently 404 in production). Prose indata/grok-skill-md.template.md, rendered byscripts/build-skills-pack.mjs(also checked bynpm run check:skills-pack). URLs and limits (connector URLs, 4/min and 30/hour generation caps, 40 s call budget) now live once indata/skill-md.facts.jsonand are substituted into both this file and the generalskill.mdtemplate, so they cannot drift.tests/grok-skill-md.test.js(8 tests): committed render equals template, every three.ws URL resolves to a vercel route, page or api handler, named tools are served on the grok surface, limits matchapi/_mcp-studio/handler.jsanddispatch.js, no wallet tool named. - Step 0 measured:
public/skill.mdhad URLs hardcoded and no Grok variant;/api/mcp-groklive with 14 studio tools;get_jobnot yet live in production, so the file teachescheck_job. Production curls run:initialize(returnsMcp-Session-Id),tools/list,search_catalog(10 chair matches with viewer, GLB, poster, embed),forge_free(returnedpendingwithjobIdandviewer_url),check_job(returnedpendingwithstage: mesh; the render had not finished after several minutes of polling, so thedoneshape was not observed in this run). The regeneration also refreshed.agents/skillsandpublic/skill.mdfor another session's uncommittedfind-3d-assetswording change. - Unverified: Grok Skills' upload format is undocumented; plain Markdown with Agent Skills frontmatter is the assumption.
- The probe now strips em and en dashes from the JSON it writes (server error bodies are quoted verbatim).
docs/mcp.mddocuments thePUBLIC_APP_ORIGINrequirement for local probing, since otherwise the OAuth challenge names three.ws and an SDK client rightly refuses it. - Vitest: 2198 files, 31987 tests pass.
audit:docsreports one unrelated finding: untrackedworkers/cad-forge/has no README (another session's in-flight worker).
2026-10-09 order 031 (MCP prompts for an always-on agent)
Added agent-get-started, daily-3d-brief, asset-pack, avatar-from-photo to the studio (mcp-studio) and Grok surfaces, and agent-report to core and the signed-in Grok surface. Studio dispatcher gained prompts/list and prompts/get rendered against the caller's visible catalog; ChatGPT surface stays prompt-free. list_my_agents (read-only, landed in bdfdd1ece) lets signed-in Grok callers enumerate agents for agent-report. Tests: tests/mcp-prompts-unattended.test.js plus the docs/mcp.md use-case coverage test.
2026-10-09 order 030 (MCP client analytics) done
- Shipped in 7b200e2b8: every hosted MCP server (
mcp,mcp-3d,mcp-agent,mcp-bazaar,pump-fun-mcp, studiofull/chatgpt/grok) issues anMcp-Session-Idon initialize and records, after the response and batched, a session row plus daily aggregates by client, version, surface, auth kind and tool (api/_lib/mcp-clients.js, migration20261009172000_mcp_client_analytics.sql, applied afterdb:statusshowed only it pending).GET /api/ops/mcp-clients?days=30(requireAdmin), page/mcp-clients, raw sessions purged after 30 days by thedb-retentioncron. Docs:docs/ops/mcp-clients.md. - Evidence: local order 023 probe against a server with
.env.localloaded showed clientprobe(7 sessions, 2search_catalogcalls, anonymous, full surface) viagatherMcpClients; the live endpoint answers 401 unauthenticated; 22 tests intests/mcp-clients.test.jsincl. 401 and 403; browser check of all states at 375/768/1440 with zero page errors (admin login unavailable, so the endpoint response was intercepted using realgatherMcpClientsoutput). - Caveats: calls from clients that never echo the session id count as client
unknown(the board shows the share). The probe's client name changed toprobe. The local probe wrote to the production database. A server started withoutDATABASE_URLlogsflush_failedand drops events.
2026-10-09 order 036 (discovery metadata for agent clients) done
public/.well-known/mcp.jsonnow has aclientsblock (claude,chatgpt,cursor,vscode,grok-bot) with recommended server, auth mode and settings; the file is hand-maintained (the generator only refreshes resources and prompts), so it was edited directly and re-formatted bybuild-mcp-surfaces.mjs. Documented indocs/mcp.mdas a three.ws extension./grokadded to the curatedsite.llmsDevelopers group indata/pages.json;public/llms.txtnow lists "three.ws for Grok" beside the connect line.npm run build:pagespasses.- New
tests/mcp-directory.test.js(9 tests): shape,clients, and every endpoint routed (route table orapi/<name>.jsthrough the filesystem phase).audit:mcp,audit:docs,check:rulesclean.
2026-10-09: order 035 (docs/grok-bot.md) done
- Shipped
docs/grok-bot.mdin 434e50b25 (route/docs/grok-bot): connector settings per sign-in mode, which server to pick, the links contract, jobs and idempotency, rate limits and install tokens, scoped keys and the spend rule, the prompts, and a troubleshooting table covering every failure linescripts/mcp-client-probe.mjscan emit plus the runtime errors (-32029,-32003, idempotency codes). Linked fromdocs/start-here.md, a new Grok Bot section in thedocs/mcp.mdclient list, and aSTRUCTURE.mdrow;data/pages.jsonanddata/changelog.jsonentries added, generated feeds rebuilt.npm run audit:docsclean,npm run check:rulesOK. - Samples: initialize, session id,
tools/list,search_catalogandforge_freeran against production as written.idempotency_key,get_job,prompts/list,POST /api/mcp-studio/installand?auth=oauthare not in the production build yet (production answers 200 to?auth=oauth, 404 to install, empty prompts, rejectsidempotency_key), so they were run against a local server instead, wherenpm run probe:mcp-clients -- --only grokpasses (15 tools, 4 prompts, OAuth ok) while the same command against production fails the sign-in checks until the next deploy. Local generation could not complete (no S3/LLM env), so the idempotent replay shape rests ondocs/mcp-studio.mdand its tests rather than a fresh run.
2026-10-09 order 034 (/grok landing page) done
- Step 0:
pages/grok.htmlalready existed and was wired in all five places (route, vite input,data/pages.json,STRUCTURE.md, build:pages), with hero, live MCP demo, a real gallery strip (loading skeleton, empty, error with retry), live tools list and a tabbed setup section. This pass added a "Three jobs to hand Grok" section (asset pack, model with embed, talking persona, each naming its tools) and a link to/grok-skill.md, and fixed the gallery poster: a same-origin GLB path cannot be rendered by/api/render/glb(400 in dev), so it now uses the concept image directly. Production gallery URLs are absolute and render (200 image/png). - Evidence: Playwright on vite at 320, 768, 1440 px: 6 gallery items, 14 tools, no horizontal overflow, no console errors or failed requests.
build:pagespasses,/grokis inllms.txtand the sitemap index,/connectGrok tab anddocs/grok-bot.mdlink/grokand the skill file.check:rulesOK. - Left out by design: the @-mention bot status section (order 064 endpoint does not exist) and a link to order 038's tutorial (not written yet); the three recipes link to
/docs/grokinstead.
2026-10-09: order 037 (npx three-ws setup for Grok Bot) done
npx three-ws setup --client grok-bot(also--clients cursor,grok-bot, and a Grok Bot row in the interactive picker) is a new "remote" client kind (packages/three-ws-cli/src/clients/remote.js,src/commands/remote.js). It needs no account for the free studio: prints Name, Transport, Server URL (/api/mcp-grok), Authentication and the chat prompt, copies the URL where a clipboard tool exists (src/clipboard.js,--no-copyskips), flags a localhost origin as unreachable from xAI's cloud, and runs a realtools/listagainst the public URL (exit 1 on failure).--connector-keysigns in (requestingagents:write), mints oneconnectorpreset key and reuses it from the credential store. This neededPOST /api/api-keys(the bearer route the CLI can reach) to acceptpreset: "connector"; it fixes the grant, refuses a caller scope, and 403s a bearer lacking the expanded scopes.- Evidence: production run printed correct fields and
answered tools/list with 14 tools; 23 CLI tests pass (packages/three-ws-cli/tests/grok-bot.test.js, 9 new) plus 4 route tests intests/api/api-keys-connector-preset.test.js;check:rulesandaudit:docsclean. - Unverified: the
--connector-keymint against production (the/api/api-keyspreset change is not deployed; covered by mocked-fetch and route tests only). Nothing deployed or pushed.
2026-10-09: order 039 (xAI remote MCP end to end) partial, no xAI key
- Shipped
scripts/xai-mcp-e2e.mjsandnpm run e2e:xai-mcp: sends a Responses API request per surface (/api/mcp-studio,/api/mcp-grok) with the tool fields from the current docs.x.ai Remote MCP page (type,server_url,server_label,server_description), asks for a ready-made chair viewer link, and exits non-zero unless an MCP call tosearch_catalogis recorded and the text has a three.ws viewer URL.--dry-runprints the exact requests. Documented indocs/grok-bot.md. - Step 0: no
GROK_API_KEYorXAI_API_KEYin.env,.env.local, the Cloud Run service or Secret Manager. Dry run verified; the live run was not. - Remaining: the "With a key: exits 0 against production" line. Owner: order 927 (create the xAI key). Then run
npm run e2e:xai-mcp. Caveat: xAI does not document the output item shape of a server-side MCP call, so the call detection matches any*call*output item whose name is or ends withsearch_catalog; confirm on the first live run. The order file stays in place.
2026-10-09: order 043 (X search through xAI) built, one line open
api/_lib/x-search.jsgained rung 2: when the bearer path throwsXSearchUnavailable(no credentials, 401, 429, reserve reached, X down) andXAI_API_KEY/GROK_API_KEYis set, it callsPOST https://api.x.ai/v1/responseswith thex_searchtool (from_datefrom the window) and a strict JSON schema, then parses into theparseSearchPayloadshape. A post is kept only if the tool cited its status URL and its text contains the mint.XAI_X_SEARCH_DAILY_CAP(default 200, 0 disables) caps it per UTC day;searchMintPostsDetailedreports the serving rung and latency, onex_searchlog line per search,xSearchStats()reads per-day counts. The Scout stores the rung onx.rung.- Evidence: 7 new tests in
tests/sentiment-scout.test.js(32 pass) over the real-shaped fixturetests/fixtures/x-search-xai-response.json, including the cap stopping the rung. Request shape printed by a dry run.check:rulesOK. Docs:docs/sentiment-scout.mdanddocs/ops/llm-lanes.md. - Open line: the live call with a real xAI key. No xAI key exists in
.env,.env.local, or the Cloud Run service, so the response shape (citations location, strict schema with tools) is unproven against the live API. Owner: order 927 (xAI key). Order file left in place. No changelog entry (no user-visible change until a key is set).
2026-10-09: order 040 (computer-use operability) done
scripts/audit-agent-operability.mjs(npm run audit:agent-operability) drives /create, /forge, /connect, an agent profile and /launch with getByRole/getByLabel only. Before: 24 findings across 5 flows. After: 5/5 flows pass, 0 findings, 0 console errors. Evidence:prompts/x-grok/_generated/operability.json.- Fixes: accessible names contain the visible text (forge engine, Surprise me, Enhance, More ideas, Roll & Forge, create cards, x402 badge), launch counters moved to aria-describedby, atlas hint chip is a real button, walk companion canvas is a keyboard-operable named button.
- Not verified: forge generation completing (the local run stalled at 95% after 200s); the audit asserts the visible status during the wait instead.
2026-10-09: order 038 (Grok Bot recipes tutorial) done
- Shipped
docs/tutorials/grok-bot-recipes.md(route/tutorials/grok-bot-recipes) andscripts/run-grok-recipe.mjs <name>: six recipes (daily brief, game jam asset pack, avatar from a photo, X post image to 3D, weekly agent report, $THREE market brief), each with the exact Grok Bot sentence, the tools in order, and the output captured by running that sequence against production this session. Linked fromdocs/grok-bot.mdand/grok;data/pages.jsonanddata/changelog.jsonentries added. - Evidence: all six runs exited 0 and their GLB and poster URLs served 200.
audit:docsclean,check:rulesOK,build:pagespasses. - Caveats: the two image recipes used a public catalog render as the reference image (no real teammate photo or live X post to attach in a script); Grok Bot itself was not driven, only the tool sequence. Recipes 5 and 6 target
/api/mcpwith a read-only key because production/api/mcp-grokdoes not yet list account tools. Under concurrent load two generations exceeded 10 minutes and were rerun alone. Generated feeds were not committed (they would carry another agent's uncommitted changelog entry).
2026-10-09: order 045 (gateway worker rebuild) found already built, one line open
- Step 0:
workers/agent-gatewayis fully committed (src/index.js, drain.js, adapters/telegram.js and discord.js, setup.js, Dockerfile, cloudbuild.yaml, README.md, scripts/deploy-env.mjs, 4 test files; commits 7da824e6b, eaba66bc6, 604801491, 34d2f93c1). The order's premise (package.json only) is stale; nothing was rebuilt. - Evidence: worker
npm test62/62 pass on a real Postgres engine (PGlite running the shipped gateway migrations) with adapter fakes at the platform boundary; the/helpTelegram fixture drains throughhandleEventand the adapter, row acknowledged.npm run devboots, serves/healthz(503 with no bot token, as documented), backlog read from the real inbox. README coverage loop prints nothing.cloudbuild.yamlparses, pinsthree-ws-build@andthree-ws@;gcloud builds submithas no dry-run flag;check:gcloudignoreOK. Rootnpm testhad one red,tests/tutorials-manifest.test.js, becausegrok-bot-recipes(order 038) had no manifest entry; added it topublic/tutorials-manifest.jsand the test passes. - Open line: "npm run dev drains a locally queued Telegram event". The Neon HTTP driver cannot reach a local Postgres, and
.env.localis production, so a live drain would claim and answer real chats with a real token. Proven in tests instead. Owner: after deploy, send/helpto the bot and watch/healthzcounters (GATEWAY_CHAT_KEYSconfines a local run). Deploy:gcloud builds submit --config workers/agent-gateway/cloudbuild.yaml . --region us-central1 --project aerial-vehicle-466722-p5 --substitutions=SHORT_SHA=manual$(date +%s). Order file left in place.
2026-10-09: order 044 (agent brain: Grok) done
- Shipped
api/_lib/agent-brain.js(one resolver for chosen model, owner xAI key rung, free-lane failover, badge metadata) wired into the copilot, the gateway conversation, agents-v1 runs and messages, the strategy loop and agent-loop billing (owner-key calls bill zero credits).src/agent-copilot.jsrenders a.awh-cop-brainbadge showing which model answered and a failover note. Commits39c9893ea(feature) andec8d1d270(generated changelog, feature index, llms files). - Evidence:
tests/agent-brain.test.js12/12, full vitest 2186 files and 31867 tests pass. Browser run against a local server with real provider keys, QA agent set to grok-4.3: badge read "nvidia/nemotron-3-super-120b-a12b (fallback for grok-4.3)", title "grok-4.3 was unavailable, so ... answered on nvidia", reply streamed, 0 console errors. QA agent model was reset afterwards. - Not verified: an answer actually served by xAI (no owner xAI key exists on this account). Groq's qwen rung returned 429 (output-token limit) locally; the chain failed over correctly once other rungs were present.
2026-10-09: order 049 (X adapter for the gateway core) done
- Shipped
api/_lib/gateway/adapters/x.js(createXAdapter,xBotLive): the gateway send surface over X.chatIdis the mention's post id;sendTextreplies throughpostOnewithin_reply_to_tweet_id(second chunk replies to the first),sendMediafetches over the SSRF-pinned fetch, uploads withuploadMediaV2and replies,sendChoicerenders the buttons as a three.ws link inside the post budget,typingis a no-op,editMessageis refused. Bound to one mention: wrong target, a third post, and a second reply to an already-answered mention all throw.postOneis now exported fromapi/_lib/x-post.js. - Dry run is the default: live needs
X_MENTION_BOT_LIVEexactly1, the policy not in dry run, and a token resolver. Otherwise each send writesreply_text,reply_media_url,reply_link,decision=reply,dry_run=trueonto thex_mention_eventsrow and returns adry_rundelivery. - Weighting:
twitter-textlast published June 2022 (fails the 2-year maintenance rule), soapi/_lib/x-text-weight.jsimplements X's documented counting (Latin 1, other code points 2, emoji sequence 2, URL 23) pluschunkForX(at most two parts, never cuts a URL or emoji). - Evidence:
tests/x-text-weight.test.jsandtests/x-gateway-adapter.test.js, 27 pass, against the real migration in PGlite and the realx-post.jswith onlyfetchUpstreamcaptured. Dry-run tests assert zero HTTP calls and a complete row; live tests assert the exact/2/tweetsand media upload request shapes.check:rulesOK. - Not verified: a live post to X (owner-gated, order 928).
2026-10-09: order 051 (public reply brain) done
- Shipped
api/_lib/x-mention-reply.js(composePublicReply): tool-less single completion on the agent's brain chain (order 044resolveAgentBrain) or the platform chain for the company account; mention text quoted as data in the user turn only. Post-checks in code: X weighted length (officialtwitter-text, new dependency) at most 260, https three.ws link allowlist, no hashtags or handles, cashtags and coin names other than $THREE rejected, address detection, financial-phrasing denylist, "I did it" action-claim detector. Any failure returns the fixed help reply.llmCompletegained an optionalchainoverride. - Evidence:
tests/x-mention-reply.test.js40/40. Opt-inRUN_LLM_TESTS=1corpus (tests/x-mention-reply.llm.test.js) 16/16 against the real chain (kilo, ovh); the checks caught one over-long reply and one "financial advice" reply, and an llm7 429 fell to the fixed reply. - Not verified: an xAI-served reply (no xAI key on this account).
2026-10-09: order 050 (mention polling cron) done
- Shipped
api/_lib/x-mention-poll.js(runMentionTick,pollAccount,handleMention, run lock inapp_settings, per-author limitsX_MENTION_REPLIES_PER_AUTHOR_HOURdefault 3 andX_MENTION_REPLIES_PER_AUTHOR_DAYdefault 10), thex-mentionshandler inapi/cron/[name].jsand its route, and a*/2 * * * *entry invercel.json(cron count now 126 in CLAUDE.md, README.md, docs/build.md). First poll of an account only anchors the cursor. X tier, credit, rate and auth refusals are quiet recorded outcomes. The cursor moves only past fully recorded mentions. Dry run only: the loop passes no poster token, so going live stays order 928. - Routing:
helpand refused text get the fixed texts,chatgoes tocomposePublicReply,make,image3d,avatar,launchanswer help with reasonhandler_not_builtuntil their orders replace the route. Orders 055 (safety) and 057 (budget) are not built, so only the parser's refusals and the reply brain's post-checks apply; the loop takes agent accounts from anagentAccountshook that order 060 supplies (none today). - One length counter:
api/_lib/x-mention-reply.jsnow usesx-text-weight.js(weightedLength,findUrls) and thetwitter-textdependency and lockfile entry are removed (it was last published June 2022). This supersedes the order 051 note above that namedtwitter-text. - Evidence:
tests/x-mention-poll.test.js10/10 on the real migration (PGlite) with the captured timeline fixture. Real dry-run tick against @trythreews with production credentials: 100 mentions read (299 of 300 reads left), 25 handled, 7 dry-run replies, 0 posted, all rowsdry_run, noreply_tweet_id. Cursor then advanced to the newest id so a later live flip never answers history. - Not verified: scheduler job creation (
deploy:gcp:sync-cronsruns at deploy, owner-gated). Observed: a model reply contained an em dash; the order 051 post-check does not reject it.
2026-10-09: order 055 (mention safety rails) done
- Shipped
api/_lib/x-mention-guard.js(kill switch via envX_MENTION_BOT_PAUSED=1or thex_mention_bot_pausedsettings row, own-account skip,x_mention_blocklist, known-bot skip with a specific reason for a bot quoting our post, 24-hour author age, one reply per conversation per hour, depth cap of two) andapi/_lib/x-mention-known-bots.js(usernamesgrokandbotas the source, ids resolved throughGET /2/users/byand cached daily, unresolved names still matched by username). Wired intohandleMentionandpollAccount; every decision is recorded with a reason. New reader pieces:lookupUsersByUsername, authorcreatedAt,countRepliesInConversation. Rules and how to change each:docs/x-mention-bot.md. - Follow-up from order 050: the reply post-check now rejects em and en dashes (
reason: dash) andcleanModelTextnormalizes them to commas (number ranges to hyphens) before the check. - Evidence:
tests/x-mention-guard.test.js(rule tests on the real migration in PGlite; the kill switch tests assert zero calls to the reply brain and adapter) andtests/x-mention-reply.test.jspass; poll, reader and store suites still pass (112 total in the five touched suites). - Not verified: a live
users/byresolution ofgrokandbot(first production tick does it; tier refusals are recorded as unresolved). Order 056 relaxesknown_botfor the on-behalf-of flow.
2026-10-09: order 057 (X budget controller) done
- Shipped
api/_lib/x-budget.js: daily and monthly read and post counters inapp_settings(no migration; thebudgetdecision already existed), caps fromX_MENTION_MONTHLY_POST_CAP(1500),X_MENTION_DAILY_POST_CAP(80),X_MENTION_MONTHLY_READ_CAP(15000), a degrade ladder (chat 70%, avatar 80%, image3d 90%, make/launch/help 100%) recorded asbudgetdecisions, and header-driven backoff (x-rate-limit-*,x-app-limit-24hour-*, 429 fallback 15 minutes). Wired intohandleMention(gate before compose, count after send, dry run included) andpollAccount(read gate, read count, backoff from headers and from a 429).fetchMentionsnow returns responseheaders;XRateLimitedcarries them.getBudgetUsage()is the object order 064 serves from the status endpoint (no status endpoint exists yet, so nothing is exposed over HTTP). - Defaults and reasoning:
docs/x-mention-bot.md, "The X budget". Defaults are conservative placeholders for order 926 to replace with the real tier allowances. - Evidence:
tests/x-budget.test.js25/25 on the real migration (PGlite).
2026-10-09: order 052 (make-it-3D flow) done
- Shipped
api/_lib/x-mention-make.js: studio moderation, then the free gpt-forge text-to-3D lane, a bounded wait (X_MAKE_BUDGET_MS, default 150s), and one recorded end state per mention: reply (rendered PNG plus/m/<creation>link), pending (job id kept on the row, answered once byfinishPendingMakes, withX_MAKE_GIVE_UP_MSdefault 30 min), the designed failure reply with a prefilled/forge?prompt=link, or a fixed refusal. Creations belong to the system bot account (users.service_account), areunlisted, and carryforge_creations.x_author_id(migration20261009201500_forge_creations_x_author.sql, applied) for order 058. Live delivery goes through an injecteddeliver; without one a live row is heldpaused. - Evidence:
prompts/x-grok/_generated/make-dry-run.json(scriptscripts/x-mention-make-dry-run.mjs): 5 prompts, 6 real production generations, all reply rows, every poster PNG and/m/link answered 200. Three outlived the wait budget and were answered by the follow-up tick.tests/x-mention-make.test.js15 tests (success, timeout then follow-up incl. overlapping ticks, failure, unsafe) on the real migrations via PGlite. - Code landed in sweep commits
9997cdcd4and607229b22by a concurrent agent; the close-out commit carries this log and the order deletion. Observed: the free lane took 4 to 7 minutes per model today, so the 150s default usually ends pending; the follow-up tick must run (order 050's cron should callfinishPendingMakes).
2026-10-09: order 054 (avatar from profile) built, one done line waiting on a deploy
- Shipped
api/_lib/x-mention-avatar.js(own profile image only,_normalupgraded to 400x400, vision moderation, image-to-3D then auto-rig, bounded wait plusfinishPendingAvatarsfollow-up,default_avatarreply with the/createlink), wired intox-mention-poll.js. Tests:tests/x-mention-avatar.test.js14 passing, including own-image-only and the named-other-account case. Doc:docs/x-mention-avatar.md. Code landed in sweep commit9997cdcd4. - Evidence:
prompts/x-grok/_generated/avatar-dry-run.json: 3 reply rows from real public profile images (profile image fetch 200, pose link 200) plus a default-image row. - Remaining line: media status codes. Production
/api/render/glbcaps input at 10 MB and the rigged avatars are 15 to 16 MB, so the poster answers 413 there. This commit raises the cap to 25 MB (the renderer's own default); against a local server the same rigged GLB renders 200 image/png. After the next deploy, rerunnode scripts/x-mention-avatar-dry-run.mjsto record production media 200s, then delete the order file. Owner: whoever runs the deploy (gated).
2026-10-09: late-reply follow-ups wired into the x-mentions tick
runMentionTicknow callsrunFollowUps()each tick:finishPendingMakes()andfinishPendingAvatars(), behind the kill switch and the read/post budget gate, each error-isolated. TheirdeliveriscreateDeliver()(api/_lib/x-mention-deliver.js) on the order 049 X adapter: dry rows are recorded, live rows post only withX_MENTION_BOT_LIVE=1plus a token resolver, and posts are counted against the budget. Report keys:makeFollowUp,avatarFollowUp,followUps.- Evidence:
tests/x-mention-poll.test.js16 passing (6 new, real PGlite migrations, adapter posting captured at itspostboundary); make and avatar suites still pass. Nothing was posted to X. Remaining owner step: a company-account token resolver for live mode (order 928).
2026-10-09: order 053 (image-to-3D reply) built, one done line waiting on a deploy
- Shipped
api/_lib/x-media-image.js(X media CDN only,pbs.twimg.com/media/, no redirects, 5 MB streamed cap, 15s timeout, MIME and magic-byte check) andapi/_lib/x-mention-image3d.js(own image only withnot_own_imageskips, fail-closed vision review, image-to-3D lane, bounded wait,finishPendingImage3dfollow-up, link-only reply when the poster cannot render). Doc:docs/x-mention-image3d.md. Core code landed in sweep commit9997cdcd4; the close-out commit carries the poster probe, subject article strip, evidence fixes and this log. - Tests:
tests/x-mention-image3d.test.js22 passing (own image, someone else's image skip, non-CDN reject, oversized reject, pending follow-up, unrenderable poster). - Evidence:
prompts/x-grok/_generated/image3d-dry-run.json: 3 own-image reply rows from real public product posts (photo fetch 200,/m/link 200). Media: 2 of 3 posters answer 200 image/png; row 2 answers 413 because production/api/render/glbcaps input at 10 MB and that GLB is 11.5 MB. - Remaining line: three rows with loading media. The 25 MB cap is in
11914b4c8; after the next deploy rerunnode scripts/x-mention-image3d-dry-run.mjs --posts <ids>to record row 2 as 200, then delete the order file. Owner: whoever runs the deploy (gated). - Not wired:
x-mention-poll.jsstill routesimage3dto help viaUNBUILT_HANDLERS, and no cron callsfinishPendingImage3d.x-mention-image3d.jsimports the in-flightx-mention-make.js.
2026-10-09: order 053 image-to-3D wired into the x-mentions poll (dry run)
handleMentionnow routes theimage3dintent tohandleImage3d()(removed fromUNBUILT_HANDLERS;makeandlaunchstill answer help).runFollowUps()also runsfinishPendingImage3d()behind the same kill switch and budget gate, error-isolated, delivering through the samecreateDeliver(); report keyimage3dFollowUp.- Git check:
x-mention-make.js,x-mention-image3d.jsand their tests were already committed (git statusclean at start); nothing to commit for them. - Tests:
tests/x-mention-poll.test.jsextended (image3d routed to its handler against real PGlite with only CDN/vision/store/3D-lane edges replaced; late image3d settle live and dry; failure isolation; kill switch and budget skip all three; tick runs all three). poll + image3d + make + avatar suites: 71 passing. Nothing was posted to X. - Remaining: unchanged from the 053 entry (rerun the image3d dry-run script after the next deploy; live posting needs the order 928 token resolver).
2026-10-09: order 058 (claim what the bot made) done
- Shipped
api/_lib/x-creation-claim.js(claim only where the user's verified X link equalsforge_creations.x_author_idand the bot still owns the row;claimForUser,claimForAuthor,listClaimable,withClaimNote), the ledgerx_creation_claims(migration20261009213000_x_creation_claims.sql, applied; one row per move with sourcelink,claim_pageormention),GET/POST /api/x/claim, and the/x/claimpage wired in all five places (page,vercel.jsonroute,vite.config.jsinput plus dev mirror,data/pages.json,STRUCTURE.md). The X OAuth callback claims on link and/x/claimis an allowed return surface. The system bot account already existed (ensureBotUser, no credentials); attribution now hands a creation straight to an author who had already linked. Every success reply from make, image-to-3D and avatar getsSaved to your library.(linked) orClaim it: <origin>/x/claim(unlinked), skipped if it would exceed one post. - Evidence:
tests/x-creation-claim.test.js8 passing on the real migrations (PGlite): a creation is claimed when the user links the matching X id, never for a different id, no link, a disconnected link, or an id outside the author. 337 tests pass across the x-mention suites. Browser:/x/claimon a local server plus Vite at 375 and 1440 px, dark and light, zero console errors in signed out, unlinked (real signed-in QA session; local env has no X OAuth client so it shows the unavailable copy), empty, list, claim success, claim failure and load error (the last four with the API response intercepted, since no real unclaimed rows exist to claim safely). - Not verified: the live OAuth round trip (needs a deployed callback and a real X account); a real mention-to-claim run waits on going live.
2026-10-23: order 061 (agent mention settings UI) closed
- Applied
20261011220000_agent_mention_policy.sqlalone withnode scripts/apply-migrations.mjs --apply --file ...(additive, idempotent; the 10 other pending migrations were left untouched). The fourmention_replies_*columns now exist onagent_x_policies, so the save no longer hits Postgres42703. UI, API and decisions endpoint shipped earlier in ad25ced40. - Evidence:
tests/x-mention-decisions-endpoint.test.jsandtests/agent-mention-policy-migration.test.js12/12 passing; column presence confirmed by a query against the shared database. - Not verified: an authenticated HTTP PUT round trip against the live database after the migration.
2026-10-23: order 024 (cloud agent rate limits) re-verified, one line open
- Install tokens, install-keyed budgets, helpful denials, the
/connectpanel anddocs/mcp-studio.mdwere already shipped (earlier commits). Re-verified today:tests/mcp-studio-install-token.test.js,tests/mcp-studio-ratelimit.test.js,tests/mcp-studio.test.js60/60 passing;tests/mcp-schema.test.js20/20 passing (the held-catalog failure no longer reproduces). - Scripted run (
scripts/probe-mcp-install-tokens.mjsagainst a localserver/index.mjs): token A admitted 4 times, 5th refused withgeneration_burstkeyed oninstall, reset time and remedy in the denial; token B from the same IP still admitted. - Open: full
npm testis red in this checkout for environmental reasons only (1065 vitest files fail onERR_MODULE_NOT_FOUND:lru-cacheandthreeare missing fromnode_modules, plus a very large concurrent uncommitted tree). Owner of the line: whoever next runsnpm installon a quiet tree, thennpm test; then deleteprompts/finish/024-x-grok-02-cloud-agent-rate-limits.md.
2026-10-23: orders 023 to 931 sweep
- Order 060 (agent mention replies): found already shipped in
4516247ea(api/_lib/x-agent-mentions.js, wired intox-mention-poll.jslistAccounts/handleMention,countAccountRepliesinx-mention-store.js, "Agent mode" indocs/x-mention-bot.md).tests/x-agent-mentions.test.jsandtests/x-mention-poll.test.jspass (105 of 105 across the seven suites run today). Order file retired. - Order 023:
npm run probe:mcp-clientsagainst production exits 0, 8 of 8 servers. Open line: a green fullnpm test. - Order 039/927: still no xAI key on the machine,
.env,.env.local, the Cloud Run service or Secret Manager. Owner creates it at console.x.ai. - Order 926:
node scripts/x-mentions-probe.mjsre-run today, HTTP 200 on the mentions timeline with the held OAuth 1.0a credentials (prompts/x-grok/_generated/mentions-probe.jsonrefreshed). X pricing per docs.x.com (pay-per-use): post read $0.005, owned mentions read $0.001 per resource, create post $0.015 (with URL $0.200), webhook events billed per event delivered (post.create $0.005). Owner decision: whether to enable pay-per-use credits for the webhook path; polling already works. - Order 929:
docs/partners/grok-bot-listings.mdwritten, nothing submitted. - Order 930: draft
data/x-content/stories/grok-bot-connector.json; the thread with a real mention reply and the site article wait on go-live (928). - Order 931:
docs/partners/x-player-card-submission.md. Finding: production serves/forge/embedwith the site-wideframe-ancestors(IBM only), not the route's*, so X could not frame the player until this is fixed. - Order 928: production has no
/api/x/mention-bot/statusyet (the bot is not deployed). Review sample, preflight and deploy remain the owner's go-ahead.