claude-token-saver 3.9.0 โ†’ 3.9.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.
package/README.en.md CHANGED
@@ -144,19 +144,21 @@ An auto `.bak` is kept, but **the session context that earned the rule its place
144
144
 
145
145
  ## ๐Ÿ“ฆ compact-window โ€” pin where a 1M session compacts
146
146
 
147
- Claude Code compacts when usage approaches `min(autoCompactWindow, model max context)`. On a 1M window, with that value unset, compaction only fires near 800k โ€” and until then every request re-bills the whole context. Pinning 400k keeps twice a 200k session's headroom for the genuinely large pastes while cutting off the runaway tail.
147
+ Claude Code compacts when usage approaches `min(autoCompactWindow, model max context)`. On a 1M window, with that value unset, compaction only fires near 800k โ€” and until then every request re-bills the whole context. **1M is too large; the recommendation is a 400kโ€“700k band** โ€” 2โ€“3.5x a 200k session's headroom for the genuinely large pastes, with the runaway tail cut off.
148
+
149
+ **Anything inside the band is left alone.** 400k is the floor where the saving beats the extra compactions, and long sessions often want more room than that. Only an unset window, or one above 700k, is warned about (a smaller one is a deliberate, more aggressive choice).
148
150
 
149
151
  **200k sessions are never warned** โ€” their window is already at or below 200k, so the setting cannot change anything.
150
152
 
151
153
  ```bash
152
154
  claude-token-saver compact-window # status (model, window, value, source)
153
- claude-token-saver compact-window set --global # pin 400k in ~/.claude/settings.json
155
+ claude-token-saver compact-window set --global # pin 500k (mid-band) in ~/.claude/settings.json
154
156
  claude-token-saver compact-window set --project # pin it in <root>/.claude/settings.json
155
- claude-token-saver compact-window set --global --value 250k # explicit value (100kโ€“1M)
157
+ claude-token-saver compact-window set --global --value 600k # explicit value (100kโ€“1M)
156
158
  claude-token-saver compact-window off | on # toggle the warning
157
159
  ```
158
160
 
159
- - On a 1M model with the value unset or above 400k, the statusline shows `๐Ÿ…ทโš  compact-window?` and the session briefing hands the model the exact registration command.
161
+ - On a 1M model with the value unset or above 700k, the statusline shows `๐Ÿ…ทโš  compact-window?` and the session briefing hands the model the exact registration command.
160
162
  - Scope (`--global`/`--project`) is **required** for `set` โ€” a global settings file is never edited on a guess.
161
163
  - Every other key in `settings.json` is preserved and a `.bak` is written first. Malformed JSON aborts the write untouched.
162
164
  - An exported `CLAUDE_CODE_AUTO_COMPACT_WINDOW` beats settings.json; `set` detects that and says so.
