token-pilot 0.14.1 → 0.14.2
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/README.md +8 -8
- package/dist/index.js +2 -2
- package/package.json +14 -12
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Token Pilot
|
|
2
2
|
|
|
3
|
-
MCP server that reduces token consumption in AI coding assistants by **
|
|
3
|
+
MCP server that reduces token consumption in AI coding assistants by **up to 80%** via AST-aware lazy file reading.
|
|
4
4
|
|
|
5
5
|
Instead of dumping entire files into the LLM context, Token Pilot returns structural overviews (classes, functions, signatures, line ranges) and lets the AI load only the specific symbols it needs.
|
|
6
6
|
|
|
@@ -13,7 +13,7 @@ Token Pilot: smart_read("user-service.ts") → 15-line outline → ~200 tok
|
|
|
13
13
|
After edit: read_diff("user-service.ts") → ~20 tokens
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
**Up to 80% reduction** on large files. Files under 200 lines are returned in full automatically (zero overhead for small files). Typical sessions with a mix of file sizes see **30-50% savings**, scaling higher with repeated reads (session cache, compact reminders) and targeted symbol loading.
|
|
17
17
|
|
|
18
18
|
## Installation
|
|
19
19
|
|
|
@@ -132,7 +132,7 @@ npx token-pilot uninstall-hook # Remove
|
|
|
132
132
|
When connected, every MCP client receives rules like:
|
|
133
133
|
|
|
134
134
|
```
|
|
135
|
-
WHEN TO USE TOKEN PILOT (saves
|
|
135
|
+
WHEN TO USE TOKEN PILOT (saves up to 80% tokens):
|
|
136
136
|
• Reading code files → smart_read (returns structure, not raw content)
|
|
137
137
|
• Need one function/class → read_symbol (loads only that symbol)
|
|
138
138
|
• Exploring a directory → outline (all symbols in one call)
|
|
@@ -158,7 +158,7 @@ For more control, you can add rules to your project:
|
|
|
158
158
|
|
|
159
159
|
| Tool | Instead of | Description |
|
|
160
160
|
|------|-----------|-------------|
|
|
161
|
-
| `smart_read` | `Read` | AST structural overview: classes, functions, methods with signatures.
|
|
161
|
+
| `smart_read` | `Read` | AST structural overview: classes, functions, methods with signatures. Up to 80% savings on large files. Framework-aware: shows HTTP routes, column types, validation rules. |
|
|
162
162
|
| `read_symbol` | `Read` + scroll | Load source of a specific symbol. Supports `Class.method`. `show` param: full/head/tail/outline. |
|
|
163
163
|
| `read_for_edit` | `Read` before `Edit` | Minimal RAW code around a symbol — copy directly as `old_string` for Edit tool. |
|
|
164
164
|
| `read_range` | `Read` offset | Read a specific line range from a file. |
|
|
@@ -280,13 +280,13 @@ When both are configured, Token Pilot automatically:
|
|
|
280
280
|
- Suggests context-mode for large non-code files
|
|
281
281
|
- Shows combined architecture info in `session_analytics`
|
|
282
282
|
|
|
283
|
-
**Combined savings:
|
|
283
|
+
**Combined savings: up to 80%** in a typical coding session.
|
|
284
284
|
|
|
285
285
|
## Supported Languages
|
|
286
286
|
|
|
287
|
-
Token Pilot supports all
|
|
287
|
+
Token Pilot supports all 29 languages that [ast-index](https://github.com/defendend/Claude-ast-index-search) supports:
|
|
288
288
|
|
|
289
|
-
TypeScript, JavaScript, Python, Rust, Go, Java, Kotlin, Swift, C#, C++, C, PHP, Ruby, Scala, Dart, Lua, Shell/Bash, SQL, R, Vue, Svelte, Perl, Groovy
|
|
289
|
+
TypeScript, JavaScript, Python, Rust, Go, Java, Kotlin, Swift, Objective-C, C#, C++, C, PHP, Ruby, Scala, Dart, Lua, Shell/Bash, SQL, R, Vue, Svelte, Perl, Groovy, Elixir, Common Lisp, Matlab, Protocol Buffers, BSL (1C:Enterprise)
|
|
290
290
|
|
|
291
291
|
Plus structural summaries for non-code files: JSON, YAML, Markdown, TOML, XML, CSV.
|
|
292
292
|
|
|
@@ -395,7 +395,7 @@ src/
|
|
|
395
395
|
|
|
396
396
|
Token Pilot is built on top of these excellent open-source projects:
|
|
397
397
|
|
|
398
|
-
- **[ast-index](https://github.com/defendend/Claude-ast-index-search)** by [@defendend](https://github.com/defendend) — Rust-based AST indexing engine with tree-sitter, SQLite FTS5, and support for
|
|
398
|
+
- **[ast-index](https://github.com/defendend/Claude-ast-index-search)** by [@defendend](https://github.com/defendend) — Rust-based AST indexing engine with tree-sitter, SQLite FTS5, and support for 29 programming languages. Token Pilot uses it as the backend for all code analysis.
|
|
399
399
|
- **[claude-context-mode](https://github.com/mksglu/claude-context-mode)** by [@mksglu](https://github.com/mksglu) — Complementary MCP plugin for shell output and data file processing via sandbox + BM25. Token Pilot integrates with it for maximum combined savings.
|
|
400
400
|
- **[Model Context Protocol](https://modelcontextprotocol.io/)** by Anthropic — The protocol that makes all of this possible.
|
|
401
401
|
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
3
|
-
import { readFileSync } from 'node:fs';
|
|
3
|
+
import { readFileSync, realpathSync } from 'node:fs';
|
|
4
4
|
import { execFile } from 'node:child_process';
|
|
5
5
|
import { promisify } from 'node:util';
|
|
6
6
|
import { fileURLToPath } from 'node:url';
|
|
@@ -449,7 +449,7 @@ MCP Tools (18):
|
|
|
449
449
|
`);
|
|
450
450
|
process.exit(0);
|
|
451
451
|
}
|
|
452
|
-
const isDirectRun = process.argv[1] !== undefined && fileURLToPath(import.meta.url) === process.argv[1];
|
|
452
|
+
const isDirectRun = process.argv[1] !== undefined && realpathSync(fileURLToPath(import.meta.url)) === realpathSync(process.argv[1]);
|
|
453
453
|
if (isDirectRun) {
|
|
454
454
|
main().catch(err => {
|
|
455
455
|
console.error(`[token-pilot] Fatal: ${err instanceof Error ? err.message : err}`);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "token-pilot",
|
|
3
|
-
"version": "0.14.
|
|
4
|
-
"description": "Save
|
|
3
|
+
"version": "0.14.2",
|
|
4
|
+
"description": "Save up to 80% tokens when AI reads code — MCP server for token-efficient code navigation, AST-aware structural reading instead of dumping full files into context window",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"bin": {
|
|
@@ -29,24 +29,26 @@
|
|
|
29
29
|
"prepublishOnly": "npm run build && node --input-type=module -e \"import { chmod } from 'node:fs/promises'; await chmod('dist/index.js', 0o755);\""
|
|
30
30
|
},
|
|
31
31
|
"keywords": [
|
|
32
|
+
"mcp",
|
|
33
|
+
"mcp-server",
|
|
34
|
+
"model-context-protocol",
|
|
35
|
+
"claude",
|
|
36
|
+
"claude-code",
|
|
37
|
+
"cursor",
|
|
38
|
+
"codex",
|
|
39
|
+
"cline",
|
|
40
|
+
"ai-coding",
|
|
41
|
+
"llm-tools",
|
|
32
42
|
"token-savings",
|
|
33
43
|
"token-reduction",
|
|
34
44
|
"context-window",
|
|
35
|
-
"save-tokens",
|
|
36
|
-
"reduce-tokens",
|
|
37
|
-
"token-efficient",
|
|
38
|
-
"token-economy",
|
|
39
45
|
"context-optimization",
|
|
40
|
-
"fewer-tokens",
|
|
41
|
-
"mcp",
|
|
42
|
-
"mcp-server",
|
|
43
|
-
"model-context-protocol",
|
|
44
46
|
"ast",
|
|
45
47
|
"code-reading",
|
|
46
48
|
"code-navigation",
|
|
47
49
|
"smart-read",
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
+
"developer-tools",
|
|
51
|
+
"tree-sitter"
|
|
50
52
|
],
|
|
51
53
|
"repository": {
|
|
52
54
|
"type": "git",
|