token-pilot 0.35.0 → 0.36.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.
@@ -6,14 +6,14 @@
6
6
  },
7
7
  "metadata": {
8
8
  "description": "Token Pilot \u2014 save 60-90% tokens when AI reads code",
9
- "version": "0.35.0"
9
+ "version": "0.36.0"
10
10
  },
11
11
  "plugins": [
12
12
  {
13
13
  "name": "token-pilot",
14
14
  "source": "./",
15
15
  "description": "Reduces token consumption by 60-90% via AST-aware lazy file reading, structural symbol navigation, and cross-session tool-usage analytics. 22 MCP tools + 19 subagents + budget watchdog hooks.",
16
- "version": "0.35.0",
16
+ "version": "0.36.0",
17
17
  "author": {
18
18
  "name": "Digital-Threads"
19
19
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "token-pilot",
3
- "version": "0.35.0",
3
+ "version": "0.36.0",
4
4
  "description": "Saves 60-90% tokens on AI code reading. AST-aware lazy reads, symbol navigation, find_usages, structural git diff/log, edit-safety guard, Task-routing matcher, cross-session telemetry (errors + diagnostics), 25 tp-* subagents tiered to haiku/sonnet/opus with budget watchdog.",
5
5
  "author": {
6
6
  "name": "Digital-Threads",
package/README.md CHANGED
@@ -232,6 +232,43 @@ lines instead of bouncing the call. The structural summary still
232
232
  rides along in `additionalContext`. Default OFF because the field
233
233
  is undocumented and may change.
234
234
 
235
+ ## What's new for Claude Code 2.1.151+
236
+
237
+ These notes are about behaviour you'll see automatically once you
238
+ update both Claude Code and `token-pilot@latest`. No extra
239
+ configuration required.
240
+
241
+ ### Session title badge (`[TP] Nk saved`)
242
+
243
+ The SessionStart hook now sets the window/tab title to the cumulative
244
+ token savings for the current project, using Claude Code 2.1.152's
245
+ `hookSpecificOutput.sessionTitle` field. You'll see a badge like
246
+ `[TP] 1.2M saved` in the title bar so you can confirm at a glance
247
+ that the plugin is doing its job.
248
+
249
+ ### Hardened skills (`disallowed-tools`)
250
+
251
+ The three bundled skills (`guide`, `install`, `stats`) declare
252
+ `disallowed-tools` (Claude Code 2.1.152+) so a runaway model can't
253
+ issue `Write` / `Edit` / `Task` while the skill is on display. The
254
+ install skill keeps `Bash` because it has to run
255
+ `npx token-pilot install-ast-index`; the other two have Bash
256
+ disallowed too.
257
+
258
+ ### Auto mode on third-party providers
259
+
260
+ Claude Code 2.1.158 opened auto mode to Bedrock / Vertex / Foundry
261
+ on Opus 4.7 + 4.8. If you're on one of those, opt in with
262
+ `CLAUDE_CODE_ENABLE_AUTO_MODE=1`. token-pilot's deny-Read /
263
+ deny-Bash gates still run on top — auto mode never bypasses them.
264
+
265
+ ### Opus 4.8 as fast-mode default
266
+
267
+ Claude Code 2.1.154 made Opus 4.8 the default for high effort. The
268
+ tp-* agents that already declared `model: haiku` keep their cheaper
269
+ tier (90 %+ of the agent roster); the few sonnet/opus-tier ones
270
+ ride the upgrade automatically.
271
+
235
272
  ## Troubleshooting
236
273
 
237
274
  ```bash
@@ -9,7 +9,7 @@ tools:
9
9
  - mcp__token-pilot__read_symbol
10
10
  - Bash
11
11
  model: haiku
12
- token_pilot_version: "0.35.0"
12
+ token_pilot_version: "0.36.0"
13
13
  token_pilot_body_hash: dd184501203fa7f3c73f419c4ffbe33c4be75400cb64a7a51733a3fe23f6e085
14
14
  requiredMcpServers:
15
15
  - "token-pilot"
@@ -11,7 +11,7 @@ tools:
11
11
  - Grep
12
12
  - Read
13
13
  model: sonnet
14
- token_pilot_version: "0.35.0"
14
+ token_pilot_version: "0.36.0"
15
15
  token_pilot_body_hash: d172f600bf32277ea6eb4cbbee4542ddd698a986dcd96997d33930561964569b
16
16
  requiredMcpServers:
17
17
  - "token-pilot"
@@ -8,7 +8,7 @@ tools:
8
8
  - mcp__token-pilot__test_summary
9
9
  - mcp__token-pilot__outline
10
10
  - Bash
11
- token_pilot_version: "0.35.0"
11
+ token_pilot_version: "0.36.0"
12
12
  token_pilot_body_hash: de64a406b5176de19f7422619c7de7949b1f28865f225402c9cea9255f377428
13
13
  requiredMcpServers:
14
14
  - "token-pilot"
@@ -13,7 +13,7 @@ tools:
13
13
  - Edit
14
14
  - Glob
15
15
  model: sonnet
16
- token_pilot_version: "0.35.0"
16
+ token_pilot_version: "0.36.0"
17
17
  token_pilot_body_hash: 68b32af2dacd82ebe52c4eec93edb903d452688274c3065218270627c564d8b0
18
18
  requiredMcpServers:
19
19
  - "token-pilot"
@@ -11,7 +11,7 @@ tools:
11
11
  - Grep
12
12
  - Read
13
13
  model: sonnet
14
- token_pilot_version: "0.35.0"
14
+ token_pilot_version: "0.36.0"
15
15
  token_pilot_body_hash: d9b7f5b7ae6f4ae21305c775361bcab097cc774370a6d976c093571d46d55021
16
16
  requiredMcpServers:
17
17
  - "token-pilot"
@@ -12,7 +12,7 @@ tools:
12
12
  - Read
13
13
  - Bash
14
14
  model: sonnet
15
- token_pilot_version: "0.35.0"
15
+ token_pilot_version: "0.36.0"
16
16
  token_pilot_body_hash: 052413de8d92377edcde6ae5c823f5378db304baccfa29e8866467f42553a500
17
17
  requiredMcpServers:
18
18
  - "token-pilot"
@@ -9,7 +9,7 @@ tools:
9
9
  - Bash
10
10
  - Read
11
11
  model: haiku
12
- token_pilot_version: "0.35.0"
12
+ token_pilot_version: "0.36.0"
13
13
  token_pilot_body_hash: e14dc57493d816f8c2e017963e2ef5f66bea50fd0b805a80e8a0d97c968427e7
14
14
  requiredMcpServers:
15
15
  - "token-pilot"
@@ -13,7 +13,7 @@ tools:
13
13
  - Edit
14
14
  - Glob
15
15
  model: haiku
16
- token_pilot_version: "0.35.0"
16
+ token_pilot_version: "0.36.0"
17
17
  token_pilot_body_hash: 57d741794ab40e31a7ac49c68ea39a9088f5827cdef866ce81bfca1b7c9180cf
18
18
  requiredMcpServers:
19
19
  - "token-pilot"
@@ -10,7 +10,7 @@ tools:
10
10
  - Bash
11
11
  - Read
12
12
  model: haiku
13
- token_pilot_version: "0.35.0"
13
+ token_pilot_version: "0.36.0"
14
14
  token_pilot_body_hash: 7b70fa76a60e3c58a1de4f56c32c0f166424137e203a0cf1c8654e7c9235d904
15
15
  requiredMcpServers:
16
16
  - "token-pilot"
@@ -12,7 +12,7 @@ tools:
12
12
  - mcp__token-pilot__read_symbols
13
13
  - Read
14
14
  model: sonnet
15
- token_pilot_version: "0.35.0"
15
+ token_pilot_version: "0.36.0"
16
16
  token_pilot_body_hash: 351a987e11eba63852f5431a16d8eb53104f4f689f82fdcc5a2bf4db948ba92f
17
17
  requiredMcpServers:
18
18
  - "token-pilot"
@@ -8,7 +8,7 @@ tools:
8
8
  - mcp__token-pilot__read_symbol
9
9
  - Bash
10
10
  model: inherit
11
- token_pilot_version: "0.35.0"
11
+ token_pilot_version: "0.36.0"
12
12
  token_pilot_body_hash: de5722bfea374eaab096c1ae635c37879e7a91370ee3cd0532f4240be03c91eb
13
13
  requiredMcpServers:
14
14
  - "token-pilot"
@@ -13,7 +13,7 @@ tools:
13
13
  - Edit
14
14
  - Bash
15
15
  model: sonnet
16
- token_pilot_version: "0.35.0"
16
+ token_pilot_version: "0.36.0"
17
17
  token_pilot_body_hash: 375a824d0d847bb5453ec594c7a62ad566ee7e4d92717b0473f771f1a0477c60
18
18
  requiredMcpServers:
19
19
  - "token-pilot"
@@ -11,7 +11,7 @@ tools:
11
11
  - Grep
12
12
  - Glob
13
13
  model: sonnet
14
- token_pilot_version: "0.35.0"
14
+ token_pilot_version: "0.36.0"
15
15
  token_pilot_body_hash: 0334de1bf99b431b65359637d125cda7c44c6f780eb92c57cc538715b1939536
16
16
  requiredMcpServers:
17
17
  - "token-pilot"
@@ -10,7 +10,7 @@ tools:
10
10
  - mcp__token-pilot__smart_read
11
11
  - mcp__token-pilot__smart_read_many
12
12
  - mcp__token-pilot__read_section
13
- token_pilot_version: "0.35.0"
13
+ token_pilot_version: "0.36.0"
14
14
  token_pilot_body_hash: 832e95633fbc8e9b0c10f3e540a327d4be062fb4b3f17a6cce6be13f414e2927
15
15
  requiredMcpServers:
16
16
  - "token-pilot"
@@ -11,7 +11,7 @@ tools:
11
11
  - Bash
12
12
  - Read
13
13
  model: sonnet
14
- token_pilot_version: "0.35.0"
14
+ token_pilot_version: "0.36.0"
15
15
  token_pilot_body_hash: b61f06380d80798fa2e49d37bcba0653495bee04dd6bdbc1feff9a75607b0508
16
16
  requiredMcpServers:
17
17
  - "token-pilot"
@@ -11,7 +11,7 @@ tools:
11
11
  - mcp__token-pilot__read_for_edit
12
12
  - Read
13
13
  model: sonnet
14
- token_pilot_version: "0.35.0"
14
+ token_pilot_version: "0.36.0"
15
15
  token_pilot_body_hash: f83f50d05b4f70285ae7afed2b1a406fc436df56e61a0aedbfb31edc7f2b6e66
16
16
  requiredMcpServers:
17
17
  - "token-pilot"
@@ -8,7 +8,7 @@ tools:
8
8
  - mcp__token-pilot__outline
9
9
  - mcp__token-pilot__read_symbol
10
10
  model: sonnet
11
- token_pilot_version: "0.35.0"
11
+ token_pilot_version: "0.36.0"
12
12
  token_pilot_body_hash: c5f6fc122c89e16e5cf774045f92169ee3468555320b898171ba13eca5323550
13
13
  requiredMcpServers:
14
14
  - "token-pilot"
@@ -9,7 +9,7 @@ tools:
9
9
  - mcp__token-pilot__module_info
10
10
  - Bash
11
11
  model: sonnet
12
- token_pilot_version: "0.35.0"
12
+ token_pilot_version: "0.36.0"
13
13
  token_pilot_body_hash: 8ef3c3341cbfed4eb8dd130126a9683edc57e378c92ff0ca764d584fd941c55c
14
14
  requiredMcpServers:
15
15
  - "token-pilot"
package/agents/tp-run.md CHANGED
@@ -16,7 +16,7 @@ tools:
16
16
  - Glob
17
17
  - Bash
18
18
  model: haiku
19
- token_pilot_version: "0.35.0"
19
+ token_pilot_version: "0.36.0"
20
20
  token_pilot_body_hash: 2b08618d34a61f00aafccbda9fed6d83243296dedb83440edbd2d5c28bb6dbc4
21
21
  requiredMcpServers:
22
22
  - "token-pilot"
@@ -9,7 +9,7 @@ tools:
9
9
  - mcp__token-pilot__session_budget
10
10
  - Bash
11
11
  - Read
12
- token_pilot_version: "0.35.0"
12
+ token_pilot_version: "0.36.0"
13
13
  token_pilot_body_hash: 529374ed728f5eed5b758b3be3da65624783c0bf0c1a253d7d661a843eb5f767
14
14
  requiredMcpServers:
15
15
  - "token-pilot"
@@ -11,7 +11,7 @@ tools:
11
11
  - Read
12
12
  - Grep
13
13
  model: sonnet
14
- token_pilot_version: "0.35.0"
14
+ token_pilot_version: "0.36.0"
15
15
  token_pilot_body_hash: a60f6ae110eb3138064bce074e8ba26fa0ce5f4659df1624a9d9d3646803391b
16
16
  requiredMcpServers:
17
17
  - "token-pilot"
@@ -9,7 +9,7 @@ tools:
9
9
  - Read
10
10
  - Write
11
11
  model: sonnet
12
- token_pilot_version: "0.35.0"
12
+ token_pilot_version: "0.36.0"
13
13
  token_pilot_body_hash: c7a4e8b39228fd5158528f389c924c5ff2d98c4b9b05ee0106d54a26c5dc1350
14
14
  requiredMcpServers:
15
15
  - "token-pilot"
@@ -10,7 +10,7 @@ tools:
10
10
  - mcp__token-pilot__test_summary
11
11
  - Glob
12
12
  - Grep
13
- token_pilot_version: "0.35.0"
13
+ token_pilot_version: "0.36.0"
14
14
  token_pilot_body_hash: be81eed53a3720d146cf89e4a14a7a56577633f7c84c234c412ab70d64c05b11
15
15
  requiredMcpServers:
16
16
  - "token-pilot"
@@ -8,7 +8,7 @@ tools:
8
8
  - mcp__token-pilot__find_usages
9
9
  - mcp__token-pilot__read_symbol
10
10
  model: sonnet
11
- token_pilot_version: "0.35.0"
11
+ token_pilot_version: "0.36.0"
12
12
  token_pilot_body_hash: 362ecf4cb03b059421ea26933473700900073dc38b3a7fe271208dfb1ae14f90
13
13
  requiredMcpServers:
14
14
  - "token-pilot"
@@ -13,7 +13,7 @@ tools:
13
13
  - Edit
14
14
  - Bash
15
15
  model: sonnet
16
- token_pilot_version: "0.35.0"
16
+ token_pilot_version: "0.36.0"
17
17
  token_pilot_body_hash: 269f2fe22ff4517c277d3f56ca67d8a5527b93290ab21079a83ba7af22c1b5a9
18
18
  requiredMcpServers:
19
19
  - "token-pilot"
@@ -274,11 +274,60 @@ export async function handleSessionStart(opts) {
274
274
  ".token-pilot/snapshots/latest.md",
275
275
  ".token-pilot/hook-events.jsonl",
276
276
  ];
277
+ // v0.36.0 — sessionTitle was added in Claude Code 2.1.152. We surface
278
+ // the cumulative saved-token count for this project so users see the
279
+ // payoff at a glance in their window/tab title. Best-effort — if the
280
+ // savings file is unreadable we fall back to a neutral title.
281
+ let sessionTitle;
282
+ try {
283
+ const { loadSessionStats } = await import("../core/session-savings.js");
284
+ // Sum savings across all sessions in this project, not just one.
285
+ const stats = loadSessionStats(opts.projectRoot, "");
286
+ // sessionId="" makes loadSessionStats short-circuit; use a tiny
287
+ // dedicated reader instead.
288
+ const { readFileSync } = await import("node:fs");
289
+ const { join } = await import("node:path");
290
+ let total = 0;
291
+ try {
292
+ const raw = readFileSync(join(opts.projectRoot, ".token-pilot", "hook-events.jsonl"), "utf-8");
293
+ for (const line of raw.split("\n")) {
294
+ if (!line)
295
+ continue;
296
+ try {
297
+ const ev = JSON.parse(line);
298
+ if (typeof ev.savedTokens === "number")
299
+ total += ev.savedTokens;
300
+ }
301
+ catch {
302
+ /* skip malformed line */
303
+ }
304
+ }
305
+ }
306
+ catch {
307
+ /* no log file yet */
308
+ }
309
+ // Use the larger of "single-session" (loadSessionStats fallback)
310
+ // and the all-sessions sum so an empty single-session number
311
+ // doesn't override the meaningful project-wide total.
312
+ const surfaced = Math.max(total, stats.savedTokens);
313
+ if (surfaced > 0) {
314
+ const human = surfaced >= 1_000_000
315
+ ? `${(surfaced / 1_000_000).toFixed(1)}M`
316
+ : surfaced >= 1000
317
+ ? `${Math.round(surfaced / 1000)}k`
318
+ : `${surfaced}`;
319
+ sessionTitle = `[TP] ${human} saved`;
320
+ }
321
+ }
322
+ catch {
323
+ /* sessionTitle is best-effort decoration; never block startup */
324
+ }
277
325
  const output = {
278
326
  hookSpecificOutput: {
279
327
  hookEventName: "SessionStart",
280
328
  additionalContext: message,
281
329
  watchPaths,
330
+ ...(sessionTitle ? { sessionTitle } : {}),
282
331
  },
283
332
  };
284
333
  return JSON.stringify(output);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "token-pilot",
3
- "version": "0.35.0",
3
+ "version": "0.36.0",
4
4
  "description": "Save up to 80% tokens when AI reads code — MCP server for token-efficient code navigation, AST-aware structural reading instead of dumping full files into context window",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -3,6 +3,17 @@ name: guide
3
3
  description: Show a quick-reference guide for all Token Pilot tools — when to use each one
4
4
  command: guide
5
5
  user_invocable: true
6
+ # v0.36.0 — disallowed-tools is a Claude Code 2.1.152+ field that
7
+ # strips the listed tools from the model's surface while this skill
8
+ # is active. The guide just renders Markdown; it never needs Edit /
9
+ # Write / Bash / Task. Defense-in-depth so a runaway model can't
10
+ # mutate the workspace while a help screen is on display.
11
+ disallowed-tools:
12
+ - Bash
13
+ - Edit
14
+ - MultiEdit
15
+ - Write
16
+ - Task
6
17
  ---
7
18
 
8
19
  Display the following Token Pilot tool reference to the user. Show it exactly as formatted below.
@@ -3,6 +3,16 @@ name: install
3
3
  description: Install or check ast-index binary (auto-downloads if missing)
4
4
  command: install
5
5
  user_invocable: true
6
+ # v0.36.0 — disallowed-tools (Claude Code 2.1.152+). The install
7
+ # skill drives one `npx token-pilot install-ast-index` Bash command;
8
+ # nothing else. Keep Bash, block all write/edit/delegation tools so
9
+ # a rogue interpretation can't extend the install into arbitrary
10
+ # workspace mutation.
11
+ disallowed-tools:
12
+ - Edit
13
+ - MultiEdit
14
+ - Write
15
+ - Task
6
16
  ---
7
17
 
8
18
  Run the following command to install or verify the ast-index binary:
@@ -3,6 +3,14 @@ name: stats
3
3
  description: Show Token Pilot session analytics — token savings, per-tool breakdown, top files, per-agent grouping
4
4
  command: stats
5
5
  user_invocable: true
6
+ # v0.36.0 — disallowed-tools (Claude Code 2.1.152+). stats only reads
7
+ # the events log and runs `token-pilot stats` variants. No
8
+ # Edit/Write/Task ever — block them defensively.
9
+ disallowed-tools:
10
+ - Edit
11
+ - MultiEdit
12
+ - Write
13
+ - Task
6
14
  ---
7
15
 
8
16
  Two entry points: