token-pilot 0.28.3 → 0.30.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 (52) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/CHANGELOG.md +75 -0
  4. package/README.md +39 -390
  5. package/agents/tp-api-surface-tracker.md +4 -2
  6. package/agents/tp-audit-scanner.md +4 -2
  7. package/agents/tp-commit-writer.md +4 -2
  8. package/agents/tp-context-engineer.md +4 -2
  9. package/agents/tp-dead-code-finder.md +4 -2
  10. package/agents/tp-debugger.md +4 -2
  11. package/agents/tp-dep-health.md +4 -2
  12. package/agents/tp-doc-writer.md +4 -2
  13. package/agents/tp-history-explorer.md +4 -2
  14. package/agents/tp-impact-analyzer.md +4 -2
  15. package/agents/tp-incident-timeline.md +4 -2
  16. package/agents/tp-incremental-builder.md +4 -2
  17. package/agents/tp-migration-scout.md +4 -2
  18. package/agents/tp-onboard.md +4 -2
  19. package/agents/tp-performance-profiler.md +4 -2
  20. package/agents/tp-pr-reviewer.md +4 -2
  21. package/agents/tp-refactor-planner.md +4 -2
  22. package/agents/tp-review-impact.md +4 -2
  23. package/agents/tp-run.md +4 -2
  24. package/agents/tp-session-restorer.md +4 -2
  25. package/agents/tp-ship-coordinator.md +4 -2
  26. package/agents/tp-spec-writer.md +4 -2
  27. package/agents/tp-test-coverage-gapper.md +4 -2
  28. package/agents/tp-test-triage.md +4 -2
  29. package/agents/tp-test-writer.md +4 -2
  30. package/dist/cli/tool-audit.d.ts +5 -0
  31. package/dist/cli/tool-audit.js +9 -1
  32. package/dist/core/policy-engine.d.ts +1 -5
  33. package/dist/core/policy-engine.js +9 -24
  34. package/dist/hooks/pre-bash.d.ts +13 -1
  35. package/dist/hooks/pre-bash.js +56 -1
  36. package/dist/hooks/pre-grep.d.ts +2 -1
  37. package/dist/hooks/pre-grep.js +3 -1
  38. package/dist/index.js +4 -2
  39. package/dist/server/enforcement-mode.d.ts +47 -0
  40. package/dist/server/enforcement-mode.js +59 -0
  41. package/dist/server/tool-definitions.d.ts +20 -0
  42. package/dist/server/tool-definitions.js +113 -10
  43. package/dist/server/tool-profiles.d.ts +19 -1
  44. package/dist/server/tool-profiles.js +38 -4
  45. package/dist/server.d.ts +2 -0
  46. package/dist/server.js +68 -16
  47. package/docs/agents.md +82 -0
  48. package/docs/configuration.md +117 -0
  49. package/docs/hooks.md +99 -0
  50. package/docs/installation.md +143 -0
  51. package/docs/tools.md +61 -0
  52. package/package.json +2 -2
@@ -8,8 +8,8 @@ tools:
8
8
  - mcp__token-pilot__test_summary
9
9
  - mcp__token-pilot__outline
10
10
  - Bash
11
- token_pilot_version: "0.28.3"
12
- token_pilot_body_hash: 559a0b61d20974bf33e35bc4c80dcf1b41d10d4df46cf9d05d3d5620713cd46f
11
+ token_pilot_version: "0.30.0"
12
+ token_pilot_body_hash: b6831f11c61a9b255c2b6ffa04837130242fd02843463a7d30f109c1a06b3e3f
13
13
  ---
14
14
 
15
15
  You are a token-pilot agent (`tp-<name>`). Your defining contract:
@@ -18,6 +18,8 @@ For every file in a programming language, you MUST use the token-pilot MCP tools
18
18
 
19
19
  If any MCP tool fails, fall back sensibly (another MCP tool → bounded Read → pass-through) and note the fallback in your output. Never silently abandon the contract.
20
20
 
21
+ For heavy Bash operations (test runs, builds, recursive searches, network calls, any command with potentially large stdout): when `mcp__context-mode__execute` or `ctx_batch_execute` is available, use it instead of raw Bash. Context-mode runs commands in a sandbox and only the result enters your context — typically 95% token reduction vs raw stdout dump. This is complementary to token-pilot: we own code reading, context-mode owns command execution.
22
+
21
23
  Your specific role is defined below.
22
24
 
23
25
  Role: commit-message authoring.
@@ -13,8 +13,8 @@ tools:
13
13
  - Edit
14
14
  - Glob
15
15
  model: sonnet
16
- token_pilot_version: "0.28.3"
17
- token_pilot_body_hash: 8977f452021085a9ba63338bf94e8903e56b30e199dc32e41acc4ec3173a931d
16
+ token_pilot_version: "0.30.0"
17
+ token_pilot_body_hash: 43f9364ce722ff76daf0f8720ddaf9f77e18d4c4ed8bee3e15f12d207798e778
18
18
  ---
19
19
 
20
20
  You are a token-pilot agent (`tp-<name>`). Your defining contract:
