@blockrun/franklin 3.18.0 → 3.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -296,6 +296,22 @@ On-chain affiliate (20 bps in sell-token, force-set server-side) flows to BlockR
296
296
  - \`/v1/modal/{...path}\` — Modal GPU sandbox passthrough (create/exec/etc.).
297
297
  - \`/v1/pm/{...path}\` — prediction-market data passthrough.
298
298
 
299
+ **Surf — crypto data + chat (x402-paid)** via the generic \`BlockRun\` capability. ~55 curated endpoints. Tier-1 $0.001, Tier-2 $0.005, Tier-3 / chat $0.02.
300
+ - \`/v1/surf/exchange/*\` — CEX trading pairs, prices, perps, depth, klines, funding history, long/short ratio.
301
+ - \`/v1/surf/market/*\` — token rankings, fear/greed, futures, ETF flows, options skew, liquidations, on-chain indicators (NUPL/SOPR/MVRV), price indicators (RSI/MACD/BBANDS).
302
+ - \`/v1/surf/news/{feed,detail}\` — AI-curated crypto news.
303
+ - \`/v1/surf/onchain/{bridge,yield,gas-price,tx,schema,query,sql}\` — bridge/yield rankings, gas, tx detail, **raw SQL against 80+ indexed chain tables (Tier-3, $0.02)**, structured chain query, schema introspection.
304
+ - \`/v1/surf/token/{tokenomics,dex-trades,holders,transfers}\` — token analytics.
305
+ - \`/v1/surf/wallet/{detail,history,net-worth,transfers,protocols,labels/batch}\` — wallet intelligence + batch labels (CEX/Whale/Bridge/MEV).
306
+ - \`/v1/surf/social/*\` — KOL/CT mindshare, smart-follower history, tweets, user profiles. The canonical source for crypto-Twitter signal.
307
+ - \`/v1/surf/fund/{detail,portfolio,ranking}\` — VC fund profiles, portfolios, ranking.
308
+ - \`/v1/surf/project/{detail,defi/metrics,defi/ranking}\` — project profiles + DeFi protocol metrics.
309
+ - \`/v1/surf/chat/completions\` — surf-1.5 chat model with first-class citations (\`citation: ["source","chart"]\`). \$0.02/call flat.
310
+
311
+ For Surf workflows, prefer the bundled skills (\`/surf-market\`, \`/surf-chain\`, \`/surf-social\`, \`/surf-chat\`) — they document which endpoint to pick for which question and the cost trade-off. Skipped (use the dedicated tools instead): \`/v1/surf/prediction-market/*\` (use \`PredictionMarket\`), \`/v1/surf/search/*\` (use \`ExaSearch\`), \`/v1/surf/web/*\` (use \`BrowserX\`).
312
+
313
+ **Generic gateway primitive**: \`BlockRun({ path, method, params, body })\` is a single capability that signs x402 and forwards to ANY path under \`/api\`. Use it for Surf endpoints (above) and any future BlockRun partner that doesn't have a dedicated capability yet. Always specify the exact path; the primitive will not guess.
314
+
299
315
  **Endpoints that DO NOT exist** (common hallucinations — do NOT call):
300
316
  - \`/v1/image/generate\` (singular — use \`/v1/images/generations\`)
301
317
  - \`/v1/spending\` (no such route — derive from on-chain history if needed)
@@ -0,0 +1,92 @@
1
+ ---
2
+ name: surf-chain
3
+ description: On-chain analytics via Surf — raw SQL against 80+ indexed chain tables, structured queries, schema introspection, wallet labels (CEX/Whale/Bridge/MEV…), wallet net worth, transfers, DeFi positions, gas prices, bridge volumes, yield pools. Use when the user wants on-chain forensics, wallet intelligence, holder analysis, transfer tracking, or custom chain queries.
4
+ triggers:
5
+ - "on-chain"
6
+ - "wallet analysis"
7
+ - "wallet detail"
8
+ - "wallet history"
9
+ - "wallet net worth"
10
+ - "token holders"
11
+ - "token transfers"
12
+ - "gas price"
13
+ - "bridge volume"
14
+ - "yield pool"
15
+ - "label wallet"
16
+ - "on-chain sql"
17
+ - "chain query"
18
+ argument-hint: <address, hash, or question>
19
+ cost-receipt: true
20
+ ---
21
+
22
+ You are running inside Franklin on **{{wallet_chain}}**. Use the `BlockRun` tool to call Surf's on-chain endpoints. The flagship capability here is **on-chain SQL** — write a query against 80+ indexed chain tables and get back a result set in sub-second.
23
+
24
+ **Two different "chains" to keep straight:**
25
+ 1. **Payment chain** — where Franklin's wallet signs the x402 USDC payment. Currently `{{wallet_chain}}`. Surf only accepts settlement on **Base** (treasury `0x058a59…`). If the user is on Solana, ask them to `/chain base` before retrying.
26
+ 2. **Query chain** — the chain the data is *about*. Passed as a parameter to endpoints like `onchain/gas-price`, `onchain/tx`, `token/holders`, `token/transfers`. Valid values include `ethereum`, `base`, `arbitrum`, `polygon`, `optimism`, `bsc`. When the user doesn't specify and they're on `base`, default to `chain: "base"`. If they ask about Solana on-chain data, note that these EVM-shaped endpoints don't cover Solana — use a Solana-specific tool instead.
27
+
28
+ ## How to use
29
+
30
+ `BlockRun({ path: "/v1/surf/<endpoint>", method: "<GET|POST>", params|body: { ... } })`. Method is GET unless the catalog says POST.
31
+
32
+ ## Endpoint catalog
33
+
34
+ ### Direct lookups (Tier 1, $0.001)
35
+ | Path | Method | Required | What it returns |
36
+ |---|---|---|---|
37
+ | `/v1/surf/onchain/gas-price` | GET | `chain` | Current gas on the named chain |
38
+ | `/v1/surf/onchain/tx` | GET | `hash`, `chain` | Tx details |
39
+ | `/v1/surf/onchain/bridge/ranking` | GET | — | Bridge protocols ranked by volume |
40
+ | `/v1/surf/onchain/yield/ranking` | GET | — | Yield pools (lending, LP, staking) |
41
+
42
+ ### Raw + structured chain query (Tier 3, $0.02 — premium)
43
+ | Path | Method | Required | What it returns |
44
+ |---|---|---|---|
45
+ | `/v1/surf/onchain/schema` | GET | — | ClickHouse table schema introspection. **Always call this FIRST** before writing SQL so you know the tables, columns, and types. |
46
+ | `/v1/surf/onchain/query` | POST | — (typed body) | Structured chain query with typed predicates. Safer than SQL when the question fits a fixed shape. |
47
+ | `/v1/surf/onchain/sql` | POST | body: `{ query: string }` | Raw SQL against 80+ indexed tables. Sub-second. Use for novel questions that the typed query can't express. |
48
+
49
+ ### Token analytics (Tier 2, $0.005)
50
+ | Path | Method | Required | What it returns |
51
+ |---|---|---|---|
52
+ | `/v1/surf/token/holders` | GET | `address`, `chain` | Top token holders with balances |
53
+ | `/v1/surf/token/transfers` | GET | `address`, `chain` | Token transfer history |
54
+
55
+ ### Wallet intelligence (Tier 2, $0.005)
56
+ | Path | Method | Required | What it returns |
57
+ |---|---|---|---|
58
+ | `/v1/surf/wallet/detail` | GET | `address` | Aggregated wallet profile across chains |
59
+ | `/v1/surf/wallet/history` | GET | `address` | Transaction history |
60
+ | `/v1/surf/wallet/net-worth` | GET | `address` | Net-worth time series |
61
+ | `/v1/surf/wallet/transfers` | GET | `address` | Transfer history |
62
+ | `/v1/surf/wallet/protocols` | GET | `address` | DeFi positions (Aave, Lido, Uniswap, etc.) |
63
+ | `/v1/surf/wallet/labels/batch` | GET | `addresses` (comma-sep) | Batch label lookup: CEX, Whale, Bridge, MEV, Contract, etc. |
64
+
65
+ ## How to choose
66
+
67
+ - **"What's gas on Base?"** → `onchain/gas-price` with `chain: "base"` ($0.001). One call, done.
68
+ - **"Look up this tx"** → `onchain/tx` with `hash` + `chain`.
69
+ - **"Who owns this token?"** → `token/holders` ($0.005). Pair with `wallet/labels/batch` on the top 20 to see which holders are CEXes vs whales.
70
+ - **"Profile this wallet"** → `wallet/detail` first ($0.005). If they want depth, follow up with `wallet/history`, `wallet/net-worth`, `wallet/protocols`.
71
+ - **"Is this address a CEX / whale / MEV bot?"** → `wallet/labels/batch` — cheapest forensic call.
72
+ - **"Bridge volume this week"** → `onchain/bridge/ranking` ($0.001).
73
+ - **"Best yield on USDC right now"** → `onchain/yield/ranking` ($0.001), filter for USDC.
74
+
75
+ ### On-chain SQL workflow
76
+
77
+ For novel chain questions (e.g. "all addresses that received >100 ETH from Tornado in 2025"):
78
+
79
+ 1. **Schema first** — `BlockRun({ path: "/v1/surf/onchain/schema", method: "GET" })` ($0.02). Note the tables, columns, types.
80
+ 2. **Try structured query** — `BlockRun({ path: "/v1/surf/onchain/query", method: "POST", body: { /* typed predicates */ } })` ($0.02) when the shape fits.
81
+ 3. **Raw SQL fallback** — `BlockRun({ path: "/v1/surf/onchain/sql", method: "POST", body: { query: "SELECT …" } })` ($0.02) for anything else.
82
+ 4. **Validate** — if SQL fails parse or returns empty unexpectedly, fix the query and re-run. Each retry is $0.02 — be deliberate.
83
+
84
+ ## Cost discipline
85
+
86
+ - Wallet/token reads are $0.005 each. If you need 5 lookups, expect $0.025.
87
+ - Tier-3 chain queries are $0.02/call. Plan the schema → query → result loop before firing; don't fire speculative SQL.
88
+ - Always include the cost in your summary back to the user.
89
+
90
+ ## The user asked
91
+
92
+ $ARGUMENTS
@@ -0,0 +1,76 @@
1
+ ---
2
+ name: surf-chat
3
+ description: Crypto-native chat with citations via the surf-1.5 model. Different from a generic LLM call — surf-1.5 is grounded in live crypto data and returns first-class citations (source links + charts). Use when the user wants research-shaped answers about projects, tokens, market events, or DeFi protocols, with sources attached.
4
+ triggers:
5
+ - "surf chat"
6
+ - "crypto research"
7
+ - "ask surf"
8
+ - "with citations"
9
+ - "grounded answer"
10
+ argument-hint: <research question>
11
+ cost-receipt: true
12
+ ---
13
+
14
+ You are running inside Franklin on **{{wallet_chain}}**. The `surf-1.5` model is crypto-native: it knows current market data, projects, on-chain flow, social signal, and returns structured citations. Reach for it when the user wants a sourced answer rather than a vibes-based one.
15
+
16
+ **Chain note:** Surf currently settles x402 payments on **Base** only. If the user's active chain is `solana`, ask them to `/chain base` before calling — surf-1.5 is $0.02/call, so a failed payment retry isn't free.
17
+
18
+ ## How to use
19
+
20
+ Call:
21
+
22
+ ```
23
+ BlockRun({
24
+ path: "/v1/surf/chat/completions",
25
+ method: "POST",
26
+ body: {
27
+ model: "surf-1.5",
28
+ messages: [
29
+ { role: "user", content: "<the question>" }
30
+ ],
31
+ citation: ["source", "chart"]
32
+ }
33
+ })
34
+ ```
35
+
36
+ Cost: **flat $0.02 per call** (per-token billing is Phase 2 upstream).
37
+
38
+ ### Response shape
39
+
40
+ OpenAI-compatible, with two extras:
41
+ - `choices[0].message.content` — the text answer
42
+ - `choices[0].message.citations[]` — array of `{ type: "source" | "chart", url, title }`
43
+
44
+ When you report back to the user, **always include the citations** as a footer:
45
+
46
+ ```
47
+ [Answer text]
48
+
49
+ Sources:
50
+ 1. <title> — <url>
51
+ 2. <title> — <url>
52
+ ```
53
+
54
+ If `citations` is empty, mention that the answer is ungrounded.
55
+
56
+ ### Multi-turn
57
+
58
+ Pass previous `messages` back in for follow-up turns. Each turn is $0.02.
59
+
60
+ ## When to use surf-chat vs the main agent loop
61
+
62
+ - **Use surf-chat** when: the question is about market state, project research, narrative tracking, or "what happened to X in the last week" — anywhere fresh crypto context matters and you want citations to share with the user.
63
+ - **Use the main agent loop** (no surf-chat) when: the question is general reasoning, coding, planning, summarization of content already in scope, or anything where adding citations doesn't add value.
64
+
65
+ The wallet is funding the surf-chat call directly — be deliberate about reaching for it.
66
+
67
+ ## When to use surf-chat vs the data endpoints
68
+
69
+ - **surf-chat** is good when you don't know which endpoints to compose, or when the answer is qualitative ("what's the bull case for $X?").
70
+ - The **`/surf-market` / `/surf-chain` / `/surf-social` skills** are better when the question is structured ("price of BTC", "RSI on ETH", "wallet net worth") — they're $0.001–$0.005 each and you keep full control of the data.
71
+
72
+ If you can answer with one $0.001 call to a data endpoint, do that. Only escalate to surf-chat when the question needs synthesis across many endpoints or the user explicitly asks for cited research.
73
+
74
+ ## The user asked
75
+
76
+ $ARGUMENTS
@@ -0,0 +1,101 @@
1
+ ---
2
+ name: surf-market
3
+ description: Crypto market data via Surf — prices, futures, ETFs, options, fear/greed, technical and on-chain indicators, token DEX flows, news, project profiles, VC fund holdings. Use when the user asks about market conditions, ranking tokens, futures positioning, technical signals, options skew, news context, or VC/fund intelligence.
4
+ triggers:
5
+ - "market overview"
6
+ - "fear greed"
7
+ - "futures"
8
+ - "etf flow"
9
+ - "options skew"
10
+ - "tokenomics"
11
+ - "rsi"
12
+ - "macd"
13
+ - "liquidations"
14
+ - "vc fund"
15
+ - "token ranking"
16
+ argument-hint: <symbol or question>
17
+ cost-receipt: true
18
+ ---
19
+
20
+ You are running inside Franklin on **{{wallet_chain}}**. Crypto market data lives behind the `BlockRun` tool, which signs USDC x402 payments from the user's wallet on every call. Pick the cheapest endpoint that answers the question.
21
+
22
+ **Chain note:** Surf currently settles x402 payments on **Base** only (treasury is `0x058a59…` on Base). If the user's active chain is `solana` and you hit a payment error, tell them to switch with `/chain base` before retrying — the request itself works, the wallet just needs to be on Base to sign the payment.
23
+
24
+ ## How to use
25
+
26
+ Call `BlockRun({ path: "/v1/surf/<endpoint>", method: "GET", params: { ... } })`. All endpoints below are GET unless noted. Required params must be supplied or you'll get a 400 (no charge).
27
+
28
+ ## Endpoint catalog
29
+
30
+ ### Exchange (CEX intelligence)
31
+ | Path | Tier | Required params | What it returns |
32
+ |---|---|---|---|
33
+ | `/v1/surf/exchange/markets` | $0.001 | — | Trading pairs catalog across major CEXes |
34
+ | `/v1/surf/exchange/price` | $0.001 | `pair` | Ticker price for a pair |
35
+ | `/v1/surf/exchange/perp` | $0.001 | `pair` | Perpetual contract snapshot |
36
+ | `/v1/surf/exchange/depth` | $0.005 | `pair` | Order book depth |
37
+ | `/v1/surf/exchange/klines` | $0.005 | `pair` | OHLCV candlesticks |
38
+ | `/v1/surf/exchange/funding-history` | $0.005 | `pair` | Perp funding rate history |
39
+ | `/v1/surf/exchange/long-short-ratio` | $0.005 | `pair` | Long/short positioning |
40
+
41
+ ### Market (broad-market intelligence)
42
+ | Path | Tier | Required params | What it returns |
43
+ |---|---|---|---|
44
+ | `/v1/surf/market/ranking` | $0.001 | — | Token ranking (market cap, volume, change) |
45
+ | `/v1/surf/market/fear-greed` | $0.001 | — | Fear & Greed index history |
46
+ | `/v1/surf/market/futures` | $0.001 | — | Futures market overview |
47
+ | `/v1/surf/market/price` | $0.001 | `symbol` | Token price history |
48
+ | `/v1/surf/market/etf` | $0.001 | `symbol` | Spot ETF flow history (BTC, ETH) |
49
+ | `/v1/surf/market/options` | $0.001 | `symbol` | Options skew / IV / volume |
50
+ | `/v1/surf/market/liquidation/exchange-list` | $0.005 | — | Liquidations by exchange |
51
+ | `/v1/surf/market/liquidation/order` | $0.005 | — | Large liquidation orders |
52
+ | `/v1/surf/market/liquidation/chart` | $0.005 | `symbol` | Liquidation chart over time |
53
+ | `/v1/surf/market/onchain-indicator` | $0.005 | `symbol`, `metric` | NUPL, SOPR, MVRV, Puell, NVT |
54
+ | `/v1/surf/market/price-indicator` | $0.005 | `indicator`, `symbol` | RSI, MACD, Bollinger, EMA |
55
+
56
+ ### News
57
+ | Path | Tier | Required params | What it returns |
58
+ |---|---|---|---|
59
+ | `/v1/surf/news/feed` | $0.001 | — | AI-curated crypto news feed |
60
+ | `/v1/surf/news/detail` | $0.001 | `id` | Full article by ID |
61
+
62
+ ### Project (DeFi protocols + project profiles)
63
+ | Path | Tier | Required params | What it returns |
64
+ |---|---|---|---|
65
+ | `/v1/surf/project/detail` | $0.001 | — | Aggregated project profile (token + DeFi + social) |
66
+ | `/v1/surf/project/defi/metrics` | $0.001 | `metric` | Per-protocol DeFi metrics (TVL, fees, revenue) |
67
+ | `/v1/surf/project/defi/ranking` | $0.001 | `metric` | DeFi protocol ranking |
68
+
69
+ ### Token (on-chain analytics)
70
+ | Path | Tier | Required params | What it returns |
71
+ |---|---|---|---|
72
+ | `/v1/surf/token/tokenomics` | $0.001 | — | Unlock schedule + vesting |
73
+ | `/v1/surf/token/dex-trades` | $0.005 | `address` | DEX trade history |
74
+
75
+ ### Fund (VC + treasury intelligence)
76
+ | Path | Tier | Required params | What it returns |
77
+ |---|---|---|---|
78
+ | `/v1/surf/fund/detail` | $0.001 | — | VC fund profile |
79
+ | `/v1/surf/fund/portfolio` | $0.001 | — | VC fund portfolio holdings |
80
+ | `/v1/surf/fund/ranking` | $0.001 | `metric` | Top VC funds ranking |
81
+
82
+ ## How to choose
83
+
84
+ - **"How's the market?"** → `market/fear-greed` + `market/ranking` (both $0.001). Cheap snapshot.
85
+ - **"What's BTC doing?"** → `market/price` for history, `exchange/price` for spot tick, `market/etf` for institutional flow.
86
+ - **"Show me liquidations."** → `market/liquidation/chart` for time series, `market/liquidation/order` for whale events.
87
+ - **"Technical signal on ETH"** → `market/price-indicator` with `indicator: "RSI"` (or MACD, BBANDS, EMA).
88
+ - **"On-chain health"** → `market/onchain-indicator` with `metric: "NUPL"` etc.
89
+ - **"Who holds this token / where is it traded?"** → `token/tokenomics` for supply schedule, `token/dex-trades` for flow.
90
+ - **"What VCs back this project?"** → `fund/portfolio` (filter by project).
91
+
92
+ ## Cost discipline
93
+
94
+ - Most read endpoints are Tier 1 ($0.001). Burn freely.
95
+ - Tier 2 ($0.005) endpoints carry depth, history, or fraud-signal data — use when the cheaper endpoint can't answer.
96
+ - Avoid speculative multi-endpoint scans. Pick the right endpoint for the question; if unsure, ask the user one clarifying question first.
97
+ - Report the cost on every call in your summary: "Pulled fear/greed history ($0.001). Index sits at 62 (greed)."
98
+
99
+ ## The user asked
100
+
101
+ $ARGUMENTS
@@ -0,0 +1,73 @@
1
+ ---
2
+ name: surf-social
3
+ description: Crypto-Twitter / KOL intelligence via Surf — project mindshare time series, smart-follower history (high-signal accounts), social ranking, tweet + replies fetch, user profile / followers / posts / replies. Use when the user asks about KOL sentiment, project attention, smart money commentary, narrative momentum, or specific Twitter handles.
4
+ triggers:
5
+ - "kol sentiment"
6
+ - "mindshare"
7
+ - "smart followers"
8
+ - "crypto twitter"
9
+ - "ct sentiment"
10
+ - "twitter analysis"
11
+ - "social ranking"
12
+ - "tweet"
13
+ - "twitter handle"
14
+ argument-hint: <project, handle, or question>
15
+ cost-receipt: true
16
+ ---
17
+
18
+ You are running inside Franklin on **{{wallet_chain}}**. Use the `BlockRun` tool to call Surf's social endpoints. This is the canonical source for crypto-Twitter signal — mindshare scoring, KOL identification, and reply-graph analysis.
19
+
20
+ **Chain note:** Surf currently settles x402 payments on **Base** only. If the user's active chain is `solana` and you hit a payment error, ask them to `/chain base` before retrying. The social data itself is chain-agnostic.
21
+
22
+ ## How to use
23
+
24
+ `BlockRun({ path: "/v1/surf/<endpoint>", method: "GET", params: { ... } })`. All endpoints below are GET.
25
+
26
+ ## Endpoint catalog
27
+
28
+ ### Project-level signal (Tier 2, $0.005)
29
+ | Path | Required params | What it returns |
30
+ |---|---|---|
31
+ | `/v1/surf/social/detail` | — | Aggregated social analytics for a project |
32
+ | `/v1/surf/social/ranking` | — | Mindshare ranking across projects |
33
+ | `/v1/surf/social/smart-followers/history` | — | Smart-follower count history (high-signal accounts only) |
34
+ | `/v1/surf/social/mindshare` | `q`, `interval` | Mindshare time series for a project (`q` = ticker or name, `interval` = `1d` / `7d` / `30d`) |
35
+
36
+ ### Tweet-level (Tier 1, $0.001)
37
+ | Path | Required params | What it returns |
38
+ |---|---|---|
39
+ | `/v1/surf/social/tweets` | `ids` (comma-sep) | Fetch tweets by ID |
40
+ | `/v1/surf/social/tweet/replies` | `tweet_id` | Replies to a specific tweet |
41
+
42
+ ### User-level (Tier 1, $0.001)
43
+ | Path | Required params | What it returns |
44
+ |---|---|---|
45
+ | `/v1/surf/social/user` | `handle` | Twitter user profile |
46
+ | `/v1/surf/social/user/followers` | `handle` | Followers list |
47
+ | `/v1/surf/social/user/following` | `handle` | Following list |
48
+ | `/v1/surf/social/user/posts` | `handle` | User posts |
49
+ | `/v1/surf/social/user/replies` | `handle` | User replies |
50
+
51
+ ## How to choose
52
+
53
+ - **"What's the market saying about $X?"** → `social/mindshare` with `q: "X", interval: "7d"` ($0.005). Read the trend, not the absolute number.
54
+ - **"Who's the smart money following $X?"** → `social/smart-followers/history` ($0.005). Compare growth rate to baseline.
55
+ - **"Top projects by attention right now"** → `social/ranking` ($0.005).
56
+ - **"Is @handle a real player?"** → `social/user` then `social/user/followers` (look at follower-to-following ratio + which smart accounts follow them).
57
+ - **"What did @handle say recently?"** → `social/user/posts` ($0.001 each).
58
+ - **"Show me the reply storm under tweet X"** → `social/tweet/replies` ($0.001).
59
+
60
+ ## When NOT to use this skill
61
+
62
+ - Generic Twitter scraping or non-crypto sentiment → use `BrowserX` or a web search tool. Surf is curated for crypto-relevant accounts.
63
+ - Real-time tweet streaming → not supported; this is historical / batch reads.
64
+
65
+ ## Cost discipline
66
+
67
+ - User-level reads are cheap ($0.001). Free to fan out across 5–10 handles when profiling.
68
+ - Project-level signal is $0.005/call. One mindshare + one smart-followers call is usually enough to answer "is this thing real?".
69
+ - Always include the cost in your summary.
70
+
71
+ ## The user asked
72
+
73
+ $ARGUMENTS
@@ -0,0 +1,70 @@
1
+ ---
2
+ name: trade-discussion
3
+ description: Record market commentary, hypotheses, or open observations as a structured note — no trade fired, no position sized. Lighter than /trade-strategy. Saves to ~/.blockrun/notes/ for future reference. Use when the user wants to think out loud about the market.
4
+ triggers:
5
+ - "market commentary"
6
+ - "trade discussion"
7
+ - "observation"
8
+ - "just thinking"
9
+ - "market thought"
10
+ - "log a thought"
11
+ argument-hint: <topic>
12
+ cost-receipt: false
13
+ ---
14
+
15
+ You are running inside Franklin on **{{wallet_chain}}**. This skill is the lightest of the three trading skills — no trade, no full strategy doc, just a short observation with enough structure to be useful later.
16
+
17
+ ## Workflow
18
+
19
+ 1. **Gather context only if cheap or asked.** Don't burn $0.005 on a chain query for a discussion note unless the user requested data. Default: write the note from what you already know.
20
+
21
+ 2. **Write the note.** Use the `Write` tool to create:
22
+
23
+ - Path: `~/.blockrun/notes/<YYYY-MM-DD>-<slug>-discussion.md`
24
+ - Slug: 3–5-word kebab-case (e.g. `etf-flow-divergence-watch`)
25
+ - Content template:
26
+
27
+ ```markdown
28
+ # Discussion — <Title>
29
+
30
+ **Date:** <YYYY-MM-DD>
31
+ **Author:** Franklin (skill: /trade-discussion)
32
+
33
+ ## Observation
34
+
35
+ <1–3 paragraphs.>
36
+
37
+ ## Symbols mentioned
38
+
39
+ `<SYMBOL1>` `<SYMBOL2>` (etc.)
40
+
41
+ ## Tags
42
+
43
+ `<sentiment>` `<watch>` `<thesis-fragment>` (etc.)
44
+
45
+ ## Open questions
46
+
47
+ - <Question 1 — what would confirm or invalidate this?>
48
+ - <Question 2>
49
+
50
+ ## Possible follow-ups
51
+
52
+ - `/surf-market` for <specific data>
53
+ - `/surf-social` for <specific KOL or mindshare check>
54
+ - `/trade-strategy` if this matures into a plan
55
+ - `/trade-signal` if a clear entry emerges
56
+ ```
57
+
58
+ 3. **Confirm.** Report back: "Note saved to `<path>`. Tagged `<tags>`. No trade fired. If this hardens into a plan, run `/trade-strategy <topic>`."
59
+
60
+ 4. **Do not call `TradingOpenPosition`.** Discussion notes are explicitly trade-free.
61
+
62
+ ## When this skill fits vs the alternatives
63
+
64
+ - **`/trade-discussion`** — open-ended observation, hypothesis, "what if". Cheapest, least structured.
65
+ - **`/trade-strategy`** — committed plan with entry/exit/sizing. Reach for this when an observation has hardened.
66
+ - **`/trade-signal`** — the actual trade. Fires `TradingOpenPosition`, hits the wallet (paper trading) and the journal.
67
+
68
+ ## The user said
69
+
70
+ $ARGUMENTS
@@ -0,0 +1,79 @@
1
+ ---
2
+ name: trade-signal
3
+ description: Open a paper-trade position with a structured rationale — direction, price target, stop, time horizon, conviction, evidence, tags, thesis. The journal scores the trade on discipline (verifiability, evidence, specificity, novelty, review), not P&L, and surfaces the trend in TradingPortfolio. Use any time the user wants to open a position with intent, not vibes.
4
+ triggers:
5
+ - "open a trade"
6
+ - "buy"
7
+ - "long"
8
+ - "short"
9
+ - "take a position"
10
+ - "trade signal"
11
+ - "trade idea"
12
+ argument-hint: <symbol or thesis>
13
+ cost-receipt: false
14
+ ---
15
+
16
+ You are running inside Franklin on **{{wallet_chain}}**. This is paper trading — fills are simulated against a live mark — so the value is the discipline, not the dollars. Every trade entered through this skill carries a rationale that the journal scorer evaluates on five dimensions:
17
+
18
+ | Dimension | Weight | Earned by |
19
+ |---|---|---|
20
+ | verifiability | 30% | direction + priceTarget both set |
21
+ | evidence | 25% | thesis ≥ 200 chars + 3 evidence items + indicator keywords (RSI/MACD/funding/etc.) |
22
+ | specificity | 20% | symbol + ≥ 2 tags |
23
+ | novelty | 15% | not the 4th identical revenge-trade this week |
24
+ | review | 10% | post-trade note left at close |
25
+
26
+ Total is a 0–5 score, persisted with the trade and averaged across the last 10 entries in the portfolio footer.
27
+
28
+ ## Workflow
29
+
30
+ 1. **Read the request.** The user's argument is below under "The user said". If it's a complete thesis (symbol + direction + reasoning + numbers), proceed to step 3. If anything's vague, ask **one** clarifying question — the cheapest call you have on the wallet is "tell me more before I burn $0.001 on a market quote."
31
+
32
+ 2. **Optional context** — if you don't already have a recent quote, call `TradingMarket({ ticker, assetClass })` (free for crypto, $0.001 for stocks). For thesis support beyond price, the `/surf-market`, `/surf-chain`, or `/surf-social` skills can be invoked, each documenting their own endpoint costs.
33
+
34
+ 3. **Construct the rationale.** Fill as many fields as the request justifies:
35
+
36
+ - `direction`: `"long"` for buys (paper trading is long-only today).
37
+ - `priceTarget`: where you expect to take profit (USD).
38
+ - `stopLoss`: where you'll exit if wrong (USD).
39
+ - `timeHorizon`: `"1h"`, `"1d"`, `"1w"`, `"1m"`, `"3m"` — match the trade type.
40
+ - `conviction`: 1 (low, "small probe") → 5 (high, "size up").
41
+ - `evidence`: 2–4 items. Indicator readings, news links, on-chain stats, comparable trades.
42
+ - `tags`: 2+ categories — `"momentum"`, `"mean-reversion"`, `"macro"`, `"event"`, `"sentiment"`, etc.
43
+ - `thesis`: a paragraph (target 200+ chars) connecting the evidence to the trade. Mention at least one named indicator if you cite one.
44
+
45
+ 4. **Size with discipline.** Default per-position cap is $400, total exposure $900 (see TradingPortfolio for current utilization). Don't size beyond what conviction justifies — a conviction-2 trade at the cap is a discipline red flag.
46
+
47
+ 5. **Fire the trade** by calling `TradingOpenPosition`:
48
+
49
+ ```
50
+ TradingOpenPosition({
51
+ symbol: "<TICKER>",
52
+ qty: <quantity>,
53
+ priceUsd: <fill price>,
54
+ rationale: {
55
+ direction: "long",
56
+ priceTarget: <number>,
57
+ stopLoss: <number>,
58
+ timeHorizon: "<period>",
59
+ conviction: <1-5>,
60
+ evidence: ["<source 1>", "<source 2>", ...],
61
+ tags: ["<tag 1>", "<tag 2>"],
62
+ thesis: "<200+ char paragraph>"
63
+ }
64
+ })
65
+ ```
66
+
67
+ 6. **Surface the score.** The tool result shows the fill. Then call `TradingPortfolio` once and quote the new discipline score back to the user — "Trade booked. Journal score on this entry: 4.2/5. Discipline trend over the last 10 trades: 3.6/5 (evidence flagged below 3 — keep citing indicators)."
68
+
69
+ 7. **Stop.** Don't fan out to multiple trades unless the user explicitly asks for portfolio construction. One disciplined trade beats five vibes-trades.
70
+
71
+ ## Anti-patterns
72
+
73
+ - Firing `TradingOpenPosition` without a rationale block. The journal still records the trade but it scores ~1/5 on discipline. Don't do this.
74
+ - Inventing evidence. If the user says "feels like a top" and you can't find supporting data, write that into the thesis verbatim and let the score reflect it. The journal is a mirror, not a press release.
75
+ - Trading the same symbol + direction four times in a week. The novelty penalty fires for a reason — that's revenge trading.
76
+
77
+ ## The user said
78
+
79
+ $ARGUMENTS
@@ -0,0 +1,91 @@
1
+ ---
2
+ name: trade-strategy
3
+ description: Write a long-form trading strategy document — thesis, entry triggers, exit rules, position sizing, hold horizon, kill criteria. No trade is fired. Saves a structured markdown note to ~/.blockrun/notes/. Use when the user wants to plan an approach before committing capital.
4
+ triggers:
5
+ - "trading strategy"
6
+ - "write a strategy"
7
+ - "strategy doc"
8
+ - "trade plan"
9
+ - "planning a trade"
10
+ argument-hint: <topic or thesis>
11
+ cost-receipt: false
12
+ ---
13
+
14
+ You are running inside Franklin on **{{wallet_chain}}**. This skill captures *intent* before *action*. The user wants a written strategy, not an executed trade. Result: a markdown file under `~/.blockrun/notes/` that the user (and future Franklin sessions) can reference when the actual trade fires via `/trade-signal`.
15
+
16
+ ## Workflow
17
+
18
+ 1. **Clarify if needed.** If the argument is just a ticker ("BTC") without a direction, ask one clarifying question about what the user is trying to do (long, short, range, event-driven).
19
+
20
+ 2. **Gather supporting context.** Use the `/surf-market`, `/surf-chain`, or `/surf-social` skills to pull data that informs the strategy. Each surfaces its own cost; mention what you spent at the end.
21
+
22
+ 3. **Write the strategy doc.** Use the `Write` tool to create:
23
+
24
+ - Path: `~/.blockrun/notes/<YYYY-MM-DD>-<slug>-strategy.md` (replace `~` with the user's actual home dir; ask if you don't know it, or run `Bash("echo $HOME")` once)
25
+ - Slug: short kebab-case identifier derived from the topic (e.g. `btc-pre-halving-long`)
26
+ - Content template:
27
+
28
+ ```markdown
29
+ # Strategy — <Title>
30
+
31
+ **Date:** <YYYY-MM-DD>
32
+ **Author:** Franklin (skill: /trade-strategy)
33
+ **Status:** draft
34
+
35
+ ## Thesis
36
+
37
+ <2–4 paragraphs: why this trade now. Cite the data sources you pulled.>
38
+
39
+ ## Symbols & direction
40
+
41
+ - Primary: <SYMBOL> <long|short>
42
+ - Hedges (if any): <SYMBOL> <long|short>
43
+
44
+ ## Entry triggers
45
+
46
+ - <Specific price levels, indicator readings, or events that must hold>
47
+ - <…>
48
+
49
+ ## Position sizing
50
+
51
+ - Per-symbol notional cap: $<N> (vs Franklin's $400 default)
52
+ - Conviction tier: <1–5> — justification: <…>
53
+
54
+ ## Exit rules
55
+
56
+ - Take profit: <price | indicator | event>
57
+ - Stop loss: <price | indicator | event>
58
+ - Time stop: exit by <date / horizon> regardless
59
+
60
+ ## Kill criteria
61
+
62
+ What invalidates the entire thesis? (Be specific — name a level, a metric, or a market regime change.)
63
+
64
+ ## Evidence
65
+
66
+ - <source 1>
67
+ - <source 2>
68
+ - <indicator reading>
69
+
70
+ ## Tags
71
+
72
+ `<momentum>` `<macro>` `<event>` (etc.)
73
+
74
+ ## Linked trades
75
+
76
+ (Populated as `/trade-signal` invocations reference this doc.)
77
+ ```
78
+
79
+ 4. **Confirm the path.** Report back to the user: "Strategy saved to `<path>`. Open it with your editor or pull it into your next `/trade-signal` call as context. Discipline score on the strategy is captured when the first trade fires."
80
+
81
+ 5. **Do not call `TradingOpenPosition`.** This skill is plan-only. The user fires the trade separately via `/trade-signal` when ready.
82
+
83
+ ## Anti-patterns
84
+
85
+ - Skipping kill criteria. Every strategy has them; "I'll know when to exit" is not a strategy.
86
+ - Position sizing without conviction-justified caps. A conviction-2 strategy that loads the full $400 cap is theater.
87
+ - Writing a strategy doc and immediately firing a trade. The point of separating the two is to force a pause. If the user wants both, run `/trade-strategy` first, then `/trade-signal` referencing the saved file.
88
+
89
+ ## The user said
90
+
91
+ $ARGUMENTS
@@ -0,0 +1,21 @@
1
+ /**
2
+ * BlockRun primitive — the generic x402-paid gateway capability.
3
+ *
4
+ * One tool, every BlockRun endpoint. Replaces the per-API hardcoded pattern
5
+ * (ImageGen, VideoGen, Phone tools, etc) for new integrations. Skills in
6
+ * src/skills-bundled/<name>/SKILL.md describe which paths to call for which
7
+ * user intents; this tool just signs the x402 payment and forwards.
8
+ *
9
+ * Why the indirection: BlockRun keeps shipping new partner APIs (Surf,
10
+ * Phone & Voice, future ML/data partners). Hardcoding each as a fresh
11
+ * CapabilityHandler means a Franklin npm release per partner and a bigger
12
+ * tool list for the LLM to reason about. This primitive plus markdown
13
+ * skill files decouples API expansion from agent releases — new partners
14
+ * ship as a new SKILL.md, no code change.
15
+ *
16
+ * Signing pattern mirrors src/tools/modal.ts and src/phone/client.ts; we
17
+ * deliberately keep the copy-paste rather than refactor those into a
18
+ * shared module (out of scope; would touch unrelated tools).
19
+ */
20
+ import type { CapabilityHandler } from '../agent/types.js';
21
+ export declare const blockrunCapability: CapabilityHandler;