@spfunctions/cli 2.0.6 → 2.0.7
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.
- package/README.md +266 -144
- package/dist/160.index.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,109 +1,245 @@
|
|
|
1
1
|
# SimpleFunctions CLI (`sf`)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A terminal-native prediction market agent. Builds causal models of the world, scans 4,000+ Kalshi and Polymarket contracts for mispricings, and trades on your thesis — autonomously or with you in the loop.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
```
|
|
6
|
+
$ sf world
|
|
7
|
+
# World State — 2026-04-05T05:38 UTC
|
|
8
|
+
SF Index: Uncertainty 22/100 | Geopolitical Risk 53/100
|
|
9
|
+
|
|
10
|
+
Markets: SPY $655.94 (+0.12%) | GLD $429.08 (-1.79%) | USO $138.18 (+11.99%)
|
|
11
|
+
|
|
12
|
+
## Geopolitical
|
|
13
|
+
- Will the U.S. invade Iran before 2027?: 54c (-7c)
|
|
14
|
+
- Russia x Ukraine ceasefire by end of 2026?: 30c
|
|
15
|
+
|
|
16
|
+
## Economy
|
|
17
|
+
- US recession by end of 2026?: 28c
|
|
18
|
+
- How many Fed rate cuts in 2026?: 0 (0 bps): 36c
|
|
19
|
+
```
|
|
6
20
|
|
|
7
|
-
##
|
|
21
|
+
## Install
|
|
8
22
|
|
|
9
23
|
```bash
|
|
10
24
|
npm install -g @spfunctions/cli
|
|
11
|
-
sf
|
|
12
|
-
sf
|
|
13
|
-
|
|
25
|
+
sf login # browser auth (recommended)
|
|
26
|
+
sf status # verify everything works
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## What it does
|
|
30
|
+
|
|
31
|
+
**World model** — Real-time prediction index distilled from thousands of markets. One command gives any LLM situational awareness.
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
sf world # ~800 token world state snapshot
|
|
35
|
+
sf world --delta # what changed since last check (~30 tokens)
|
|
36
|
+
sf world --focus energy,geo # deep coverage on specific topics
|
|
37
|
+
sf ideas # S&T-style trade ideas with catalyst + risk
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**Thesis engine** — Structured causal models with Bayesian node trees, continuous evaluation against live market data, and automatic edge detection.
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
sf create "Oil will exceed $120 by Q3 due to Hormuz disruption"
|
|
44
|
+
sf list # all theses with confidence + status
|
|
45
|
+
sf context <id> # causal tree + top edges + positions
|
|
46
|
+
sf evaluate <id> # trigger deep re-evaluation
|
|
47
|
+
sf signal <id> "OPEC cuts" # inject a signal for next eval cycle
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**Edge detection** — Cross-venue scanner compares your model's probabilities against Kalshi and Polymarket prices.
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
sf edges # top mispricings across all theses
|
|
54
|
+
sf scan "recession" # search 4,000+ markets by keyword
|
|
55
|
+
sf book KXRECSSNBER-26 # orderbook depth
|
|
56
|
+
sf watch oil orderbook # live terminal orderbook stream
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Intent system** — Declarative execution: describe what you want, the runtime handles when and how.
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
sf intent buy KXRECSSNBER-26 10 --price 30 --trigger below:28 --auto
|
|
63
|
+
sf intent list # active intents + fill status
|
|
64
|
+
sf runtime start # daemon evaluates triggers, executes orders
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**Interactive agent** — Natural language interface with 30+ tools. Maintains a persistent workspace, shares context across sessions, and can schedule its own future actions.
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
sf agent <id> # TUI agent with tool calling
|
|
71
|
+
sf agent <id> --once "summarize my portfolio risk" # single-shot
|
|
72
|
+
sf agent <id> --plain # readline mode, no TUI
|
|
73
|
+
sf telegram --daemon # Telegram bot (text + voice)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**X / Twitter intelligence** — Social signal layer.
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
sf x "tariff impact" # discussion summary + top posts
|
|
80
|
+
sf x-volume "iran oil" # volume and velocity trend
|
|
81
|
+
sf x-news "fed rate" # Grok-aggregated news stories
|
|
82
|
+
sf x-account @elikinosian # recent posts from an account
|
|
14
83
|
```
|
|
15
84
|
|
|
16
85
|
## Setup
|
|
17
86
|
|
|
18
|
-
###
|
|
87
|
+
### Quick (browser login)
|
|
19
88
|
|
|
20
89
|
```bash
|
|
21
|
-
sf
|
|
90
|
+
sf login
|
|
22
91
|
```
|
|
23
92
|
|
|
24
|
-
|
|
25
|
-
1. **SF API key** (required) — get one at [simplefunctions.dev](https://simplefunctions.dev)
|
|
26
|
-
2. **Kalshi credentials** (optional) — for positions, trading, and orderbook data
|
|
27
|
-
3. **Trading mode** (optional) — enable `sf buy`/`sf sell` commands
|
|
93
|
+
### Power user
|
|
28
94
|
|
|
29
|
-
|
|
95
|
+
```bash
|
|
96
|
+
sf setup # interactive wizard: API key, Kalshi, Polymarket, trading
|
|
97
|
+
sf setup --check # show config status
|
|
98
|
+
sf setup --polymarket # configure Polymarket wallet
|
|
99
|
+
sf setup --enable-trading # unlock buy/sell/intent commands
|
|
100
|
+
```
|
|
30
101
|
|
|
31
|
-
|
|
102
|
+
Config is saved to `~/.sf/config.json`. Environment variables override config values:
|
|
32
103
|
|
|
33
104
|
```bash
|
|
34
|
-
export SF_API_KEY=sf_live_xxx
|
|
35
|
-
export KALSHI_API_KEY_ID=xxx
|
|
36
|
-
export KALSHI_PRIVATE_KEY_PATH=~/.
|
|
105
|
+
export SF_API_KEY=sf_live_xxx
|
|
106
|
+
export KALSHI_API_KEY_ID=xxx
|
|
107
|
+
export KALSHI_PRIVATE_KEY_PATH=~/.kalshi/private.pem
|
|
37
108
|
```
|
|
38
109
|
|
|
39
110
|
### Verify
|
|
40
111
|
|
|
41
112
|
```bash
|
|
42
|
-
sf
|
|
43
|
-
|
|
113
|
+
$ sf status
|
|
114
|
+
API ok simplefunctions.dev 252ms
|
|
115
|
+
Auth ok sf_live_8838...
|
|
116
|
+
Kalshi ok $156.42 balance
|
|
117
|
+
Polymarket ok 0xd53b9354...
|
|
118
|
+
Theses ok 4 active, 4 total
|
|
119
|
+
Trading ok enabled
|
|
120
|
+
Runtime -- not running (sf runtime start)
|
|
121
|
+
Telegram ok PID 84372
|
|
44
122
|
```
|
|
45
123
|
|
|
46
|
-
##
|
|
124
|
+
## Command Reference
|
|
47
125
|
|
|
48
|
-
###
|
|
126
|
+
### World Model (no auth required)
|
|
49
127
|
|
|
50
128
|
| Command | Description |
|
|
51
129
|
|---------|-------------|
|
|
52
|
-
| `sf
|
|
53
|
-
| `sf
|
|
54
|
-
| `sf
|
|
55
|
-
| `sf
|
|
56
|
-
| `sf
|
|
57
|
-
| `sf
|
|
58
|
-
| `sf publish <id>` | Make thesis publicly viewable |
|
|
59
|
-
| `sf unpublish <id>` | Remove from public view |
|
|
130
|
+
| `sf world` | Prediction index: markets + geopolitics + economy + crypto + elections |
|
|
131
|
+
| `sf world --delta` | Changes since last check (~30 tokens, ideal for agent polling) |
|
|
132
|
+
| `sf world --focus <topics>` | Deep coverage on specific topics |
|
|
133
|
+
| `sf ideas` | Trade ideas with conviction, catalyst, direction, risk |
|
|
134
|
+
| `sf query "question"` | LLM-enhanced market knowledge search |
|
|
135
|
+
| `sf markets` | Traditional markets: SPY, VIX, bonds, gold, oil |
|
|
60
136
|
|
|
61
|
-
###
|
|
137
|
+
### Thesis
|
|
62
138
|
|
|
63
139
|
| Command | Description |
|
|
64
140
|
|---------|-------------|
|
|
65
|
-
| `sf
|
|
66
|
-
| `sf
|
|
67
|
-
| `sf
|
|
68
|
-
| `sf
|
|
141
|
+
| `sf list` | All theses with status, confidence, last update |
|
|
142
|
+
| `sf get <id>` | Full details: causal tree, edges, evaluation history |
|
|
143
|
+
| `sf context [id]` | No id: global market snapshot. With id: thesis context |
|
|
144
|
+
| `sf create "thesis"` | Create a new thesis |
|
|
145
|
+
| `sf signal <id> "text"` | Inject signal for next evaluation |
|
|
146
|
+
| `sf evaluate <id>` | Trigger deep re-evaluation |
|
|
147
|
+
| `sf augment <id>` | Evolve causal tree with new nodes |
|
|
148
|
+
| `sf heartbeat <id>` | View/configure autonomous evaluation schedule + costs |
|
|
149
|
+
| `sf publish` / `sf unpublish <id>` | Manage public visibility |
|
|
150
|
+
|
|
151
|
+
### Markets
|
|
69
152
|
|
|
70
|
-
|
|
153
|
+
| Command | Description |
|
|
154
|
+
|---------|-------------|
|
|
155
|
+
| `sf scan "keywords"` | Search Kalshi + Polymarket by keyword |
|
|
156
|
+
| `sf scan --series TICKER` | Browse all markets in a Kalshi series |
|
|
157
|
+
| `sf edges [--json]` | Top mispricings across all theses |
|
|
158
|
+
| `sf watch [query] [mode]` | Live market watch (modes: orderbook, flow, cross-venue, all) |
|
|
159
|
+
| `sf book <ticker> [...]` | Orderbook depth for specific markets |
|
|
160
|
+
| `sf whatif <id>` | What-if scenario analysis on causal tree |
|
|
161
|
+
| `sf liquidity [topic]` | Orderbook liquidity scanner |
|
|
162
|
+
| `sf forecast <event>` | Market distribution (P50/P75/P90) |
|
|
163
|
+
| `sf explore [slug]` | Browse public theses |
|
|
164
|
+
|
|
165
|
+
### Portfolio
|
|
71
166
|
|
|
72
167
|
| Command | Description |
|
|
73
168
|
|---------|-------------|
|
|
74
|
-
| `sf
|
|
75
|
-
| `sf positions` | Current positions with P&L and edge overlay |
|
|
169
|
+
| `sf positions` | Kalshi + Polymarket positions with P&L |
|
|
76
170
|
| `sf balance` | Account balance |
|
|
77
171
|
| `sf orders` | Resting (open) orders |
|
|
78
172
|
| `sf fills` | Recent trade fills |
|
|
79
|
-
| `sf performance` | P&L over time with thesis event annotations |
|
|
80
173
|
| `sf settlements` | Settled contracts with final P&L |
|
|
81
|
-
| `sf
|
|
174
|
+
| `sf performance` | P&L over time with event annotations |
|
|
175
|
+
| `sf dashboard` | Interactive TUI portfolio overview |
|
|
176
|
+
|
|
177
|
+
### Intents & Runtime
|
|
178
|
+
|
|
179
|
+
Intents are declarative execution orders. You define the trade and trigger condition; the runtime daemon evaluates and executes.
|
|
180
|
+
|
|
181
|
+
| Command | Description |
|
|
182
|
+
|---------|-------------|
|
|
183
|
+
| `sf intent buy <ticker> <qty>` | Create buy intent (`--trigger below:28`, `--auto`, `--expire 1d`) |
|
|
184
|
+
| `sf intent sell <ticker> <qty>` | Create sell intent |
|
|
185
|
+
| `sf intent list` | Active intents (`--all` for history) |
|
|
186
|
+
| `sf intent status <id>` | Detailed status + fills |
|
|
187
|
+
| `sf intent cancel <id>` | Cancel an intent |
|
|
188
|
+
| `sf runtime start` | Start execution daemon |
|
|
189
|
+
| `sf runtime stop` | Stop daemon |
|
|
190
|
+
| `sf runtime status` | Active intents + runtime state |
|
|
82
191
|
|
|
83
|
-
### Trading (requires
|
|
192
|
+
### Trading (requires `--enable-trading`)
|
|
84
193
|
|
|
85
194
|
| Command | Description |
|
|
86
195
|
|---------|-------------|
|
|
87
|
-
| `sf buy <ticker> <qty>` | Buy contracts |
|
|
196
|
+
| `sf buy <ticker> <qty>` | Buy contracts (`--price 31`, `--market`, `--side yes\|no`) |
|
|
88
197
|
| `sf sell <ticker> <qty>` | Sell contracts |
|
|
89
198
|
| `sf cancel [orderId]` | Cancel order(s) |
|
|
90
199
|
| `sf rfq <ticker> <qty>` | Request for quote on large orders |
|
|
91
200
|
|
|
92
|
-
###
|
|
201
|
+
### Agent
|
|
93
202
|
|
|
94
203
|
| Command | Description |
|
|
95
204
|
|---------|-------------|
|
|
96
|
-
| `sf
|
|
97
|
-
| `sf
|
|
98
|
-
| `sf
|
|
99
|
-
| `sf
|
|
205
|
+
| `sf agent [id]` | Interactive agent (TUI with panels) |
|
|
206
|
+
| `sf agent [id] --plain` | Readline mode, pipe-friendly |
|
|
207
|
+
| `sf agent [id] --once "prompt"` | Single-shot: run, answer, exit |
|
|
208
|
+
| `sf prompt [id]` | Print dynamic system prompt for any LLM |
|
|
209
|
+
| `sf telegram [--daemon]` | Telegram bot (text + voice messages) |
|
|
210
|
+
|
|
211
|
+
The agent has 30+ tools including market scanning, trading, workspace read/write, X search, self-wake scheduling, and a math calculator. Slash commands inside the agent: `/voice` `/tree` `/edges` `/pos` `/eval` `/balance` `/intents` `/wakes` `/alerts` `/switch` `/model` `/help` `/exit`.
|
|
100
212
|
|
|
101
|
-
###
|
|
213
|
+
### X / Twitter
|
|
102
214
|
|
|
103
215
|
| Command | Description |
|
|
104
216
|
|---------|-------------|
|
|
105
|
-
| `sf
|
|
106
|
-
| `sf
|
|
217
|
+
| `sf x "query"` | Discussion summary + top posts |
|
|
218
|
+
| `sf x-volume "query"` | Discussion volume and velocity trend |
|
|
219
|
+
| `sf x-news "query"` | Grok-aggregated news stories |
|
|
220
|
+
| `sf x-account @username` | Recent posts from a specific account |
|
|
221
|
+
|
|
222
|
+
### Info
|
|
223
|
+
|
|
224
|
+
| Command | Description |
|
|
225
|
+
|---------|-------------|
|
|
226
|
+
| `sf feed` | Evaluation history stream |
|
|
227
|
+
| `sf delta <id>` | Changes since last check |
|
|
228
|
+
| `sf milestones` | Upcoming Kalshi events |
|
|
229
|
+
| `sf schedule` | Exchange status |
|
|
230
|
+
| `sf announcements` | Exchange announcements |
|
|
231
|
+
| `sf history <ticker>` | Historical market data |
|
|
232
|
+
| `sf status` | Full system health check |
|
|
233
|
+
|
|
234
|
+
### Sharing
|
|
235
|
+
|
|
236
|
+
Any command with `--share` generates a short URL:
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
sf scan "gold" --share
|
|
240
|
+
sf query "fed rate" --share
|
|
241
|
+
sf context --share
|
|
242
|
+
```
|
|
107
243
|
|
|
108
244
|
## JSON Output
|
|
109
245
|
|
|
@@ -113,139 +249,121 @@ Most commands support `--json` for machine-readable output:
|
|
|
113
249
|
sf list --json
|
|
114
250
|
sf context f582bf76 --json
|
|
115
251
|
sf edges --json
|
|
116
|
-
sf
|
|
117
|
-
sf
|
|
252
|
+
sf world --json
|
|
253
|
+
sf ideas --json
|
|
254
|
+
sf intent list --json
|
|
118
255
|
```
|
|
119
256
|
|
|
120
257
|
## For AI Agents
|
|
121
258
|
|
|
122
|
-
|
|
259
|
+
If you are an AI agent (Claude, GPT, Cursor, etc.), these are the commands that matter:
|
|
123
260
|
|
|
124
|
-
###
|
|
261
|
+
### Setup
|
|
125
262
|
|
|
126
263
|
```bash
|
|
127
264
|
npm install -g @spfunctions/cli
|
|
128
|
-
sf
|
|
265
|
+
sf login # or: export SF_API_KEY=sf_live_xxx
|
|
266
|
+
sf list # verify: should print theses
|
|
129
267
|
```
|
|
130
268
|
|
|
131
|
-
|
|
132
|
-
```bash
|
|
133
|
-
export SF_API_KEY=sf_live_YOUR_KEY_HERE
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
### Step 2: Verify it works
|
|
269
|
+
### Primary commands
|
|
137
270
|
|
|
138
271
|
```bash
|
|
139
|
-
|
|
140
|
-
|
|
272
|
+
# World state in ~800 tokens — give your agent situational awareness
|
|
273
|
+
sf world --json
|
|
141
274
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
ID Status Conf Updated Title
|
|
145
|
-
f582bf76 active 82% Mar 12 11:13 Oil prices will exceed $100...
|
|
146
|
-
a1b2c3d4 active 65% Mar 11 09:30 Fed will cut rates by June...
|
|
147
|
-
```
|
|
275
|
+
# What changed since last poll — ~30 tokens, efficient for loops
|
|
276
|
+
sf world --delta --json
|
|
148
277
|
|
|
149
|
-
|
|
278
|
+
# Thesis context: causal tree + edges + positions + evaluation
|
|
279
|
+
sf context <thesisId> --json
|
|
150
280
|
|
|
151
|
-
|
|
281
|
+
# Top mispricings across all theses
|
|
282
|
+
sf edges --json
|
|
152
283
|
|
|
153
|
-
|
|
154
|
-
sf
|
|
284
|
+
# Single-shot agent: ask a question, get an answer, exit
|
|
285
|
+
sf agent <thesisId> --once "what is the biggest risk to my portfolio?"
|
|
155
286
|
```
|
|
156
287
|
|
|
157
|
-
|
|
288
|
+
### Key JSON fields
|
|
289
|
+
|
|
290
|
+
`sf context <id> --json` returns:
|
|
158
291
|
|
|
159
292
|
```json
|
|
160
293
|
{
|
|
161
|
-
"
|
|
162
|
-
"thesis": "Oil prices will exceed $100 by end of 2026",
|
|
163
|
-
"title": "Oil Bull Thesis",
|
|
164
|
-
"status": "active",
|
|
165
|
-
"confidence": 0.82,
|
|
294
|
+
"confidence": 0.31,
|
|
166
295
|
"causalTree": {
|
|
167
|
-
"
|
|
168
|
-
"nodes": [
|
|
169
|
-
{
|
|
170
|
-
"id": "n1",
|
|
171
|
-
"label": "Supply disruption",
|
|
172
|
-
"probability": 0.75,
|
|
173
|
-
"importance": 0.6,
|
|
174
|
-
"depth": 0
|
|
175
|
-
}
|
|
176
|
-
]
|
|
296
|
+
"nodes": [{ "id": "n1", "label": "...", "probability": 0.95 }]
|
|
177
297
|
},
|
|
178
|
-
"edges": [
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
"thesisPrice": 55,
|
|
186
|
-
"edge": 20,
|
|
187
|
-
"confidence": 0.8
|
|
188
|
-
}
|
|
189
|
-
],
|
|
190
|
-
"lastEvaluation": {
|
|
191
|
-
"summary": "Supply concerns rising due to...",
|
|
192
|
-
"newConfidence": 0.82,
|
|
193
|
-
"confidenceDelta": 0.03
|
|
194
|
-
}
|
|
298
|
+
"edges": [{
|
|
299
|
+
"marketId": "KXWTIMAX-26DEC31-T140",
|
|
300
|
+
"venue": "kalshi",
|
|
301
|
+
"marketPrice": 62,
|
|
302
|
+
"thesisPrice": 95,
|
|
303
|
+
"edge": 33
|
|
304
|
+
}]
|
|
195
305
|
}
|
|
196
306
|
```
|
|
197
307
|
|
|
198
|
-
**Key fields:**
|
|
199
308
|
- `confidence` — overall thesis probability (0 to 1)
|
|
200
|
-
- `edges[].edge` — mispricing
|
|
201
|
-
- `edges[].marketPrice` — current market price
|
|
202
|
-
- `edges[].thesisPrice` — what the thesis model thinks the price should be
|
|
203
|
-
- `lastEvaluation.summary` — human-readable summary of latest analysis
|
|
309
|
+
- `edges[].edge` — mispricing in cents (positive = market underpriced vs model)
|
|
310
|
+
- `edges[].marketPrice` — current market price (0-100 cents)
|
|
204
311
|
|
|
205
|
-
###
|
|
312
|
+
### Patterns
|
|
206
313
|
|
|
207
314
|
```bash
|
|
208
|
-
#
|
|
209
|
-
sf
|
|
210
|
-
|
|
211
|
-
# View top edges (mispricings) across all theses
|
|
212
|
-
sf edges --json
|
|
213
|
-
|
|
214
|
-
# Search Kalshi markets by keyword
|
|
215
|
-
sf scan "recession" --json
|
|
315
|
+
# Monitor: poll world state, react to deltas
|
|
316
|
+
sf world --delta --json
|
|
216
317
|
|
|
217
|
-
#
|
|
218
|
-
sf
|
|
318
|
+
# React to news: inject signal, re-evaluate, read updated state
|
|
319
|
+
sf signal <id> "Breaking: OPEC cuts production" --type news
|
|
320
|
+
sf evaluate <id>
|
|
321
|
+
sf context <id> --json
|
|
219
322
|
|
|
220
|
-
#
|
|
221
|
-
sf
|
|
323
|
+
# Trade: create intent with trigger, let runtime execute
|
|
324
|
+
sf intent buy KXRECSSNBER-26 5 --price 30 --trigger below:28 --auto
|
|
325
|
+
sf runtime start
|
|
222
326
|
```
|
|
223
327
|
|
|
224
|
-
###
|
|
328
|
+
### Error codes
|
|
225
329
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
330
|
+
| Error | Fix |
|
|
331
|
+
|-------|-----|
|
|
332
|
+
| "API key required" | `sf login` or set `SF_API_KEY` |
|
|
333
|
+
| "Thesis not found" | `sf list` to get valid IDs (8-char prefix works) |
|
|
334
|
+
| "Kalshi not configured" | `sf setup` to add Kalshi credentials |
|
|
335
|
+
| "Trading disabled" | `sf setup --enable-trading` |
|
|
230
336
|
|
|
231
|
-
|
|
232
|
-
```bash
|
|
233
|
-
sf signal <id> "Reuters: Iran nuclear deal collapses" --type news
|
|
234
|
-
sf evaluate <id> # trigger re-evaluation after injecting signal
|
|
235
|
-
sf context <id> --json # read updated state
|
|
236
|
-
```
|
|
337
|
+
## Architecture
|
|
237
338
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
339
|
+
```
|
|
340
|
+
You ──→ sf agent ──→ LLM (Claude/GPT) ──→ 30+ tools
|
|
341
|
+
│ │
|
|
342
|
+
│ ┌────────────────────────┘
|
|
343
|
+
▼ ▼
|
|
344
|
+
┌─────────────────────┐
|
|
345
|
+
│ SF API Server │
|
|
346
|
+
│ thesis · edges · │
|
|
347
|
+
│ intents · eval · │
|
|
348
|
+
│ proxy (LLM/TTS) │
|
|
349
|
+
└────────┬────────────┘
|
|
350
|
+
│
|
|
351
|
+
┌────────┴────────┐
|
|
352
|
+
│ │
|
|
353
|
+
┌────▼────┐ ┌──────▼──────┐
|
|
354
|
+
│ Kalshi │ │ Polymarket │
|
|
355
|
+
│ API │ │ API │
|
|
356
|
+
└─────────┘ └─────────────┘
|
|
357
|
+
|
|
358
|
+
Local only (never leaves your machine):
|
|
359
|
+
~/.sf/config.json — API keys, Kalshi private key path
|
|
360
|
+
~/.sf/workspace/ — agent scratchpad (notes, context logs)
|
|
361
|
+
~/.sf/wake/ — scheduled agent wake conditions
|
|
362
|
+
~/.sf/bus/ — daemon ↔ agent message bus
|
|
363
|
+
~/.sf/trade-journal.jsonl — local trade log
|
|
241
364
|
```
|
|
242
365
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
- **"API key required"** — set `SF_API_KEY` env var or run `sf setup --key <key>`
|
|
246
|
-
- **"Thesis not found"** — use `sf list` to get valid thesis IDs. IDs can be short prefixes (first 8 chars)
|
|
247
|
-
- **"Kalshi not configured"** — positions/trading commands need Kalshi credentials via `sf setup`
|
|
248
|
-
- **Exit code 0** — success. **Exit code 1** — error (message printed to stderr)
|
|
366
|
+
**Kalshi credentials never leave your machine.** Orders are signed locally with your RSA private key and sent directly to the Kalshi API. The SF server never sees your trading keys.
|
|
249
367
|
|
|
250
368
|
## Local Development
|
|
251
369
|
|
|
@@ -254,6 +372,10 @@ cd cli
|
|
|
254
372
|
npm install
|
|
255
373
|
npm run dev -- list # run without building
|
|
256
374
|
npm run build # compile to dist/
|
|
257
|
-
npm run test # run
|
|
375
|
+
npm run test # run tests
|
|
258
376
|
npm link # install as global 'sf' command
|
|
259
377
|
```
|
|
378
|
+
|
|
379
|
+
## License
|
|
380
|
+
|
|
381
|
+
MIT
|