@@ -23,6 +23,8 @@ For every file in a programming language, you MUST use the token-pilot MCP tools
23
23
 
24
24
  If any MCP tool fails, fall back sensibly (another MCP tool → bounded Read → pass-through) and note the fallback in your output. Never silently abandon the contract.
25
25
 
26
+ For heavy Bash operations (test runs, builds, recursive searches, network calls, any command with potentially large stdout): when `mcp__context-mode__execute` or `ctx_batch_execute` is available, use it instead of raw Bash. Context-mode runs commands in a sandbox and only the result enters your context — typically 95% token reduction vs raw stdout dump. This is complementary to token-pilot: we own code reading, context-mode owns command execution.
27
+
26
28
  Your specific role is defined below.
27
29
 
28
30
  Role: curate what AI agents see so output quality stays high.
@@ -11,8 +11,8 @@ tools:
11
11
  - Grep
12
12
  - Read
13
13
  model: sonnet
14
- token_pilot_version: "0.28.3"
15
- token_pilot_body_hash: 33798b70002a206c4547d08ff46caefe6dbe5a9300f94ab5dad4a57ab5fb4478
14
+ token_pilot_version: "0.30.0"
15
+ token_pilot_body_hash: 386760aed26df6c3595d3267954605565fad08afa8761e016079ae60c19887a8
16
16
  ---
17
17
 
18
18
  You are a token-pilot agent (`tp-<name>`). Your defining contract:
@@ -21,6 +21,8 @@ For every file in a programming language, you MUST use the token-pilot MCP tools
21
21
 
22
22
  If any MCP tool fails, fall back sensibly (another MCP tool → bounded Read → pass-through) and note the fallback in your output. Never silently abandon the contract.
23
23
 
24
+ For heavy Bash operations (test runs, builds, recursive searches, network calls, any command with potentially large stdout): when `mcp__context-mode__execute` or `ctx_batch_execute` is available, use it instead of raw Bash. Context-mode runs commands in a sandbox and only the result enters your context — typically 95% token reduction vs raw stdout dump. This is complementary to token-pilot: we own code reading, context-mode owns command execution.
25
+
24
26
  Your specific role is defined below.
25
27
 
26
28
  Role: safe dead-code detection.
@@ -12,8 +12,8 @@ tools:
12
12
  - Read
13
13
  - Bash
14
14
  model: sonnet
15
- token_pilot_version: "0.28.3"
16
- token_pilot_body_hash: ada78a5a3f029721fa51e7cd203395ff0e87f0ab614cc7cf0d5bcc1bf9a80435
15
+ token_pilot_version: "0.30.0"
16
+ token_pilot_body_hash: 71738830d025e86c70988e046a2f7f30b4590f3d284291a18609ed5fdd732321
17
17
  ---
18
18
 
19
19
  You are a token-pilot agent (`tp-<name>`). Your defining contract:
@@ -22,6 +22,8 @@ For every file in a programming language, you MUST use the token-pilot MCP tools
22
22
 
23
23
  If any MCP tool fails, fall back sensibly (another MCP tool → bounded Read → pass-through) and note the fallback in your output. Never silently abandon the contract.
24
24
 
25
+ For heavy Bash operations (test runs, builds, recursive searches, network calls, any command with potentially large stdout): when `mcp__context-mode__execute` or `ctx_batch_execute` is available, use it instead of raw Bash. Context-mode runs commands in a sandbox and only the result enters your context — typically 95% token reduction vs raw stdout dump. This is complementary to token-pilot: we own code reading, context-mode owns command execution.
26
+
25
27
  Your specific role is defined below.
26
28
 
27
29
  Role: bug diagnosis via systematic triage.
@@ -9,8 +9,8 @@ tools:
9
9
  - Bash
10
10
  - Read
11
11
  model: haiku
12
- token_pilot_version: "0.28.3"
13
- token_pilot_body_hash: 6224d989835ea284985b474005b8b46052b7007c4610e661b10658286b5c6624
12
+ token_pilot_version: "0.30.0"
13
+ token_pilot_body_hash: 12634cd28889d0a0ef1b4a6b994ba978353e14f3cb349011c393076e7e2b5c96
14
14
  ---
15
15
 
16
16
  You are a token-pilot agent (`tp-<name>`). Your defining contract:
@@ -19,6 +19,8 @@ For every file in a programming language, you MUST use the token-pilot MCP tools
19
19
 
20
20
  If any MCP tool fails, fall back sensibly (another MCP tool → bounded Read → pass-through) and note the fallback in your output. Never silently abandon the contract.
21
21
 
22
+ For heavy Bash operations (test runs, builds, recursive searches, network calls, any command with potentially large stdout): when `mcp__context-mode__execute` or `ctx_batch_execute` is available, use it instead of raw Bash. Context-mode runs commands in a sandbox and only the result enters your context — typically 95% token reduction vs raw stdout dump. This is complementary to token-pilot: we own code reading, context-mode owns command execution.
23
+
22
24
  Your specific role is defined below.
23
25
 
24
26
  Role: dependency health audit.
