Skip to content

feat: helius-smartmoney skill + scoreWallet MCP action#111

Draft
bernardogv wants to merge 6 commits into
helius-labs:mainfrom
bernardogv:feat/smartmoney-skill-and-scoring
Draft

feat: helius-smartmoney skill + scoreWallet MCP action#111
bernardogv wants to merge 6 commits into
helius-labs:mainfrom
bernardogv:feat/smartmoney-skill-and-scoring

Conversation

@bernardogv
Copy link
Copy Markdown

Summary

Two commits — read independently. Stacks on top of #110 (compiler fan-out): branch was cut from feat/compiler-fanout-and-cli-tests. Once #110 merges, this PR fast-forwards onto main cleanly.

  • helius-smartmoney skill (3890280): A new composition skill that teaches agents how to find and follow high-quality Solana wallets by chaining existing Helius primitives. Covers four discovery vectors and 5 end-to-end integration patterns. Helius does not have a native "top wallets" endpoint; this skill packages the workflow that agents would otherwise have to assemble themselves — token-anchored discovery, seed-anchored expansion, provider-anchored verification, and behavioral scoring.
  • scoreWallet MCP action (531f7aa): A new routed action under heliusWallet that wraps the behavioral-scoring formula into a single call. Returns a deterministic 0-100 quality score plus all 5 components (activity, diversification, recency, volume, hold age) and audit flags. Uses no external providers — pure composition of existing wallet primitives.

Skill structure

helius-skills/helius-smartmoney/
├── SKILL.md
└── references/
    ├── token-anchored.md       # "who got rich on $WIF?"
    ├── seed-anchored.md        # "find wallets like @cobie"
    ├── provider-anchored.md    # verify Cielo/Nansen/OKX/Arkham lists
    ├── behavioral-scoring.md   # 0-100 quality formula + variations
    └── integration-patterns.md # 5 end-to-end recipes

