claude-token-saver 2.6.0 → 2.7.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/advice.js +156 -14
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-token-saver",
3
- "version": "2.6.0",
3
+ "version": "2.7.0",
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/advice.js CHANGED
@@ -59,6 +59,48 @@ export const ISSUE_MESSAGES = {
59
59
  commands: [`Press ${toggleShortcut()} to toggle on/off instantly`],
60
60
  commandsKo: [`${toggleShortcut()} 누르면 즉시 on/off 토글`],
61
61
  },
62
+ {
63
+ label: 'Cap extended-thinking budget (⚠ check /effort first)',
64
+ labelKo: '확장 사고(thinking) 예산 제한 (⚠ /effort 먼저 확인)',
65
+ commands: [
66
+ '⚠ Run `/effort` to check current level — `xhigh` is the #1 cap killer',
67
+ '/effort medium — Anthropic-official default (use this for normal coding)',
68
+ '/effort low — for simple edits, labeling, boilerplate',
69
+ '/effort xhigh — ONLY for complex architecture / multi-file refactor planning, then revert',
70
+ 'export MAX_THINKING_TOKENS=8000 # global hard cap (overrides /effort)',
71
+ ],
72
+ commandsKo: [
73
+ '⚠ `/effort`로 현재 단계 확인 — `xhigh`가 캡 소진의 1순위 원인',
74
+ '/effort medium — Anthropic 공식 기본값 (일반 코딩은 이걸로)',
75
+ '/effort low — 단순 편집·라벨링·보일러플레이트',
76
+ '/effort xhigh — 복잡한 아키텍처·다파일 리팩터 계획 한정, 끝나면 즉시 복귀',
77
+ 'export MAX_THINKING_TOKENS=8000 # 전역 하드 캡 (/effort 위에 우선 적용)',
78
+ ],
79
+ },
80
+ {
81
+ label: 'Plan mode preemptively (Shift+Tab)',
82
+ labelKo: 'Plan 모드 선제 사용 (Shift+Tab)',
83
+ commands: [
84
+ 'Plan mode forces a written plan before any edits — prevents wrong-direction rework',
85
+ 'Rework after a misread spec costs more tokens than 1 extra plan turn',
86
+ ],
87
+ commandsKo: [
88
+ 'Plan 모드는 편집 전에 계획을 쓰게 강제 — 잘못된 방향 재작업 방지',
89
+ '스펙 오독 후 재작업이 plan 1턴 추가보다 훨씬 비쌈',
90
+ ],
91
+ },
92
+ {
93
+ label: 'Compact or clear when context grows',
94
+ labelKo: '컨텍스트가 커지면 /compact 또는 /clear',
95
+ commands: [
96
+ '/compact — summarize the session history in place',
97
+ '/clear — drop history entirely at a clean task boundary',
98
+ ],
99
+ commandsKo: [
100
+ '/compact — 세션 히스토리를 그 자리에서 요약',
101
+ '/clear — 작업 분기점에서 히스토리를 통째로 비우기',
102
+ ],
103
+ },
62
104
  {
63
105
  label: '⚠ Known bug #31640',
64
106
  labelKo: '⚠ 알려진 버그 #31640',
@@ -86,14 +128,26 @@ export const ISSUE_MESSAGES = {
86
128
  {
87
129
  label: 'Avoid opening fresh sessions too often',
88
130
  labelKo: '새 세션을 너무 자주 열지 말기',
89
- commands: ['Continue the same task in the same session (context switching = cache miss)'],
90
- commandsKo: ['같은 작업은 같은 세션에서 계속 (컨텍스트 전환 = 캐시 미스)'],
131
+ commands: [
132
+ 'Continue the same task in the same session (context switching = cache miss)',
133
+ 'Resume with `claude --continue` instead of starting fresh — preserves the prefix cache',
134
+ ],
135
+ commandsKo: [
136
+ '같은 작업은 같은 세션에서 계속 (컨텍스트 전환 = 캐시 미스)',
137
+ '새로 시작 대신 `claude --continue`로 재개 — prefix 캐시 보존',
138
+ ],
91
139
  },
92
140
  {
93
141
  label: 'Stabilize the prompt prefix',
94
142
  labelKo: '프롬프트 prefix 안정화',
95
- commands: ['System prompts / tool definitions that change per request invalidate the cache every time'],
96
- commandsKo: ['요청마다 바뀌는 시스템 프롬프트 / 도구 정의는 매번 캐시를 무효화'],
143
+ commands: [
144
+ 'System prompts / tool definitions that change per request invalidate the cache every time',
145
+ 'Trim CLAUDE.md — every line ships on every turn; keep only durable rules',
146
+ ],
147
+ commandsKo: [
148
+ '요청마다 바뀌는 시스템 프롬프트 / 도구 정의는 매번 캐시를 무효화',
149
+ 'CLAUDE.md 다이어트 — 모든 줄이 매 턴 실림; 영속적인 규칙만 유지',
150
+ ],
97
151
  },
98
152
  ],
99
153
  },