@@ -13,8 +13,8 @@ tools:
13
13
  - Edit
14
14
  - Glob
15
15
  model: haiku
16
- token_pilot_version: "0.28.3"
17
- token_pilot_body_hash: 72347b06aaea75ed960972e96e2523c221b2ea7c892a3931aa0e7c32e4c86555
16
+ token_pilot_version: "0.30.0"
17
+ token_pilot_body_hash: 8e29d07dd8f58adeb9530ec477a59a6e42de6c624f322d2c6cfa8da66456b46a
18
18
  ---
19
19
 
20
20
  You are a token-pilot agent (`tp-<name>`). Your defining contract:
@@ -23,6 +23,8 @@ For every file in a programming language, you MUST use the token-pilot MCP tools
23
23
 
24
24
  If any MCP tool fails, fall back sensibly (another MCP tool → bounded Read → pass-through) and note the fallback in your output. Never silently abandon the contract.
25
25
 
26
+ For heavy Bash operations (test runs, builds, recursive searches, network calls, any command with potentially large stdout): when `mcp__context-mode__execute` or `ctx_batch_execute` is available, use it instead of raw Bash. Context-mode runs commands in a sandbox and only the result enters your context — typically 95% token reduction vs raw stdout dump. This is complementary to token-pilot: we own code reading, context-mode owns command execution.
27
+
26
28
  Your specific role is defined below.
27
29
 
28
30
  Role: documentation author — decisions, ADRs, READMEs, API docs.
@@ -10,8 +10,8 @@ tools:
10
10
  - Bash
11
11
  - Read
12
12
  model: haiku
13
- token_pilot_version: "0.28.3"
14
- token_pilot_body_hash: b2daca007e959eaf26bf9a4d92ba36c3aa277a51de4ca4db674833d36acbe11b
13
+ token_pilot_version: "0.30.0"
14
+ token_pilot_body_hash: 260197bc31531352f5eda3b70cf114c7c57bb7e9373f68ca76161dd68a804b0d
15
15
  ---
16
16
 
17
17
  You are a token-pilot agent (`tp-<name>`). Your defining contract:
@@ -20,6 +20,8 @@ For every file in a programming language, you MUST use the token-pilot MCP tools
20
20
 
21
21
  If any MCP tool fails, fall back sensibly (another MCP tool → bounded Read → pass-through) and note the fallback in your output. Never silently abandon the contract.
22
22
 
23
+ For heavy Bash operations (test runs, builds, recursive searches, network calls, any command with potentially large stdout): when `mcp__context-mode__execute` or `ctx_batch_execute` is available, use it instead of raw Bash. Context-mode runs commands in a sandbox and only the result enters your context — typically 95% token reduction vs raw stdout dump. This is complementary to token-pilot: we own code reading, context-mode owns command execution.
24
+
23
25
  Your specific role is defined below.
24
26
 
25
27
  Role: git-history archaeology — why, when, by whom.
@@ -12,8 +12,8 @@ tools:
12
12
  - mcp__token-pilot__read_symbols
13
13
  - Read
14
14
  model: sonnet
15
- token_pilot_version: "0.28.3"
16
- token_pilot_body_hash: 0be2620ce0303f912f6b3334f261d169f064970c0d16602fa1e76db4cb2ea441
15
+ token_pilot_version: "0.30.0"
16
+ token_pilot_body_hash: 1da6936cc117a7627640fae3cc85bf13a17f0b0b0d0d533423dfb4b7c0b4b1c2
17
17
  ---
18
18
 
19
19
  You are a token-pilot agent (`tp-<name>`). Your defining contract:
@@ -22,6 +22,8 @@ For every file in a programming language, you MUST use the token-pilot MCP tools
22
22
 
23
23
  If any MCP tool fails, fall back sensibly (another MCP tool → bounded Read → pass-through) and note the fallback in your output. Never silently abandon the contract.
24
24
 
25
+ For heavy Bash operations (test runs, builds, recursive searches, network calls, any command with potentially large stdout): when `mcp__context-mode__execute` or `ctx_batch_execute` is available, use it instead of raw Bash. Context-mode runs commands in a sandbox and only the result enters your context — typically 95% token reduction vs raw stdout dump. This is complementary to token-pilot: we own code reading, context-mode owns command execution.
26
+
25
27
  Your specific role is defined below.
26
28
 
27
29
  Role: impact analysis.
@@ -8,8 +8,8 @@ tools:
8
8
  - mcp__token-pilot__read_symbol
9
9
  - Bash
10
10
  model: inherit
11
- token_pilot_version: "0.28.3"
12
- token_pilot_body_hash: 420ffc423c7479a8d4e1b226cf73eb98d6d41388317c74a950d7f3b6240b6786
11
+ token_pilot_version: "0.30.0"
12
+ token_pilot_body_hash: 213746bab7acb6730a6edb16e1ff7b2c56572c3adf4f94990799f1c168cfa2ad
13
13
  ---
14
14
 
15
15
  You are a token-pilot agent (`tp-<name>`). Your defining contract:
@@ -18,6 +18,8 @@ For every file in a programming language, you MUST use the token-pilot MCP tools
18
18
 
19
19
  If any MCP tool fails, fall back sensibly (another MCP tool → bounded Read → pass-through) and note the fallback in your output. Never silently abandon the contract.
20
20
 
21
+ For heavy Bash operations (test runs, builds, recursive searches, network calls, any command with potentially large stdout): when `mcp__context-mode__execute` or `ctx_batch_execute` is available, use it instead of raw Bash. Context-mode runs commands in a sandbox and only the result enters your context — typically 95% token reduction vs raw stdout dump. This is complementary to token-pilot: we own code reading, context-mode owns command execution.
22
+
21
23
  Your specific role is defined below.
22
24
 
23
25
  Role: incident post-mortem timeline builder.
@@ -13,8 +13,8 @@ tools:
13
13
  - Edit
14
14
  - Bash
15
15
  model: sonnet
16
- token_pilot_version: "0.28.3"
17
- token_pilot_body_hash: 9cb0bdf6e209d8ac613487385c01ef269d827dc3eddaf81b8eba581a3150b1e3
16
+ token_pilot_version: "0.30.0"
17
+ token_pilot_body_hash: 14c9adcabfb772c77a467a5fbfa682abbd5adc87e22d7fbe5d1329ffd790dde5
18
18
  ---
19
19
 
20
20
  You are a token-pilot agent (`tp-<name>`). Your defining contract:
@@ -23,6 +23,8 @@ For every file in a programming language, you MUST use the token-pilot MCP tools
23
23
 
24
24
  If any MCP tool fails, fall back sensibly (another MCP tool → bounded Read → pass-through) and note the fallback in your output. Never silently abandon the contract.
25
25
 
26
+ For heavy Bash operations (test runs, builds, recursive searches, network calls, any command with potentially large stdout): when `mcp__context-mode__execute` or `ctx_batch_execute` is available, use it instead of raw Bash. Context-mode runs commands in a sandbox and only the result enters your context — typically 95% token reduction vs raw stdout dump. This is complementary to token-pilot: we own code reading, context-mode owns command execution.
27
+
26
28
  Your specific role is defined below.
27
29
 
28
30
  Role: incremental feature implementation with slice-by-slice discipline.
@@ -11,8 +11,8 @@ tools:
11
11
  - Grep
12
12
  - Glob
13
13
  model: sonnet
14
- token_pilot_version: "0.28.3"
15
- token_pilot_body_hash: cf32cdee777430ecc6732db32b3f883a685c8a02b6dc93379d71b15555e79b3e
14
+ token_pilot_version: "0.30.0"
15
+ token_pilot_body_hash: 62893e448e943d0e1b928a670823ec3e152de395e487564862f145bd82161fcb
16
16
  ---
17
17
 
18
18
  You are a token-pilot agent (`tp-<name>`). Your defining contract:
@@ -21,6 +21,8 @@ For every file in a programming language, you MUST use the token-pilot MCP tools
21
21
 
22
22
  If any MCP tool fails, fall back sensibly (another MCP tool → bounded Read → pass-through) and note the fallback in your output. Never silently abandon the contract.
23
23
 
24
+ For heavy Bash operations (test runs, builds, recursive searches, network calls, any command with potentially large stdout): when `mcp__context-mode__execute` or `ctx_batch_execute` is available, use it instead of raw Bash. Context-mode runs commands in a sandbox and only the result enters your context — typically 95% token reduction vs raw stdout dump. This is complementary to token-pilot: we own code reading, context-mode owns command execution.
25
+
24
26
  Your specific role is defined below.
25
27
 
26
28
  Role: migration impact mapping.
@@ -10,8 +10,8 @@ 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.28.3"
14
- token_pilot_body_hash: ae0b86eaffaf34bf283b94b5572481fa8c2d6a2a25193f1173b70bef0fbe1919
13
+ token_pilot_version: "0.30.0"
14
+ token_pilot_body_hash: 4e82f7b3c6446663e958fb6bf5eb5348bbdf33389269c888ce0dab766e50561f
15
15
  ---
16
16
 
17
17
  You are a token-pilot agent (`tp-<name>`). Your defining contract:
@@ -20,6 +20,8 @@ For every file in a programming language, you MUST use the token-pilot MCP tools
20
20
 
21
21
  If any MCP tool fails, fall back sensibly (another MCP tool → bounded Read → pass-through) and note the fallback in your output. Never silently abandon the contract.
22
22
 
23
+ For heavy Bash operations (test runs, builds, recursive searches, network calls, any command with potentially large stdout): when `mcp__context-mode__execute` or `ctx_batch_execute` is available, use it instead of raw Bash. Context-mode runs commands in a sandbox and only the result enters your context — typically 95% token reduction vs raw stdout dump. This is complementary to token-pilot: we own code reading, context-mode owns command execution.
24
+
23
25
  Your specific role is defined below.
24
26
 
25
27
  Role: repository onboarding.
@@ -11,8 +11,8 @@ tools:
11
11
  - Bash
12
12
  - Read
13
13
  model: sonnet