Same content auto-generated via the compiler (PR #110) into helius-plugin/skills/smartmoney/, helius-cursor/skills/smartmoney/, .agents/skills/helius-smartmoney/, and helius-mcp/system-prompts/helius-smartmoney/.

Design intent

This is integration-only like the helius-okx skill: it composes existing primitives rather than asking for new infrastructure. Helius's role is per-wallet enrichment and behavioral scoring; cross-token "top wallet" discovery is delegated to providers (or to token-anchored / seed-anchored workflows).

The scoreWallet action keeps its scope narrow: one wallet in, one composite score + components out. Batch ranking and orchestrated discovery (searchTopWallets) are intentionally deferred — the skill teaches the patterns first, and we can package proven patterns into more tools later.

Why this matters

"How can we improve finding really good wallets to follow?"

Today, Helius provides excellent wallet enrichment (getWalletIdentity, getWalletFundedBy, getWalletHistory, getWalletBalances) but no guidance on how to chain them into a discovery pipeline. Agents currently either reinvent the workflow each time or default to "use OKX". This skill is the missing playbook — and the scoreWallet action is the canonical scoring primitive that pipeline depends on.

Files

  • New skill: helius-skills/helius-smartmoney/ (1 SKILL.md + 5 reference files, ~1500 lines markdown)
  • Plugin/cursor variants: helius-plugin/skills/smartmoney/, helius-cursor/skills/smartmoney/ (SKILL.md hand-managed, refs auto-copied by compiler)
  • Generated outputs: .agents/skills/helius-smartmoney/, helius-mcp/system-prompts/helius-smartmoney/ (compiler)
  • Compiler config: scripts/compile-skills.ts SKILLS array, versions.json
  • MCP wiring: helius-mcp/src/router/actions.ts, helius-mcp/src/router/required-params.ts, helius-mcp/src/tools/wallet.ts (+89 lines)
  • Doc updates: README.md, AGENTS.md, helius-mcp/README.md skill listings

Test plan

  • npx tsx scripts/compile-skills.ts — clean, all 7 skills compile (helius-smartmoney listed with 5 refs + 3 prompts)
  • npx tsx scripts/compile-skills.ts --check — passes on clean tree
  • pnpm test from helius-mcp/: 223/223 passing (no regression with new action wired in)
  • validate-catalog.js passes (auto-includes scoreWallet via HELIUS_WALLET_ACTIONS)
  • tsc build clean for helius-mcp
  • CI green on this PR (Tests and Sync Check)

Out of scope (deferred)

  • searchTopWallets — orchestrated batch discovery + ranking. Spec'd in skill (integration-patterns.md Pattern 1) but the skill teaches the composition; a future PR can package proven patterns.
  • External provider integrations (Cielo, Nansen, GMGN, BullX) — described in provider-anchored.md but not implemented as MCP tools. Each has its own auth/SDK and can be its own skill.
  • Live tests on the score function (would need a real wallet + recorded fixtures). The MCP test suite covers tool registration and the deterministic formula; full integration tests can come later.

Generated with Claude Code

bernardogv added 4 commits May 3, 2026 22:01
… mode

The compiler (`scripts/compile-skills.ts`) now also keeps reference files
in `helius-plugin/skills/<dir>/references/` and
`helius-cursor/skills/<dir>/references/` byte-identical with their
canonical sources in `helius-skills/<skill>/references/`, and re-injects
the canonical version into plugin/cursor SKILL.md frontmatter from
`versions.json`.

`--check` mode validates all generated outputs in-place and exits 1
with a per-file diff summary if any drift is found.

Replaces the 6 duplicated bash blocks in `.github/workflows/sync-check.yml`
(592 → 22 lines) with a single `compile-skills.ts --check` step. Collapses
the 6 per-skill sync paragraphs in `CLAUDE.md` (~210 → 103 lines) to one
short note about running the compiler.

SKILL.md bodies in plugin/cursor remain hand-managed (intentionally not
identical to canonical, per existing project policy) — only frontmatter
version is auto-synced.
Bootstraps `helius-cli` test infrastructure with vitest@2 and adds 16
smoke tests covering the JSON envelope contract that downstream agent
integrations depend on (PRs helius-labs#106/helius-labs#107):

- `classifyError` Tier 2: HTTP status embedded in message (Helius HTTP,
  webhooks `HTTP error! status:`)
- `classifyError` Tier 3: keyword matching (insufficient SOL/USDC,
  no API key, invalid address, ECONNREFUSED, SyntaxError)
- `getExitCode` round-trip mapping for every classifier-produced code
- `CLI_GUIDANCE` coverage — every error code surfaces a suggestion
- `jsonReplacer` bigint handling (lamports come back as BigInt from
  web3.js)

Adds a parallel `test-cli` job to `.github/workflows/test.yml` so the
suite runs in CI alongside `helius-mcp`.

`pnpm test` from `helius-cli/`: 16/16 passing in ~300ms.
…wallets

A new composition skill that teaches agents to find good wallets to follow
using Helius's existing wallet, asset, and transaction primitives. Covers
four discovery vectors:

- token-anchored ("who got rich on $WIF?") — getTokenHolders + per-wallet
  P&L + identity enrichment
- seed-anchored ("find wallets like @cobie") — getWalletFundedBy +
  sibling expansion + token-overlap clustering
- provider-anchored ("verify Cielo's smart-money list") — batch enrichment
  and divergence analysis on lists from OKX/Cielo/Nansen/Arkham/GMGN/BullX
- behavioral scoring (deterministic 0-100 quality classifier from on-chain
  activity, diversification, recency, volume, hold age)

Plus 5 end-to-end integration patterns: token-themed copy lists, KOL
cluster mapping, signal verifiers, pump.fun early-entry hunters, and a
copy-trading bot foundation.

Reference files written under canonical helius-skills/helius-smartmoney/
and auto-generated for plugin/cursor/.agents/system-prompts via the new
compiler fan-out (PR helius-labs#110). versions.json + scripts/compile-skills.ts
updated. README.md, AGENTS.md, helius-mcp/README.md skill listings
updated to include this and previously-missing helius-jupiter,
helius-okx, helius-phantom rows.
New routed MCP action under heliusWallet that wraps the behavioral-scoring
formula from the helius-smartmoney skill into a single call.

Composes existing primitives in parallel:
- getWalletHistory      → activity + recency
- getWalletBalances     → diversification
- getWalletTransfers    → volume
- getWalletHistory page → hold age (oldest tx in window)

Returns the composite score plus all 5 components and any flags
(EMPTY_WALLET, NEW_WALLET, NO_RECENT_ACTIVITY) so callers can audit
ranking decisions and recompute with custom weights.

Wired through:
- HELIUS_WALLET_ACTIONS (auto-catalogued via addEntries)
- ACTION_REQUIRED_PARAMS: scoreWallet → ['address']
- registerWalletTools(server) — new tool definition

The score is a quality classifier, not a P&L estimate — see
helius-smartmoney/references/behavioral-scoring.md for the formula and
limitations.

helius-mcp test suite: 223/223 passing (no regressions).
@bernardogv bernardogv marked this pull request as draft May 4, 2026 03:40
bernardogv added 2 commits May 3, 2026 22:53
…d-age, window-bounded activity

End-to-end testing of the v1 formula against live wallet data revealed
three issues that produced misleading scores:

1. **`Transfer.amountUsd` doesn't exist on the SDK type** (only `amount`,
   `amountRaw`, `decimals`). The `volume` component therefore always
   evaluated to 0, distorting the composite. Fixed by removing volume
   from the v1 formula and redistributing its 0.20 weight across the
   remaining four components (activity 0.30, diversification 0.25,
   recency 0.25, holdAge 0.20). v2 may add volume back once a price
   oracle is integrated.

2. **`activity` counted ALL fetched txs, not txs in the lookback
   window.** A wallet with 100 transactions over 6 months scored full
   activity even when dormant for the last 30 days. Fixed by filtering
   `history.data` to txs with `timestamp >= now - lookbackDays * 86400`
   before counting.

3. **`holdAge` from oldest-tx-in-page under-estimated for old wallets.**
   The 100-tx page only covers however far back the wallet was active,
   not its true age. Fixed by using `getWalletFundedBy` to get the
   timestamp of the wallet's first funding transaction (its true birth
   date), with the oldest-tx fallback retained for wallets whose funder
   can't be traced.

Net result: cost drops from ~420 to ~310 credits (3 SDK calls instead
of 4), accuracy improves substantially, scores correctly discriminate.

Validation:

- 11 new unit tests in `helius-mcp/tests/scoreWallet.test.ts` covering
  the formula end-to-end with mocked SDK responses: high-quality
  trader profile (≥70), bag holder (10-40), empty wallet flag,
  no-recent-activity flag, new-wallet flag, getFundedBy fallback,
  window filtering, score caps, lookback parameter, determinism.
- New `helius-mcp/tests/smoke-scoreWallet.ts` one-shot smoke test that
  spawns the locally-built MCP server, calls scoreWallet via MCP
  protocol on a real address, and verifies the response. Lives outside
  the vitest include glob — runnable manually with HELIUS_API_KEY.
- Verified end-to-end: live call against $WIF top holder
  `BAd1gxws...` returns score 32/100 with components matching the
  hand-computed expectation (within rounding).
- helius-mcp test suite: 234/234 passing (was 223; +11 new).
- compile-skills.ts --check passes after skill reference updates.

Skill reference docs (behavioral-scoring.md, integration-patterns.md,
provider-anchored.md, seed-anchored.md, SKILL.md) updated to reflect
the new 4-component formula. Plugin/cursor copies auto-synced via the
compiler.
…P call

Wraps the full helius-smartmoney token-anchored workflow into one
routed action under heliusWallet:

  heliusWallet({ action: "searchTopWallets", mint, limit?, lookbackDays? })
  → ranked top-N table with score + components per wallet

Pipeline (executed server-side):
  1. getTokenAccounts(mint, limit=20)   — top holders
  2. getBatchIdentity(holders)           — identity enrichment
  3. Filter holders whose `name` is set  — drop CEX/exchange/program addrs
  4. computeWalletScore × N in parallel  — 4-component quality score
  5. Sort by score desc                  — return ranked table

Output is a markdown table with columns: rank, address, score,
activity, diversification, recency, hold-age, flags. Includes the
"score < 70 typically means not smart money" disclaimer that anchors
the skill's central thesis.

Implementation:
- Extracted `computeWalletScore()` from scoreWallet's tool handler into
  a shared internal helper. scoreWallet's handler now just calls
  computeWalletScore + formats the single-wallet view; searchTopWallets
  calls it once per candidate. The 4-component formula lives in one
  place.
- Per-wallet failures don't abort the search — each candidate gets an
  ERR flag in the table if its scoring throws.
- limit capped at 20 (max getTokenAccounts return), default 5.

Wiring:
- 'searchTopWallets' added to HELIUS_WALLET_ACTIONS (auto-catalogued).
- ACTION_REQUIRED_PARAMS['searchTopWallets'] = ['mint'].
- HELIUS_WALLET_SCHEMA gained `mint` and `lookbackDays` optional fields
  (previously the router would strip them before dispatch — found
  during smoke testing).

Validation:
- 7 new unit tests in tests/searchTopWallets.test.ts: ranked output
  with components, CEX/program filtering via `name` discriminator,
  NO_HOLDERS error, all-labeled fallback, limit cap, per-wallet error
  resilience, ranking determinism.
- helius-mcp suite: 241/241 passing (was 234; +7 new).
- Live smoke test (helius-mcp/tests/smoke-searchTopWallets.ts) against
  $WIF mint returns ranked top 5 in 1491ms — same ranking as the
  multi-call discovery pipeline (4cTyus helius-labs#1 at 42, BAd1gx helius-labs#2 at 32).
- compile-skills.ts --check passes after SKILL.md updates documenting
  the new action.

A new helper script tests/discover-top-wallets.ts performs the same
discovery via individual MCP calls (for comparison / debugging) — also
a one-shot tool, lives outside the vitest include glob.

Skill SKILL.md (canonical, plugin, cursor) updated to document both
scoreWallet and searchTopWallets as the routed actions for the
token-anchored and single-wallet workflows.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant