Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
docs(prompts): block order 060 on the evolve/main divergence, no code written
nirholas03e47048374e
diff --git a/prompts/finish/060-x-grok-38-agent-mention-replies.md b/prompts/finish/060-x-grok-38-agent-mention-replies.mdindex bc1c08c27..13cc233d2 100644--- a/prompts/finish/060-x-grok-38-agent-mention-replies.md+++ b/prompts/finish/060-x-grok-38-agent-mention-replies.md@@ -1,5 +1,7 @@# x-grok 38: agents that answer their own mentions+**Evolve status (2026-10-11).** Confirmed genuinely unshipped on both branches: `git show main:prompts/finish/060-x-grok-38-agent-mention-replies.md` still exists byte-identical to this file, `main`'s `api/_lib/x-agent-policy.js` has no `mention_replies` entry, and `main`'s own `x-mention-poll.js` still calls `agentAccounts = async () => []` with a comment reading "which order 060 provides from the agent policy", so no session has built this anywhere. The blocker is `evolve`/`main` divergence (OWNER-ACTIONS row 34, now 362 commits behind / 117 ahead): this order's entire prerequisite subsystem, the mention-polling cron (`x-mention-poll.js`) and its full import closure (`x-mentions.js`, `x-mention-store.js`, `x-mention-reply.js`, `x-mention-guard.js`, `x-budget.js`, `gateway/adapters/x.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.js`, `x-text-weight.js`, orders 045-058), exists only on `main` and does not exist at all in this `evolve` checkout. There is no file here to extend, so the only two options are (a) hand-copying that entire ~14-file subsystem out of `main` piecemeal, which is the partial, judgment-call reconciliation row 34 already says an agent should not attempt unattended, since several of those files (`x-mentions.js`, `x-mention-store.js`, `gateway/adapters/x.js`, `api/cron/[name].js`) already differ between the two branches in ways that need hand resolution, not a copy; or (b) building a second, independent implementation against `evolve`'s pre-order-045 base, which order 055's own history already proved produces an inferior, unreconcilable duplicate that has to be discarded once `main`'s real version surfaces. Neither is a sound unattended action, so this order stays open rather than ship either. Once row 34's reconciliation lands (evolve rebased or merged onto current `main`), this order becomes a small, mechanical addition on top of what `main` already has: 4 new `agent_x_policies` columns + migration, a `mention_replies` entry in `POST_KINDS`, an `agentAccounts()` supplier joining `agent_x_policies`/`agent_x_connections`/`missingScopes()`, wiring that supplier into `listAccounts()`/`pollAccount()`/`handleMention()` in `x-mention-poll.js` (intent allow-list and daily-cap gates, agent persona and avatar-poster media passed into `composePublicReply`/`sendMedia`, per-agent `policyDryRun`/token resolver), a `countAccountReplies()` addition to `x-mention-store.js`, tests, and an "agent mode" section in `docs/x-mention-bot.md`. No new OWNER-ACTIONS row: row 34 already covers the reconciliation this order depends on, now updated to name this order too. Nothing was committed against the stale base.+How to run: paste this file's repo path into a fresh Claude Code chat in this repository and say "run this work order". Runnable now, no gate. Dry run by default per agent.## Operating clause (binding)diff --git a/prompts/finish/_context/production-100-OWNER-ACTIONS.md b/prompts/finish/_context/production-100-OWNER-ACTIONS.mdindex cd8c74e54..46ec2c1f0 100644--- a/prompts/finish/_context/production-100-OWNER-ACTIONS.md+++ b/prompts/finish/_context/production-100-OWNER-ACTIONS.md@@ -45,7 +45,7 @@ on it; some resolve themselves as other work lands.| 31 | **Redeploy the GPU workers that fetch caller images, so a Wikimedia reference photo stops failing** (added 2026-10-09 by the evolve loop triage sweep). `upload.wikimedia.org` answers httpx's default `python-httpx` agent with 403, so `model-triposg` failed every job whose reference photo was a Wikimedia link before inference (4 logged 403 failures in the 24 hours to 2026-10-09 03:00 UTC). `d886d09e1` sends a descriptive User-Agent from the shared `worker_security.py`, mirrored to all 17 vendored copies, but a worker only picks it up when its image is rebuilt. Start with the one that failed: `gcloud builds submit --config workers/model-triposg/cloudbuild.yaml --region us-central1 --project aerial-vehicle-466722-p5 --substitutions=SHORT_SHA=manual$(date +%s) .` (the command in `workers/model-triposg/README.md`); the other image-fetching workers (`model-trellis`, `model-hunyuan3d`, `rig`, `texture`, `stylize`, `segment`, `remesh`) inherit it on their next routine deploy. Separately worth a look: `model-trellis` was killed by its own liveness probe (`/health` timing out during inference, then signal 9) three times in the 24 hours to 2026-10-09, which left 147 task polls answering 503; not root-caused this session. | one build | Image-to-3D jobs whose reference photo is a Wikimedia link | [workers/model-triposg/README.md](../../../workers/model-triposg/README.md) || 32 | **Decide retention for the six large tables the database retention cron never prunes** (added 2026-10-09 by the evolve loop triage sweep). The Neon footprint reached 11,606 MB, past the 8192 MB high-water mark since 2026-09-09, so five write-heavy crons (`launcher-tick`, `coin-intel-observe`, `smart-money-rollup`, `recompute-reputation`, `intel-learn`) skipped every tick for a month. The sweep raised `DB_RETENTION_HIGH_WATER_MB` to 16384 (config-only, pre-approved; real cap `neon.max_cluster_size` is 16TB), which buys about six weeks at the measured ~114 MB a day. The growth is in tables outside the retention set, and pruning them deletes history, so it is not an agent's call: `oracle_training_set` 1.8 GB (1.37M rows), `x402_self_facilitator_log` 1.4 GB (3.0M rows; the code already names it a product decision about lifetime revenue totals), `firewall_decisions` 1.2 GB, `usage_events` 0.7 GB, `club_tips` 0.6 GB (1.2M rows), `ops_alerts` 0.5 GB (693k one-off `503 settlement_unavailable` rows from July to October). Name a window per table (or keep forever and accept the storage bill); an agent then adds each to `TIME_SERIES_TABLES` in `api/cron/db-retention.js`. | decision | Keeping the write crons running past mid-November without raising the mark again | [docs/ops/db-retention.md](../../../docs/ops/db-retention.md) || 33 | **Create a production xAI API key so a Grok model's live MCP calls against three.ws can be proven** (added 2026-10-10 by the evolve loop, x-grok order 039, which already owns this exact gate as order 927: `prompts/finish/927-x-grok-46-owner-grok-api-key.md`). Step 0 re-derivation this session found no `GROK_API_KEY`/`XAI_API_KEY` anywhere: not in `process.env`, not in `.env`/`.env.local`, not on the `three-ws-api` Cloud Run service (`node scripts/read-service-env.mjs '^(GROK\|XAI)_API_KEY$' --names` returned nothing). `scripts/xai-mcp-e2e.mjs` (npm script `e2e:xai-mcp`) is built and verified end to end in dry-run mode: it matches xAI's current Responses API remote-MCP schema field for field and names this gate when no key is found. Create a key at console.x.ai, then either set it directly (`gcloud run services update three-ws-api --region us-central1 --update-env-vars GROK_API_KEY=<key>`) or hand it to order 927 to wire through Secret Manager; afterward `npm run e2e:xai-mcp` should exit 0 against production. | minutes, console only | Closes x-grok order 039's one remaining Definition of Done line, and order 927 | [_context/x-grok-PROGRESS.md](x-grok-PROGRESS.md), 2026-10-10 entry |-| 34 | **Decide how to reconcile the `evolve` worktree branch with `main`: it is 358 commits behind** (added 2026-10-11 by the evolve loop, while working x-grok order 050). `git log --oneline HEAD..main \| wc -l` from `/home/user/projects/.evolve-wt` on branch `evolve` returns 358: `main` shipped (among much else) x-grok orders 044, 046 to 052, and 055 to 058 (the `x-mention-poll.js` bot, its safety rails, budget controller, and the make/image3d/avatar handlers) while `evolve` has no record of any of it, because `evolve` never merged or rebased from `main` after it branched. `evolve` also carries 20+ of its own commits not on `main` yet (x-grok orders 038 to 040, 043, 045, 049, an accessibility fix, an a11y wire-up), so this is a real two-way divergence, not a simple fast-forward. The practical cost: this session spent real effort re-discovering and re-implementing order 050's mention-poll cron from scratch before noticing `main` already shipped a more complete version, and the same evidence shows orders 051, 052, 055, 056, 057 and 058's order files are stale duplicates sitting in `prompts/finish/` on `evolve` for the same reason (noted in [x-grok-PROGRESS.md](x-grok-PROGRESS.md), 2026-10-11 entry); every future evolve session that picks one up will repeat this exact waste until the branch is caught up. Merging or rebasing 358 commits safely is a judgment call about which side wins on any file both branches touched (this evolve worktree's own x-search/agent-brain/agent-gateway/gateway-adapter work overlaps the same `api/cron/[name].js` and `vercel.json` main also edited); that is not a mechanical fix an agent should attempt unattended. Decide the reconciliation approach (likely: rebase `evolve`'s unique commits onto current `main`, resolving the handful of shared-file conflicts by hand) and either do it or direct an agent to. **Re-measured 2026-10-11 while verifying order 051 against `main` from a throwaway detached worktree (removed after, nothing committed to `main`): `main`'s shipped `x-mention-reply.js` has a live bug that this reconciliation should fix in the same pass.** `composePublicReply`'s `chainFor()` builds its model chain from `agent-brain.js`/`agent-model.js` (`{name,url,key,model}` records meant for `copilot-engine.js`'s own round-trip reader), then hands that chain to `llmComplete` in `llm.js`, whose attempt loop calls `p.buildBody(...)`, a method only `llm.js`'s own, differently-shaped `providerChain()` objects define. Every attempt on every rung throws the same `TypeError` and the whole chain "exhausts" in milliseconds, always landing on the safe fixed fallback reply. Verified live with production's own `GROQ_API_KEY`/`OPENROUTER_API_KEY`/`NVIDIA_API_KEY` (`RUN_LLM_TESTS=1 npx vitest run tests/x-mention-reply.llm.test.js --reporter=verbose`): 16/16 "passed" (the test accepts a safe fallback as a pass) but all 16 fell back with `reason: 'llm_error', detail: '... p.buildBody is not a function'`, and the real `x_mention_events` table already carries 129 rows with `reason: 'fallback:llm_error'` from the live mention-poll cron, recorded before this was diagnosed. The public reply bot has likely never sent a single real model-composed reply to a stranger; it is safe (every post-check still holds) but has silently answered every public mention with the fixed help text only. Fix, once someone is on `main`: change `chainFor()` to build from `llm.js`'s own `providerChain({ grokKey, grokModel })` (resolving the agent's Grok key/model the way `agent-grok-key.js` already does) instead of `modelChain`/`resolveAgentBrain`, so the chain shape matches what `llmComplete` reads. Full writeup: [x-grok-PROGRESS.md](x-grok-PROGRESS.md), 2026-10-11 entry for order 051. | decision, then a rebase (the `chainFor()` fix itself is a small, mechanical change once on `main`) | Stops repeat duplicate work across the whole x-grok campaign and any other area both branches touched, and fixes a currently-silent production defect in the public X reply bot | [x-grok-PROGRESS.md](x-grok-PROGRESS.md), 2026-10-11 entries |+| 34 | **Decide how to reconcile the `evolve` worktree branch with `main`: it is 358 commits behind** (added 2026-10-11 by the evolve loop, while working x-grok order 050). `git log --oneline HEAD..main \| wc -l` from `/home/user/projects/.evolve-wt` on branch `evolve` returns 358: `main` shipped (among much else) x-grok orders 044, 046 to 052, and 055 to 058 (the `x-mention-poll.js` bot, its safety rails, budget controller, and the make/image3d/avatar handlers) while `evolve` has no record of any of it, because `evolve` never merged or rebased from `main` after it branched. `evolve` also carries 20+ of its own commits not on `main` yet (x-grok orders 038 to 040, 043, 045, 049, an accessibility fix, an a11y wire-up), so this is a real two-way divergence, not a simple fast-forward. The practical cost: this session spent real effort re-discovering and re-implementing order 050's mention-poll cron from scratch before noticing `main` already shipped a more complete version, and the same evidence shows orders 051, 052, 055, 056, 057 and 058's order files are stale duplicates sitting in `prompts/finish/` on `evolve` for the same reason (noted in [x-grok-PROGRESS.md](x-grok-PROGRESS.md), 2026-10-11 entry); every future evolve session that picks one up will repeat this exact waste until the branch is caught up. Merging or rebasing 358 commits safely is a judgment call about which side wins on any file both branches touched (this evolve worktree's own x-search/agent-brain/agent-gateway/gateway-adapter work overlaps the same `api/cron/[name].js` and `vercel.json` main also edited); that is not a mechanical fix an agent should attempt unattended. Decide the reconciliation approach (likely: rebase `evolve`'s unique commits onto current `main`, resolving the handful of shared-file conflicts by hand) and either do it or direct an agent to. **Re-measured 2026-10-11 while verifying order 051 against `main` from a throwaway detached worktree (removed after, nothing committed to `main`): `main`'s shipped `x-mention-reply.js` has a live bug that this reconciliation should fix in the same pass.** `composePublicReply`'s `chainFor()` builds its model chain from `agent-brain.js`/`agent-model.js` (`{name,url,key,model}` records meant for `copilot-engine.js`'s own round-trip reader), then hands that chain to `llmComplete` in `llm.js`, whose attempt loop calls `p.buildBody(...)`, a method only `llm.js`'s own, differently-shaped `providerChain()` objects define. Every attempt on every rung throws the same `TypeError` and the whole chain "exhausts" in milliseconds, always landing on the safe fixed fallback reply. Verified live with production's own `GROQ_API_KEY`/`OPENROUTER_API_KEY`/`NVIDIA_API_KEY` (`RUN_LLM_TESTS=1 npx vitest run tests/x-mention-reply.llm.test.js --reporter=verbose`): 16/16 "passed" (the test accepts a safe fallback as a pass) but all 16 fell back with `reason: 'llm_error', detail: '... p.buildBody is not a function'`, and the real `x_mention_events` table already carries 129 rows with `reason: 'fallback:llm_error'` from the live mention-poll cron, recorded before this was diagnosed. The public reply bot has likely never sent a single real model-composed reply to a stranger; it is safe (every post-check still holds) but has silently answered every public mention with the fixed help text only. Fix, once someone is on `main`: change `chainFor()` to build from `llm.js`'s own `providerChain({ grokKey, grokModel })` (resolving the agent's Grok key/model the way `agent-grok-key.js` already does) instead of `modelChain`/`resolveAgentBrain`, so the chain shape matches what `llmComplete` reads. Full writeup: [x-grok-PROGRESS.md](x-grok-PROGRESS.md), 2026-10-11 entry for order 051. **Re-measured again 2026-10-11 while working order 060 (agent mention replies): the gap is now 362 commits behind / 117 ahead, and order 060 cannot be built at all until this reconciles, because its entire prerequisite subsystem (`x-mention-poll.js` and its ~14-file import closure, orders 045-058) exists only on `main` and has no file to extend on `evolve`; left open with a dated status note rather than hand-copied or duplicated. Full writeup: [x-grok-PROGRESS.md](x-grok-PROGRESS.md), 2026-10-11 entry for order 060.** | decision, then a rebase (the `chainFor()` fix itself is a small, mechanical change once on `main`) | Stops repeat duplicate work across the whole x-grok campaign and any other area both branches touched, and fixes a currently-silent production defect in the public X reply bot | [x-grok-PROGRESS.md](x-grok-PROGRESS.md), 2026-10-11 entries |Deleted 2026-09-01: the former row 5 (`WALLET_ENCRYPTION_KEY_PREVIOUS` policy), whichdeclared itself "delete on reading" and had outlived that by three weeks.diff --git a/prompts/finish/_context/x-grok-PROGRESS.md b/prompts/finish/_context/x-grok-PROGRESS.mdindex bd8c6a0ed..58d5bb05a 100644--- a/prompts/finish/_context/x-grok-PROGRESS.md+++ b/prompts/finish/_context/x-grok-PROGRESS.md@@ -365,3 +365,11 @@ Cross-session handoff for the `x-grok-` orders ([x-grok-00-CONTEXT.md](x-grok-00- DoD "tests pass; migration previewed then applied": `tests/x-identity.test.js` (6 tests) and `tests/user-identities-provider-constraint.test.js` (4 tests, live DB) both pass, 10/10. `node scripts/apply-migrations.mjs --apply` applied the new migration (confirmed by the live-DB constraint tests exercising `provider='x'`, `'google'`, a rejected `'facebook'`, and the one-identity-per-provider unique index). Full suite with `DATABASE_URL` correctly unset for the run: `2215 passed | 2 failed` files, 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) via `git log`, not touched by this diff.- DoD "browser check: sign in with X on `npm run dev` reaches the X consent screen with the right scopes": `X_OAUTH_CLIENT_ID`/`X_OAUTH_CLIENT_SECRET` do not exist anywhere in this system, confirmed by `node 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 real `server/index.mjs` on a spare port with dummy `X_OAUTH_CLIENT_ID`/`SECRET` values and confirmed `GET /api/auth/x/login?next=/create` returns a real 302 to `https://twitter.com/i/oauth2/authorize` with `scope=tweet.read+users.read+offline.access` (the login flow's intended read-only scope set, not the full posting scope) and a PKCE `code_challenge`/`code_challenge_method=S256`. No vite/browser session was run since this worktree has no `dist/` build and the credentials needed for a real consent screen do not exist on this deployment; the single missing pair is `X_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_SECRET` on 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.md` is byte-identical to this branch's copy, `main`'s `api/_lib/x-agent-policy.js` has no `mention_replies` entry, and `main`'s `api/_lib/x-mention-poll.js` still calls `runMentionTick()` with zero arguments from `api/cron/[name].js`, defaulting `agentAccounts` to `async () => []`, with a comment reading "supplied by `agentAccounts`, 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.js` and `x-text-weight.js` do not exist in this checkout at all (`MISSING`, not `DIFF`). `x-mentions.js`, `x-mention-store.js`, `gateway/adapters/x.js` and `api/cron/[name].js` exist but differ from `main`'s versions. This is the same divergence OWNER-ACTIONS row 34 already logged while working order 050 (now 362 commits behind `main` / 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 `main` has not built it either. The two ways to proceed are both unsound for an unattended session: hand-copying `main`'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 once `main`'s real version surfaces, except here there would be no real `main` version to compare against yet, so the duplicate would become the only implementation and would conflict with whatever `main` eventually builds in the same space).+- Resolution: left `prompts/finish/060-x-grok-38-agent-mention-replies.md` in place with a dated Evolve status paragraph naming the exact blocker and sketching the mechanical diff (4 policy columns + migration, `mention_replies` in `POST_KINDS`, an `agentAccounts()` supplier, the `listAccounts`/`pollAccount`/`handleMention` wiring, a `countAccountReplies()` 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 in `production-100-OWNER-ACTIONS.md` updated 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.