14
- token_pilot_version: "0.28.3"
15
- token_pilot_body_hash: 14b6fb4423a839c119120c2ea12c9dd6ab6ad1aeb13df1e7c22807b290cf1f9c
14
+ token_pilot_version: "0.30.0"
15
+ token_pilot_body_hash: 8b9f454a47e57e3761668de788850ef97d5d6f127b059cf8e0cef03deaca3f98
16
16
  ---
17
17
 
18
18
  You are a token-pilot agent (`tp-<name>`). Your defining contract:
@@ -21,6 +21,8 @@ For every file in a programming language, you MUST use the token-pilot MCP tools
21
21
 
22
22
  If any MCP tool fails, fall back sensibly (another MCP tool → bounded Read → pass-through) and note the fallback in your output. Never silently abandon the contract.
23
23
 
24
+ For heavy Bash operations (test runs, builds, recursive searches, network calls, any command with potentially large stdout): when `mcp__context-mode__execute` or `ctx_batch_execute` is available, use it instead of raw Bash. Context-mode runs commands in a sandbox and only the result enters your context — typically 95% token reduction vs raw stdout dump. This is complementary to token-pilot: we own code reading, context-mode owns command execution.
25
+
24
26
  Your specific role is defined below.
25
27
 
26
28
  Role: performance diagnosis and targeted optimization.
@@ -11,8 +11,8 @@ tools:
11
11
  - mcp__token-pilot__read_for_edit
12
12
  - Read
13
13
  model: sonnet
14
- token_pilot_version: "0.28.3"
15
- token_pilot_body_hash: 73ba5844c8354088dcb10c671622daecc0e8589568de15a6001e1cf951eea586
14
+ token_pilot_version: "0.30.0"
15
+ token_pilot_body_hash: 91003b244472c4e65d840b55474a86ce04fba379859d588cc0fa54850b0e1e4f
16
16
  ---
17
17
 
18
18
  You are a token-pilot agent (`tp-<name>`). Your defining contract:
@@ -21,6 +21,8 @@ For every file in a programming language, you MUST use the token-pilot MCP tools
21
21
 
22
22
  If any MCP tool fails, fall back sensibly (another MCP tool → bounded Read → pass-through) and note the fallback in your output. Never silently abandon the contract.
23
23
 
24
+ For heavy Bash operations (test runs, builds, recursive searches, network calls, any command with potentially large stdout): when `mcp__context-mode__execute` or `ctx_batch_execute` is available, use it instead of raw Bash. Context-mode runs commands in a sandbox and only the result enters your context — typically 95% token reduction vs raw stdout dump. This is complementary to token-pilot: we own code reading, context-mode owns command execution.
25
+
24
26
  Your specific role is defined below.
25
27
 
26
28
  Role: PR / diff review across five axes.
@@ -8,8 +8,8 @@ tools:
8
8
  - mcp__token-pilot__outline
9
9
  - mcp__token-pilot__read_symbol
10
10
  model: sonnet
11
- token_pilot_version: "0.28.3"
12
- token_pilot_body_hash: dcc2c2aaeb443cc9688639b4337c6069b9d5bf21e3ed757fc8b3ac8a9d61bc03
11
+ token_pilot_version: "0.30.0"
12
+ token_pilot_body_hash: 45f972c6b36929491a529322bac3c34fd44872f7be4a974d25c7e27cb12e9dc3
13
13
  ---
14
14
 
15
15
  You are a token-pilot agent (`tp-<name>`). Your defining contract:
@@ -18,6 +18,8 @@ For every file in a programming language, you MUST use the token-pilot MCP tools
18
18
 
19
19
  If any MCP tool fails, fall back sensibly (another MCP tool → bounded Read → pass-through) and note the fallback in your output. Never silently abandon the contract.
20
20
 
21
+ For heavy Bash operations (test runs, builds, recursive searches, network calls, any command with potentially large stdout): when `mcp__context-mode__execute` or `ctx_batch_execute` is available, use it instead of raw Bash. Context-mode runs commands in a sandbox and only the result enters your context — typically 95% token reduction vs raw stdout dump. This is complementary to token-pilot: we own code reading, context-mode owns command execution.
22
+
21
23
  Your specific role is defined below.
22
24
 
23
25
  Role: refactor planning with behaviour-preservation discipline.
@@ -9,8 +9,8 @@ tools:
9
9
  - mcp__token-pilot__module_info
10
10
  - Bash
11
11
  model: sonnet
12
- token_pilot_version: "0.28.3"
13
- token_pilot_body_hash: 72b635f511492188587d6cb6fd70f936ae34cf5df1f9cd9eff7849cf1231e185
12
+ token_pilot_version: "0.30.0"
13
+ token_pilot_body_hash: 3c1c66f952ac63a5936bec86fefda8c842fb9713bca81e48ca5bb568ccb5f367
14
14
  ---
15
15
 
16
16
  You are a token-pilot agent (`tp-<name>`). Your defining contract:
@@ -19,6 +19,8 @@ For every file in a programming language, you MUST use the token-pilot MCP tools
19
19
 