@@ -263,6 +265,9 @@ Also update `statusLine.command` in `~/.claude/settings.json` to `claude-token-s
263
265
 
264
266
  ## Release notes
265
267
 
268
+ ### v3.9.1 (2026-08-01)
269
+ - **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
+
266
271
  ### v3.9.0 (2026-08-01)
267
272
 
268
273
  Compared this tool's design against manifest.build's "Everyone is building LLM routers, we deprecated ours" (a retrospective on 4 months across 7,000 users) and closed the four of their failure modes that were not already ruled out here. Full comparison in [TIER_CRITERIA.md ยง3.9](./docs/TIER_CRITERIA.md).
package/README.md CHANGED
@@ -125,15 +125,17 @@ ratchet์˜ ๊ฐ€์น˜๋Š” **ํ•œ ๋ฐฉํ–ฅ ๋ˆ„์ **์— ์žˆ์Šต๋‹ˆ๋‹ค. ๋ฃฐ์„ ๊ฐ€๋ณ๊ฒŒ ์ง€
125
125
 
126
126
  ## ๐Ÿ“ฆ compact-window โ€” 1M ์ปจํ…์ŠคํŠธ์˜ ์ž๋™ ์••์ถ• ์ง€์  ๊ณ ์ •
127
127
 
128
- Claude Code๋Š” `min(autoCompactWindow, ๋ชจ๋ธ ์ตœ๋Œ€ ์ฐฝ)`์— ๊ฐ€๊นŒ์›Œ์ง€๋ฉด ๋Œ€ํ™”๋ฅผ ์ž๋™ ์••์ถ•ํ•ฉ๋‹ˆ๋‹ค. 1M ์ฐฝ์„ ์“ฐ๋ฉด ์ด ๊ฐ’์ด ์žกํ˜€ ์žˆ์ง€ ์•Š์€ ํ•œ 80๋งŒ ํ† ํฐ ๊ทผ์ฒ˜๊นŒ์ง€ ๊ฐ€์„œ์•ผ ์••์ถ•์ด ๊ฑธ๋ฆฌ๊ณ , ๊ทธ์ „๊นŒ์ง€ ๋ชจ๋“  ์š”์ฒญ์ด ์ „์ฒด ์ปจํ…์ŠคํŠธ๋ฅผ ํ†ต์งธ๋กœ ์žฌ๊ณผ๊ธˆํ•ฉ๋‹ˆ๋‹ค. 40๋งŒ์œผ๋กœ ๊ณ ์ •ํ•˜๋ฉด ํฐ ๋ถ™์—ฌ๋„ฃ๊ธฐ์šฉ ์—ฌ์œ ๋Š” 200k ์„ธ์…˜์˜ ๋‘ ๋ฐฐ๋กœ ๋‚จ๊ธฐ๋ฉด์„œ ๊ผฌ๋ฆฌ๋งŒ ์ž˜๋ผ๋ƒ…๋‹ˆ๋‹ค.
128
+ Claude Code๋Š” `min(autoCompactWindow, ๋ชจ๋ธ ์ตœ๋Œ€ ์ฐฝ)`์— ๊ฐ€๊นŒ์›Œ์ง€๋ฉด ๋Œ€ํ™”๋ฅผ ์ž๋™ ์••์ถ•ํ•ฉ๋‹ˆ๋‹ค. 1M ์ฐฝ์„ ์“ฐ๋ฉด ์ด ๊ฐ’์ด ์žกํ˜€ ์žˆ์ง€ ์•Š์€ ํ•œ 80๋งŒ ํ† ํฐ ๊ทผ์ฒ˜๊นŒ์ง€ ๊ฐ€์„œ์•ผ ์••์ถ•์ด ๊ฑธ๋ฆฌ๊ณ , ๊ทธ์ „๊นŒ์ง€ ๋ชจ๋“  ์š”์ฒญ์ด ์ „์ฒด ์ปจํ…์ŠคํŠธ๋ฅผ ํ†ต์งธ๋กœ ์žฌ๊ณผ๊ธˆํ•ฉ๋‹ˆ๋‹ค. **1M์€ ๋„ˆ๋ฌด ํฌ๋‹ˆ 40๋งŒ~70๋งŒ ๋ฒ”์œ„๋ฅผ ๊ถŒ์žฅํ•ฉ๋‹ˆ๋‹ค** โ€” ํฐ ๋ถ™์—ฌ๋„ฃ๊ธฐ์šฉ ์—ฌ์œ ๋Š” 200k ์„ธ์…˜์˜ 2~3.5๋ฐฐ๋กœ ๋‚จ๊ธฐ๋ฉด์„œ ๊ผฌ๋ฆฌ๋งŒ ์ž˜๋ผ๋ƒ…๋‹ˆ๋‹ค.
129
+
130
+ **๊ถŒ์žฅ ๋ฒ”์œ„ ์•ˆ์ด๋ฉด ๊ฒฝ๊ณ ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.** 40๋งŒ์€ ์ ˆ๊ฐ์ด ์••์ถ• ํšŸ์ˆ˜๋ฅผ ์ด๊ธฐ๋Š” ํ•˜ํ•œ์ด๊ณ , ๊ธด ์„ธ์…˜์€ ๊ทธ๋ณด๋‹ค ์—ฌ์œ ๊ฐ€ ๋” ํ•„์š”ํ•œ ๊ฒฝ์šฐ๊ฐ€ ๋งŽ์Šต๋‹ˆ๋‹ค. ๋ฏธ์„ค์ •์ด๊ฑฐ๋‚˜ 70๋งŒ์„ ๋„˜์„ ๋•Œ๋งŒ ์•Œ๋ฆฝ๋‹ˆ๋‹ค(๊ทธ๋ณด๋‹ค ๋‚ฎ๊ฒŒ ์žก์€ ๊ฑด ๋” ๊ณต๊ฒฉ์ ์œผ๋กœ ์•„๋ผ๊ฒ ๋‹ค๋Š” ์„ ํƒ์ด๋ผ ๊ทธ๋ƒฅ ๋‘ก๋‹ˆ๋‹ค).
129
131
 
130
132
  **200k ์ปจํ…์ŠคํŠธ๋Š” ๊ฒฝ๊ณ  ๋Œ€์ƒ์ด ์•„๋‹™๋‹ˆ๋‹ค** โ€” ์ฐฝ์ด ์ด๋ฏธ 200k ์ดํ•˜๋ผ ์ด ์„ค์ •์ด ๋ฐ”๊ฟ€ ๊ฒŒ ์—†์Šต๋‹ˆ๋‹ค.
131
133
 
132
134
  ```bash
