Skip to content

Commit 5fb2fd3

Browse files
shahinyanmclaude
andcommitted
feat: v0.43.0 — module_route tool, statusline session+MCP savings, CC 2.1.16x
Bundled release capturing everything actionable from ast-index 3.41→3.45 and Claude Code 2.1.163→2.1.167. Added - module_route MCP tool (#23) wrapping ast-index 3.44 `module-route`: transitive dependency path(s) between two modules, text/json/mermaid/dot output. Full-profile only. Handler + client method + validation + server dispatch + tool definition + tests. - statusline Claude.ai rate limits (CC 2.1.80+): `5h:NN% 7d:NN%` from the `rate_limits` payload (schema verified against the 2.1.167 bundle). - effort: low on the guide/install/stats skills (CC 2.1.16x). Fixed — statusline - bare [TP] in monorepos/subdirs/worktrees: walk up to the project root (nearest ancestor with .token-pilot/), like git finds .git. - undercounted savings: the badge summed only hook-denial savings (hook-events.jsonl). It now also sums MCP-tool savings (tool-calls.jsonl, tokensWouldBe − tokensReturned). The MCP server stamps each tool-calls row with the real CLAUDE_CODE_SESSION_ID (was empty), so both sources split per session. - frozen-looking number: render session + project with one decimal, e.g. [TP s:12.3k · 172.6k]. Changed - version 0.43.0 (package/plugin/marketplace + help banner 22→23). - docs: README + docs/tools.md tool count and module_route entry. Chore - remove dead imports in src/ast-index/client.ts. Notes (no code, CC 2.1.16x): additionalContext-on-failed-tool fix, SubagentStop background_tasks/session_crons, glob deny rules — documented in README/CHANGELOG. MessageDisplay hook deliberately deferred: output contract unconfirmable from the minified bundle and it saves no tokens (display-only). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent aa6a32b commit 5fb2fd3

44 files changed

Lines changed: 835 additions & 81 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude-plugin/marketplace.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
"email": "shahinyanm@gmail.com"
66
},
77
"metadata": {
8-
"description": "Token Pilot \u2014 save 60-90% tokens when AI reads code",
9-
"version": "0.42.3"
8+
"description": "Token Pilot save 60-90% tokens when AI reads code",
9+
"version": "0.43.0"
1010
},
1111
"plugins": [
1212
{
1313
"name": "token-pilot",
1414
"source": "./",
1515
"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.42.3",
16+
"version": "0.43.0",
1717
"author": {
1818
"name": "Digital-Threads"
1919
},

.claude-plugin/plugin.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "token-pilot",
3-
"version": "0.42.3",
3+
"version": "0.43.0",
44
"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.",
55
"author": {
66
"name": "Digital-Threads",
@@ -21,7 +21,9 @@
2121
"mcpServers": {
2222
"token-pilot": {
2323
"command": "sh",
24-
"args": ["${CLAUDE_PLUGIN_ROOT}/start.sh"]
24+
"args": [
25+
"${CLAUDE_PLUGIN_ROOT}/start.sh"
26+
]
2527
}
2628
}
2729
}

CHANGELOG.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,107 @@ All notable changes to Token Pilot will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.43.0] - 2026-06-06
9+
10+
Bundled release: everything actionable from **ast-index 3.41→3.45** and
11+
**Claude Code 2.1.163→2.1.167**, plus a statusline fix.
12+
13+
### Added — `module_route` MCP tool (ast-index 3.44)
14+
15+
New tool wrapping ast-index's `module-route` command: the transitive
16+
dependency path(s) between two modules. Answers "how does module A reach
17+
module B through the import graph?", traces coupling, and can emit a
18+
dependency diagram.
19+
20+
- `from` / `to` (required), plus `all`, `maxPaths` (≤200), `maxDepth`
21+
(≤50), `viaKind` (`api`/`implementation`/`all`), `format`
22+
(`text`/`json`/`mermaid`/`dot`).
23+
- Machine formats (json/mermaid/dot) pass through clean — no header that
24+
would corrupt a diagram/parse. Text format gets a `MODULE ROUTE: a → b`
25+
header.
26+
- Empty output explains both causes (modules unrelated **or** the
27+
module-dependency graph isn't indexed — `ast-index rebuild`).
28+
- Full-profile only (not in nav/edit/minimal sets) — a specialised
29+
analysis tool, like the audit tools.
30+
- `exec` already sets `AST_INDEX_WALK_UP=1`, so the route resolves from a
31+
monorepo subdir without passing `--walk-up`.
32+
33+
### Fixed — statusline now counts MCP-tool savings, not just hook denials
34+
35+
The badge summed only `hook-events.jsonl` (`savedTokens` from intercepted
36+
raw `Read`/`Grep`). The larger share — savings from the MCP tools
37+
themselves (`smart_read`, `outline`, `find_usages`, …) — lives in
38+
`tool-calls.jsonl` and was **invisible** to the badge, so the displayed
39+
figure undercounted real savings (often by an order of magnitude).
40+
41+
Two changes fix it:
42+
43+
- The MCP server now stamps every `tool-calls.jsonl` row with the real
44+
Claude Code session id, read from `CLAUDE_CODE_SESSION_ID` (exported to
45+
child processes; verified against the 2.1.167 bundle — the same value
46+
the hooks receive and the statusline payload carries). Previously these
47+
rows had an empty `session_id`, so they could not be attributed to a
48+
session at all.
49+
- The statusline sums **both** logs: `hook-events.jsonl` `savedTokens`
50+
plus `tool-calls.jsonl` (`tokensWouldBe − tokensReturned`), each split
51+
into the current session and the project total. Zero/negative deltas
52+
(pass-throughs) are ignored.
53+
54+
### Added — statusline Claude.ai rate limits (CC 2.1.80+)
55+
56+
The badge now appends `5h:42% 7d:13%` when the statusline payload carries
57+
`rate_limits` (subscribers only, after the first API response). Schema
58+
verified against the 2.1.167 bundle: `rate_limits.five_hour.used_percentage`
59+
and `rate_limits.seven_day.used_percentage`. Unlike the cumulative token
60+
total, these numbers move every turn — the badge finally shows something
61+
live. Parsed with `sed` (no `jq` dependency) and whitelisted to digits.
62+
63+
### Fixed — statusline bare `[TP]` in monorepos / subdirs / worktrees
64+
65+
The badge resolved the events log only at the exact `cwd` from the
66+
payload. In a monorepo (or worktree, or any session `cd`'d into a
67+
subpackage) the `.token-pilot/` dir is at the repo root, so the lookup
68+
failed and rendered a bare `[TP]` with no token count. The script now
69+
**walks up** to the nearest ancestor with `.token-pilot/` (bounded to 40
70+
levels), the same way git finds `.git`.
71+
72+
### Changed — statusline shows session + project savings (`s:12.3k · 172.6k`)
73+
74+
The badge now renders **both** the current session's saved tokens (the
75+
number you watch climb during a run) and the cumulative project total,
76+
e.g. `[TP s:12.3k · 172.6k]`. A fresh session that hasn't saved anything
77+
yet falls back to the project total alone (never an empty badge after
78+
first use). Numbers render with one decimal (`172.6k`, not `172k`) so a
79+
single turn's ~100-token savings is visible on each render — whole-`k`
80+
rounding previously made the figure look frozen.
81+
82+
### Added — `effort: low` on the bundled skills (CC 2.1.16x)
83+
84+
`guide` / `install` / `stats` declare `effort: low` — they render static
85+
output or run one CLI call, so they don't need a high-effort model.
86+
Faster and cheaper when invoked.
87+
88+
### Notes — Claude Code 2.1.16x integration (no code change required)
89+
90+
- **`additionalContext` no longer dropped on a failed tool call** — our
91+
PreToolUse routing guidance now survives a failed call (we benefit
92+
automatically).
93+
- **`SubagentStop` input gained `background_tasks` / `session_crons`**
94+
available to our subagent-stop hook for future budget feedback.
95+
- **Glob deny rules (`"*"` denies all tools)** — usable as a second
96+
enforcement layer on top of our deny hooks for stricter TP adoption.
97+
98+
### Deferred — `MessageDisplay` hook (researched, not shipped)
99+
100+
CC's new `MessageDisplay` hook transforms assistant text *as displayed*.
101+
Deliberately NOT wired this release: (1) the output contract (the field
102+
that returns replacement text) is not confirmable from the minified
103+
2.1.167 bundle — and our rule is never to ship an unverified CC field
104+
beside working hooks; (2) it is display-only, so it saves no input or
105+
output tokens (the text is already generated and already in context).
106+
That is caveman's cosmetic-output domain, not token-pilot's input domain.
107+
Revisit once a live MessageDisplay payload pins the contract.
108+
8109
## [0.30.0] - 2026-04-19
9110

10111
### Added — `minimal` profile (5 tools, near-zero overhead)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Creates (or merges into) `.mcp.json` with `token-pilot` + [`context-mode`](https
4343

4444
## What You Get
4545

46-
- **22 MCP tools** — structural reads, symbol search, git analysis, session analytics → [tools reference](docs/tools.md)
46+
- **23 MCP tools** — structural reads, symbol search, git analysis, module routing, session analytics → [tools reference](docs/tools.md)
4747
- **PreToolUse hooks** — block heavy `Grep`/`Bash`/`Read` calls; redirect to efficient alternatives → [hooks & modes](docs/hooks.md)
4848
- **25 `tp-*` subagents** (Claude Code only) — MCP-first delegates with haiku/sonnet model tiers and budget enforcement → [agents reference](docs/agents.md)
4949
- **Tool profiles** — trim advertised `tools/list` to save ~2 k tokens per session → [profiles & config](docs/configuration.md)

agents/tp-api-surface-tracker.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ tools:
99
- mcp__token-pilot__read_symbol
1010
- Bash
1111
model: haiku
12-
token_pilot_version: "0.42.3"
12+
token_pilot_version: "0.43.0"
1313
token_pilot_body_hash: dd184501203fa7f3c73f419c4ffbe33c4be75400cb64a7a51733a3fe23f6e085
1414
requiredMcpServers:
1515
- "token-pilot"

agents/tp-audit-scanner.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ tools:
1111
- Grep
1212
- Read
1313
model: sonnet
14-
token_pilot_version: "0.42.3"
14+
token_pilot_version: "0.43.0"
1515
token_pilot_body_hash: d172f600bf32277ea6eb4cbbee4542ddd698a986dcd96997d33930561964569b
1616
requiredMcpServers:
1717
- "token-pilot"

agents/tp-commit-writer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ tools:
88
- mcp__token-pilot__test_summary
99
- mcp__token-pilot__outline
1010
- Bash
11-
token_pilot_version: "0.42.3"
11+
token_pilot_version: "0.43.0"
1212
token_pilot_body_hash: de64a406b5176de19f7422619c7de7949b1f28865f225402c9cea9255f377428
1313
requiredMcpServers:
1414
- "token-pilot"

agents/tp-context-engineer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ tools:
1313
- Edit
1414
- Glob
1515
model: sonnet
16-
token_pilot_version: "0.42.3"
16+
token_pilot_version: "0.43.0"
1717
token_pilot_body_hash: 68b32af2dacd82ebe52c4eec93edb903d452688274c3065218270627c564d8b0
1818
requiredMcpServers:
1919
- "token-pilot"

agents/tp-dead-code-finder.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ tools:
1111
- Grep
1212
- Read
1313
model: sonnet
14-
token_pilot_version: "0.42.3"
14+
token_pilot_version: "0.43.0"
1515
token_pilot_body_hash: d9b7f5b7ae6f4ae21305c775361bcab097cc774370a6d976c093571d46d55021
1616
requiredMcpServers:
1717
- "token-pilot"

agents/tp-debugger.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ tools:
1212
- Read
1313
- Bash
1414
model: sonnet
15-
token_pilot_version: "0.42.3"
15+
token_pilot_version: "0.43.0"
1616
token_pilot_body_hash: 052413de8d92377edcde6ae5c823f5378db304baccfa29e8866467f42553a500
1717
requiredMcpServers:
1818
- "token-pilot"

0 commit comments

Comments
 (0)