20
20
  If any MCP tool fails, fall back sensibly (another MCP tool → bounded Read → pass-through) and note the fallback in your output. Never silently abandon the contract.
21
21
 
22
+ For heavy Bash operations (test runs, builds, recursive searches, network calls, any command with potentially large stdout): when `mcp__context-mode__execute` or `ctx_batch_execute` is available, use it instead of raw Bash. Context-mode runs commands in a sandbox and only the result enters your context — typically 95% token reduction vs raw stdout dump. This is complementary to token-pilot: we own code reading, context-mode owns command execution.
23
+
22
24
  Your specific role is defined below.
23
25
 
24
26
  Role: pre-merge blast-radius review.
package/agents/tp-run.md CHANGED
@@ -16,8 +16,8 @@ tools:
16
16
  - Glob
17
17
  - Bash
18
18
  model: haiku
19
- token_pilot_version: "0.28.3"
20
- token_pilot_body_hash: d665d57085db38077d0eeab74bda8bdb84c9ad59688495486059af5d3fac67cf
19
+ token_pilot_version: "0.30.0"
20
+ token_pilot_body_hash: de342efe1e3ee265df1773ebde1241555750ab17de249190a5c1c200f1f8f51a
21
21
  ---
22
22
 
23
23
  You are a token-pilot agent (`tp-<name>`). Your defining contract:
@@ -26,6 +26,8 @@ For every file in a programming language, you MUST use the token-pilot MCP tools
26
26
 
27
27
  If any MCP tool fails, fall back sensibly (another MCP tool → bounded Read → pass-through) and note the fallback in your output. Never silently abandon the contract.
28
28
 
29
+ For heavy Bash operations (test runs, builds, recursive searches, network calls, any command with potentially large stdout): when `mcp__context-mode__execute` or `ctx_batch_execute` is available, use it instead of raw Bash. Context-mode runs commands in a sandbox and only the result enters your context — typically 95% token reduction vs raw stdout dump. This is complementary to token-pilot: we own code reading, context-mode owns command execution.
30
+
29
31
  Your specific role is defined below.
30
32
 
31
33
  Role: general-purpose token-pilot workhorse.
@@ -9,8 +9,8 @@ tools:
9
9
  - mcp__token-pilot__session_budget
10
10
  - Bash
11
11
  - Read
12
- token_pilot_version: "0.28.3"
13
- token_pilot_body_hash: 35b7f333a28c94e7dc89fcc3171703c4b466225f55cd5c701b7592f4f6486440
12
+ token_pilot_version: "0.30.0"
13
+ token_pilot_body_hash: d031f30e9cc4ea454aa256427659ed27249d820b75dc8b9b99c81ba7635230a7
14
14
  ---
15
15
 
16
16
  You are a token-pilot agent (`tp-<name>`). Your defining contract:
@@ -19,6 +19,8 @@ For every file in a programming language, you MUST use the token-pilot MCP tools
19
19
 
20
20
  If any MCP tool fails, fall back sensibly (another MCP tool → bounded Read → pass-through) and note the fallback in your output. Never silently abandon the contract.
21
21
 
22
+ For heavy Bash operations (test runs, builds, recursive searches, network calls, any command with potentially large stdout): when `mcp__context-mode__execute` or `ctx_batch_execute` is available, use it instead of raw Bash. Context-mode runs commands in a sandbox and only the result enters your context — typically 95% token reduction vs raw stdout dump. This is complementary to token-pilot: we own code reading, context-mode owns command execution.
23
+
22
24
  Your specific role is defined below.
23
25
 
24
26
  Role: session-state rehydration.
@@ -11,8 +11,8 @@ tools:
11
11
  - Read
12
12
  - Grep
13
13
  model: sonnet
14
- token_pilot_version: "0.28.3"
15
- token_pilot_body_hash: e8f9c28da23e318328f5afd85b09e8e7b96e0dab21a4c6779ba798cd709ced64
14
+ token_pilot_version: "0.30.0"
15
+ token_pilot_body_hash: 6b1c27b3dc4fad622cebff7c49e079fc764ca0ae57ef5bc4e61b563d8321092d
16
16
  ---
17
17
 
18
18
  You are a token-pilot agent (`tp-<name>`). Your defining contract:
@@ -21,6 +21,8 @@ For every file in a programming language, you MUST use the token-pilot MCP tools
21
21
 
22
22
  If any MCP tool fails, fall back sensibly (another MCP tool → bounded Read → pass-through) and note the fallback in your output. Never silently abandon the contract.
23
23
 
24
+ For heavy Bash operations (test runs, builds, recursive searches, network calls, any command with potentially large stdout): when `mcp__context-mode__execute` or `ctx_batch_execute` is available, use it instead of raw Bash. Context-mode runs commands in a sandbox and only the result enters your context — typically 95% token reduction vs raw stdout dump. This is complementary to token-pilot: we own code reading, context-mode owns command execution.
25
+
24
26
  Your specific role is defined below.
25
27
 
26
28
  Role: pre-production readiness coordinator.
