@blockrun/franklin 3.2.4 → 3.3.1

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.
Files changed (61) hide show
  1. package/README.md +216 -233
  2. package/dist/agent/commands.js +54 -13
  3. package/dist/agent/context.js +31 -1
  4. package/dist/agent/loop.js +48 -19
  5. package/dist/agent/permissions.js +3 -3
  6. package/dist/commands/migrate.d.ts +13 -0
  7. package/dist/commands/migrate.js +389 -0
  8. package/dist/commands/panel.d.ts +6 -0
  9. package/dist/commands/panel.js +29 -0
  10. package/dist/commands/start.js +41 -2
  11. package/dist/events/bridge.d.ts +1 -0
  12. package/dist/events/bridge.js +24 -0
  13. package/dist/events/bus.d.ts +17 -0
  14. package/dist/events/bus.js +55 -0
  15. package/dist/events/types.d.ts +49 -0
  16. package/dist/events/types.js +8 -0
  17. package/dist/index.js +15 -0
  18. package/dist/learnings/extractor.d.ts +16 -0
  19. package/dist/learnings/extractor.js +234 -0
  20. package/dist/learnings/index.d.ts +3 -0
  21. package/dist/learnings/index.js +2 -0
  22. package/dist/learnings/store.d.ts +15 -0
  23. package/dist/learnings/store.js +130 -0
  24. package/dist/learnings/types.d.ts +24 -0
  25. package/dist/learnings/types.js +7 -0
  26. package/dist/mcp/client.js +9 -2
  27. package/dist/narrative/state.d.ts +30 -0
  28. package/dist/narrative/state.js +69 -0
  29. package/dist/panel/html.d.ts +5 -0
  30. package/dist/panel/html.js +341 -0
  31. package/dist/panel/server.d.ts +7 -0
  32. package/dist/panel/server.js +152 -0
  33. package/dist/session/storage.js +4 -2
  34. package/dist/social/browser-pool.d.ts +29 -0
  35. package/dist/social/browser-pool.js +57 -0
  36. package/dist/social/preflight.d.ts +14 -0
  37. package/dist/social/preflight.js +26 -0
  38. package/dist/social/x.d.ts +8 -0
  39. package/dist/social/x.js +9 -1
  40. package/dist/stats/tracker.d.ts +1 -0
  41. package/dist/stats/tracker.js +59 -13
  42. package/dist/tools/bash.js +6 -1
  43. package/dist/tools/index.js +3 -0
  44. package/dist/tools/posttox.d.ts +7 -0
  45. package/dist/tools/posttox.js +137 -0
  46. package/dist/tools/searchx.d.ts +7 -0
  47. package/dist/tools/searchx.js +111 -0
  48. package/dist/tools/trading.d.ts +3 -0
  49. package/dist/tools/trading.js +168 -0
  50. package/dist/tools/webfetch.js +19 -9
  51. package/dist/tools/write.js +2 -0
  52. package/dist/trading/config.d.ts +23 -0
  53. package/dist/trading/config.js +45 -0
  54. package/dist/trading/data.d.ts +30 -0
  55. package/dist/trading/data.js +112 -0
  56. package/dist/trading/metrics.d.ts +29 -0
  57. package/dist/trading/metrics.js +105 -0
  58. package/dist/ui/app.js +73 -44
  59. package/dist/ui/markdown.d.ts +9 -0
  60. package/dist/ui/markdown.js +86 -0
  61. package/package.json +1 -1
package/README.md CHANGED
@@ -6,11 +6,11 @@
6
6
  <code>◆</code> &nbsp; Franklin &nbsp; <code>◆</code>
7
7
  </h1>
8
8
 
9
- <h3>The AI agent with a wallet.</h3>
9
+ <h3>The wallet-native economic agent.</h3>
10
10
 
11
11
  <p>
12
- While others chat, Franklin spends.<br>
13
- One wallet. Every model. Every paid API. Pay per action in USDC.
12
+ While others generate text, Franklin deploys capital.<br>
13
+ One wallet. Every model. Every paid API. Budgeted execution in USDC.
14
14
  </p>
15
15
 
16
16
  <p>
@@ -27,12 +27,11 @@
27
27
 
28
28
  <p>
29
29
  <a href="#quick-start">Quick&nbsp;start</a> ·
30
- <a href="#what-it-looks-like">Demo</a> ·
31
- <a href="#why-franklin">Why</a> ·
30
+ <a href="#a-new-category">New&nbsp;category</a> ·
31
+ <a href="#what-franklin-can-execute">What&nbsp;it&nbsp;does</a> ·
32
+ <a href="#the-comparison">Compare</a> ·
32
33
  <a href="#features">Features</a> ·
33
- <a href="#plugin-sdk">Plugins</a> ·
34
34
  <a href="#how-it-works">Architecture</a> ·
