token-pilot 0.28.3 → 0.29.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.
- package/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +40 -0
- package/agents/tp-api-surface-tracker.md +4 -2
- package/agents/tp-audit-scanner.md +4 -2
- package/agents/tp-commit-writer.md +4 -2
- package/agents/tp-context-engineer.md +4 -2
- package/agents/tp-dead-code-finder.md +4 -2
- package/agents/tp-debugger.md +4 -2
- package/agents/tp-dep-health.md +4 -2
- package/agents/tp-doc-writer.md +4 -2
- package/agents/tp-history-explorer.md +4 -2
- package/agents/tp-impact-analyzer.md +4 -2
- package/agents/tp-incident-timeline.md +4 -2
- package/agents/tp-incremental-builder.md +4 -2
- package/agents/tp-migration-scout.md +4 -2
- package/agents/tp-onboard.md +4 -2
- package/agents/tp-performance-profiler.md +4 -2
- package/agents/tp-pr-reviewer.md +4 -2
- package/agents/tp-refactor-planner.md +4 -2
- package/agents/tp-review-impact.md +4 -2
- package/agents/tp-run.md +4 -2
- package/agents/tp-session-restorer.md +4 -2
- package/agents/tp-ship-coordinator.md +4 -2
- package/agents/tp-spec-writer.md +4 -2
- package/agents/tp-test-coverage-gapper.md +4 -2
- package/agents/tp-test-triage.md +4 -2
- package/agents/tp-test-writer.md +4 -2
- package/dist/hooks/pre-bash.d.ts +11 -0
- package/dist/hooks/pre-bash.js +53 -0
- package/dist/server/tool-definitions.js +2 -2
- package/package.json +1 -1
|
@@ -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.
|
|
9
|
+
"version": "0.29.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.
|
|
16
|
+
"version": "0.29.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.
|
|
3
|
+
"version": "0.29.0",
|
|
4
4
|
"description": "Saves 60-90% tokens when AI reads code. AST-aware lazy reading, symbol navigation, cross-session tool-usage analytics, 22 subagents (haiku/sonnet/opus-tiered) with budget watchdog.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Digital-Threads",
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,46 @@ All notable changes to Token Pilot will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.29.0] - 2026-04-19
|
|
9
|
+
|
|
10
|
+
Consolidation release based on Sonnet 4.6 + Opus 4.7 verification findings. Closes the short-tail issues that came out of the two live runs before the weekly-quota window reopens.
|
|
11
|
+
|
|
12
|
+
### Added — context-mode partnership in shared preamble
|
|
13
|
+
|
|
14
|
+
Both verification runs showed the same asymmetry: `token-pilot` saves on delegated (subagent) code reads; `context-mode` saves on main-thread Bash/command execution. Opus 4.7 literally wrote: "Во всей остальной работе использовал `ctx_batch_execute` вместо raw Bash — это adoption context-mode, не token-pilot". That's the right behaviour — we shouldn't fight it, we should formalise it.
|
|
15
|
+
|
|
16
|
+
All 25 tp-* agents now carry an instruction in the shared preamble: *for heavy Bash (tests, builds, recursive searches, network calls), prefer `mcp__context-mode__execute` / `ctx_batch_execute` when available — runs in sandbox, only result enters context (95% reduction vs raw stdout)*. This is complementary, not redundant: token-pilot owns code reading, context-mode owns command execution.
|
|
17
|
+
|
|
18
|
+
### Fixed — composite Bash escape patterns (from Opus 4.7 v0.28.2 report)
|
|
19
|
+
|
|
20
|
+
Opus's verification noted that quoted / wrapped heavy commands slipped past our `PreToolUse:Bash` hook:
|
|
21
|
+
|
|
22
|
+
- `bash -c "cat src/foo.ts"` → slipped
|
|
23
|
+
- `sh -c "grep -r foo ."` → slipped
|
|
24
|
+
- `eval "cat src/foo.ts"` → slipped
|
|
25
|
+
- `for f in *.ts; do cat $f; done` → slipped
|
|
26
|
+
- `while read f; do git log; done` → slipped
|
|
27
|
+
|
|
28
|
+
Added `extractWrappedCommands()` in `src/hooks/pre-bash.ts` — unwraps `bash/sh/zsh -c "..."`, `eval "..."`, `for/while/until ... do BODY done` — and re-runs the heavy-pattern check on each inner body. First deny wins. Adds 7 regression tests covering both deny (heavy inside wrapper) and allow (benign inside wrapper — `bash -c "ls"`, `eval "echo hello"`).
|
|
29
|
+
|
|
30
|
+
### Changed — honest tool descriptions for weak performers
|
|
31
|
+
|
|
32
|
+
- `smart_log` description now carries a heads-up: "two verification runs measured this tool at ~39% token reduction (borderline). Cumulative data being gathered — tool may be dropped or redesigned in v0.30.0 if numbers don't improve". The description already advised scoping with `path` or `count`; kept.
|
|
33
|
+
- `session_budget` re-framed as **META / info-only** — doesn't save tokens itself, purely diagnostic. This matches the META_TOOLS grouping in profiles (shipped in v0.28.1) and stops users thinking it's an optimisation tool.
|
|
34
|
+
|
|
35
|
+
### Changed — composed-agent line budget 60 → 65
|
|
36
|
+
|
|
37
|
+
Shared preamble now carries the context-mode paragraph — 3 extra lines flow into every composed agent file. Three agents (tp-context-engineer, tp-dead-code-finder, tp-doc-writer) ticked over the 60-line cap by 1-3 lines. Raised the hard limit to 65 to accommodate the new content without trimming per-agent instructions. 25 agents currently in the 38-63 range.
|
|
38
|
+
|
|
39
|
+
### Deferred to v0.30.0
|
|
40
|
+
|
|
41
|
+
- **Stop-hook output watchdog** — cap main-thread response size. Needs an experiment against Claude Code API first; too much new surface for a same-day patch.
|
|
42
|
+
- **Automatic MCP response buffer** — intercept 3rd-party MCP (GitHub / Jira / Slack) responses via `updatedMCPToolOutput`. Biggest potential lever in the ecosystem, but a full feature, not a patch.
|
|
43
|
+
- **`smart_log` final decision** — keep, redesign, or drop based on cumulative `tool-audit` data after a week of use.
|
|
44
|
+
- **`explore_area` self-sizing** — v0.28.3 tightened the caps (20/500 → 10/200); next step is compare predicted output to `estimateExploreAreaWorkflowTokens` baseline and trim when exceeded.
|
|
45
|
+
|
|
46
|
+
1026 tests passing (+7 new on composite Bash escape).
|
|
47
|
+
|
|
8
48
|
## [0.28.3] - 2026-04-19
|
|
9
49
|
|
|
10
50
|
### Fixed — `explore_area` output size (was −31% savings)
|
|
@@ -9,8 +9,8 @@ tools:
|
|
|
9
9
|
- mcp__token-pilot__read_symbol
|
|
10
10
|
- Bash
|
|
11
11
|
model: haiku
|
|
12
|
-
token_pilot_version: "0.
|
|
13
|
-
token_pilot_body_hash:
|
|
12
|
+
token_pilot_version: "0.29.0"
|
|
13
|
+
token_pilot_body_hash: c9d33476fdf70c8a7a493ec8720f54792eda2f81585996246e94c130ff3ec356
|
|
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: public-API diff with semver classification.
|
|
@@ -11,8 +11,8 @@ tools:
|
|
|
11
11
|
- Grep
|
|
12
12
|
- Read
|
|
13
13
|
model: sonnet
|
|
14
|
-
token_pilot_version: "0.
|
|
15
|
-
token_pilot_body_hash:
|
|
14
|
+
token_pilot_version: "0.29.0"
|
|
15
|
+
token_pilot_body_hash: 7095ffab66aca2e424f00875933e3f63bc10651eef2fde6a59f08bbbdbf86f7c
|
|
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: audit scanner — surfaces risks, never fixes.
|
|
@@ -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.
|
|
12
|
-
token_pilot_body_hash:
|
|
11
|
+
token_pilot_version: "0.29.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.
|
|
17
|
-
token_pilot_body_hash:
|
|
16
|
+
token_pilot_version: "0.29.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.
|
|
15
|
-
token_pilot_body_hash:
|
|
14
|
+
token_pilot_version: "0.29.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.
|
package/agents/tp-debugger.md
CHANGED
|
@@ -12,8 +12,8 @@ tools:
|
|
|
12
12
|
- Read
|
|
13
13
|
- Bash
|
|
14
14
|
model: sonnet
|
|
15
|
-
token_pilot_version: "0.
|
|
16
|
-
token_pilot_body_hash:
|
|
15
|
+
token_pilot_version: "0.29.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.
|
package/agents/tp-dep-health.md
CHANGED
|
@@ -9,8 +9,8 @@ tools:
|
|
|
9
9
|
- Bash
|
|
10
10
|
- Read
|
|
11
11
|
model: haiku
|
|
12
|
-
token_pilot_version: "0.
|
|
13
|
-
token_pilot_body_hash:
|
|
12
|
+
token_pilot_version: "0.29.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.
|
package/agents/tp-doc-writer.md
CHANGED
|
@@ -13,8 +13,8 @@ tools:
|
|
|
13
13
|
- Edit
|
|
14
14
|
- Glob
|
|
15
15
|
model: haiku
|
|
16
|
-
token_pilot_version: "0.
|
|
17
|
-
token_pilot_body_hash:
|
|
16
|
+
token_pilot_version: "0.29.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.
|
|
14
|
-
token_pilot_body_hash:
|
|
13
|
+
token_pilot_version: "0.29.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.
|
|
16
|
-
token_pilot_body_hash:
|
|
15
|
+
token_pilot_version: "0.29.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.
|
|
12
|
-
token_pilot_body_hash:
|
|
11
|
+
token_pilot_version: "0.29.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.
|
|
17
|
-
token_pilot_body_hash:
|
|
16
|
+
token_pilot_version: "0.29.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.
|
|
15
|
-
token_pilot_body_hash:
|
|
14
|
+
token_pilot_version: "0.29.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.
|
package/agents/tp-onboard.md
CHANGED
|
@@ -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.
|
|
14
|
-
token_pilot_body_hash:
|
|
13
|
+
token_pilot_version: "0.29.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.
|
|
15
|
-
token_pilot_body_hash:
|
|
14
|
+
token_pilot_version: "0.29.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.
|
package/agents/tp-pr-reviewer.md
CHANGED
|
@@ -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.
|
|
15
|
-
token_pilot_body_hash:
|
|
14
|
+
token_pilot_version: "0.29.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.
|
|
12
|
-
token_pilot_body_hash:
|
|
11
|
+
token_pilot_version: "0.29.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.
|
|
13
|
-
token_pilot_body_hash:
|
|
12
|
+
token_pilot_version: "0.29.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.
|
|
20
|
-
token_pilot_body_hash:
|
|
19
|
+
token_pilot_version: "0.29.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.
|
|
13
|
-
token_pilot_body_hash:
|
|
12
|
+
token_pilot_version: "0.29.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.
|
|
15
|
-
token_pilot_body_hash:
|
|
14
|
+
token_pilot_version: "0.29.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.
|
package/agents/tp-spec-writer.md
CHANGED
|
@@ -9,8 +9,8 @@ tools:
|
|
|
9
9
|
- Read
|
|
10
10
|
- Write
|
|
11
11
|
model: sonnet
|
|
12
|
-
token_pilot_version: "0.
|
|
13
|
-
token_pilot_body_hash:
|
|
12
|
+
token_pilot_version: "0.29.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.
|
|
14
|
-
token_pilot_body_hash:
|
|
13
|
+
token_pilot_version: "0.29.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.
|
package/agents/tp-test-triage.md
CHANGED
|
@@ -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.
|
|
12
|
-
token_pilot_body_hash:
|
|
11
|
+
token_pilot_version: "0.29.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.
|
package/agents/tp-test-writer.md
CHANGED
|
@@ -13,8 +13,8 @@ tools:
|
|
|
13
13
|
- Edit
|
|
14
14
|
- Bash
|
|
15
15
|
model: sonnet
|
|
16
|
-
token_pilot_version: "0.
|
|
17
|
-
token_pilot_body_hash:
|
|
16
|
+
token_pilot_version: "0.29.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.
|
package/dist/hooks/pre-bash.d.ts
CHANGED
|
@@ -37,6 +37,17 @@ export type PreBashDecision = {
|
|
|
37
37
|
kind: "deny";
|
|
38
38
|
reason: string;
|
|
39
39
|
};
|
|
40
|
+
/**
|
|
41
|
+
* v0.29.0 — expose wrapped commands. Opus 4.7's v0.28.2 verification
|
|
42
|
+
* report showed escape patterns: `bash -c "cat src/foo.ts"`,
|
|
43
|
+
* `eval "..."`, `for f in *.ts; do cat $f; done` all slipped through
|
|
44
|
+
* our heuristics because the dangerous call sat inside quotes / a loop
|
|
45
|
+
* body. Unwrap those before matching.
|
|
46
|
+
*
|
|
47
|
+
* Returns the original command PLUS the extracted inner body for each
|
|
48
|
+
* wrapper found. Duplication is fine — detectHeavyPattern is pure.
|
|
49
|
+
*/
|
|
50
|
+
export declare function extractWrappedCommands(command: string): string[];
|
|
40
51
|
export declare function detectHeavyPattern(command: string): PreBashDecision;
|
|
41
52
|
export declare function decidePreBash(input: PreBashInput): PreBashDecision;
|
|
42
53
|
export declare function renderPreBashOutput(decision: PreBashDecision): string | null;
|
package/dist/hooks/pre-bash.js
CHANGED
|
@@ -32,7 +32,60 @@ function invokes(command, utility) {
|
|
|
32
32
|
const re = new RegExp(`(^|[;&|\\n]\\s*)${utility}(\\s|$)`, "m");
|
|
33
33
|
return re.test(command);
|
|
34
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* v0.29.0 — expose wrapped commands. Opus 4.7's v0.28.2 verification
|
|
37
|
+
* report showed escape patterns: `bash -c "cat src/foo.ts"`,
|
|
38
|
+
* `eval "..."`, `for f in *.ts; do cat $f; done` all slipped through
|
|
39
|
+
* our heuristics because the dangerous call sat inside quotes / a loop
|
|
40
|
+
* body. Unwrap those before matching.
|
|
41
|
+
*
|
|
42
|
+
* Returns the original command PLUS the extracted inner body for each
|
|
43
|
+
* wrapper found. Duplication is fine — detectHeavyPattern is pure.
|
|
44
|
+
*/
|
|
45
|
+
export function extractWrappedCommands(command) {
|
|
46
|
+
const out = [command];
|
|
47
|
+
// bash -c "..." / sh -c "..." / zsh -c "..."
|
|
48
|
+
for (const shell of ["bash", "sh", "zsh"]) {
|
|
49
|
+
const re = new RegExp(`\\b${shell}\\s+-c\\s+(?:"([^"]+)"|'([^']+)')`, "g");
|
|
50
|
+
for (const m of command.matchAll(re)) {
|
|
51
|
+
const inner = m[1] ?? m[2];
|
|
52
|
+
if (inner)
|
|
53
|
+
out.push(inner);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
// eval "..." / eval '...'
|
|
57
|
+
for (const m of command.matchAll(/\beval\s+(?:"([^"]+)"|'([^']+)')/g)) {
|
|
58
|
+
const inner = m[1] ?? m[2];
|
|
59
|
+
if (inner)
|
|
60
|
+
out.push(inner);
|
|
61
|
+
}
|
|
62
|
+
// for LOOP with body: `for X in Y; do BODY; done` — extract BODY
|
|
63
|
+
// Also covers `while COND; do BODY; done` and `until COND; do BODY; done`
|
|
64
|
+
for (const m of command.matchAll(/\b(?:for|while|until)\b[^;]*;\s*do\s+(.+?)\s*;?\s*done\b/gs)) {
|
|
65
|
+
const body = m[1];
|
|
66
|
+
if (body)
|
|
67
|
+
out.push(body);
|
|
68
|
+
}
|
|
69
|
+
return out;
|
|
70
|
+
}
|
|
35
71
|
export function detectHeavyPattern(command) {
|
|
72
|
+
const cmd = command.trim();
|
|
73
|
+
if (!cmd)
|
|
74
|
+
return { kind: "allow" };
|
|
75
|
+
// v0.29.0: check each of the original + any unwrapped inner commands.
|
|
76
|
+
// First deny wins.
|
|
77
|
+
const candidates = extractWrappedCommands(cmd);
|
|
78
|
+
if (candidates.length > 1) {
|
|
79
|
+
// Check only the unwrapped inners; the original is handled below.
|
|
80
|
+
for (let i = 1; i < candidates.length; i++) {
|
|
81
|
+
const inner = detectHeavyPatternSingle(candidates[i]);
|
|
82
|
+
if (inner.kind === "deny")
|
|
83
|
+
return inner;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return detectHeavyPatternSingle(cmd);
|
|
87
|
+
}
|
|
88
|
+
function detectHeavyPatternSingle(command) {
|
|
36
89
|
const cmd = command.trim();
|
|
37
90
|
if (!cmd)
|
|
38
91
|
return { kind: "allow" };
|
|
@@ -499,7 +499,7 @@ export const TOOL_DEFINITIONS = [
|
|
|
499
499
|
},
|
|
500
500
|
{
|
|
501
501
|
name: "smart_log",
|
|
502
|
-
description: "Use INSTEAD OF raw git log. Structured commit history with category detection (feat/fix/refactor/docs), file stats, author breakdown. Filters by path and ref.",
|
|
502
|
+
description: "Use INSTEAD OF raw git log. Structured commit history with category detection (feat/fix/refactor/docs), file stats, author breakdown. Filters by path and ref. HEADS UP: two verification runs measured this tool at ~39% token reduction (borderline — vs 95-99% for outline/smart_diff). Cumulative data being gathered — tool may be dropped or redesigned in v0.30.0 if numbers don't improve. Prefer scoping with `path` or `count` to tighten savings.",
|
|
503
503
|
inputSchema: {
|
|
504
504
|
type: "object",
|
|
505
505
|
properties: {
|
|
@@ -581,7 +581,7 @@ export const TOOL_DEFINITIONS = [
|
|
|
581
581
|
},
|
|
582
582
|
{
|
|
583
583
|
name: "session_budget",
|
|
584
|
-
description: "
|
|
584
|
+
description: "META / info-only: reports Read-hook pressure for this session (suppressed tokens, reference budget, burn fraction, effective denyThreshold). Does NOT save tokens itself — this is diagnostic, use to decide when to tighten before a big read. NOTE: burnFraction measures hook activity, not actual context-window occupancy.",
|
|
585
585
|
inputSchema: {
|
|
586
586
|
type: "object",
|
|
587
587
|
properties: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "token-pilot",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.0",
|
|
4
4
|
"description": "Save up to 80% tokens when AI reads code \u2014 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",
|