@@ -142,6 +196,36 @@ export const ISSUE_MESSAGES = {
142
196
  '긴 문서/README 생성 요청은 스크립트로 옮겨 출력 축소',
143
197
  ],
144
198
  },
199
+ {
200
+ label: 'Cap extended-thinking budget (⚠ check /effort)',
201
+ labelKo: '확장 사고(thinking) 예산 제한 (⚠ /effort 확인)',
202
+ commands: [
203
+ '⚠ Check `/effort` — `xhigh` burns thinking tokens that count as output',
204
+ '/effort medium — Anthropic-official default; switch back from xhigh',
205
+ 'export MAX_THINKING_TOKENS=8000 # global hard cap',
206
+ ],
207
+ commandsKo: [
208
+ '⚠ `/effort` 확인 — `xhigh`는 thinking 토큰을 다량 소비 (출력으로 집계)',
209
+ '/effort medium — Anthropic 공식 기본값; xhigh에서 복귀',
210
+ 'export MAX_THINKING_TOKENS=8000 # 전역 하드 캡',
211
+ ],
212
+ },
213
+ {
214
+ label: 'Model matching strategy (80/15/5 rule)',
215
+ labelKo: '모델 매칭 전략 (80/15/5 비율)',
216
+ commands: [
217
+ 'Sonnet 80% — daily coding, edits, refactors',
218
+ 'Opus 15% — complex design, multi-file refactor planning, deep debugging',
219
+ 'Haiku 5% — boilerplate, labeling, summaries, subagent work',
220
+ 'Switch with `/model sonnet` / `/model opus` / `/model haiku`',
221
+ ],
222
+ commandsKo: [
223
+ 'Sonnet 80% — 일상 코딩, 편집, 리팩터링',
224
+ 'Opus 15% — 복잡한 설계, 다파일 리팩터 계획, 깊은 디버깅',
225
+ 'Haiku 5% — 보일러플레이트, 라벨링, 요약, 서브에이전트 작업',
226
+ '`/model sonnet` / `/model opus` / `/model haiku`로 전환',
227
+ ],
228
+ },
145
229
  ],
146
230
  },
147
231
  HIGH_REQUEST_COUNT: {
@@ -165,6 +249,40 @@ export const ISSUE_MESSAGES = {
165
249
  commands: ['Check that the agent is not repeating the same test/search in a loop'],
166
250
  commandsKo: ['에이전트가 동일한 테스트/검색을 루프로 반복하고 있지 않은지 확인'],
167
251
  },
252
+ {
253
+ label: 'Delegate large searches to a subagent (Sonnet by default)',
254
+ labelKo: '대형 검색은 서브에이전트로 위임 (Sonnet 기본)',
255
+ commands: [
256
+ 'Use the Task tool with the Explore subagent for repo-wide searches',
257
+ 'Pin custom subagents to Sonnet/Haiku in their frontmatter: `model: sonnet`',
258
+ 'The subagent runs in its own context — main session keeps a clean prefix',
259
+ ],
260
+ commandsKo: [
261
+ '레포 전반 검색은 Task 도구의 Explore 서브에이전트로 위임',
262
+ '커스텀 서브에이전트는 frontmatter에 `model: sonnet` 명시 (Opus 자동 상속 방지)',
263
+ '서브에이전트는 자체 컨텍스트에서 실행 — 메인 세션 prefix가 깨끗하게 유지됨',
264
+ ],
265
+ },
266
+ {
267
+ label: 'Migrate MCP servers → Skills / CLI',
268
+ labelKo: 'MCP 서버 → Skills / CLI 전환',
269
+ commands: [
270
+ '30 MCP tools ≈ 3,600 tokens loaded every turn — measured by mcp2cli (HN 146pts)',
271
+ 'Replacing rarely-used MCPs with Skills (loaded on demand) or shell CLI cuts ~96%',
272
+ 'Audit `.mcp.json` and disable everything not used weekly',
273
+ ],
274
+ commandsKo: [
275
+ 'MCP 도구 30개 ≈ 매 턴 3,600 토큰 상시 로드 (mcp2cli 측정, HN 146pts)',
276
+ '드물게 쓰는 MCP를 Skills(필요 시 로드) 또는 셸 CLI로 대체하면 ~96% 절감',
277
+ '`.mcp.json` 점검해 주간에 안 쓰는 건 모두 비활성화',
278
+ ],
279
+ },
280
+ {
281
+ label: 'Trim hooks that inject context',
282
+ labelKo: '컨텍스트 주입 훅 정리',
283
+ commands: ['Disable noisy PreToolUse/PostToolUse hooks unless they earn their tokens'],
284
+ commandsKo: ['값을 못 하는 PreToolUse/PostToolUse 훅은 비활성화'],
285
+ },
168
286
  ],
169
287
  },