133
135
  claude-token-saver compact-window # ํ˜„์žฌ ์ƒํƒœ (๋ชจ๋ธยท์ฐฝยท์„ค์ •๊ฐ’ยท์ถœ์ฒ˜)
134
- claude-token-saver compact-window set --global # ~/.claude/settings.json ์— 40๋งŒ ๊ณ ์ •
136
+ claude-token-saver compact-window set --global # ~/.claude/settings.json ์— 50๋งŒ ๊ณ ์ • (๋ฒ”์œ„ ์ค‘๊ฐ„)
135
137
  claude-token-saver compact-window set --project # <root>/.claude/settings.json ์— ๊ณ ์ •
136
- claude-token-saver compact-window set --global --value 250k # ๊ฐ’ ์ง์ ‘ ์ง€์ • (10๋งŒ~1M)
138
+ claude-token-saver compact-window set --global --value 600k # ๊ฐ’ ์ง์ ‘ ์ง€์ • (10๋งŒ~1M)
137
139
  claude-token-saver compact-window off | on # ๊ฒฝ๊ณ  ํ‘œ์‹œ ํ† ๊ธ€
138
140
  ```
139
141
 
@@ -220,6 +222,9 @@ npm uninstall -g claude-cache-monitor && npm i -g claude-token-saver
220
222
 
221
223
  ## ๋ฆด๋ฆฌ์Šค ๋…ธํŠธ
222
224
 
225
+ ### v3.9.1 (2026-08-01)
226
+ - **compact-window ๊ถŒ์žฅ๊ฐ’์ด ๋‹จ์ผ 40๋งŒ์—์„œ 40๋งŒ~70๋งŒ ๋ฒ”์œ„๋กœ** โ€” 40๋งŒ์€ ์‹ค์‚ฌ์šฉ์—์„œ ๋„ˆ๋ฌด ๋นก๋นกํ•ด ์••์ถ•์ด ์žฆ์•˜์Šต๋‹ˆ๋‹ค. ์ด์ œ ๋ฒ”์œ„๋ฅผ ์ œ์•ˆํ•˜๊ณ , **๊ทธ ์•ˆ(๋˜๋Š” ๊ทธ๋ณด๋‹ค ๋‚ฎ๊ฒŒ) ์žก์•„๋‘” ์„ธ์…˜์€ ๊ฒฝ๊ณ ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.** ๋ฏธ์„ค์ •์ด๊ฑฐ๋‚˜ 70๋งŒ ์ดˆ๊ณผ์ผ ๋•Œ๋งŒ `๐Ÿ…ทโš  compact-window?`์™€ ๋ธŒ๋ฆฌํ•‘์ด ๋œน๋‹ˆ๋‹ค. `set`์˜ ๊ธฐ๋ณธ๊ฐ’๋„ ๋ฒ”์œ„ ์ค‘๊ฐ„์ธ 50๋งŒ์œผ๋กœ ์˜ฌ๋ ธ๊ณ , ์›ํ•˜๋Š” ๊ฐ’์€ `--value 600k`๋กœ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค.
227
+
223
228
  ### v3.9.0 (2026-08-01)
224
229
 
225
230
  manifest.build์˜ "๋‹ค๋“ค LLM ๋ผ์šฐํ„ฐ ๋งŒ๋“œ๋Š”๋ฐ ์šฐ๋ฆฌ๋Š” ํ๊ธฐํ–ˆ๋‹ค"(7์ฒœ ์‚ฌ์šฉ์žยท4๊ฐœ์›” ์‹ค์‚ฌ์šฉ ํšŒ๊ณ )์™€ ์ด ๋„๊ตฌ์˜ ์„ค๊ณ„๋ฅผ ๋Œ€์กฐํ•ด, ๊ทธ์ชฝ ์‹คํŒจ ์š”์ธ ์ค‘ ์•„์ง ์•ˆ ๋ง‰ํ˜€ ์žˆ๋˜ ๊ฒƒ 4๊ฐœ๋ฅผ ๋ฉ”์› ์Šต๋‹ˆ๋‹ค. ์ž์„ธํ•œ ๋Œ€์กฐ๋Š” [TIER_CRITERIA.md ยง3.9](./docs/TIER_CRITERIA.md).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-token-saver",
3
- "version": "3.9.0",
3
+ "version": "3.9.1",
4
4
  "description": "Save tokens on Claude Code โ€” spike diagnosis, 1M-context detection, TTL countdown, statusline. (formerly claude-cache-monitor)",
5
5
  "type": "module",
6
6
  "bin": {
package/src/brief.js CHANGED
@@ -246,7 +246,7 @@ export async function runBrief({ sessionId, transcriptPath, now = Date.now() })
246
246
  briefed.add(sig);
247
247
  s.briefed = [...briefed];
248
248
  const now = st.window ? `ํ˜„์žฌ ${fmtK(st.window)}` : 'ํ˜„์žฌ ๋ฏธ์„ค์ •';
249
- items.push(`1M ์ปจํ…์ŠคํŠธ ๋ชจ๋ธ(${st.model})์ธ๋ฐ autoCompactWindow๊ฐ€ ${now}์ž…๋‹ˆ๋‹ค โ€” ์ž๋™ ์••์ถ•์ด 80๋งŒ ํ† ํฐ ๊ทผ์ฒ˜์—์„œ์•ผ ๊ฑธ๋ ค ๊ทธ์ „๊นŒ์ง€ ๋ชจ๋“  ์š”์ฒญ์ด ์ „์ฒด ์ปจํ…์ŠคํŠธ๋ฅผ ์žฌ๊ณผ๊ธˆํ•ฉ๋‹ˆ๋‹ค. 40๋งŒ์œผ๋กœ ๊ณ ์ •ํ•˜๋ฉด 1M ์ฐฝ์€ ๊ทธ๋Œ€๋กœ ๋‘๊ณ  ์••์ถ• ์‹œ์ ๋งŒ ์•ž๋‹น๊น๋‹ˆ๋‹ค. ๋“ฑ๋ก: claude-token-saver compact-window set --global|--project (์ ์šฉ ๋ฒ”์œ„๋Š” ์‚ฌ์šฉ์ž์—๊ฒŒ ํ™•์ธ) / ๋„๊ธฐ: compact-window off`);
249
+ items.push(`1M ์ปจํ…์ŠคํŠธ ๋ชจ๋ธ(${st.model})์ธ๋ฐ autoCompactWindow๊ฐ€ ${now}์ž…๋‹ˆ๋‹ค โ€” ์ž๋™ ์••์ถ•์ด 80๋งŒ ํ† ํฐ ๊ทผ์ฒ˜์—์„œ์•ผ ๊ฑธ๋ ค ๊ทธ์ „๊นŒ์ง€ ๋ชจ๋“  ์š”์ฒญ์ด ์ „์ฒด ์ปจํ…์ŠคํŠธ๋ฅผ ์žฌ๊ณผ๊ธˆํ•ฉ๋‹ˆ๋‹ค. 1M์€ ๋„ˆ๋ฌด ํฌ๋‹ˆ ${fmtK(st.recommendedMin)}~${fmtK(st.recommendedMax)} ๋ฒ”์œ„๋ฅผ ๊ถŒ์žฅํ•ฉ๋‹ˆ๋‹ค(๊ทธ ๋ฒ”์œ„ ์•ˆ์ด๋ฉด ๊ฒฝ๊ณ ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค). 1M ์ฐฝ ์ž์ฒด๋Š” ๊ทธ๋Œ€๋กœ ๋‘๊ณ  ์••์ถ• ์‹œ์ ๋งŒ ์•ž๋‹น๊น๋‹ˆ๋‹ค. ๋“ฑ๋ก: claude-token-saver compact-window set --global|--project [--value ${fmtK(st.recommendedMax)}] (๊ธฐ๋ณธ ${fmtK(st.recommended)}, ์ ์šฉ ๋ฒ”์œ„๋Š” ์‚ฌ์šฉ์ž์—๊ฒŒ ํ™•์ธ) / ๋„๊ธฐ: compact-window off`);
250
250
  }
251
251
  }
252
252
  } catch { /* settings unreadable โ€” other briefings above still apply */ }
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Subcommand: compact-window โ€” audit / pin Claude Code's `autoCompactWindow`.
3
3
  * claude-token-saver compact-window # status
4
- * claude-token-saver compact-window set --global # pin 400k in ~/.claude/settings.json
5
- * claude-token-saver compact-window set --project # pin 400k in <root>/.claude/settings.json
6
- * claude-token-saver compact-window set --global --value 250k
4
+ * claude-token-saver compact-window set --global # pin 500k in ~/.claude/settings.json
5
+ * claude-token-saver compact-window set --project # pin 500k in <root>/.claude/settings.json
6
+ * claude-token-saver compact-window set --global --value 600k
7
7
  * claude-token-saver compact-window off | on # toggle the statusline warning
8
8
  *
9
9
  * Scope is deliberately explicit for `set`: writing a global settings.json is
@@ -69,22 +69,25 @@ export async function run({ args, hasFlag }) {
69
69
  return;
70
70
  }
71
71
  if (s.ok) {
72
- console.log(ko ? '\nโœ… ์••์ถ• ์ฐฝ์ด 400k ์ดํ•˜๋กœ ๊ณ ์ •๋ผ ์žˆ์Šต๋‹ˆ๋‹ค.' : '\nโœ… Compaction window is pinned at or below 400k.');
72
+ console.log(ko
73
+ ? `\nโœ… ์••์ถ• ์ฐฝ์ด ๊ถŒ์žฅ ๋ฒ”์œ„(${fmt(s.recommendedMin)}~${fmt(s.recommendedMax)}) ์ƒํ•œ ์ดํ•˜์ž…๋‹ˆ๋‹ค.`
74
+ : `\nโœ… Compaction window is at or below the top of the recommended ${fmt(s.recommendedMin)}โ€“${fmt(s.recommendedMax)} band.`);
73
75
  return;
74
76
  }
75
77
  console.log(ko
76
78
  ? `\nโš  1M ์ปจํ…์ŠคํŠธ์ธ๋ฐ autoCompactWindow๊ฐ€ ${s.reason === 'unset' ? '์„ค์ •๋˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค' : `${fmt(s.window)}๋กœ ๋„ˆ๋ฌด ํฝ๋‹ˆ๋‹ค`} โ€” ์ž๋™ ์••์ถ•์ด 80๋งŒ ํ† ํฐ ๊ทผ์ฒ˜์—์„œ์•ผ ๊ฑธ๋ฆฝ๋‹ˆ๋‹ค.`
77
79
  : `\nโš  1M context with autoCompactWindow ${s.reason === 'unset' ? 'unset' : `at ${fmt(s.window)}`} โ€” compaction only fires near 800k.`);
78
80
  console.log(ko
79
- ? ' ๊ทธ ์ „๊นŒ์ง€ ๋ชจ๋“  ์š”์ฒญ์ด ์ „์ฒด ์ปจํ…์ŠคํŠธ๋ฅผ ์žฌ๊ณผ๊ธˆํ•ฉ๋‹ˆ๋‹ค. 40๋งŒ์œผ๋กœ ๊ณ ์ •ํ•˜๋ฉด 1M ์ฐฝ์€ ์œ ์ง€ํ•˜๋ฉด์„œ ์••์ถ• ์‹œ์ ๋งŒ ์•ž๋‹น๊น๋‹ˆ๋‹ค.'
80
- : ' Until then every request re-bills the whole context. Pinning 400k keeps the 1M window while capping the runaway tail.');
81
- console.log('\n claude-token-saver compact-window set --global (~/.claude/settings.json)');
82
- console.log(' claude-token-saver compact-window set --project (<root>/.claude/settings.json)');
81
+ ? ` ๊ทธ ์ „๊นŒ์ง€ ๋ชจ๋“  ์š”์ฒญ์ด ์ „์ฒด ์ปจํ…์ŠคํŠธ๋ฅผ ์žฌ๊ณผ๊ธˆํ•ฉ๋‹ˆ๋‹ค. 1M์€ ๋„ˆ๋ฌด ํฌ๋‹ˆ ${fmt(s.recommendedMin)}~${fmt(s.recommendedMax)} ๋ฒ”์œ„๋ฅผ ๊ถŒ์žฅํ•ฉ๋‹ˆ๋‹ค (๊ธฐ๋ณธ๊ฐ’ ${fmt(s.recommended)}, --value๋กœ ์กฐ์ ˆ). 1M ์ฐฝ ์ž์ฒด๋Š” ๊ทธ๋Œ€๋กœ ๋‘๊ณ  ์••์ถ• ์‹œ์ ๋งŒ ์•ž๋‹น๊น๋‹ˆ๋‹ค.`
82
+ : ` Until then every request re-bills the whole context. 1M is too large โ€” pick something in ${fmt(s.recommendedMin)}โ€“${fmt(s.recommendedMax)} (default ${fmt(s.recommended)}, override with --value). The 1M window itself stays.`);
83
+ console.log(`\n claude-token-saver compact-window set --global (~/.claude/settings.json, ${fmt(s.recommended)})`);
84
+ console.log(` claude-token-saver compact-window set --project (<root>/.claude/settings.json, ${fmt(s.recommended)})`);
85
+ console.log(` claude-token-saver compact-window set --global --value ${fmt(s.recommendedMax)}`);
83
86
  console.log(ko ? ' (์ ์šฉ ๋ฒ”์œ„๋Š” ์‚ฌ์šฉ์ž์—๊ฒŒ ๋จผ์ € ํ™•์ธํ•  ๊ฒƒ)' : ' (confirm the scope with the user first)');
84
87
  return;
85
88
  }
86
89
 
87
90
  console.error(`Unknown compact-window subcommand: ${sub}`);
88
- console.error('Usage: claude-token-saver compact-window [status|set --global|--project [--value 400k]|off|on]');
91
+ console.error('Usage: claude-token-saver compact-window [status|set --global|--project [--value 500k]|off|on]');
89
92
  process.exit(1);
90
93
  }
@@ -5,8 +5,13 @@
5
5
  * `min(settings.autoCompactWindow, model max context)`. On a 1M window the
6
6
  * default lets a session grow past 800k before compaction ever fires, so every
7
7
  * later request re-bills a context most sessions never needed. Pinning
8
- * `autoCompactWindow: 400000` keeps twice the headroom of a 200k session for
9
- * the genuinely large ones while capping the runaway tail.
8
+ * `autoCompactWindow` somewhere in 400kโ€“700k keeps 2โ€“3.5x the headroom of a
9
+ * 200k session for the genuinely large ones while capping the runaway tail.
10
+ *
11
+ * The recommendation is a range, not a number: 400k is the floor where the
12
+ * saving is worth the extra compactions, and in practice long sessions often
13
+ * want more room than that. Anything at or below 700k is left alone โ€” only an
14
+ * unset window, or one above 700k, is a real config defect.
10
15
  *
11
16
  * 200k sessions are exempt by design: their window is already <= 200k, so the
12
17
  * setting changes nothing and a warning would be pure noise.
@@ -28,7 +33,13 @@ import { debug } from './debug.js';
28
33
  // the app would honor.
29
34
  export const MIN_WINDOW = 100_000;
30
35
  export const MAX_WINDOW = 1_000_000;
31
- export const RECOMMENDED_WINDOW = 400_000;
36
+ // Recommended band. Warn only outside it on the high side (or when unset) โ€”
37
+ // a window below RECOMMENDED_MIN is a deliberate, more aggressive choice and
38
+ // costs nothing, so it stays silent.
39
+ export const RECOMMENDED_MIN = 400_000;
40
+ export const RECOMMENDED_MAX = 700_000;
41
+ // What `compact-window set` writes when no --value is given: middle of the band.
42
+ export const RECOMMENDED_WINDOW = 500_000;
32
43
 
33
44
  // A model id whose context is the 1M variant. Claude Code spells it as a
34
45
  // suffix on the model id (`claude-opus-5[1m]`); the beta header form
@@ -116,10 +127,10 @@ export function effectiveWindow(root) {
116
127
  /**
117
128
  * Full audit result. `ok` is true when there is nothing to warn about โ€” either
118
129
  * the session is not on a 1M model (exempt), or the window is already pinned at
119
- * or below the recommended 400k.
130
+ * or below the top of the recommended band (700k).
120
131
  *
121
132
  * `reason` names why it is not ok: 'unset' (no autoCompactWindow anywhere) or
122
- * 'too-large' (set, but above 400k โ€” still lets context run away).
133
+ * 'too-large' (set, but above 700k โ€” still lets context run away).
123
134
  */
124
135
  export function compactWindowStatus({ root = process.cwd() } = {}) {
125
136
  const { model, source: modelSource } = resolveModelId(root);
@@ -133,10 +144,12 @@ export function compactWindowStatus({ root = process.cwd() } = {}) {
133
144
  windowSource: win.source,
134
145
  windowPath: win.path || null,
135
146
  recommended: RECOMMENDED_WINDOW,
147
+ recommendedMin: RECOMMENDED_MIN,
148
+ recommendedMax: RECOMMENDED_MAX,
136
149
  };
137
150
  if (!is1m) return { ...base, ok: true, reason: 'not-1m' };
138
151
  if (win.value === null) return { ...base, ok: false, reason: 'unset' };
139
- if (win.value > RECOMMENDED_WINDOW) return { ...base, ok: false, reason: 'too-large' };
152
+ if (win.value > RECOMMENDED_MAX) return { ...base, ok: false, reason: 'too-large' };
140
153
  return { ...base, ok: true, reason: 'configured' };
141
154
  }
142
155