@@ -9,8 +9,8 @@ tools:
9
9
  - Read
10
10
  - Write
11
11
  model: sonnet
12
- token_pilot_version: "0.28.3"
13
- token_pilot_body_hash: ed0b9f938c152c0d7be5a6a5eaf3c97c19b27ae4a9540aec342f0edb0927cb27
12
+ token_pilot_version: "0.30.0"
13
+ token_pilot_body_hash: 4ae44482db80a8a3a43794c6ecb665ec0b5385a274e1e5b2e3a404956075be88
14
14
  ---
15
15
 
16
16
  You are a token-pilot agent (`tp-<name>`). Your defining contract:
@@ -19,6 +19,8 @@ For every file in a programming language, you MUST use the token-pilot MCP tools
19
19
 
20
20
  If any MCP tool fails, fall back sensibly (another MCP tool → bounded Read → pass-through) and note the fallback in your output. Never silently abandon the contract.
21
21
 
22
+ For heavy Bash operations (test runs, builds, recursive searches, network calls, any command with potentially large stdout): when `mcp__context-mode__execute` or `ctx_batch_execute` is available, use it instead of raw Bash. Context-mode runs commands in a sandbox and only the result enters your context — typically 95% token reduction vs raw stdout dump. This is complementary to token-pilot: we own code reading, context-mode owns command execution.
23
+
22
24
  Your specific role is defined below.
23
25
 
24
26
  Role: pre-code specification author.
@@ -10,8 +10,8 @@ tools:
10
10
  - mcp__token-pilot__test_summary
11
11
  - Glob
12
12
  - Grep
13
- token_pilot_version: "0.28.3"
14
- token_pilot_body_hash: cc3d1f46fdb95ac3caf9344f69f1ddcd5ce5a175ee70aa150b7f9fda93edb152
13
+ token_pilot_version: "0.30.0"
14
+ token_pilot_body_hash: 6d862d1bcaeda3fb13099f51e40faaaf45d16d7d41d1b938609500192aa606f2
15
15
  ---
16
16
 
17
17
  You are a token-pilot agent (`tp-<name>`). Your defining contract:
@@ -20,6 +20,8 @@ For every file in a programming language, you MUST use the token-pilot MCP tools
20
20
 
21
21
  If any MCP tool fails, fall back sensibly (another MCP tool → bounded Read → pass-through) and note the fallback in your output. Never silently abandon the contract.
22
22
 
23
+ For heavy Bash operations (test runs, builds, recursive searches, network calls, any command with potentially large stdout): when `mcp__context-mode__execute` or `ctx_batch_execute` is available, use it instead of raw Bash. Context-mode runs commands in a sandbox and only the result enters your context — typically 95% token reduction vs raw stdout dump. This is complementary to token-pilot: we own code reading, context-mode owns command execution.
24
+
23
25
  Your specific role is defined below.
24
26
 
25
27
  Role: test coverage gap finder.
@@ -8,8 +8,8 @@ tools:
8
8
  - mcp__token-pilot__find_usages
9
9
  - mcp__token-pilot__read_symbol
10
10
  model: sonnet
11
- token_pilot_version: "0.28.3"
12
- token_pilot_body_hash: 255912c47661d203c8f9a735237bc419f97e937f788a01811bbe126ee3dd5878
11
+ token_pilot_version: "0.30.0"
12
+ token_pilot_body_hash: f4e0dcbd2b4e8648efcafc9d53101a66bf394d7c90e97df7581ac47fcfbff5cb
13
13
  ---
14
14
 
15
15
  You are a token-pilot agent (`tp-<name>`). Your defining contract:
@@ -18,6 +18,8 @@ For every file in a programming language, you MUST use the token-pilot MCP tools
18
18
 
19
19
  If any MCP tool fails, fall back sensibly (another MCP tool → bounded Read → pass-through) and note the fallback in your output. Never silently abandon the contract.
20
20
 
21
+ For heavy Bash operations (test runs, builds, recursive searches, network calls, any command with potentially large stdout): when `mcp__context-mode__execute` or `ctx_batch_execute` is available, use it instead of raw Bash. Context-mode runs commands in a sandbox and only the result enters your context — typically 95% token reduction vs raw stdout dump. This is complementary to token-pilot: we own code reading, context-mode owns command execution.
22
+
21
23
  Your specific role is defined below.
22
24
 
23
25
  Role: test-failure triage.
@@ -13,8 +13,8 @@ tools:
13
13
  - Edit
14
14
  - Bash
15
15
  model: sonnet
16
- token_pilot_version: "0.28.3"
17
- token_pilot_body_hash: 96211a3e7f6b52dd47fef286eec3584b1c269fb3464c1102f8b7edbe470700e6
16
+ token_pilot_version: "0.30.0"
17
+ token_pilot_body_hash: 960fe9e907e9c7d13b14dcc22af99e8cc7e7335f99791fa808df76ac21e1f5e9
18
18
  ---
19
19
 
20
20
  You are a token-pilot agent (`tp-<name>`). Your defining contract:
@@ -23,6 +23,8 @@ For every file in a programming language, you MUST use the token-pilot MCP tools
23
23
 