35
- <a href="#roadmap">Roadmap</a> ·
36
35
  <a href="#community">Community</a>
37
36
  </p>
38
37
 
@@ -42,9 +41,9 @@
42
41
 
43
42
  ## The pitch in one paragraph
44
43
 
45
- Every AI coding tool today writes text. `franklin` **spends money** your USDC, from your wallet, on your behalf, under a hard budget cap to actually get work done. One agent. 55+ models. Every paid API routed through the [x402](https://x402.org) micropayment protocol. No subscriptions. No API keys. No account. The wallet is your identity.
44
+ `franklin` is not a coding copilot and not just another task runner. Franklin is a **wallet-native economic agent**: software with purchasing power. You give it a goal and a budget. Franklin decides what model to call, what tool to use, what API is worth paying for, and when to stop. Every paid action routes through the [x402](https://x402.org) micropayment protocol and settles against your own wallet. No subscriptions. No API keys. No account. The wallet is the identity.
46
45
 
47
- Built by the [BlockRun](https://blockrun.ai) team. Apache2.0. TypeScript. Ships as one npm package.
46
+ Built by the [BlockRun](https://blockrun.ai) team. Apache-2.0. TypeScript. Ships as one npm package.
48
47
 
49
48
  ---
50
49
 
@@ -66,32 +65,117 @@ That's it. Zero signup, zero credit card, zero phone verification. Send **$5 of
66
65
 
67
66
  ---
68
67
 
69
- ## What it looks like
68
+ ## A new category
69
+
70
+ > **Economic Agent**
71
+ >
72
+ > Software that can hold a wallet, price its own actions, spend toward an outcome, and stop at a hard budget cap.
73
+
74
+ That definition matters.
75
+
76
+ Most AI products fit into one of three buckets:
77
+ - They answer questions.
78
+ - They write code.
79
+ - They automate a fixed workflow.
80
+
81
+ Franklin does something different. It combines:
82
+ - **Purchasing power** — it can pay for models, tools, and APIs.
83
+ - **Budget awareness** — it knows spend is part of the problem, not an afterthought.
84
+ - **Cross-vertical execution** — marketing, trading, research, code, ops.
85
+ - **Hard stopping conditions** — when the wallet or budget says stop, it stops.
86
+
87
+ That is why Franklin is an economic agent, not just a task agent.
88
+
89
+ ---
90
+
91
+ ## What Franklin can execute
92
+
93
+ Franklin is **chat-first**. You do not wire a DAG, configure six API keys, or commit to one model vendor. You state an outcome. Franklin decides what to read, search, fetch, call, and pay for.
94
+
95
+ ### 📈 Trading signals
96
+
97
+ ```text
98
+ > what's BTC looking like today?
99
+
100
+ ✓ TradingSignal BTC
101
+
102
+ ## BTC Signal Report
103
+
104
+ Price: $71,056 USD (+2.3% 24h)
105
+ Market Cap: $1.42T
106
+ 24h Volume: $29.6B
107
+
108
+ ### Technical Indicators (30d)
109
+ - RSI(14): 53.2 — neutral
110
+ - MACD: 339.21 / Signal: 280.45 — bullish crossover
111
+ - Bollinger: within band (upper $73,773 / lower $64,545)
112
+ - Volatility: 35.3% annualized — medium
113
+
114
+ > if I enter at 65000 with $1000, where should my stop be?
115
+
116
+ Based on ATR(14) and support at $63,500:
117
+ Entry: $65,000 · Stop: $63,200 (−2.8%) · Risk: $27.69
118
+ Risk/reward to $70K target: 1:2.8 ✓
119
+ ```
120
+
121
+ Live data from CoinGecko. RSI, MACD, Bollinger, and volatility computed locally. No API key needed.
122
+
123
+ ### 🎯 Social growth
70
124
 
71
125
  ```text
72
- ███████╗██████╗ █████╗ ███╗ ██╗██╗ ██╗██╗ ██╗███╗ ██╗
73
- ██╔════╝██╔══██╗██╔══██╗████╗ ██║██║ ██╔╝██║ ██║████╗ ██║
74
- █████╗ ██████╔╝███████║██╔██╗ ██║█████╔╝ ██║ ██║██╔██╗ ██║
75
- ██╔══╝ ██╔══██╗██╔══██║██║╚██╗██║██╔═██╗ ██║ ██║██║╚██╗██║
76
- ██║ ██║ ██║██║ ██║██║ ╚████║██║ ██╗███████╗██║██║ ╚████║
77
- ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝╚══════╝╚═╝╚═╝ ╚═══╝
78
- Franklin · The AI agent with a wallet · v3.1.0
126
+ > find X posts complaining about AI rate limits
127
+
128
+ SearchX "AI rate limits"
79
129
 
80
- Model : anthropic/claude-sonnet-4.6
81
- Wallet: 0x7a9…4e2 · 12.47 USDC
130
+ Found 8 candidates:
131
+ 1. "Claude keeps throttling me in the middle of shipping..." — @buildermax (2h)
132
+ 2. "I need an agent that can switch models automatically." — @indiedev (5h)
133
+ ...
82
134
 
135
+ > write a reply to #2 — mention Franklin uses a wallet instead of subscriptions
136
+
137
+ Draft:
138
+ "That was my pain too. Franklin routes across 55+ models,
139
+ pays per action from a USDC wallet, and doesn't trap you
140
+ inside a monthly seat. Better economics, better uptime."
141
+
142
+ > looks good, post it
143
+
144
+ ✓ PostToX Reply posted to x.com/indiedev/status/...
145
+ ```
146
+
147
+ Search X, generate contextual replies, and post with confirmation. Uses Playwright for browser automation, so there is no X API key, no OAuth maze, and no $100/month developer account.
148
+
149
+ ### 🔎 Research, code, anything with a budget
150
+
151
+ ```text
152
+ > compare the top 5 AI agent pricing models, summarize the patterns, and save a note for me
153
+
154
+ ✓ WebSearch ai agent pricing models
155
+ ✓ WebFetch 5 articles
156
+ ✓ Write notes/agent-pricing.md
157
+
158
+ Summary:
159
+ - Most agents hide pricing behind monthly seats
160
+ - Usage-based products win with power users and teams
161
+ - Wallet-based billing is still basically empty whitespace
162
+ ```
163
+
164
+ ```text
83
165
  > refactor src/auth.ts to use the new jwt helper, then run the tests
84
166
 
85
- ✓ Read src/auth.ts $0.0024
86
- ✓ Read src/lib/jwt.ts $0.0011
87
- ✓ Edit src/auth.ts (-24 +31 lines) $0.0082
88
- ✓ Bash npm test $0.0000
167
+ ✓ Read src/auth.ts $0.002
168
+ ✓ Read src/lib/jwt.ts $0.001
169
+ ✓ Edit src/auth.ts (-24 +31 lines) $0.008
170
+ ✓ Bash npm test $0.000
89
171
  › 142 passing · 0 failing · 2.4s
90
172
 
91
- Done in 18s · 4 tool calls · 12.8k in / 2.1k out · $0.0117
173
+ Done in 18s · $0.011
92
174
  ```
93
175
 
94
- Every tool call is itemised. Every token is priced. The wallet is the source of truth — when it hits zero, Franklin stops. No overdraft, no surprise bill, no rate-limit wall at 3am.
176
+ Code is still first-class. It is just **one workload**, not the category.
177
+
178
+ Every tool call is itemized. Every token is priced. When the wallet hits zero, Franklin stops. No overdraft, no surprise bill, no rate-limit wall at 3am.
95
179
 
96
180
  ---
97
181
 
@@ -101,23 +185,23 @@ Every tool call is itemised. Every token is priced. The wallet is the source of
101
185
  <tr>
102
186
  <td width="33%" valign="top">
103
187
 
104
- ### 💳 &nbsp;Pay per action
188
+ ### 💳 &nbsp;Budget is native
105
189
 
106
- No subscriptions. No "Pro" tier. You fund a wallet once and Franklin spends atomically per API call via HTTP 402. Cheap models cost fractions of a cent. Frontier models cost what they cost. When the wallet is empty, Franklin stops.
190
+ Franklin does not bolt spend tracking on afterward. Cost is part of the loop. The agent can choose free, cheap, or premium paths per step, and every paid action settles against your wallet.
107
191
 
108
192
  </td>
109
193
  <td width="33%" valign="top">
110
194
 
111
195
  ### 🔐 &nbsp;Wallet is identity
112
196
 
113
- No email. No phone. No KYC. Your Base or Solana address is your account. Portable across machines — `franklin setup` imports an existing wallet in one command. Your sessions, your config, your money.
197
+ No email. No phone. No KYC. Your Base or Solana address is your account. Portable across machines. Your sessions, your config, your money.
114
198
 
115
199
  </td>
116
200
  <td width="33%" valign="top">
117
201
 
118
- ### 🧠 &nbsp;55+ models, one interface
202
+ ### 🧠 &nbsp;One runtime, many verticals
119
203
 
120
- Claude Sonnet/Opus 4.6, GPT‑5.4, Gemini 2.5 Pro, Grok 4, DeepSeek V3, GLM‑5.1, Kimi, Minimax, plus NVIDIA's free tier (Nemotron, Qwen3 Coder). Switch mid‑session with `/model`. Automatic fallback if one provider is down.
204
+ Marketing, trading, research, code, and anything else you can express as tools plus budgeted execution. Franklin is a runtime for economic workflows, not a single-purpose copilot.
121
205
 
122
206
  </td>
123
207
  </tr>
@@ -127,19 +211,18 @@ Claude Sonnet/Opus 4.6, GPT‑5.4, Gemini 2.5 Pro, Grok 4, DeepSeek V3, GLM‑5.
127
211
 
128
212
  ## The comparison
129
213
 
130
- | | Claude Code | Aider | Cursor | **Franklin** |
131
- | --------------------------------- | -------------- | ------------- | -------------- | --------------------- |
132
- | Writes and edits code | | | | |
133
- | Multi‑model support | ❌ Claude only | ✅ BYOK | ⚠️ limited | ✅ **55+ via 1 wallet** |
134
- | Pricing model | Subscription | BYOK | Subscription | **Pay per action** |
135
- | Identity | Account | API keys | Account | **Wallet** |
136
- | Spend budget cap enforced on‑chain | ❌ | ❌ | | ✅ |
137
- | Pay any API (images, search…) | | | ❌ | via x402 |
138
- | Plugin SDK for custom workflows | ❌ | ⚠️ | ❌ | ✅ |
139
- | Persistent sessions + search | ⚠️ | ⚠️ | ⚠️ | ✅ |
140
- | Start free, no signup | ❌ | ⚠️ BYOK | ❌ | ✅ |
214
+ | | Chatbots | Coding agents | Workflow tools | **Franklin** |
215
+ | ------------------------------------ | --------------- | ---------------- | ---------------- | ------------------------------- |
216
+ | Main unit of value | Answers | Code changes | Fixed automations| **Budgeted outcomes** |
217
+ | Has purchasing power | ❌ | | | ✅ **wallet-native** |
218
+ | Can choose tools/models per step | ⚠️ limited | ✅ mostly coding | ❌ usually fixed | **yes** |
219
+ | Works across marketing/trading/code | ⚠️ | code-first | ⚠️ integration-bound | **cross-vertical** |
220
+ | Hard spend cap | ❌ | ❌ | ⚠️ external billing | ✅ **wallet balance** |
221
+ | Identity | Account | Account / API key| Account | ✅ **wallet** |
222
+ | Start free, no signup | ⚠️ | ❌ / BYOK | ❌ | ✅ |
223
+ | Paid APIs through one interface | | ⚠️ | | ✅ **55+ models + paid tools** |
141
224
 
142
- Franklin is the first agent in the **Autonomous Economic Agent** category an agent that takes a goal, decides what to spend on, and executes within a hard budget cap enforced by the wallet.
225
+ **Franklin is the economic agent category in one sentence:** software with a wallet that can spend toward a result.
143
226
 
144
227
  ---
145
228
 
@@ -149,44 +232,44 @@ Franklin is the first agent in the **Autonomous Economic Agent** category — an
149
232
  <tr>
150
233
  <td width="50%" valign="top">
151
234
 
152
- **🧠 55+ models via one wallet**
153
- Anthropic, OpenAI, Google, xAI, DeepSeek, GLM, Kimi, Minimax, NVIDIA free tier. One URL, one wallet, automatic fallback.
235
+ **💼 Wallet-native economic execution**
236
+ Franklin can decide what is worth paying for, route the call, sign the micropayment, and keep going until the goal is done or the budget is exhausted.
154
237
 
155
- **💳 x402 micropayments**
156
- HTTP 402 native. Every tool call is a tiny signed transaction against your USDC balance. No escrow, no refund API, no subscription.
238
+ **📈 Trading signals**
239
+ Ask "what's BTC looking like?" Franklin fetches live price data, computes RSI/MACD/Bollinger/volatility, and synthesizes a signal.
157
240
 
158
- **🚦 Smart tier routing**
159
- Mark steps as `free` / `cheap` / `premium` — Franklin picks the best model per tier, per task. Configurable defaults in `franklin config`.
241
+ **🎯 Social growth**
242
+ Ask "find X posts about my category" — Franklin searches X, drafts replies, and posts with your confirmation.
160
243
 
161
- **🔌 Plugin SDK**
162
- Core is workflow‑agnostic. Ship a new vertical (marketing, trading, research) without touching the agent loop. See [docs/plugin-sdk.md](docs/plugin-sdk.md).
244
+ **🧠 55+ models via one wallet**
245
+ Anthropic, OpenAI, Google, xAI, DeepSeek, GLM, Kimi, Minimax, NVIDIA free tier. One wallet, one interface, automatic fallback.
163
246
 
164
- **💾 Persistent sessions**
165
- Every turn is streamed to disk with full metadata. Resume any session by ID. Survives crashes, reboots, context compaction.
247
+ **💳 x402 micropayments**
248
+ HTTP 402 native. Every paid action is a signed micropayment against your USDC balance. No subscriptions. No refund loop. No account lock-in.
166
249
 
167
- **🔍 Full‑text session search**
168
- `franklin search "payment loop"` tokenised search across every past session. No SQLite, no indexing daemon, just fast.
250
+ **🚦 Smart spend routing**
251
+ Free / cheap / premium per step. Franklin picks the cheapest model that can do the job, then escalates when quality matters.
169
252
 
170
253
  </td>
171
254
  <td width="50%" valign="top">
172
255
 
173
- **📊 Cost insights**
174
- `franklin insights` daily spend sparklines, per‑model breakdown, projections. Never wonder where the USDC went.
256
+ **🛠 16 built-in tools**
257
+ Read, Write, Edit, Bash, Glob, Grep, WebFetch, WebSearch, Task, ImageGen, AskUser, SubAgent, TradingSignal, TradingMarket, SearchX, PostToX.
175
258
 
176
- **⚡ Anthropic prompt caching**
177
- Multi‑turn Sonnet/Opus sessions use ephemeral cache breakpoints (`system_and_3` strategy). Large input savings on long conversations.
259
+ **💾 Persistent sessions**
260
+ Every turn is streamed to disk with metadata. Resume any session by ID. Survives crashes, reboots, and compaction.
178
261
 
179
- **🛠 12 built‑in tools**
180
- Read · Write · Edit · Bash · Glob · Grep · WebFetch · WebSearch · Task · ImageGen · AskUser · SubAgent.
262
+ **🔍 Full-text session search**
263
+ `franklin search "payment loop"` from the CLI, or `/session-search "payment loop"` in chat.
181
264
 
182
- **🔗 MCP auto‑discovery**
183
- Drop‑in Model Context Protocol servers from `~/.blockrun/mcp.json`. Ships with awareness of `blockrun-mcp` (markets, X, prediction markets) and `unbrowse` (any site API).
265
+ **📊 Cost insights**
266
+ `franklin insights` shows spend breakdowns, trends, and projections. Never wonder where the USDC went.
184
267
 
185
- **🧭 Plan / Execute modes**
186
- `/plan` to design read‑only, `/execute` to commit. No accidental writes while exploring.
268
+ **⚡ Anthropic prompt caching**
269
+ Multi-turn Sonnet/Opus sessions use ephemeral cache breakpoints to reduce input spend on long conversations.
187
270
 
188
- **🪄 Slash ergonomics**
189
- `/commit`, `/push`, `/pr`, `/review`, `/ultrathink`, `/compact`, `/model`, `/cost`, `/wallet`, and 20+ more.
271
+ **🔌 Plugin SDK + MCP**
272
+ Core is workflow-agnostic. Add new verticals without touching the loop. Discover external tools automatically through MCP.
190
273
 
191
274
  </td>
192
275
  </tr>
@@ -194,121 +277,40 @@ Drop‑in Model Context Protocol servers from `~/.blockrun/mcp.json`. Ships with
194
277
 
195
278
  ---
196
279
 
197
- ## Plugin SDK
198
-
199
- Franklin is plugin‑first. The core agent doesn't know what a "marketing campaign" or "trading signal" is — it just runs workflows. Adding a new vertical is a single TypeScript file.
200
-
201
- ```typescript
202
- import type { Plugin, Workflow } from '@blockrun/franklin/plugin-sdk';
203
-
204
- const researchWorkflow: Workflow = {
205
- id: 'research',
206
- name: 'Competitor Research',
207
- description: 'Find and summarise 10 competitors in a given space',
208
- steps: [
209
- {
210
- name: 'search',
211
- modelTier: 'none', // pure API call, no LLM
212
- execute: async (ctx) => {
213
- const results = await ctx.exa.search(ctx.input.topic, { limit: 10 });
214
- return { output: `Found ${results.length}`, data: { results } };
215
- },
216
- },
217
- {
218
- name: 'summarise',
219
- modelTier: 'cheap', // bulk work — use GLM or DeepSeek
220
- execute: async (ctx) => {
221
- const summaries = await ctx.llm.map(ctx.data.results, (r) =>
222
- `Summarise in 3 bullets: ${r.text}`);
223
- return { output: 'Summaries written', data: { summaries } };
224
- },
225
- },
226
- {
227
- name: 'synthesise',
228
- modelTier: 'premium', // final output — use Claude Opus
229
- execute: async (ctx) => {
230
- const report = await ctx.llm.complete({
231
- system: 'You are a strategy analyst.',
232
- user: `Synthesise these into a 1‑page report: ${JSON.stringify(ctx.data.summaries)}`,
233
- });
234
- return { output: report };
235
- },
236
- },
237
- ],
238
- };
239
-
240
- export const myPlugin: Plugin = {
241
- id: 'research',
242
- name: 'Research',
243
- version: '0.1.0',
244
- workflows: [researchWorkflow],
245
- };
246
- ```
247
-
248
- Three steps, three tiers, three prices. The agent routes each step to the cheapest model that can do the job. Full guide: **[docs/plugin-sdk.md](docs/plugin-sdk.md)**.
249
-
250
- ---
251
-
252
280
  ## Slash commands
253
281
 
254
- A curated subset of what `franklin` exposes inside an interactive session:
255
-
256
282
  | Command | What it does |
257
283
  | -------------------------------- | ---------------------------------------------------- |
258
284
  | `/model [name]` | Interactive model picker, or switch directly |
259
- | `/plan` · `/execute` | Readonly planning mode commit mode |
285
+ | `/plan` / `/execute` | Read-only planning mode / execution mode |
260
286
  | `/ultrathink <q>` | Deep reasoning mode for hard problems |
261
- | `/compact` | Structured context compression (Goal/Progress/Next) |
262
- | `/search <q>` | Full‑text search across past sessions |
263
- | `/history` · `/resume <id>` | Session management |
264
- | `/commit` · `/push` · `/pr` | Git workflow helpers (Franklin writes the message) |
265
- | `/review` · `/fix` · `/test` | One‑shot code review, bugfix, or test generation |
266
- | `/explain <file>` · `/refactor` | Targeted explanation or refactor |
267
- | `/cost` · `/wallet` | Session cost, wallet address & USDC balance |
287
+ | `/compact` | Structured context compression |
288
+ | `/search <q>` | Search the codebase |
289
+ | `/session-search <q>` | Search past sessions |
290
+ | `/history` / `/resume [id]` | Inspect or restore conversation state |
291
+ | `/commit` / `/push` / `/pr` | Git workflow helpers |
292
+ | `/review` / `/fix` / `/test` | One-shot code review, bugfix, or test runs |
293
+ | `/cost` / `/wallet` | Session cost, wallet address, and balance |
268
294
  | `/insights [--days N]` | Rich usage analytics |
269
- | `/mcp` · `/doctor` · `/context` | Diagnostics |
270
295
  | `/help` | Full command list |
271
296
 
272
- Run `franklin` and type `/help` to see everything.
273
-
274
- ---
275
-
276
- ## CLI commands
277
-
278
- Top‑level commands (`franklin --help`):
279
-
280
- ```text
281
- setup [chain] Create a wallet for payments (base | solana)
282
- start Start the interactive agent (default command)
283
- models List available models and pricing
284
- balance Check wallet USDC balance
285
- config <action> Manage config: default‑model, sonnet‑model, routing…
286
- stats Usage statistics and cost savings vs. Claude Opus
287
- insights Rich usage analytics (also /insights in session)
288
- search <q> Full‑text session search (also /search in session)
289
- social AI‑powered social engagement plugin
290
- plugins List installed plugins
291
- proxy Run a payment proxy for Claude Code compatibility
292
- init / uninit Install/remove the background daemon (macOS LaunchAgent)
293
- daemon <action> start | stop | status
294
- logs Tail debug logs
295
- ```
296
-
297
297
  ---
298
298
 
299
299
  ## How it works
300
300
 
301
- ```
301
+ ```text
302
302
  ┌──────────────────────────────────────────────────────────────┐
303
- │ Franklin Agent
304
- Plugin SDK · Tool loop · Router · Session · Compaction
303
+ │ Franklin Runtime
304
+ Intent Routing Tool Use Spend Decisions Result
305
+ ├──────────────────────────────────────────────────────────────┤
306
+ │ Agent Loop │
307
+ │ 16 tools · Sessions · Compaction · Pricing · Plugin SDK │
305
308
  ├──────────────────────────────────────────────────────────────┤
306
309
  │ BlockRun Gateway │
307
- │ 55+ LLMs · Exa search · DALL·E · (soon) Runway · Suno
308
- │ CoinGecko · Dune · Apollo │
310
+ │ 55+ LLMs · CoinGecko · Search · Image APIs · paid services
309
311
  ├──────────────────────────────────────────────────────────────┤
310
312
  │ x402 Micropayment Protocol │
311
- │ HTTP 402 · USDC on Base & Solana · on‑chain budget cap
313
+ │ HTTP 402 · USDC on Base & Solana · signed payment payloads
312
314
  └──────────────────────────────────────────────────────────────┘
313
315
 
314
316
 
@@ -318,91 +320,87 @@ logs Tail debug logs
318
320
  └─────────────┘
319
321
  ```
320
322
 
321
- Every API call resolves to a signed micropayment against your wallet. You fund once; Franklin spends per task, priced by the upstream provider. No middlemen, no refund loop, no subscription renewal date.
323
+ The loop is simple:
324
+ 1. You state an outcome.
325
+ 2. Franklin chooses what to read, call, and pay for.
326
+ 3. The payment settles against your wallet.
327
+ 4. Franklin reports the result and the spend.
328
+
329
+ That economic loop is the product.
322
330
 
323
331
  ---
324
332
 
325
333
  ## Project layout
326
334
 
327
- ```
335
+ ```text
328
336
  src/
329
337
  ├── index.ts CLI entry (franklin + runcode alias)
330
- ├── banner.ts FRANKLIN gold→emerald gradient
338
+ ├── banner.ts Ben Franklin portrait + FRANKLIN gradient text
331
339
  ├── agent/ Agent loop, LLM client, compaction, commands
332
- ├── tools/ 12 builtin tools (Read/Write/Edit/Bash/…)
340
+ ├── tools/ 16 built-in tools (Read/Write/Edit/Bash/Glob/Grep/
341
+ │ WebFetch/WebSearch/Task/ImageGen/AskUser/SubAgent/
342
+ │ TradingSignal/TradingMarket/SearchX/PostToX)
343
+ ├── trading/ Market data (CoinGecko) + technical indicators
344
+ ├── social/ X browser automation (Playwright) + reply engine
345
+ ├── events/ Internal event bus (signals, posting, workflow events)
333
346
  ├── plugin-sdk/ Public plugin contract (Workflow/Plugin/Channel)
334
- ├── plugins/ Plugin registry + runner (pluginagnostic)
335
- ├── plugins-bundled/ Plugins shipped with Franklin
336
- │ └── social/ AI‑powered social engagement
337
- ├── session/ Persistent sessions + FTS search
347
+ ├── plugins/ Plugin registry + runner (plugin-agnostic)
348
+ ├── session/ Persistent sessions + search
338
349
  ├── stats/ Usage tracking + insights engine
339
- ├── ui/ Inkbased terminal UI
340
- ├── proxy/ Payment proxy for Claude Code compatibility
341
- ├── router/ Smart model tier routing (free/cheap/premium)
350
+ ├── ui/ Ink-based terminal UI
351
+ ├── proxy/ Payment proxy for external tools
352
+ ├── router/ Smart model routing (free/cheap/premium)
342
353
  ├── wallet/ Wallet management (Base + Solana)
343
- ├── mcp/ MCP server autodiscovery
354
+ ├── mcp/ MCP server auto-discovery
344
355
  └── commands/ CLI subcommands
345
356
  ```
346
357
 
347
358
  ---
348
359
 
349
- ## Roadmap
350
-
351
- ### Shipped in v3.1.0
352
- - Interactive agent with 12 built‑in tools
353
- - 55+ models across Anthropic, OpenAI, Google, xAI, DeepSeek, GLM, Kimi, Minimax, NVIDIA free tier
354
- - Plugin SDK (workflow, channel, plugin) — plugin‑first architecture
355
- - **Social plugin** — AI‑powered engagement on Reddit / X
356
- - x402 micropayment integration
357
- - Wallet setup (Base + Solana), balance, funding flow
358
- - Persistent sessions + full‑text search
359
- - Cost insights engine with daily sparklines
360
- - Anthropic prompt caching (ephemeral, multi‑breakpoint)
361
- - Plan/Execute modes, slash commands, compaction, smart routing
362
- - MCP auto‑discovery
363
- - Proxy mode for Claude Code compatibility
364
-
365
- ### 🚧 In progress
366
- - **Marketing plugin** — campaigns, Reddit/IG outreach, content generation pipelines
367
- - **Trading plugin** — signals, market research, risk analysis
368
- - Video (Runway) and audio (Suno) paid tool routes
369
- - Per‑step budget caps inside workflows
370
- - More languages in `franklin config` (`.yaml` support)
371
-
372
- ### 💭 Under consideration
373
- - Shared plugin registry (install community plugins with `franklin plugins add`)
374
- - Fiat on‑ramp inside `franklin setup`
375
- - Mobile wallet handoff via WalletConnect
360
+ ## Free tier, for real
361
+
362
+ Start with **zero dollars**. Franklin defaults to free NVIDIA models that need no wallet funding.
363
+
364
+ ```bash
365
+ franklin --model nvidia/nemotron-ultra-253b
366
+ ```
367
+
368
+ When you fund the wallet, Franklin gets more purchasing power: Claude, GPT, Gemini, Grok, and paid tools like Exa, DALL-E, and CoinGecko Pro.
376
369
 
377
370
  ---
378
371
 
379
- ## Free tier, for real
372
+ ## Social automation (advanced)
380
373
 
381
- Start with **zero dollars**. Franklin defaults to free NVIDIA models (Nemotron 70B, Qwen3 Coder 480B) that need no wallet funding. Rate‑limited to 60 requests/hour on the gateway, but genuinely free.
374
+ Once you've tuned Franklin's reply style in chat, you can graduate to **automated batch mode**:
382
375
 
383
376
  ```bash
384
- franklin --model nvidia/nemotron-ultra-253b
377
+ franklin social setup # install Chromium, write default config
378
+ franklin social login x # log in to X once (cookies persist)
379
+ franklin social config edit # set handle, products, search queries
380
+ franklin social run # dry-run — preview drafts
381
+ franklin social run --live # actually post to X
382
+ franklin social stats # posted / drafted / skipped / cost
385
383
  ```
386
384
 
387
- Only fund a wallet when you want Claude, GPT, Gemini, Grok, or paid tools like Exa and DALL·E.
385
+ The chat-based social tools (`SearchX`, `PostToX`) and the batch CLI (`franklin social run`) share the same engine. Chat first, automate later.
388
386
 
389
387
  ---
390
388
 
391
389
  ## Documentation
392
390
 
393
- - 📖 **[Plugin SDK guide](docs/plugin-sdk.md)** — build your own workflow
394
- - 📜 **[Changelog](CHANGELOG.md)** — every release explained
395
- - 🗺 **[Roadmap](docs/ROADMAP.md)** — what's coming next
396
- - 🧭 **[Claude Code compatibility](docs/)** — use Franklin as a payment proxy
391
+ - [Plugin SDK guide](docs/plugin-sdk.md) — build your own workflow vertical
392
+ - [Changelog](CHANGELOG.md) — every release explained
393
+ - [Roadmap](docs/ROADMAP.md) — what's coming next
394
+ - [Claude Code compatibility](docs/) — use Franklin as a payment proxy
397
395
 
398
396
  ---
399
397
 
400
398
  ## Community
401
399
 
402
- - 💬 **[Telegram](https://t.me/blockrunAI)** — realtime help, bug reports, feature requests
403
- - 🐦 **[@BlockRunAI](https://x.com/BlockRunAI)** — release notes, demos
404
- - 🐛 **[Issues](https://github.com/BlockRunAI/franklin/issues)** — bugs and feature requests
405
- - 💡 **[Discussions](https://github.com/BlockRunAI/franklin/discussions)** — ideas, Q&A, show & tell
400
+ - [Telegram](https://t.me/blockrunAI) — realtime help, bug reports, feature requests
401
+ - [@BlockRunAI](https://x.com/BlockRunAI) — release notes, demos
402
+ - [Issues](https://github.com/BlockRunAI/franklin/issues) — bugs and feature requests
403
+ - [Discussions](https://github.com/BlockRunAI/franklin/discussions) — ideas, Q&A, show & tell
406
404
 
407
405
  ---
408
406
 
@@ -418,20 +416,7 @@ npm run test:e2e # live e2e tests — hits real models, needs wallet
418
416
  node dist/index.js --help
419
417
  ```
420
418
 
421
- **Contributing:** please open an issue first to discuss meaningful changes. For new features, prefer a plugin over a core change — [docs/plugin-sdk.md](docs/plugin-sdk.md) exists exactly so the core stays lean. PRs welcome on bugs, docs, typos, new models in pricing.
422
-
423
- ---
424
-
425
- ## Migrating from RunCode
426
-
427
- If you were a RunCode user: **nothing breaks**. The `runcode` binary still works as an alias for `franklin` through the 60‑day compatibility window (until ~June 2026). Your config at `~/.blockrun/`, your wallet, your sessions — all migrate automatically.
428
-
429
- To update when convenient:
430
-
431
- ```bash
432
- npm uninstall -g @blockrun/runcode
433
- npm install -g @blockrun/franklin
434
- ```
419
+ **Contributing:** open an issue first to discuss meaningful changes. PRs welcome on bugs, docs, new models in pricing, and new tools.
435
420
 
436
421
  ---
437
422
 
@@ -449,16 +434,14 @@ npm install -g @blockrun/franklin
449
434
 
450
435
  ## License
451
436
 
452
- Apache2.0. See [LICENSE](LICENSE).
453
-
454
- Built on the shoulders of giants: [x402](https://x402.org), [Anthropic](https://anthropic.com), [@modelcontextprotocol](https://github.com/modelcontextprotocol), [Ink](https://github.com/vadimdemedes/ink), [commander](https://github.com/tj/commander.js).
437
+ Apache-2.0. See [LICENSE](LICENSE).
455
438
 
456
439
  ---
457
440
 
458
441
  <div align="center">
459
442
 
460
- **Franklin runs your money.**<br>
461
- <sub>Your wallet. Your agent. Your results.</sub>
443
+ **Franklin is the economic agent.**<br>
444
+ <sub>Your wallet. Your budget. Your results.</sub>
462
445
 
463
446
  <br>
464
447