claude-token-saver 3.44.0 → 3.55.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.
- package/LICENSE +202 -21
- package/NOTICE +35 -0
- package/README.ko.md +150 -48
- package/README.md +205 -192
- package/bin/cli.js +108 -39
- package/docs/CODEX.ko.md +184 -0
- package/docs/CODEX.md +497 -0
- package/examples/statusline-command.ps1 +11 -5
- package/examples/statusline-command.sh +9 -4
- package/package.json +20 -6
- package/presets/delegation/bounds.md +29 -0
- package/presets/model-rules.json +50 -9
- package/presets/ratchet-rules.json +4 -1
- package/src/agent.js +33 -0
- package/src/caps-cache.js +6 -2
- package/src/changelog.js +70 -0
- package/src/cli-name.js +25 -0
- package/src/codex-brief.js +89 -0
- package/src/codex-budget.js +73 -0
- package/src/codex-cache-policy.js +203 -0
- package/src/codex-cache.js +46 -0
- package/src/codex-delegation.js +154 -0
- package/src/codex-doc2md-ledger.js +45 -0
- package/src/codex-doc2md.js +99 -0
- package/src/codex-doctor.js +53 -0
- package/src/codex-harness.js +200 -0
- package/src/codex-hooks.js +138 -0
- package/src/codex-installer.js +79 -0
- package/src/codex-ledger.js +143 -0
- package/src/codex-panel-launcher.js +48 -0
- package/src/codex-panel-runner.js +74 -0
- package/src/codex-panel-session.js +35 -0
- package/src/codex-panel-setup.js +98 -0
- package/src/codex-panel-shell.js +51 -0
- package/src/codex-panel-state.js +40 -0
- package/src/codex-panel.js +448 -0
- package/src/codex-parser.js +397 -0
- package/src/codex-route-scan.js +171 -0
- package/src/commands/brief.js +24 -1
- package/src/commands/codex-delegate.js +59 -0
- package/src/commands/codex.js +579 -0
- package/src/commands/delegate.js +133 -0
- package/src/commands/harness.js +16 -3
- package/src/commands/install.js +109 -12
- package/src/commands/korean.js +2 -2
- package/src/commands/mode.js +22 -2
- package/src/commands/profile-map.js +164 -0
- package/src/commands/route-scan.js +74 -7
- package/src/commands/seed.js +16 -12
- package/src/commands/uninstall.js +28 -4
- package/src/commands/upgrade.js +13 -0
- package/src/compact-window.js +7 -1
- package/src/config.js +22 -3
- package/src/cost.js +34 -0
- package/src/delegation-guard.js +278 -0
- package/src/doc2md-ledger.cjs +3 -3
- package/src/doc2md.cjs +72 -28
- package/src/effort-palette.js +145 -0
- package/src/formatters/statusline.js +352 -123
- package/src/formatters/table.js +5 -4
- package/src/gateway-auth.js +86 -0
- package/src/glyphs.js +103 -0
- package/src/handoff.js +27 -7
- package/src/harness-analyzer.cjs +7 -2
- package/src/harness-templates.js +33 -1
- package/src/harness.js +51 -17
- package/src/hook-manager.js +42 -14
- package/src/hook.cjs +34 -2
- package/src/installer.js +300 -16
- package/src/litellm-budget.js +38 -67
- package/src/litellm-models.js +264 -0
- package/src/model-alias.js +170 -16
- package/src/model-rules.js +53 -17
- package/src/parser.js +89 -1
- package/src/preset-ratchet.js +133 -0
- package/src/route-inject.js +161 -0
- package/src/route-scan.js +68 -8
- package/src/seed-rules.js +117 -55
- package/src/session-paths.js +242 -0
- package/src/statusline-mode.js +106 -0
- package/src/stdin-payload.js +40 -0
- package/src/ultracode.js +202 -0
- package/src/update-check.js +217 -3
- package/src/window-labels.js +19 -8
package/README.md
CHANGED
|
@@ -10,231 +10,227 @@
|
|
|
10
10
|
<img alt="Sprag" src="https://raw.githubusercontent.com/rootstudioyaml/sprag/main/site/assets/logo/sprag-lockup-light.svg" width="220">
|
|
11
11
|
</picture>
|
|
12
12
|
|
|
13
|
-
**
|
|
13
|
+
**Cut the tokens Claude Code and Codex spend, from the first session.**
|
|
14
14
|
|
|
15
15
|
[](https://www.npmjs.com/package/sprag-cli)
|
|
16
|
-
[](https://www.npmjs.com/package/sprag-cli)
|
|
17
|
+
[](./LICENSE)
|
|
18
18
|
|
|
19
|
-
[
|
|
19
|
+
[English](https://github.com/rootstudioyaml/sprag/blob/main/README.md) · [한국어](https://github.com/rootstudioyaml/sprag/blob/main/README.ko.md)
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
[sprag.io](https://sprag.io) · [Benchmark](https://github.com/rootstudioyaml/sprag/blob/main/docs/BENCHMARK.md)
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
<a href="https://sprag.io/assets/video/sprag-compare-en.mp4"><img src="https://raw.githubusercontent.com/rootstudioyaml/sprag/main/docs/sprag-compare-en.gif" width="760" alt="Two terminals receive the same twelve requests. With Sprag, lookups and test runs go to cheaper models and documents go in as Markdown; the day ends at $1.83 against $6.68 without Sprag."></a>
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
Same 12 requests, two terminals: **$6.68 → $1.83 (−72.6%)** with Sprag.<br>
|
|
26
|
+
<sub>Example requests priced at public list rates. <a href="https://sprag.io/assets/video/sprag-compare-en.mp4">Full video (41s)</a></sub>
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
<summary><strong>🇰🇷 한국어로 보기 (클릭하면 한국어 전문이 펼쳐집니다)</strong></summary>
|
|
28
|
+
</div>
|
|
30
29
|
|
|
31
30
|
---
|
|
32
31
|
|
|
33
|
-
|
|
32
|
+
**Sprag saves tokens without changing how you work.** Lookups, checks and test
|
|
33
|
+
runs go to a cheaper model, documents reach the context as compact Markdown (a
|
|
34
|
+
540k-token deck becomes 23k tokens), and the statusline shows what each session
|
|
35
|
+
spent and saved while it runs. `npm i -g sprag-cli` sets it all up; nothing to
|
|
36
|
+
configure per project.
|
|
37
|
+
|
|
38
|
+
Sprag is named after the sprag clutch: forward motion passes, backspin locks.
|
|
39
|
+
Your agent keeps working, it just stops regressing.
|
|
34
40
|
|
|
35
|
-
|
|
41
|
+
It reads the sessions you already ran, and what it finds there holds for every
|
|
42
|
+
session after. Repeated failures become rules loaded at session start. Work that
|
|
43
|
+
a cheaper tier has never got wrong goes to a sub-agent on that tier, and every
|
|
44
|
+
delegated run writes its own price difference to a ledger. Cache and rate-limit
|
|
45
|
+
trouble reaches your statusline while you can still act on it.
|
|
36
46
|
|
|
37
|
-
|
|
47
|
+
Session analysis runs locally on the logs Claude Code and Codex already write.
|
|
48
|
+
No extra model calls or API key are needed for analysis. Optional Codex gateway
|
|
49
|
+
budget and price lookups contact your configured LiteLLM endpoint using its
|
|
50
|
+
existing credentials. The CLI requires Node.js 18+ and one TOML parser dependency.
|
|
38
51
|
|
|
39
52
|
```bash
|
|
40
|
-
npm i -g sprag-cli #
|
|
53
|
+
npm i -g sprag-cli # Claude Code, plus Codex when it is installed
|
|
41
54
|
```
|
|
42
55
|
|
|
43
|
-
|
|
56
|
+
## Codex
|
|
44
57
|
|
|
45
|
-
|
|
58
|
+
Native hooks, an `AGENTS.md` harness, scoped ratchet rules, Korean lint,
|
|
59
|
+
document conversion, token reports, and a session-bound companion panel.
|
|
60
|
+
`npm i -g sprag-cli` sets Codex up too when it is installed, with the rule
|
|
61
|
+
presets registered globally and nothing asked (`sprag install --manual` asks at
|
|
62
|
+
each step). For a Codex-only install that leaves Claude Code alone:
|
|
46
63
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
티어 기준 라우터 59.1% ← 최고 $268 ▰▰▰▰▰▱▱▱▱▱▱▱▱▱▱
|
|
57
|
-
gpt-5 57.8% $388 ▰▰▰▰▰▰▰▰▱▱▱▱▱▱▱
|
|
58
|
-
gemini-2.5-pro 57.9% $734 ▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰
|
|
64
|
+
```bash
|
|
65
|
+
npm i -g sprag-cli --ignore-scripts
|
|
66
|
+
sprag install --agent codex
|
|
67
|
+
sprag --agent codex --days 7
|
|
68
|
+
sprag panel --agent codex # live companion in a separate terminal
|
|
69
|
+
sprag --statusline --agent codex --text
|
|
70
|
+
sprag doctor --agent codex # troubleshooting only
|
|
71
|
+
sprag route-scan --agent codex
|
|
72
|
+
sprag seed --agent codex
|
|
59
73
|
```
|
|
60
74
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
75
|
+
Review and trust the new hooks in Codex's `/hooks` menu; Codex requires that
|
|
76
|
+
step. Commands still default to Claude Code; add `--agent codex` to pick Codex.
|
|
77
|
+
Codex also supports session briefings, warning history, handoffs, and opt-in
|
|
78
|
+
model routing and subagent guidance (`sprag delegate on --agent codex`). The native Codex footer
|
|
79
|
+
does not accept shell commands; Sprag provides a terminal statusline and panel.
|
|
80
|
+
Recurring simple turns become route candidates; repeated tool failures become
|
|
81
|
+
ratchet candidates. Both require your approval before a rule is registered.
|
|
82
|
+
`seed` offers compatible starter rules with separate Codex decisions.
|
|
83
|
+
`sprag route-scan savings --agent codex` records only Sprag-routed child runs
|
|
84
|
+
and estimates their price difference when matching LiteLLM prices are available.
|
|
85
|
+
It is not a billing measurement. Unknown prices remain `n/a`, and Codex document
|
|
86
|
+
counts stay separate from Claude estimates. The historical dollar figures below
|
|
87
|
+
are from Claude Code, not a Codex benchmark. See [Codex support and limits](https://sprag.io/docs/codex/), or run
|
|
88
|
+
`sprag capabilities --agent codex` for the support matrix.
|
|
89
|
+
|
|
90
|
+
| Workflow | Claude Code | Codex |
|
|
66
91
|
|---|---|---|
|
|
67
|
-
|
|
|
68
|
-
|
|
|
69
|
-
|
|
|
70
|
-
|
|
|
71
|
-
|
|
|
72
|
-
| 🇰🇷 **문체 게이트** | 쓰는 시점에 hook으로 검사합니다. 이중 피동과 번역투, 문장 연결을 살핍니다. | [문체 지침](https://github.com/rootstudioyaml/sprag/blob/main/docs/KOREAN-STYLE.md) |
|
|
73
|
-
|
|
74
|
-
실측 −18.6%는 하네스와 래칫의 몫이고, 라우팅과 문서 변환 절감액은 그 위에 얹힙니다. 두 절감액은 성격이 달라서 한 숫자로 합치지 않습니다.
|
|
75
|
-
|
|
76
|
-
## statusline 한 줄로 보는 상태
|
|
77
|
-
|
|
78
|
-
```
|
|
79
|
-
🔀 라우팅 절감 $2.09 | fable→sonnet 1회 $0.72 · opus→haiku 1회 $0.57
|
|
80
|
-
🚨 5H █████▓ 94% 🔄 12:36 · 🅷 5/5 · 🤖 Opus 5 · 🧠 Cache hit 98.8% · ⏳ Cache expires 59:46 · 📅 weekly ██▒░░░ 38% · 💵 Sep $42 · 📦 Ctx 47% of 1M
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
문제가 생기면 경고 칩이 줄 맨 앞으로 옵니다. `🚨 5H/7D NN%`, `⚠ Ctx 500k+`, `⚠ Cache miss`, `⚠ Input spike`, `⚠ Output heavy`, `⚠ Call surge`, `⚠ Rebuild churn`, `⚠ 5m TTL` 여덟 가지이며, 칩 문구를 그대로 말하면 Skill이 원인 코드와 조치 순서를 꺼내 줍니다. 세그먼트별 의미와 색 기준은 [statusline 문서](https://github.com/rootstudioyaml/sprag/blob/main/docs/STATUSLINE.md)에 정리했습니다.
|
|
84
|
-
|
|
85
|
-
## 실제 효과: 도입 전후 리포트
|
|
92
|
+
| Session instructions | `CLAUDE.md` and hooks | `AGENTS.md` and native hooks |
|
|
93
|
+
| Live telemetry | Native statusline command | Companion panel or tmux layout |
|
|
94
|
+
| Rule candidates | Claude transcripts and tier presets | Codex rollouts and compatible ratchet presets |
|
|
95
|
+
| Model routing | Haiku/Sonnet tier rules | Explicit provider model IDs and scoped rules |
|
|
96
|
+
| Routing ledger | Claude run estimates | Attributed child estimates with LiteLLM prices |
|
|
86
97
|
|
|
87
|
-
|
|
98
|
+
Both integrations coexist. Commands without `--agent codex` retain Claude behavior.
|
|
88
99
|
|
|
89
|
-
|
|
100
|
+

|
|
90
101
|
|
|
91
|
-
|
|
92
|
-
|---|---:|---:|---:|
|
|
93
|
-
| 메시지당 비용 | $2.345 | $1.910 | **−18.6%** |
|
|
94
|
-
| 메시지당 출력 토큰 | 7,391 | 6,052 | −18.1% |
|
|
95
|
-
| 메시지당 assistant 왕복 | 9.73 | 8.83 | −9.2% |
|
|
96
|
-
| 메시지당 도구 호출 | 5.72 | 5.25 | −8.2% |
|
|
102
|
+
## How it works
|
|
97
103
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
| 명령 | 하는 일 |
|
|
103
|
-
|---|---|
|
|
104
|
-
| `sprag` | 최근 1일 진단 리포트 |
|
|
105
|
-
| `sprag handoff` | 한도에 막히기 전에 작업 상태를 백업 |
|
|
106
|
-
| `sprag route-scan` | 내 기록에서 위임 후보 찾기 (LLM 호출 0회) |
|
|
107
|
-
| `sprag route-scan savings` | 라우팅 절감 원장 조회 |
|
|
108
|
-
| `sprag harness check` | 🅷 하네스 점수 확인 |
|
|
109
|
-
| `sprag doc2md <파일>` | 문서 한 건을 Markdown 으로 변환 |
|
|
110
|
-
|
|
111
|
-
전체 명령과 옵션, 출력 언어 설정은 [명령 문서](https://github.com/rootstudioyaml/sprag/blob/main/docs/COMMANDS.md)에 있습니다.
|
|
112
|
-
|
|
113
|
-
## 더 깊은 내용
|
|
114
|
-
|
|
115
|
-
| 문서 | 다루는 내용 |
|
|
116
|
-
|---|---|
|
|
117
|
-
| [설치와 기본 설정](https://github.com/rootstudioyaml/sprag/blob/main/docs/INSTALL.md) | 설치 직후 켜지는 기능, 직접 켜야 하는 기능, 끄는 방법 |
|
|
118
|
-
| [statusline](https://github.com/rootstudioyaml/sprag/blob/main/docs/STATUSLINE.md) | 세그먼트 의미, 경고 칩, 토큰 급증 원인 코드, 업데이트 안내 |
|
|
119
|
-
| [명령](https://github.com/rootstudioyaml/sprag/blob/main/docs/COMMANDS.md) | 전체 서브커맨드와 CLI 옵션 |
|
|
120
|
-
| [Harness](https://github.com/rootstudioyaml/sprag/blob/main/docs/HARNESS.md) | 5원칙, 래칫 승격, compact-window 고정, seed 프리셋 |
|
|
121
|
-
| [route-scan](https://github.com/rootstudioyaml/sprag/blob/main/docs/ROUTE_SCAN.md) | 티어 판정, 룰 파일 구조, 스캔 시점, 서브에이전트 설정 |
|
|
122
|
-
| [티어 판별 기준](https://github.com/rootstudioyaml/sprag/blob/main/docs/TIER_CRITERIA.md) | T0·T1·T2 를 가르는 근거와 연구 출처 |
|
|
123
|
-
| [벤치마크](https://github.com/rootstudioyaml/sprag/blob/main/docs/BENCHMARK.md) | LLMRouterBench 11,696문항 재현 결과 |
|
|
124
|
-
| [doc2md](https://github.com/rootstudioyaml/sprag/blob/main/docs/DOC2MD.md) | 변환 대상 포맷, 절감 근거, 문서 수정 절차, DRM 문서 |
|
|
125
|
-
| [한국어 문체 지침](https://github.com/rootstudioyaml/sprag/blob/main/docs/KOREAN-STYLE.md) | 주입 내용, 쓰기 시점 검사, 적용 전후 비교 |
|
|
126
|
-
| [라우터가 아닌 이유](https://github.com/rootstudioyaml/sprag/blob/main/docs/NOT-A-ROUTER.md) | 실시간 라우팅이 캐시를 깨서 비용을 키우는 구조 |
|
|
127
|
-
| [게이트웨이와 환경](https://github.com/rootstudioyaml/sprag/blob/main/docs/GATEWAYS.md) | Bedrock·Vertex·LiteLLM, 가격표, FAQ, 동작 원리 |
|
|
128
|
-
|
|
129
|
-
## 릴리스 노트
|
|
130
|
-
|
|
131
|
-
전체 내역은 [CHANGELOG.md](./CHANGELOG.md)로 옮겼습니다. 최근 변경은 다음과 같습니다.
|
|
104
|
+
<picture>
|
|
105
|
+
<source srcset="https://raw.githubusercontent.com/rootstudioyaml/sprag/main/docs/how-it-works.svg" type="image/svg+xml">
|
|
106
|
+
<img src="https://raw.githubusercontent.com/rootstudioyaml/sprag/main/docs/how-it-works.png" alt="What goes in: your past sessions, the task you just asked for, a document you would attach, Korean prose being written, and the tokens this turn is spending. What sprag does with it: writes a ratchet rule loaded every session, converts the document, checks the Korean as you write, prints the cost in your prompt, and routes a matched task to a haiku or sonnet sub-agent whose output the main agent reviews.">
|
|
107
|
+
</picture>
|
|
132
108
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
- **v3.34.0**: seed 프리셋 제안, 설치 시 출력 언어 선택, 컨텍스트 경고 500k 상향. 상세는 CHANGELOG 참고.
|
|
109
|
+
Everything on the left is something your session already produces. Nothing is
|
|
110
|
+
sent anywhere to read it. The tier decision at the bottom is the whole routing
|
|
111
|
+
argument in three tests: where the answer lives, whether a mistake surfaces, and
|
|
112
|
+
what error rate the rule was measured at.
|
|
138
113
|
|
|
139
|
-
|
|
114
|
+
Sprag does not swap the model you asked for. It reads what you have already run,
|
|
115
|
+
finds the kinds of task that never went wrong on a cheaper tier, and spawns a
|
|
116
|
+
sub-agent for exactly those. The main agent reviews what comes back before
|
|
117
|
+
anything counts as done, and the work returns to it the moment a rule stops
|
|
118
|
+
holding.
|
|
140
119
|
|
|
141
|
-
|
|
120
|
+
## Measured results
|
|
142
121
|
|
|
143
|
-
|
|
122
|
+
| Metric | Result | | Evidence |
|
|
123
|
+
|---|---|---|---|
|
|
124
|
+
| Public benchmark accuracy | **59.1%** vs 57.9% best single model | `▰▰▰▰▰▰▰▰▰▰▰▰` | [benchmark](https://github.com/rootstudioyaml/sprag/blob/main/docs/BENCHMARK.md) |
|
|
125
|
+
| Cost for the same queries | **$268** vs gpt-5 $388, gemini-2.5-pro $734 | `▰▰▰▰▰▱▱▱▱▱▱▱` | [benchmark](https://github.com/rootstudioyaml/sprag/blob/main/docs/BENCHMARK.md) |
|
|
126
|
+
| Tokens for the same documents | **−95.9%**, 2,011,178 → 82,209 over 12 files | `▰▱▱▱▱▱▱▱▱▱▱▱` | [doc2md](https://github.com/rootstudioyaml/sprag/blob/main/docs/DOC2MD.md) |
|
|
127
|
+
| Delegation savings, from the ledger | **$44.67** over 69 delegated runs | `▰▰▰▰▰▰▰▰▰▰▰▱` | `sprag route-scan savings` |
|
|
128
|
+
| Cheap tier on the same prompts | **24% of the cost**, one answer worse out of eight | `▰▰▰▱▱▱▱▱▱▱▱▱` | [A/B run](#the-cheap-tier-on-the-same-prompts) |
|
|
129
|
+
|
|
130
|
+
The first two rows answer the objection that comes up first: that moving work to
|
|
131
|
+
a cheaper model has to cost you accuracy. It did not. The same criteria, wired up
|
|
132
|
+
as a router, scored 1.2 points above the best single model at a third of the
|
|
133
|
+
cost. Nothing is best at everything, which is why choosing per task beats
|
|
134
|
+
choosing once.
|
|
135
|
+
|
|
136
|
+
Measured offline on LLMRouterBench (Findings of ACL 2026): 11,696 instances, 13
|
|
137
|
+
models whose answers, scores and costs ship with the dataset. No model was
|
|
138
|
+
called and nothing was spent. The router chose; the numbers were looked up. Run
|
|
139
|
+
it again and you get the same figures. It validates the criteria, not sprag's own
|
|
140
|
+
routing: the dataset has no Claude models, so deepseek-v3, qwen3-235b and gpt-5
|
|
141
|
+
stood in for cheap, mid and flagship.
|
|
142
|
+
|
|
143
|
+
The last three rows are ledgers on this machine. They grow as it runs. These were
|
|
144
|
+
read on 2026-09-18.
|
|
145
|
+
|
|
146
|
+
### Current, on one machine, last 30 days
|
|
144
147
|
|
|
145
|
-
```bash
|
|
146
|
-
sprag feedback "Bedrock에서 5m TTL 칩이 사라지지 않아요"
|
|
147
148
|
```
|
|
149
|
+
🔀 Routing saved $44.67 total (last 7d $23.21 · last 30d $42.73)
|
|
148
150
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
## 라이선스
|
|
151
|
+
opus-5 → sonnet-5 59 runs $39.75 ▰▰▰▰▰▰▰▰▰▰▱▱
|
|
152
|
+
opus-5 → haiku-4.5 10 runs $4.92 ▰▱▱▱▱▱▱▱▱▱▱▱
|
|
153
|
+
```
|
|
154
154
|
|
|
155
|
-
|
|
155
|
+
| Also measured | Over 30 days | |
|
|
156
|
+
|---|---|---|
|
|
157
|
+
| Documents converted | 12 files, 2,011,178 → 82,209 tokens | `▰▱▱▱▱▱▱▱▱▱▱▱` |
|
|
158
|
+
| Cache hit rate | 92.2% | `▰▰▰▰▰▰▰▰▰▰▰▱` |
|
|
159
|
+
| Volume behind both | 175 sessions · 14,682 API calls · 3.81B input tokens | |
|
|
156
160
|
|
|
157
|
-
|
|
161
|
+
Real output, from `sprag route-scan savings`, `sprag --days 30`, and the doc2md
|
|
162
|
+
ledger. Nothing here is a projection.
|
|
158
163
|
|
|
159
|
-
|
|
164
|
+
Every delegated run records its own price difference, so `sprag route-scan savings` traces any amount back to the rule that caused it. What the ledger deliberately leaves out is written down in [the command reference](https://github.com/rootstudioyaml/sprag/blob/main/docs/COMMANDS.md).
|
|
160
165
|
|
|
161
|
-
|
|
162
|
-
[](https://www.youtube.com/@DeepPulseEN)
|
|
163
|
-
[](https://rootstudioyaml.github.io/)
|
|
164
|
-
|
|
165
|
-
AI 개발 도구를 다루는 채널 **DeepPulse**에서 만들고 씁니다. 이 도구의 배경과 사용법은 [출시 영상(60초)](https://www.youtube.com/shorts/RaD8qMsPTnA)에서 볼 수 있습니다.
|
|
166
|
+
## Everything ships in one install, working from day one
|
|
166
167
|
|
|
167
|
-
|
|
168
|
-
|
|
168
|
+
| | What it does | More |
|
|
169
|
+
|---|---|---|
|
|
170
|
+
| ⚙️ **Ratchet rules** | Repeated failures become one-line rules loaded every session. Candidates are detected from your logs, and you choose project or global scope. | [harness](https://github.com/rootstudioyaml/sprag/blob/main/docs/HARNESS.md) |
|
|
171
|
+
| 🔀 **Model fitting** | Log-driven delegation rules carrying the error rate they were measured at and the savings they reported, written to `ratchet-model.md`. | [route-scan](https://github.com/rootstudioyaml/sprag/blob/main/docs/ROUTE_SCAN.md) |
|
|
172
|
+
| 🅷 **Harness score** | Five operating principles checked live. Skip the verify step and `🅷 4/5` says so before you report done. | [harness](https://github.com/rootstudioyaml/sprag/blob/main/docs/HARNESS.md) |
|
|
173
|
+
| 📊 **Token telemetry** | Cache hit rate, TTL, context size, output spikes and both rate-limit windows, in the prompt every turn. | [statusline](https://github.com/rootstudioyaml/sprag/blob/main/docs/STATUSLINE.md) |
|
|
174
|
+
| 📄 **doc2md** | pptx, xlsx, pdf, docx and fig converted on demand, so a document costs one read instead of your whole context. | [doc2md](https://github.com/rootstudioyaml/sprag/blob/main/docs/DOC2MD.md) |
|
|
175
|
+
| 🇰🇷 **Style gates** | Write-time prose lint enforced by hook. Shipping today for Korean technical writing: double passives, translationese, cohesion. | [style](https://github.com/rootstudioyaml/sprag/blob/main/docs/KOREAN-STYLE.md) |
|
|
169
176
|
|
|
170
|
-
|
|
177
|
+
The two savings figures are never added together. They measure different things:
|
|
178
|
+
the routing ledger records the price difference on delegated runs, and the
|
|
179
|
+
conversion ledger records tokens a document did not cost.
|
|
171
180
|
|
|
172
|
-
|
|
181
|
+
Neither one counts what the harness and the ratchet rules save. That saving
|
|
182
|
+
arrives as fewer round-trips rather than as cheaper ones.
|
|
173
183
|
|
|
174
|
-
|
|
184
|
+
## The statusline in one line
|
|
175
185
|
|
|
176
|
-
```bash
|
|
177
|
-
npm i -g sprag-cli # same package as the old claude-token-saver name
|
|
178
186
|
```
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
## Four numbers
|
|
183
|
-
|
|
184
|
-
| Metric | Result | | Evidence |
|
|
185
|
-
|---|---|---|---|
|
|
186
|
-
| Public benchmark accuracy | **59.1%** vs 57.9% best single model | `▰▰▰▰▰▰▰▰▰▰▰▰` | [benchmark](./docs/BENCHMARK.md) |
|
|
187
|
-
| Cost for the same queries | **$268** vs gpt-5 $388, gemini-2.5-pro $734 | `▰▰▰▰▰▱▱▱▱▱▱▱` | [benchmark](./docs/BENCHMARK.md) |
|
|
188
|
-
| Tokens per document | **−95.8%**, 540,429 → 22,610 | `▰▱▱▱▱▱▱▱▱▱▱▱` | [doc2md](./docs/DOC2MD.md) |
|
|
189
|
-
| Cost per user message | **−18.6%**, $2.345 → $1.910 | `▰▰▰▰▰▰▰▰▰▰▱▱` | [report](#real-world-impact--beforeafter-report) |
|
|
190
|
-
|
|
191
|
-
```text
|
|
192
|
-
accuracy total cost, 11,696 queries
|
|
193
|
-
tier-criteria router 59.1% ← best $268 ▰▰▰▰▰▱▱▱▱▱▱▱▱▱▱
|
|
194
|
-
gpt-5 57.8% $388 ▰▰▰▰▰▰▰▰▱▱▱▱▱▱▱
|
|
195
|
-
gemini-2.5-pro 57.9% $734 ▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰
|
|
187
|
+
🔀 Routing saved $44.67 | opus→sonnet 59× $39.75 · opus→haiku 10× $4.92
|
|
188
|
+
🚨 5H ▰▰▰▰▰▰▰▰▰▰▰▱ 94% 🔄 12:36 · 🅷 5/5 · 🤖 Opus 5 · 🧠 Cache hit 98.8% · ⏳ Cache expires 59:46 · 📅 weekly ▰▰▰▰▰▱▱▱▱▱▱▱ 38% · 💵 Sep $42 · 📦 Ctx 47% of 1M
|
|
196
189
|
```
|
|
197
190
|
|
|
198
|
-
|
|
191
|
+
When something is wrong the warning chip leads the line: `🚨 5H/7D NN%`, `⚠ Ctx 500k+`, `⚠ Cache miss`, `⚠ Input spike`, `⚠ Output heavy`, `⚠ Call surge`, `⚠ Rebuild churn`, `⚠ 5m TTL`. Paste the chip text into Claude and the Skill names the root-cause code and the fix. Every segment is explained in [the statusline reference](https://github.com/rootstudioyaml/sprag/blob/main/docs/STATUSLINE.md).
|
|
199
192
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
| | What it does | More |
|
|
203
|
-
|---|---|---|
|
|
204
|
-
| ⚙️ **Ratchet rules** | Repeated failures become one-line rules loaded every session; candidates are detected from your logs. | [harness](./docs/HARNESS.md) |
|
|
205
|
-
| 🔀 **Model fitting** | Log-driven delegation rules with measured error rates and savings, written to `ratchet-model.md`. | [route-scan](./docs/ROUTE_SCAN.md) |
|
|
206
|
-
| 🅷 **Harness score** | Five operating principles checked live. Skip the verify step and `🅷 4/5` says so before you report done. | [harness](./docs/HARNESS.md) |
|
|
207
|
-
| 📊 **Token telemetry** | Cache hit rate, TTL, context size, output spikes and both rate-limit windows, every turn. | [statusline](./docs/STATUSLINE.md) |
|
|
208
|
-
| 📄 **doc2md** | pptx, xlsx, pdf, docx and fig converted on demand instead of pasted into context. | [doc2md](./docs/DOC2MD.md) |
|
|
209
|
-
| 🇰🇷 **Style gates** | Write-time prose lint enforced by hook: double passives, translationese, cohesion. | [style](./docs/KOREAN-STYLE.md) |
|
|
193
|
+
Inside a JetBrains IDE terminal the chips render as single-cell glyphs instead of emoji (`◉ Cache hit 98.8% · ◧ Ctx 47% of 1M`). The IDE's default font has no emoji glyphs, so emoji leave characters from the previous frame on screen, like `Cache expires 4:545`. [Label modes](https://github.com/rootstudioyaml/sprag/blob/main/docs/STATUSLINE.md#label-modes) covers the detail, plus `sprag mode narrow` and `mode icon-force`.
|
|
210
194
|
|
|
211
|
-
The
|
|
195
|
+
## The cheap tier on the same prompts
|
|
212
196
|
|
|
213
|
-
|
|
197
|
+
The benchmark uses public data. This asks the same question of my own work: eight
|
|
198
|
+
prompts from real sessions in this repository, sent to both tiers, graded against
|
|
199
|
+
an answer written before the run (2026-09-17, raw data in
|
|
200
|
+
`video/out/measure2.json`).
|
|
214
201
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
202
|
+
| | flagship (opus-5) | cheap tier (haiku-4.5) |
|
|
203
|
+
|---|---:|---:|
|
|
204
|
+
| Cost for all eight | $2.5652 | **$0.6132** (23.9%) |
|
|
205
|
+
| Graded correct | 7 / 8 | 6 / 8 |
|
|
206
|
+
| Gave the same answer | | 6 / 8 |
|
|
219
207
|
|
|
220
|
-
|
|
208
|
+
The prompt both tiers missed is the useful one. It asked which files reference
|
|
209
|
+
`process.env` without saying whether subdirectories counted, and the two read it
|
|
210
|
+
differently. Adding that one condition made their answers identical. The question
|
|
211
|
+
was ambiguous, not hard.
|
|
221
212
|
|
|
222
|
-
|
|
213
|
+
The remaining miss is the cheap tier leaving entries out of a file listing. A
|
|
214
|
+
wrong listing is one you can see is wrong, which is the second criterion doing
|
|
215
|
+
its job.
|
|
223
216
|
|
|
224
|
-
|
|
217
|
+
So the cheap tier is not free. On this sample one lookup in eight comes back
|
|
218
|
+
worse, for a quarter of the price. That is why rules only send work whose failure
|
|
219
|
+
surfaces, and never send design or diagnosis.
|
|
225
220
|
|
|
226
|
-
|
|
221
|
+
## What the method has produced here
|
|
227
222
|
|
|
228
|
-
|
|
|
229
|
-
|
|
230
|
-
|
|
|
231
|
-
|
|
|
232
|
-
|
|
|
233
|
-
| tool calls / message | 5.72 | 5.25 | −8.2% |
|
|
223
|
+
| Measured | Value | Sample | Window |
|
|
224
|
+
|---|---|---|---|
|
|
225
|
+
| Documents converted | 2,011,178 → 82,209 tokens | 12 files (xlsx, pptx, pdf) | to 2026-09-18 |
|
|
226
|
+
| Delegated runs | $44.67 saved, $0.65 per run | 69 runs | to 2026-09-18 |
|
|
227
|
+
| Ratchet rules accumulated | 37 (30 global, 7 per-project) | 4 repositories | 2026-05-08 to 09-16 |
|
|
234
228
|
|
|
235
|
-
The
|
|
229
|
+
The two counts grow differently. Ratchet rules come from mistakes a person made,
|
|
230
|
+
so they keep coming. Delegation rules stop: the criteria recognize a fixed set of
|
|
231
|
+
work types, and once each has a rule there is nothing left to promote.
|
|
236
232
|
|
|
237
|
-
##
|
|
233
|
+
## Day-to-day commands
|
|
238
234
|
|
|
239
235
|
| Command | What it does |
|
|
240
236
|
|---|---|
|
|
@@ -245,51 +241,68 @@ The same request resolves in fewer round-trips, so first-try success goes up: th
|
|
|
245
241
|
| `sprag harness check` | Current 🅷 harness score |
|
|
246
242
|
| `sprag doc2md <file>` | Convert one document to Markdown |
|
|
247
243
|
|
|
248
|
-
Every subcommand, flag and the output-language setting: [command reference](
|
|
244
|
+
Every subcommand, flag and the output-language setting: [command reference](https://github.com/rootstudioyaml/sprag/blob/main/docs/COMMANDS.md).
|
|
249
245
|
|
|
250
|
-
##
|
|
246
|
+
## Documentation
|
|
251
247
|
|
|
252
248
|
| Doc | Covers |
|
|
253
249
|
|---|---|
|
|
254
|
-
| [
|
|
255
|
-
| [
|
|
256
|
-
| [
|
|
257
|
-
| [
|
|
258
|
-
| [
|
|
259
|
-
| [
|
|
260
|
-
| [
|
|
261
|
-
| [
|
|
262
|
-
| [
|
|
263
|
-
| [
|
|
264
|
-
| [
|
|
250
|
+
| [Codex](https://sprag.io/docs/codex/) | Installation, panel, native hooks, automatic candidates, presets, and accounting limits |
|
|
251
|
+
| [Install](https://github.com/rootstudioyaml/sprag/blob/main/docs/INSTALL.md) | What the install turns on, what stays manual, how to turn each part off |
|
|
252
|
+
| [Statusline](https://github.com/rootstudioyaml/sprag/blob/main/docs/STATUSLINE.md) | Segments, warning chips, spike issue codes, update notifications |
|
|
253
|
+
| [Commands](https://github.com/rootstudioyaml/sprag/blob/main/docs/COMMANDS.md) | Full CLI surface |
|
|
254
|
+
| [Harness](https://github.com/rootstudioyaml/sprag/blob/main/docs/HARNESS.md) | The five principles, rule promotion, compact-window pinning, seed presets |
|
|
255
|
+
| [route-scan](https://github.com/rootstudioyaml/sprag/blob/main/docs/ROUTE_SCAN.md) | Tier verdicts, rule-file mechanics, scan triggers, subagent setup |
|
|
256
|
+
| [Tier criteria](https://github.com/rootstudioyaml/sprag/blob/main/docs/TIER_CRITERIA.md) | Why T0/T1/T2 split where they do, with sources (Korean) |
|
|
257
|
+
| [Benchmark](https://github.com/rootstudioyaml/sprag/blob/main/docs/BENCHMARK.md) | The 11,696-instance LLMRouterBench run |
|
|
258
|
+
| [doc2md](https://github.com/rootstudioyaml/sprag/blob/main/docs/DOC2MD.md) | Supported formats, savings evidence, editing documents, DRM cases |
|
|
259
|
+
| [Korean style](https://github.com/rootstudioyaml/sprag/blob/main/docs/KOREAN-STYLE.md) | What gets injected, the write-time check, before/after |
|
|
260
|
+
| [Not a router](https://github.com/rootstudioyaml/sprag/blob/main/docs/NOT-A-ROUTER.md) | Why realtime routing breaks the cache and costs more |
|
|
261
|
+
| [Gateways & environment](https://github.com/rootstudioyaml/sprag/blob/main/docs/GATEWAYS.md) | Bedrock, Vertex, LiteLLM budgets, pricing table, FAQ, how it works |
|
|
262
|
+
|
|
263
|
+
Behind a LiteLLM gateway, `sprag profile-map --refresh` now reads model aliases straight from the gateway's own `GET /model/info`, so route-scan no longer needs to wait on learned votes or a hand-edited `profile-map.json`. The refresh uses the same 5-minute check and 24-hour cache as the LiteLLM budget gauge. It never stores your auth token: each refresh reads it from `apiKeyHelper` at call time and lets it expire on the helper's own schedule. Details: [route-scan](https://github.com/rootstudioyaml/sprag/blob/main/docs/ROUTE_SCAN.md).
|
|
265
264
|
|
|
266
265
|
## Release notes
|
|
267
266
|
|
|
268
267
|
The full history moved to [CHANGELOG.md](./CHANGELOG.md) (Korean; version headings and command names are language-neutral). Recent changes:
|
|
269
268
|
|
|
270
|
-
- **v3.
|
|
271
|
-
- **v3.
|
|
269
|
+
- **v3.54.0**: Codex integration adds native hooks, `AGENTS.md` harness rules, a session-bound companion panel, document conversion, diagnostics, and opt-in delegation. Codex usage accounting stays separate from Claude Code. See the [Codex guide](./docs/CODEX.md).
|
|
270
|
+
- **v3.39.0**: `feedback` subcommand for filing bug reports and feature requests straight from the terminal or a Claude session, via the gh CLI, an anonymous no-login form (auto-filed as a GitHub issue by an Apps Script relay), or a local fallback. `install` now asks before replacing an existing statusline instead of silently skipping.
|
|
271
|
+
- **v3.38.0**: `cohesion on` turns the language-neutral cohesion rules from the Korean supplement into a standalone English injection (given-before-new, one referent per pronoun, subject consistency, bridging, merging choppy sentences). Opt-in, ~0.5k tokens per session, suppressed while `korean on` already carries them.
|
|
272
272
|
- **v3.37.0**: Korean guidance grows a conservative supplement (translationese, AI-writing tics, a research-backed cohesion section whose principles apply to English prose too) and the write-time lint gains 5 translationese patterns, validated at 1 false positive across 255 real files.
|
|
273
|
-
- **v3.35.0**: A `💵 Sep $42` segment now shows estimated spend since 00:00 on the 1st of the current month, always on
|
|
273
|
+
- **v3.35.0**: A `💵 Sep $42` segment now shows estimated spend since 00:00 on the 1st of the current month, always on, including gateway setups with no 5h/7d caps. LiteLLM gateway users get a `🔑 budget ▰▱ 34% $34/$100` gauge built from the key's budget (`GET /key/info` + `GET /user/info`, team-membership budget first, then key, then internal user, verified against a Dockerized LiteLLM).
|
|
274
274
|
- **v3.34.0**: seed presets offered one at a time, output-language choice at install, context warning raised to 500k.
|
|
275
275
|
|
|
276
276
|
## Feedback
|
|
277
277
|
|
|
278
|
-
|
|
278
|
+
Bugs and feature requests go in the issue tracker: https://github.com/rootstudioyaml/sprag/issues
|
|
279
279
|
|
|
280
|
-
|
|
280
|
+
With no browser or GitHub login at hand (corporate network, mid-session), submit straight from the terminal instead, or ask Claude to do it for you:
|
|
281
281
|
|
|
282
282
|
```bash
|
|
283
283
|
sprag feedback "the 5m TTL chip never clears on Bedrock"
|
|
284
284
|
```
|
|
285
285
|
|
|
286
|
-
It files a GitHub issue
|
|
286
|
+
It files a GitHub issue through the `gh` CLI when one is authenticated. Otherwise it submits anonymously, with no login, which works where github.com is blocked. Pass `--anonymous` to skip the `gh` path. Version and OS metadata are attached automatically.
|
|
287
287
|
|
|
288
|
-
|
|
288
|
+
For a bug, please include the tool version (`sprag --version`) and your OS. For a statusline or warning issue, add the statusline output or the `sprag last` result.
|
|
289
289
|
|
|
290
290
|
## License
|
|
291
291
|
|
|
292
|
-
|
|
292
|
+
Apache License 2.0. The full text is in [LICENSE](./LICENSE), and the attributions
|
|
293
|
+
it requires are in [NOTICE](./NOTICE).
|
|
294
|
+
|
|
295
|
+
Releases up to and including v3.47.0 went out under the MIT License. A copy
|
|
296
|
+
received under those terms stays under them; the new license applies to
|
|
297
|
+
releases after that.
|
|
298
|
+
|
|
299
|
+
**Running sprag inside a product or a paid service?** The license already permits
|
|
300
|
+
that, so this is not a request for permission. We would like to hear about it
|
|
301
|
+
anyway, because the parts that get awkward at scale are the parts we would rather
|
|
302
|
+
fix than have you work around: shared ratchet rules across a team, gateway setups
|
|
303
|
+
where the model id is an opaque profile, and per-seat budget reporting. [Open an
|
|
304
|
+
issue](https://github.com/rootstudioyaml/sprag/issues) or reach us through the
|
|
305
|
+
channels below.
|
|
293
306
|
|
|
294
307
|
---
|
|
295
308
|
|
|
@@ -299,4 +312,4 @@ MIT
|
|
|
299
312
|
[](https://www.youtube.com/@DeepPulseEN)
|
|
300
313
|
[](https://rootstudioyaml.github.io/)
|
|
301
314
|
|
|
302
|
-
Built
|
|
315
|
+
Built at **DeepPulse**, a channel about AI developer tooling, and used there every day. The [launch Short (60s)](https://www.youtube.com/shorts/RaD8qMsPTnA) covers where it came from and how it gets used.
|