claude-token-saver 3.9.1 โ†’ 3.9.2

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 rootstudioyaml
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.en.md CHANGED
@@ -17,6 +17,23 @@ npm i -g claude-token-saver # postinstall auto-registers the statusline + Skil
17
17
 
18
18
  ![statusline example](./docs/statusline.png)
19
19
 
20
+ ## ๐Ÿ“บ Came here from the video? โ€” 60 seconds
21
+
22
+ This is not a router. It never intercepts a request in realtime.
23
+ **After a session ends** it reads your local logs, finds the easy patterns your expensive model
24
+ kept handling, and promotes them into rules so a cheaper model takes them **from the next session
25
+ onward**. Rules are scoped global or per-project.
26
+
27
+ ```bash
28
+ npm i -g claude-token-saver@latest
29
+ claude-token-saver route-scan # find delegation candidates in your own history (0 LLM calls)
30
+ claude-token-saver route-scan rules # list promoted rules ยท rm <N> to remove
31
+ ```
32
+
33
+ Thresholds come from **your own last-14-day distribution (p25/p75)**, not someone else's benchmark.
34
+ Measured rule-health โ€” whether a delegated run actually succeeded โ€” landed in [v3.9.0](#v390-2026-08-01).
35
+
36
+
20
37
  ## โšก Why โ€” the 30-second pitch
21
38
 
22
39
  | | |
@@ -265,6 +282,12 @@ Also update `statusLine.command` in `~/.claude/settings.json` to `claude-token-s
265
282
 
266
283
  ## Release notes
267
284
 
285
+ ### v3.9.2 (2026-08-01)
286
+ - **Added a LICENSE file (MIT)** โ€” the field existed in `package.json` but the file did not, which blocked license review for company adoption. It ships in the npm tarball now via `files`.
287
+ - **Package description and keywords rewritten for what this actually does** โ€” leftover cache-monitoring copy meant it never surfaced for `model-routing` / `delegation` / `subagent`.
288
+ - **A 60-second on-ramp at the top of the README** โ€” that this is post-hoc analysis rather than a router, plus the three commands from install to seeing your own numbers.
289
+ - **One-time note in `route-scan`** โ€” prints the explainer link exactly once. Disable with `CTS_NO_NOTE=1`.
290
+
268
291
  ### v3.9.1 (2026-08-01)
269
292
  - **compact-window now recommends a 400kโ€“700k band instead of a single 400k** โ€” 400k proved too tight in practice and compacted too often. The advice is a range now, and **a window inside it (or below it) is never warned about**; only an unset value or one above 700k raises `๐Ÿ…ทโš  compact-window?` and the briefing. `set` defaults to 500k (mid-band); pick your own with `--value 600k`.
270
293
 
package/README.md CHANGED
@@ -17,6 +17,22 @@ npm i -g claude-token-saver # postinstall์ด statusline + Skill ์ž๋™ ๋“ฑ๋ก
17
17
 
18
18
  ![statusline ์˜ˆ์‹œ](./docs/statusline.png)
19
19
 
20
+ ## ๐Ÿ“บ ์˜์ƒ ๋ณด๊ณ  ์˜ค์…จ๋‹ค๋ฉด โ€” 60์ดˆ
21
+
22
+ ๋ผ์šฐํ„ฐ๊ฐ€ ์•„๋‹™๋‹ˆ๋‹ค. ์š”์ฒญ์„ ์‹ค์‹œ๊ฐ„์œผ๋กœ ๊ฐ€๋กœ์ฑ„์ง€ ์•Š์Šต๋‹ˆ๋‹ค.
23
+ **์„ธ์…˜์ด ๋๋‚œ ๋’ค** ๋กœ์ปฌ ๊ธฐ๋ก์„ ์ฝ์–ด์„œ, ๋น„์‹ผ ๋ชจ๋ธ์ด ๋ฐ˜๋ณตํ•ด์„œ ์ฒ˜๋ฆฌํ•ด ์˜จ ์‰ฌ์šด ์œ ํ˜•์„ ๋ฝ‘๊ณ ,
24
+ ๊ทธ ์œ ํ˜•์€ **๋‹ค์Œ ์„ธ์…˜๋ถ€ํ„ฐ** ์‹ผ ๋ชจ๋ธ์ด ๋งก๋„๋ก ๋ฃฐ๋กœ ๊ฒ๋‹ˆ๋‹ค. ๋ฃฐ์€ ๊ธ€๋กœ๋ฒŒยทํ”„๋กœ์ ํŠธ๋กœ ๋ฒ”์œ„๊ฐ€ ๋‚˜๋‰ฉ๋‹ˆ๋‹ค.
25
+
26
+ ```bash
27
+ npm i -g claude-token-saver@latest
28
+ claude-token-saver route-scan # ๋‚ด ์ง€๋‚œ ์„ธ์…˜์—์„œ ์œ„์ž„ ํ›„๋ณด ๋ฝ‘๊ธฐ (LLM ํ˜ธ์ถœ 0)
29
+ claude-token-saver route-scan rules # ์Šน๊ฒฉ๋œ ๋ฃฐ ํ™•์ธ ยท rm <N> ์œผ๋กœ ์‚ญ์ œ
30
+ ```
31
+
32
+ ๊ธฐ์ค€์„ ์€ ๋‚จ์˜ ๋ฒค์น˜๋งˆํฌ๊ฐ€ ์•„๋‹ˆ๋ผ **๋‚ด ์ตœ๊ทผ 14์ผ ๋ถ„ํฌ(p25/p75)** ๋กœ ์žก์Šต๋‹ˆ๋‹ค.
33
+ ๋„˜๊ธด ๋’ค ์‹ค์ œ๋กœ ์ž˜ ๋๋Š”์ง€๊นŒ์ง€ ์žฌ๋Š” ์‹ค์ธก rule-health๋Š” [v3.9.0](#v390-2026-08-01)์— ๋“ค์–ด๊ฐ”์Šต๋‹ˆ๋‹ค.
34
+
35
+
20
36
  ## โšก ์™œ ์“ฐ๋‚˜ โ€” 30์ดˆ ์š”์•ฝ
21
37
 
22
38
  | | |
@@ -222,6 +238,12 @@ npm uninstall -g claude-cache-monitor && npm i -g claude-token-saver
222
238
 
223
239
  ## ๋ฆด๋ฆฌ์Šค ๋…ธํŠธ
224
240
 
241
+ ### v3.9.2 (2026-08-01)
242
+ - **LICENSE ํŒŒ์ผ ์ถ”๊ฐ€ (MIT)** โ€” `package.json`์—๋งŒ ์žˆ๊ณ  ํŒŒ์ผ์ด ์—†์–ด์„œ, ์‚ฌ๋‚ด ๋„์ž… ๊ฒ€ํ†  ์‹œ ๋ผ์ด์„ ์Šค ํ™•์ธ์ด ๋ง‰ํžˆ๋˜ ๋ฌธ์ œ. npm ํŒจํ‚ค์ง€์—๋„ ํฌํ•จ๋˜๋„๋ก `files`์— ๋„ฃ์—ˆ์Šต๋‹ˆ๋‹ค.
243
+ - **ํŒจํ‚ค์ง€ ์„ค๋ช…ยทํ‚ค์›Œ๋“œ๋ฅผ ํ˜„์žฌ ๊ธฐ๋Šฅ์— ๋งž๊ฒŒ ๊ต์ฒด** โ€” ์บ์‹œ ๋ชจ๋‹ˆํ„ฐ๋ง ์‹œ์ ˆ ๋ฌธ๊ตฌ๊ฐ€ ๋‚จ์•„ ์žˆ์–ด ๋ชจ๋ธ ์œ„์ž„(`model-routing`ยท`delegation`ยท`subagent`)์œผ๋กœ ๊ฒ€์ƒ‰๋˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค.
244
+ - **README ์ƒ๋‹จ์— 60์ดˆ ์ง„์ž…๋กœ** โ€” ๋ผ์šฐํ„ฐ๊ฐ€ ์•„๋‹ˆ๋ผ ์‚ฌํ›„ ๋ถ„์„์ด๋ผ๋Š” ์ ๊ณผ, ์„ค์น˜๋ถ€ํ„ฐ ๋‚ด ์ˆซ์ž ํ™•์ธ๊นŒ์ง€์˜ ๋ช…๋ น 3์ค„.
245
+ - **`route-scan` ์ตœ์ดˆ 1ํšŒ ์•ˆ๋‚ด** โ€” ๊ธฐ๋Šฅ ์„ค๋ช… ์˜์ƒ ๋งํฌ๋ฅผ ๋”ฑ ํ•œ ๋ฒˆ๋งŒ ์ถœ๋ ฅํ•ฉ๋‹ˆ๋‹ค. `CTS_NO_NOTE=1`๋กœ ๋•๋‹ˆ๋‹ค.
246
+
225
247
  ### v3.9.1 (2026-08-01)
226
248
  - **compact-window ๊ถŒ์žฅ๊ฐ’์ด ๋‹จ์ผ 40๋งŒ์—์„œ 40๋งŒ~70๋งŒ ๋ฒ”์œ„๋กœ** โ€” 40๋งŒ์€ ์‹ค์‚ฌ์šฉ์—์„œ ๋„ˆ๋ฌด ๋นก๋นกํ•ด ์••์ถ•์ด ์žฆ์•˜์Šต๋‹ˆ๋‹ค. ์ด์ œ ๋ฒ”์œ„๋ฅผ ์ œ์•ˆํ•˜๊ณ , **๊ทธ ์•ˆ(๋˜๋Š” ๊ทธ๋ณด๋‹ค ๋‚ฎ๊ฒŒ) ์žก์•„๋‘” ์„ธ์…˜์€ ๊ฒฝ๊ณ ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.** ๋ฏธ์„ค์ •์ด๊ฑฐ๋‚˜ 70๋งŒ ์ดˆ๊ณผ์ผ ๋•Œ๋งŒ `๐Ÿ…ทโš  compact-window?`์™€ ๋ธŒ๋ฆฌํ•‘์ด ๋œน๋‹ˆ๋‹ค. `set`์˜ ๊ธฐ๋ณธ๊ฐ’๋„ ๋ฒ”์œ„ ์ค‘๊ฐ„์ธ 50๋งŒ์œผ๋กœ ์˜ฌ๋ ธ๊ณ , ์›ํ•˜๋Š” ๊ฐ’์€ `--value 600k`๋กœ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค.
227
249
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "claude-token-saver",
3
- "version": "3.9.1",
4
- "description": "Save tokens on Claude Code โ€” spike diagnosis, 1M-context detection, TTL countdown, statusline. (formerly claude-cache-monitor)",
3
+ "version": "3.9.2",
4
+ "description": "Route the easy work your expensive Claude model keeps repeating down to haiku/sonnet โ€” post-hoc session analysis, no realtime router, no extra LLM calls.",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "claude-token-saver": "bin/cli.js"
@@ -16,22 +16,27 @@
16
16
  "presets/",
17
17
  "examples/",
18
18
  "README.md",
19
- "README.en.md"
19
+ "README.en.md",
20
+ "LICENSE"
20
21
  ],
21
22
  "engines": {
22
23
  "node": ">=18"
23
24
  },
24
25
  "keywords": [
25
26
  "claude",
27
+ "claude-code",
26
28
  "anthropic",
27
- "cache",
28
- "monitoring",
29
+ "model-routing",
30
+ "llm-router",
31
+ "delegation",
32
+ "subagent",
33
+ "haiku",
34
+ "cost-savings",
35
+ "token-usage",
29
36
  "prompt-caching",
30
- "cli",
37
+ "cache",
31
38
  "statusline",
32
- "claude-code",
33
- "token-usage",
34
- "cost-savings",
39
+ "cli",
35
40
  "1m-context"
36
41
  ],
37
42
  "license": "MIT",
@@ -202,6 +202,7 @@ export async function run({ args, hasFlag, numArg }) {
202
202
  console.log(lang === 'ko'
203
203
  ? '์œ„์ž„ ํ›„๋ณด ์—†์Œ (๋ฐ˜๋ณต 3ํšŒ ๋ฏธ๋งŒ์ด๊ฑฐ๋‚˜ ์ด๋ฏธ ์ฒ˜๋ฆฌ๋จ).'
204
204
  : 'No delegation candidates (below recurrence threshold or already resolved).');
205
+ (await import('../first-run-note.js')).printOnce('route-scan', lang);
205
206
  return;
206
207
  }
207
208
  console.log(lang === 'ko' ? '\n์œ„์ž„ ํ›„๋ณด (R<N>=ํ›„๋ณด ๋ฒˆํ˜ธ, T2/T1=๋‚œ์ด๋„ ๋“ฑ๊ธ‰):' : '\nDelegation candidates (R<N> = candidate id, T2/T1 = difficulty tier):');
@@ -223,5 +224,7 @@ export async function run({ args, hasFlag, numArg }) {
223
224
  console.log(lang === 'ko' ? '๋“ฑ๋ก / ๋ฌด์‹œ:' : 'Promote / dismiss:');
224
225
  console.log(' claude-token-saver harness promote R<N> --project|--global');
225
226
  console.log(' claude-token-saver route-scan dismiss <N>');
227
+ // ์ตœ์ดˆ 1ํšŒ๋งŒ โ€” ๋งค๋ฒˆ ์ฐ์œผ๋ฉด ๋„๊ตฌ๊ฐ€ ๊ด‘๊ณ ํŒ์ด ๋œ๋‹ค (CTS_NO_NOTE=1 ๋กœ ๋”)
228
+ (await import('../first-run-note.js')).printOnce('route-scan', lang);
226
229
  return;
227
230
  }
@@ -0,0 +1,63 @@
1
+ /**
2
+ * first-run-note โ€” a one-time pointer to where a feature is explained.
3
+ *
4
+ * A CLI that advertises on every invocation stops being a tool, so this fires
5
+ * ONCE per note key and then never again: the shown-at timestamp is persisted
6
+ * next to the other state files and checked before anything is printed.
7
+ *
8
+ * Opt out entirely with CTS_NO_NOTE=1 (also honoured by anything that pipes
9
+ * our output somewhere it does not belong).
10
+ */
11
+
12
+ import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'node:fs';
13
+ import { join } from 'node:path';
14
+ import { userDataDir } from './paths.js';
15
+
16
+ export function firstRunStatePath() {
17
+ return join(userDataDir(), 'first-run.json');
18
+ }
19
+
20
+ function load() {
21
+ try {
22
+ const s = JSON.parse(readFileSync(firstRunStatePath(), 'utf8'));
23
+ return s && typeof s === 'object' ? s : {};
24
+ } catch {
25
+ return {};
26
+ }
27
+ }
28
+
29
+ function markShown(key, now) {
30
+ const state = load();
31
+ state[key] = now;
32
+ const dir = userDataDir();
33
+ if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
34
+ writeFileSync(firstRunStatePath(), JSON.stringify(state) + '\n');
35
+ }
36
+
37
+ /** True only the first time this key is asked about. Best-effort โ€” a
38
+ * read-only state dir just means the note repeats, never that we crash. */
39
+ export function shouldShowOnce(key, { now = Date.now() } = {}) {
40
+ if (process.env.CTS_NO_NOTE === '1') return false;
41
+ if (load()[key]) return false;
42
+ try {
43
+ markShown(key, now);
44
+ } catch {
45
+ /* state dir unwritable โ€” show it, do not fail the command */
46
+ }
47
+ return true;
48
+ }
49
+
50
+ const NOTES = {
51
+ 'route-scan': {
52
+ ko: '๐Ÿ“บ ์ด ๊ธฐ๋Šฅ์„ ์„ค๋ช…ํ•œ ์˜์ƒ: https://www.youtube.com/@DeepPulseKR (์ด ์•ˆ๋‚ด๋Š” ํ•œ ๋ฒˆ๋งŒ ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค)',
53
+ en: '๐Ÿ“บ How this works, in 3 minutes: https://www.youtube.com/@DeepPulseEN (shown once)',
54
+ },
55
+ };
56
+
57
+ /** Print the one-time note for `key`, or nothing. */
58
+ export function printOnce(key, lang = 'en') {
59
+ const note = NOTES[key];
60
+ if (!note || !shouldShowOnce(key)) return;
61
+ console.log('');
62
+ console.log(lang === 'ko' ? note.ko : note.en);
63
+ }