sigrank 0.11.4

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Deric J. McHenry / Ello Cello LLC
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,301 @@
1
+ <div align="center">
2
+
3
+ ```
4
+ ███████ ██ ██████ ██████ █████ ███ ██ ██ ██
5
+ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██
6
+ ███████ ██ ██ ███ ██████ ███████ ██ ██ ██ █████
7
+ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
8
+ ███████ ██ ██████ ██ ██ ██ ██ ██ ████ ██ ██
9
+ ```
10
+
11
+ ◈ ─────────────────────────────────────────── ◈
12
+
13
+ # SigRank MCP
14
+
15
+ **The yield cascade + live leaderboard as MCP tools any agent can call.**
16
+
17
+ For all builders, burners and 10xers.
18
+
19
+ [![npm version](https://img.shields.io/npm/v/sigrank.svg?style=flat-square&color=gold)](https://www.npmjs.com/package/sigrank)
20
+ [![npm downloads](https://img.shields.io/npm/dm/sigrank.svg?style=flat-square&color=blue)](https://www.npmjs.com/package/sigrank)
21
+ [![CI](https://github.com/SunrisesIllNeverSee/sigrank-mcp/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/SunrisesIllNeverSee/sigrank-mcp/actions/workflows/ci.yml)
22
+ [![license](https://img.shields.io/badge/license-MIT-green.svg?style=flat-square)](./LICENSE)
23
+ [![platform](https://img.shields.io/badge/platform-node-grey.svg?style=flat-square)](https://nodejs.org)
24
+ [![live](https://img.shields.io/badge/board-signalaf.com-gold.svg?style=flat-square)](https://signalaf.com)
25
+
26
+ </div>
27
+
28
+ ---
29
+
30
+ Token-only. No auth. No transcript content. Privacy-preserving by design.
31
+
32
+ Dual-mode package: **interactive CLI dashboard** for operators, **MCP stdio server** for AI clients.
33
+
34
+ ```bash
35
+ npm install -g sigrank
36
+ sigrank # launches the full tabbed TUI (TTY detected automatically)
37
+ ```
38
+
39
+ Or one-shot without installing:
40
+
41
+ ```bash
42
+ npx sigrank board --once
43
+ ```
44
+
45
+ ## Install from GitHub
46
+
47
+ ```bash
48
+ git clone https://github.com/SunrisesIllNeverSee/sigrank-mcp.git
49
+ cd sigrank-mcp
50
+ npm install
51
+
52
+ # Run CLI
53
+ node index.mjs # TUI (if TTY)
54
+ node cli.mjs board --once # leaderboard one-shot
55
+
56
+ # Or link globally for `sigrank` command
57
+ npm link
58
+ sigrank
59
+ ```
60
+
61
+ **Repo:** [`SunrisesIllNeverSee/sigrank-mcp`](https://github.com/SunrisesIllNeverSee/sigrank-mcp)
62
+ **Site:** [signalaf.com](https://signalaf.com)
63
+ **npm:** [sigrank](https://www.npmjs.com/package/sigrank)
64
+
65
+ ---
66
+
67
+ ## Commands
68
+
69
+ ```
70
+ ⊙ SigRank CLI v0.11.2
71
+
72
+ Default (no args)
73
+ sigrank unified dashboard: cascade + token pillars + board
74
+
75
+ Commands
76
+ enroll sign in: paste a connect code (get one at signalaf.com → Settings)
77
+ submit publish your verified runs to the board (sign in first)
78
+ board live leaderboard (refreshes every 30s)
79
+ board --window 7d board for a specific window (7d, 30d, 90d, all)
80
+ board --once print once and exit
81
+ me single-platform cascade (claude by default)
82
+ me --platform codex use a different platform adapter
83
+ compare raw pillar audit: tokenpull vs ccusage vs token-dash vs tokscale
84
+ compare --platform codex compare for a specific platform
85
+ tui full tabbed TUI: Dashboard / Trends / Compare / Board / Watch / Connect
86
+ tui --platform codex TUI with a different default platform
87
+ watch live tune meter — re-reads local logs every 30s
88
+ watch --window 7d watch a specific window
89
+
90
+ Options
91
+ --window 7d · 30d · 90d · all (default: 30d for board, 7d for watch)
92
+ --platform claude · codex · amp · gemini · opencode · goose · …
93
+ --refresh poll interval in seconds (default: 30)
94
+ --once print once and exit (board only)
95
+
96
+ For AI clients (not typeable)
97
+ In a piped/non-TTY context, sigrank is an MCP stdio server.
98
+ AI clients (Claude, Cursor, …) call its tools automatically — these are
99
+ NOT shell commands. Humans use the commands above.
100
+
101
+ Examples
102
+ sigrank # unified dashboard
103
+ sigrank board # live leaderboard
104
+ sigrank compare # pillar audit (claude)
105
+ sigrank compare --platform codex
106
+ sigrank me --platform codex
107
+ sigrank watch --window 7d --refresh 60
108
+ sigrank board --window all --once
109
+ ```
110
+
111
+ ### The TUI is the whole app
112
+
113
+ Launch it and sign in inside it:
114
+
115
+ ```
116
+ npx sigrank
117
+ ```
118
+
119
+ Six tabs. Keys: `1`-`6` or `←` `→` to switch · `R` refresh · `Q` quit.
120
+
121
+ | Tab | Key | Content |
122
+ |---|---|---|
123
+ | **Dashboard** | `1` | Cascade table (all platforms × windows + combined) · Υ sparklines · token composition bars · mini board |
124
+ | **Trends** | `2` | Every metric across windows — sub-views: You / Platform / Field |
125
+ | **Compare** | `3` | 4-source pillar audit (tokenpull vs ccusage vs token-dash vs tokscale) · delta % · cascade metrics per source · cache read bar chart |
126
+ | **Board** | `4` | Full leaderboard with all fields · `[W]` cycles window (7d/30d/90d/all) |
127
+ | **Watch** | `5` | In-TUI landing panel · `[Enter]` launches the live watcher (big numbers + pillar bars + Υ trend, auto-refreshes 30s) |
128
+ | **Connect** | `6` | Sign in / switch device — paste a connect code from signalaf.com → Settings. Then `[S]` submits. |
129
+
130
+ ### Sign in + submit
131
+
132
+ ```bash
133
+ sigrank enroll # sign in: paste a connect code (get one at signalaf.com → Settings)
134
+ sigrank submit # publish your verified runs to the board (sign in first)
135
+ ```
136
+
137
+ Or do it inside the TUI on the **Connect** tab (`6`), then press `[S]` to submit.
138
+
139
+ ---
140
+
141
+ ## MCP Server mode
142
+
143
+ When stdout is not a TTY (i.e. piped to an AI client), `sigrank` starts an MCP stdio server automatically. AI clients (Claude Code, Cursor, Windsurf, etc.) use this path.
144
+
145
+ Add to `.mcp.json` or equivalent:
146
+ ```json
147
+ {
148
+ "mcpServers": {
149
+ "sigrank": {
150
+ "command": "npx",
151
+ "args": ["-y", "sigrank"]
152
+ }
153
+ }
154
+ }
155
+ ```
156
+ Or if installed globally:
157
+ ```json
158
+ {
159
+ "mcpServers": {
160
+ "sigrank": {
161
+ "command": "sigrank"
162
+ }
163
+ }
164
+ }
165
+ ```
166
+
167
+ ### MCP Tools
168
+
169
+ | Tool | Args | What |
170
+ |---|---|---|
171
+ | `rank_paste(text)` | `{input, output, cacheCreate, cacheRead}` JSON or 4 whitespace-delimited numbers | Scores token pillars → Υ Yield / SNR / Leverage / Velocity / 10xDEV / Class + prose narration card |
172
+ | `get_leaderboard()` | `{window?}` | Live board from signalaf.com — sorted by Υ Yield |
173
+ | `get_operator(codename)` | `{codename}` | One operator's live profile |
174
+ | `submit_paste(text, codename)` | `{text, codename?}` | Rank locally then POST to board. Omit codename for preview-only |
175
+ | `tokenpull(platform?)` | `{platform?}` | On-device local reader: scans local logs → 4-window cascade. Zero paste, token-only |
176
+ | `tokenpull_submit(codename, window?)` | `{codename?, window?}` | `tokenpull` → publish to board. Omit codename for preview |
177
+ | `tokenpull_compare(platform?)` | `{platform?}` | All four sources side-by-side: tokenpull + ccusage + token-dash + tokscale. Returns pillars, cascade metrics, and delta % vs tokenpull per window |
178
+ | `rank_windows` | `{platform?, window?}` | Multi-window cascade from local logs |
179
+ | `watch_tokenpull` | `{platform?, interval_s?}` | Streaming cascade snapshots |
180
+
181
+ ---
182
+
183
+ ## Cascade math
184
+
185
+ ```
186
+ Υ Yield = (cache_read × output) / input²
187
+ SNR = output / (input + output)
188
+ Leverage = cache_read / input
189
+ Velocity = output / input
190
+ 10xDEV = log₁₀(leverage)
191
+ ```
192
+
193
+ Math is in `cascade.mjs`, dependency-free. Mirrors `sigrank-app/lib/ingest/bridge.ts`.
194
+ Canon check: `MO§ES (1251211, 11296121, 128196310, 2555179769) → Υ 18436.98`.
195
+
196
+ ---
197
+
198
+ ## Token Pillars — sources
199
+
200
+ The dashboard pulls from multiple sources and shows them side-by-side for verification:
201
+
202
+ | Source | What | Platform |
203
+ |---|---|---|
204
+ | `tokenpull` | On-device JSONL scanner (canon source) | claude, codex, amp, … |
205
+ | `ccusage` | `ccusage <platform> daily --json` CLI | claude, codex |
206
+ | `token-dashboard` | `~/.claude/token-dashboard.db` SQLite | claude only |
207
+ | `tokscale` | `~/tokscale_report.json` export | claude, codex |
208
+
209
+ **Codex input is estimated** — Codex logs don't expose true input tokens directly. The formula:
210
+ ```
211
+ input = output × ioRatio (ioRatio derived from Claude ratio, else 2.0)
212
+ cacheCreate = uncached − input (uncached = input_tokens − cached_input_tokens)
213
+ cacheRead = exact (from logs)
214
+ ```
215
+ Verifier numbers (ccusage/tokscale for codex) show **raw uncached input** (`input_tokens − cached`) — a different field than the estimated input above. The discrepancy is expected and explained inline in the dashboard.
216
+
217
+ ---
218
+
219
+ ## Platform adapters
220
+
221
+ All adapters are token-only (no message content, no cost fields, no credentials).
222
+
223
+ | Platform | Path | Notes |
224
+ |---|---|---|
225
+ | Claude Code | ✅ `~/.claude/projects` | Native; dedup by `(session_id, message_id)`; subagents included |
226
+ | Codex | ✅ `~/.codex/sessions` | Estimated input via `io_ratio`; verified vs ccusage |
227
+ | Amp | ✅ `~/.local/share/amp/threads` | Full 4-pillar; per-message |
228
+ | Kimi | ✅ `~/.kimi/sessions` | Full 4-pillar; `StatusUpdate` lines only |
229
+ | pi-agent | ✅ `~/.pi/agent/sessions` | Full 4-pillar; per-message JSONL |
230
+ | OpenClaw | ✅ `~/.openclaw` | Full 4-pillar; per-message JSONL |
231
+ | Droid | ✅ `~/.factory/sessions/*.settings.json` | Full 4-pillar; thinking→output |
232
+ | Codebuff | ✅ `~/.config/manicode` | Full 4-pillar; `chat-messages.json` |
233
+ | Hermes | ✅ `~/.hermes/state.db` | Full 4-pillar; SQLite; reasoning→output |
234
+ | Kilo | ✅ `~/.local/share/kilo/kilo.db` | Full 4-pillar; SQLite |
235
+ | Qwen | ✅ `~/.qwen/projects` | `cacheCreate=0` estimated; thought→output |
236
+ | Goose | ✅ `~/.local/share/goose/sessions/sessions.db` | `cacheCreate=cacheRead=0` estimated; SQLite |
237
+ | Gemini CLI | ✅ `~/.gemini/tmp` | `cacheCreate=0` estimated; cache extracted from input field |
238
+ | GitHub Copilot CLI | ✅ `~/.copilot/otel` | OTel JSONL; requires `COPILOT_OTEL_ENABLED=true` |
239
+ | OpenCode | ⚠️ `~/.local/share/opencode` | Raw token counts not persisted in log format |
240
+ | Cursor | 🔜 | Chat log path TBD |
241
+ | Windsurf | 🔜 | Session logs at `~/.codeium/windsurf/` |
242
+
243
+ `estimated=true` means one or more pillars are derived, not native. The server re-scores all submitted pillars authoritatively; local preview Υ is indicative only.
244
+
245
+ ---
246
+
247
+ ## Privacy
248
+
249
+ - **Token-only, always.** No message content is ever read, logged, or transmitted — only token counts (`input`, `output`, `cache_creation`, `cache_read`), message IDs, and timestamps.
250
+ - **Local by default.** `tokenpull` reads only `~/.claude/projects` (Claude) or `~/.codex` (Codex) on your device. Numbers stay on your machine unless you explicitly submit with a codename.
251
+ - **Background tooling excluded.** Memory plugins, observers, summarizers (e.g. `claude-mem`, `mem0`, `observer-sessions`) are filtered from both Claude and Codex reads. `subagents/` are kept — they represent real operator work.
252
+ - **No auth required.** All board reads and the submit path are anonymous.
253
+
254
+ ---
255
+
256
+ ## Env vars
257
+
258
+ | Var | Default | Description |
259
+ |---|---|---|
260
+ | `SIGRANK_API_BASE` | `https://signalaf.com` | Override the board host |
261
+ | `SIGRANK_FETCH_TIMEOUT_MS` | `10000` | Board API fetch timeout |
262
+
263
+ ---
264
+
265
+ ## Dev / test
266
+
267
+ ```bash
268
+ node test.mjs # 29 unit tests (no network, no fs writes)
269
+ node index.mjs # stdio MCP server directly (pipe to MCP client)
270
+ ```
271
+
272
+ Tests verify (29 assertions):
273
+ - `rank_paste` canon: MO§ES `(1251211, 11296121, 128196310, 2555179769)` → Υ 18436.98 · TRANSMITTER
274
+ - `submit_paste` preview (no codename) + POST shape (injected fetch, no live writes)
275
+ - `tokenpull` dedup, window slicing, 4-window pillars (mock adapter)
276
+ - `tokenpull_submit` all 4 windows POST, sha256 hash, ddmmyy stamp
277
+ - `tokenpullCodex` io_ratio conversion per-window
278
+ - Adapter registry (15 platforms) + per-adapter shape contracts
279
+ - `rank_windows` 4-window paste scoring, partial input, no-network
280
+ - `watch_tokenpull` cascade snapshot, interval_s, TODO(AUTH.WIRE) stub
281
+ - Hardening: div-by-zero guards, parsePillars warnings, fetch timeout, EXCLUDE_TOOLING regex, narrate safety
282
+
283
+ ---
284
+
285
+ ## File map
286
+
287
+ | File | Responsibility |
288
+ |---|---|
289
+ | `index.mjs` | Entry point — TTY detection, routes to CLI or MCP server |
290
+ | `cli.mjs` | CLI commands: board, me, compare, watch, enroll, submit, help |
291
+ | `tui.mjs` | Full tabbed TUI: Dashboard / Trends / Compare / Board / Watch / Connect |
292
+ | `cascade.mjs` | Pure cascade math (Υ, SNR, leverage, velocity, 10xDEV, class) |
293
+ | `tokenpull.mjs` | On-device log scanner — Claude, Codex, multi-platform |
294
+ | `adapters.mjs` | Platform adapter registry (15+ platforms) |
295
+ | `tools.mjs` | MCP tool table + dispatcher |
296
+ | `connect.mjs` | Connect-code enrollment + device identity |
297
+ | `keystore.mjs` | Local key management (paste-keys, not API keys) |
298
+ | `submit.mjs` | Verified submit flow (signs + POSTs to board) |
299
+ | `sign.mjs` | Schema 1.0 signing (X-Agent-Signature) |
300
+ | `narrate.mjs` | Deterministic prose narration card |
301
+ | `test.mjs` | Unit tests (no external deps) |