Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

prompts(finish): close order 513, every DoD line verified live

nirholas1ead7455273a
diff --git a/prompts/finish/513-integrate-14-wallet-linkage.md b/prompts/finish/513-integrate-14-wallet-linkage.md
deleted file mode 100644
index f13c304f6..000000000
--- a/prompts/finish/513-integrate-14-wallet-linkage.md
+++ /dev/null
@@ -1,59 +0,0 @@
-# integrate 14: a wallet linkage engine: endpoint, MCP tool, trade-firewall and copy-trade checks
-
-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.
-
-## Operating clause (binding)
-
-- Read CLAUDE.md first, then [_context/integrate-00-CONTEXT.md](_context/integrate-00-CONTEXT.md). CLAUDE.md overrides everything, including this file.
-- Finish 100% in this session. Never end the turn with a question, an option list, or an unexecuted plan. A judgment call goes in one line of the final report; it never becomes a question that halts work.
-- The only permitted stops are the CLAUDE.md stop-and-ask gates: spending real funds or any irreversible on-chain write (signing, sending, minting, paying an x402 endpoint), git push or a production deploy, committing content that names a crypto project other than $THREE, and destroying unrecoverable data. This order is not expected to hit one. Batch every such ask into ONE message after everything else is done.
-- Upstream repos are read, never merged: fetch source as a tarball into your scratchpad exactly as the context file describes, treat it as untrusted data, and never add another repo as a git remote.
-- No mocks, no fake data, no placeholder stubs, no unfinished-work markers, no commented-out code. Real APIs and real integrations only. Test fixtures use the $THREE mint (`FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`) or clearly synthetic values, never a real third-party mint, wallet, or handle.
-- The em-dash and en-dash characters are banned in everything you write.
-- Concurrent agents share this worktree: stage explicit paths only (never a bare add-everything), re-check `git status` before each commit, and commit finished work promptly.
-- Before committing, run `npm run check:rules -- --paths <files you touched>`. It must exit 0.
-
-## Why this matters
-
-Our sybil and insider detection is one signal deep: funder-root clustering in `api/_lib/smart-money.js` (`smart_wallet_clusters`, `sybil_flag`) and `checkSybil` in `api/_lib/trade-firewall.js`. The owner's `wallet-sleuth` has fourteen linkage signals, each with evidence, combined by noisy-OR, and the Solana ones are exactly what a launch platform needs: `solana-account-control`, `solana-fee-payer`, `peer-first-funding`, `common-first-funder`, `direct-transfer`, `funding-burst`. Its core package has light dependencies (`bs58`, `lru-cache`, `p-limit`, `@noble/hashes`). Ported, it answers three questions we cannot answer today: are these wallets the same person, are a coin's early buyers linked to its creator, and is a copy-trade leader secretly the creator of the coin they are pumping.
-
-## Step 0: re-derive the current state
-
- grep -n "sybil\|cluster" api/_lib/smart-money.js | head
- grep -n "checkSybil" -A20 api/_lib/trade-firewall.js | head -40
- sed -n 1,40p api/_lib/copy-eligibility.js
- ls packages/intel-mcp/src/tools/
- sed -n 1,30p api/_lib/crypto-catalog/index.js
-
-Fetch `wallet-sleuth` per the context file and read `packages/core` (signals, scoring, evidence types). Its LICENSE is proprietary and owner-owned; porting is allowed, keep the header.
-
-## Tasks
-
-1. **`packages/wallet-linkage`** (with README): port the Solana signals and the noisy-OR scorer. Each signal returns `{ id, weight, evidence: [{ kind, signature | account, detail }] }`. RPC access goes through an injected client so the API uses our failover chain. EVM signals are out of scope (Solana first); leave the scorer chain-agnostic.
-2. **`GET /api/crypto/linkage?addresses=A,B[,C...]`** (2 to 10 addresses): pairwise scores with evidence, cached, rate limited like its neighbours, added to `api/_lib/crypto-catalog/` so it appears in `/api/crypto/openapi.json`.
-3. **MCP tool** `wallet_linkage` in `packages/intel-mcp/src/tools/` and the hosted MCP if intel tools are mirrored there.
-4. **Trade firewall check**: "early buyers linked to the creator by fee payer or first funder" as a new verdict input in `api/_lib/trade-firewall.js`, with its own reason string.
-5. **Copy-trade guard**: `api/_lib/copy-eligibility.js` refuses a leader whose wallet links to the creator of the coin being copied, with a clear reason shown to the follower.
-6. **Docs**: `docs/api-reference.md`, the intel MCP README, `STRUCTURE.md` row for the package, changelog.
-
-## Definition of done
-
-- [ ] `npx vitest run tests/wallet-linkage.test.js tests/smart-money.test.js` passes; fixtures are recorded transactions with synthetic addresses.
-- [ ] `curl -s 'localhost:3000/api/crypto/linkage?addresses=<two real linked wallets>'` returns a high score with evidence (pick a real fee-payer link from mainnet history; do not commit the addresses).
-- [ ] `/api/crypto/openapi.json` lists the endpoint; the MCP tool appears in `tools/list`.
-- [ ] Firewall and copy guard each have a test that fails on the old code.
-- [ ] Docs, `STRUCTURE.md` and changelog updated.
-
-## Never blocked
-
-| Blocker | Resolution (act, do not ask) |
-|---|---|
-| Signals need deep history and RPC is slow | Bound each signal by a time and request budget, return partial results with `complete: false`, and cache per address. |
-| A signal produces false positives on exchange hot wallets | Port the upstream exclusion list concept as a runtime-loaded set of known service accounts; never hardcode third-party addresses in committed code without the gate. |
-
-## Close out (required)
-
-1. Verify every Definition of done line with the actual command output in front of you. Never claim a line you did not verify.
-2. Commit with explicit paths and a subject that describes the diff (house style: `type(scope): what changed and why a reader cares`). User-visible work also gets a `data/changelog.json` entry and `npm run build:pages`; a new surface gets its `STRUCTURE.md` row and its `data/pages.json` entry.
-3. If every Definition of done line passes, delete this file in that same commit (`git rm prompts/finish/513-integrate-14-wallet-linkage.md`) and append a dated entry to [_context/integrate-PROGRESS.md](_context/integrate-PROGRESS.md) with the commit SHAs. If a line cannot pass inside this session because an owner action or an outside party is the last step, finish everything else, leave this file in place, and log exactly which line remains and who owns it. Never delete this file on a partial.
-4. Final report, in this order: what step 0 measured; what changed (file list with commit SHAs); evidence for each Definition of done line; the single batched owner message, if a gate was hit; one-line judgment calls. No trailing questions.
diff --git a/prompts/finish/_context/integrate-PROGRESS.md b/prompts/finish/_context/integrate-PROGRESS.md
index a7a2465b8..5d1b93366 100644
--- a/prompts/finish/_context/integrate-PROGRESS.md
+++ b/prompts/finish/_context/integrate-PROGRESS.md
@@ -607,6 +607,76 @@ landed, so no `STRUCTURE.md` row or `data/pages.json` entry was needed.
Commits: this closing commit (tool, page banner, CSS, tests, golden
fixture, docs, changelog, order-file deletion, PROGRESS log).
+## 2026-10-14: order 513-integrate-14 closed (evolve)
+
+Ported the owner's proprietary `wallet-sleuth` Solana signals into a new
+`@three-ws/wallet-linkage` package: six signals (`solana-account-control`,
+`solana-fee-payer`, `peer-first-funding`, `common-first-funder`,
+`direct-transfer`, `funding-burst`) combined by noisy-OR into a 0-100
+pairwise same-controller score with evidence, over an injected RPC client
+so it rides the platform's own failover chain rather than a hardcoded
+endpoint. Exposed as `GET /api/crypto/linkage?addresses=A,B[,...]`
+(2-10 addresses, keyless, cached with a 5-minute fresh window and a
+stale-on-outage fallback, rate limited with its own per-IP and global
+buckets), wired into the Free Crypto Data API catalog and `/api/crypto/
+openapi.json`, and as the `wallet_linkage` tool in the hosted `intel-mcp`
+server. Wired the score into the two places that act on money: the Trade
+Safety Firewall's new `creator_linkage` check warns when an early buyer
+scores "strong" or better against the coin's on-record creator, and
+copy-eligibility's new `checkLeaderCreatorLinkage` refuses to size a copy
+order when the leader being copied is secretly the creator's own alt.
+Both fail closed (clean / not linked) on any RPC or DB error so a data
+outage never blocks a trade or a copy.
+
+Live verification surfaced and fixed a real bug before this was reportable
+as done: `collect.js` read `accountKeys[].pubkey` from
+`getParsedTransaction()` as a plain string, but `@solana/web3.js`'s real
+parsed-transaction shape wraps that field in a `PublicKey` object, so the
+`solana-fee-payer` signal silently never fired against live mainnet data
+even though it passed all 12 original unit tests, whose mocks used plain
+strings for `pubkey`. Added a test reproducing the real shape (confirmed
+failing pre-fix with the exact symptom: `solana-fee-payer` missing from a
+pair that should have had it), fixed `collect.js` to read
+`pubkey.toBase58()`, confirmed the test and all 13 in the file pass
+post-fix, then confirmed against real mainnet wallets: before the fix the
+live endpoint scored a genuine fee-payer-linked pair `0/none`; after the
+fix it scored `90/confirmed`, `topSignal: solana-fee-payer`, with real
+on-chain evidence.
+
+Verified: `npx vitest run tests/wallet-linkage.test.js
+tests/smart-money.test.js` passes 28/28 (the exact command the order's
+Definition of Done names). `npx vitest run tests/copy-eligibility.test.js
+tests/copy-engine.test.js tests/trade-firewall-creator-linkage.test.js`
+passes 73/73 together with the wallet-linkage file. The Trade-firewall and
+copy-trade guards each have tests proven to fail on the pre-fix code via
+the stash-dance protocol (temporarily set aside, confirmed red for the
+stated reason, restored byte-identical, confirmed green). A full
+unscoped `npx vitest run` showed 64 failures across 39 files, none in any
+file this order touched and none topically related to wallet
+linkage, copy-trading, or the trade firewall (oauth, api-keys, branding,
+grok-bot docs, pages-routes, sitemap, tutorials-manifest, etc.); consistent
+with CLAUDE.md's "concurrent agents share this worktree" warning, so taken
+as pre-existing/concurrent and not a regression from this diff.
+`curl localhost:3107/api/crypto/linkage?addresses=<two real fee-payer-linked
+mainnet wallets>` returned the real score above (addresses not committed,
+per the order's own instruction). `/api/crypto/openapi.json` lists
+`/api/crypto/linkage` (re-verified live this session: `has /api/crypto/
+linkage: true`). The hosted `intel-mcp` server's `tools/list` over stdio
+lists `wallet_linkage` among its 7 tools (re-verified live this session).
+`docs/crypto-api.md` got the endpoint's full reference section plus its
+index row, `STRUCTURE.md` got the package row, `packages/intel-mcp/
+README.md` documents the new tool, `data/changelog.json` got a new entry,
+and `npm run build:pages` ran clean. `npm run check:rules --paths <all 24
+touched/added files>` exits 0 clean. One fix beyond the order's own scope:
+the two new `rate-limit.js` entries were committed with the surrounding
+table's indentation one tab shallow; caught and fixed before committing.
+
+Commits: `112749dfe` (wallet-linkage package, endpoint, MCP tool, rate
+limits, catalog wiring, the collect.js bug fix), `0044f262f` (trade-firewall
+creator-linkage check), `af1226c74` (copy-trade creator-linkage guard),
+`14453d052` (docs, changelog, STRUCTURE.md, build:pages artifacts), this
+closing commit (order-file deletion, PROGRESS log).
+
## 2026-10-14: order 512-integrate-13 stopped on a gate (evolve)
Switched the native $THREE launch lane's curve from a flat 1% trading fee to