170
288
  FREQUENT_CACHE_REBUILD: {
@@ -182,6 +300,30 @@ export const ISSUE_MESSAGES = {
182
300
  commands: ['Continue one task in one Claude Code session'],
183
301
  commandsKo: ['하나의 작업은 하나의 Claude Code 세션에서 계속'],
184
302
  },
303
+ {
304
+ label: 'Use /compact at task boundaries',
305
+ labelKo: '작업 분기점에서 /compact 사용',
306
+ commands: [
307
+ '/compact summarizes prior turns in place — keeps the session alive without re-reading everything',
308
+ 'Better than starting a fresh session, which forces a full prefix rebuild',
309
+ ],
310
+ commandsKo: [
311
+ '/compact는 이전 턴을 그 자리에서 요약 — 전체 재읽기 없이 세션 유지',
312
+ '새 세션을 여는 것보다 나음 (새 세션은 prefix 전체 재구축 강제)',
313
+ ],
314
+ },
315
+ {
316
+ label: 'Avoid re-reading large files',
317
+ labelKo: '큰 파일 반복 Read 피하기',
318
+ commands: [
319
+ 'Prefer `git diff` to see what changed instead of re-reading the whole file',
320
+ 'Edit returns success silently — no need to Read after editing',
321
+ ],
322
+ commandsKo: [
323
+ '파일 전체 다시 읽기 대신 `git diff`로 변경분만 확인',
324
+ 'Edit는 성공 시 조용히 끝남 — 편집 후 Read 다시 할 필요 없음',
325
+ ],
326
+ },
185
327
  ],
186
328
  },
187
329
  };
@@ -197,28 +339,28 @@ export const ISSUE_MESSAGES = {
197
339
  */
198
340
  export const ISSUE_TIPS = {
199
341
  LARGE_INPUT_PER_REQUEST: {
200
- en: 'Disable 1M context: `export CLAUDE_CODE_DISABLE_1M_CONTEXT=1` (or ⌥P toggle)',
201
- ko: '1M 컨텍스트 끄기: `export CLAUDE_CODE_DISABLE_1M_CONTEXT=1` (또는 ⌥P 토글)',
342
+ en: 'Check `/effort` `xhigh` is the #1 cap killer; switch to `/effort medium` (or `low`); disable 1M context; `/compact` when context grows',
343
+ ko: '`/effort` 확인 `xhigh`가 캡 소진 1순위 원인, `medium`(또는 `low`)으로 복귀; 1M 컨텍스트 끄기; 컨텍스트 커지면 `/compact`',
202
344
  },
203
345
  LOW_HIT_RATE: {
204
- en: 'Continue same task in same session; keep prompt prefix stable',
205
- ko: '같은 작업은 같은 세션에서 계속; 프롬프트 prefix 안정 유지',
346
+ en: 'Continue with `claude --continue`; keep CLAUDE.md trim every line ships every turn',
347
+ ko: '`claude --continue`로 재개; CLAUDE.md 다이어트 모든 줄이 매 턴 실림',
206
348
  },
207
349
  BUCKET_5M_DOMINANT: {
208
350
  en: 'Send any prompt within 5min to keep cache warm; Max plan unlocks 1h TTL',
209
351
  ko: '5분 이내 한 번 더 보내 캐시 유지; Max 플랜은 1시간 TTL 제공',
210
352
  },
211
353
  HIGH_OUTPUT_RATIO: {
212
- en: 'Avoid full-file rewrites prefer Edit tool; move long generations to scripts',
213
- ko: '파일 전체 재작성 피하기 Edit 도구 사용; 생성은 스크립트로',
354
+ en: 'Check `/effort` (`xhigh` inflates output); prefer Edit over full rewrites; model matching: Sonnet 80% / Opus 15% / Haiku 5%',
355
+ ko: '`/effort` 확인 (`xhigh`는 출력 폭증); Edit 도구 우선 (전체 재작성 피하기); 모델 매칭: Sonnet 80% / Opus 15% / Haiku 5%',
214
356
  },
215
357
  HIGH_REQUEST_COUNT: {
216
- en: 'Bundle independent calls into one message; check for retry loops',
217
- ko: '독립 호출은 한 메시지에 묶기; 재시도 루프 점검',
358
+ en: 'Bundle calls into one message; delegate to subagents (`model: sonnet`); migrate MCP→Skills/CLI (30 tools = ~3,600 tokens/turn)',
359
+ ko: '호출은 한 메시지에 묶기; 서브에이전트(`model: sonnet`)로 위임; MCP→Skills/CLI 전환 (30 tools ≈ 매 턴 3,600 토큰)',
218
360
  },
219
361
  FREQUENT_CACHE_REBUILD: {
220
- en: 'Continue one task in one session short sessions trigger rebuild',
221
- ko: '한 작업은 한 세션에서 짧은 세션은 재빌드 유발',
362
+ en: 'Continue one task in one session; use `/compact` at boundaries; avoid re-reading large files (use `git diff`)',
363
+ ko: '한 작업은 한 세션에서; 분기점에선 `/compact`; 파일 재읽기 대신 `git diff`',
222
364
  },
223
365
  };
224
366