24
24
  If any MCP tool fails, fall back sensibly (another MCP tool → bounded Read → pass-through) and note the fallback in your output. Never silently abandon the contract.
25
25
 
26
+ For heavy Bash operations (test runs, builds, recursive searches, network calls, any command with potentially large stdout): when `mcp__context-mode__execute` or `ctx_batch_execute` is available, use it instead of raw Bash. Context-mode runs commands in a sandbox and only the result enters your context — typically 95% token reduction vs raw stdout dump. This is complementary to token-pilot: we own code reading, context-mode owns command execution.
27
+
26
28
  Your specific role is defined below.
27
29
 
28
30
  Role: targeted test authoring with TDD discipline.
@@ -22,6 +22,11 @@ export interface ToolAuditRow {
22
22
  /** Calls where the recorder claimed NO savings (pass-through) — separate so
23
23
  * they don't poison the reduction average. */
24
24
  noneCalls: number;
25
+ /** Calls where the MCP response was served from the session cache (the model
26
+ * replayed cached tokens). These contribute to `saved` but the mechanism
27
+ * is token re-use, not structural compression — useful to split out so the
28
+ * "Est.Saved*" column is understood correctly. */
29
+ cacheHitCalls: number;
25
30
  /** True when reduction is below the low-value threshold AND we have enough
26
31
  * samples (≥5) to make a claim — avoids flagging tools after 1 bad run. */
27
32
  lowValue: boolean;
@@ -24,12 +24,15 @@ export function aggregateToolCalls(events, lowValueThreshold = 20, minSamples =
24
24
  tokensReturned: 0,
25
25
  tokensWouldBe: 0,
26
26
  noneCalls: 0,
27
+ cacheHitCalls: 0,
27
28
  };
28
29
  row.count++;
29
30
  row.tokensReturned += e.tokensReturned;
30
31
  row.tokensWouldBe += e.tokensWouldBe;
31
32
  if (e.savingsCategory === "none")
32
33
  row.noneCalls++;
34
+ if (e.sessionCacheHit)
35
+ row.cacheHitCalls++;
33
36
  byTool.set(e.tool, row);
34
37
  }
35
38
  const rows = [];
@@ -47,6 +50,7 @@ export function aggregateToolCalls(events, lowValueThreshold = 20, minSamples =
47
50
  saved,
48
51
  reductionPct,
49
52
  noneCalls: r.noneCalls,
53
+ cacheHitCalls: r.cacheHitCalls,
50
54
  lowValue,
51
55
  });
52
56
  }
@@ -74,7 +78,7 @@ Run a few MCP tool calls from your AI client, then re-run \`npx token-pilot tool
74
78
  lines.push(`Token Pilot — tool audit`);
75
79
  lines.push(` ${opts.totalEvents} calls across ${rows.length} tools (cumulative across sessions)`);
76
80
  lines.push("");
77
- lines.push(" Tool Calls Saved Returned Reduction");
81
+ lines.push(" Tool Calls Est.Saved* Returned Reduction");
78
82
  lines.push(" ─────────────────────────────────────────────────────────────────");
79
83
  for (const r of rows) {
80
84
  const tool = r.tool.padEnd(24);
@@ -91,6 +95,10 @@ Run a few MCP tool calls from your AI client, then re-run \`npx token-pilot tool
91
95
  lines.push("Low-value tools flagged above have <20% token reduction across ≥5 calls.");
92
96
  lines.push("Consider: check their `none` passthrough count, or whether a cheaper alternative (Grep, Read) would do the job.");
93
97
  }
98
+ lines.push("");
99
+ lines.push("* Est.Saved is estimated against a full-file read baseline. Actual prompt");
100
+ lines.push(" savings depend on client caching — use `cacheHitCalls` in --json output");
101
+ lines.push(" to distinguish structural compression from cache re-use.");
94
102
  return lines.join("\n");
95
103
  }
96
104
  export async function runToolAudit(opts) {
@@ -6,8 +6,6 @@
6
6
  export interface PolicyConfig {
7
7
  /** Advisory hints when an expensive tool is used where a cheaper alternative exists */
8
8
  preferCheapReads: boolean;
9
- /** Track if read_for_edit was called before edit (advisory) */
10
- requireReadForEditBeforeEdit: boolean;
11
9
  /** Always cache project overview in session cache */
12
10
  cacheProjectOverview: boolean;
13
11
  /** Warn after N full-file reads in a session */
@@ -25,13 +23,11 @@ export declare const DEFAULT_POLICIES: PolicyConfig;
25
23
  export interface PolicyCheckContext {
26
24
  fullFileReadsCount: number;
27
25
  tokensReturned: number;
28
- readForEditCalled?: Set<string>;
29
- editTargetPath?: string;
30
26
  totalCallCount?: number;
31
27
  totalTokensReturned?: number;
32
28
  }
33
29
  export interface PolicyAdvisory {
34
- level: 'info' | 'warn';
30
+ level: "info" | "warn";
35
31
  message: string;
36
32
  }
37
33
  /**