@blamechris/repo-memory 0.4.0 → 0.6.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/README.md +124 -33
- package/dist/config.d.ts +6 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +15 -0
- package/dist/config.js.map +1 -1
- package/dist/server.js +239 -215
- package/dist/server.js.map +1 -1
- package/dist/telemetry/tokens.d.ts +19 -0
- package/dist/telemetry/tokens.d.ts.map +1 -0
- package/dist/telemetry/tokens.js +25 -0
- package/dist/telemetry/tokens.js.map +1 -0
- package/dist/tools/force-reread.d.ts.map +1 -1
- package/dist/tools/force-reread.js +4 -0
- package/dist/tools/force-reread.js.map +1 -1
- package/dist/tools/get-file-summary.d.ts.map +1 -1
- package/dist/tools/get-file-summary.js +6 -0
- package/dist/tools/get-file-summary.js.map +1 -1
- package/dist/tools/invalidate.d.ts.map +1 -1
- package/dist/tools/invalidate.js +4 -0
- package/dist/tools/invalidate.js.map +1 -1
- package/dist/tools/search-by-purpose.d.ts.map +1 -1
- package/dist/tools/search-by-purpose.js +12 -1
- package/dist/tools/search-by-purpose.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
# repo-memory
|
|
2
2
|
|
|
3
|
-
An MCP server that gives AI coding agents persistent memory about your codebase.
|
|
3
|
+
An MCP server that gives AI coding agents persistent memory about your codebase. Stop wasting tokens re-reading files your agent already understands.
|
|
4
4
|
|
|
5
5
|
## Why?
|
|
6
6
|
|
|
7
|
-
AI
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
- **
|
|
11
|
-
- **
|
|
12
|
-
- **
|
|
7
|
+
Every time an AI agent explores your project, it re-reads files from scratch — burning tokens on code it's already seen. On a 200-file project, that's **~43,000 tokens wasted per exploration pass**.
|
|
8
|
+
|
|
9
|
+
repo-memory fixes this:
|
|
10
|
+
- **Caches file summaries** — exports, imports, purpose, declarations, line count
|
|
11
|
+
- **Tracks changes** — only re-reads files that actually changed (SHA-256 hash comparison)
|
|
12
|
+
- **Dependency graphs** — understands which files depend on which
|
|
13
|
+
- **Task memory** — remembers what's been explored across conversation turns
|
|
14
|
+
- **Token telemetry** — measures and proves the savings
|
|
13
15
|
|
|
14
16
|
## Quick Start
|
|
15
17
|
|
|
@@ -32,31 +34,112 @@ npm install -g @blamechris/repo-memory
|
|
|
32
34
|
repo-memory # starts MCP server on stdio
|
|
33
35
|
```
|
|
34
36
|
|
|
37
|
+
## How It Works
|
|
38
|
+
|
|
39
|
+
### The problem
|
|
40
|
+
Your agent wants to understand `src/server.ts`. Normally it reads the whole file — 300 lines, ~800 tokens. But it really just needs: "what does this file export, import, and do?" That answer is ~200 tokens.
|
|
41
|
+
|
|
42
|
+
### The flow
|
|
43
|
+
|
|
44
|
+
**First access (cache miss):**
|
|
45
|
+
1. Agent calls `get_file_summary("src/server.ts")`
|
|
46
|
+
2. repo-memory reads the file, SHA-256 hashes it, extracts a summary via regex (exports, imports, purpose, declarations, line count)
|
|
47
|
+
3. Stores the hash + summary in SQLite (`.repo-memory/cache.db` in your project)
|
|
48
|
+
4. Returns the compact summary
|
|
49
|
+
5. No savings yet — we had to read the file anyway
|
|
50
|
+
|
|
51
|
+
**Every subsequent access (cache hit):**
|
|
52
|
+
1. Agent calls `get_file_summary("src/server.ts")` again
|
|
53
|
+
2. repo-memory reads and hashes the file — hash matches what's stored
|
|
54
|
+
3. Returns the cached summary instantly, without re-parsing
|
|
55
|
+
4. Savings logged: `(full file tokens) - (summary tokens)` = tokens your agent didn't consume
|
|
56
|
+
|
|
57
|
+
**When files change:**
|
|
58
|
+
- The hash won't match, so repo-memory generates a fresh summary automatically
|
|
59
|
+
- You never get stale data
|
|
60
|
+
|
|
61
|
+
The savings compound fast. An agent exploring a project touches the same files 3-5 times per session. First pass costs full price. Every subsequent hit returns a tiny summary instead of the full file — that's where the ~3.6x compression ratio comes from.
|
|
62
|
+
|
|
35
63
|
## Tools
|
|
36
64
|
|
|
37
65
|
| Tool | Description |
|
|
38
66
|
|------|-------------|
|
|
39
67
|
| `get_file_summary` | Cached file summary (exports, imports, purpose) |
|
|
68
|
+
| `batch_file_summaries` | Get summaries for multiple files at once |
|
|
40
69
|
| `get_changed_files` | Files changed since last check |
|
|
41
70
|
| `get_project_map` | Structural overview of project |
|
|
71
|
+
| `search_by_purpose` | Search files by purpose/exports keywords |
|
|
72
|
+
| `get_related_files` | Find related files ranked by relevance |
|
|
73
|
+
| `get_dependency_graph` | File dependency relationships |
|
|
74
|
+
| `create_task` / `get_task_context` / `mark_explored` | Track investigation progress across turns |
|
|
75
|
+
| `get_token_report` | Token usage and savings report |
|
|
42
76
|
| `force_reread` | Force fresh summary generation |
|
|
43
77
|
| `invalidate` | Clear cache entries |
|
|
44
|
-
| `get_dependency_graph` | File dependency relationships |
|
|
45
|
-
| `create_task` | Create investigation task |
|
|
46
|
-
| `get_task_context` | Task state and explored files |
|
|
47
|
-
| `mark_explored` | Mark file as explored for task |
|
|
48
|
-
| `get_token_report` | Token usage telemetry report |
|
|
49
|
-
| `get_related_files` | Find related files ranked by relevance |
|
|
50
|
-
| `batch_file_summaries` | Get summaries for multiple files at once |
|
|
51
|
-
| `search_by_purpose` | Search files by purpose/exports keywords |
|
|
52
78
|
|
|
53
|
-
##
|
|
79
|
+
## Token Savings Tracking
|
|
80
|
+
|
|
81
|
+
repo-memory tracks every cache interaction so you can measure exactly how many tokens you're saving. Call `get_token_report` at any time to see your stats.
|
|
82
|
+
|
|
83
|
+
### What gets tracked
|
|
84
|
+
|
|
85
|
+
| Event | When | Tokens Recorded |
|
|
86
|
+
|-------|------|-----------------|
|
|
87
|
+
| `cache_hit` | Summary served from cache (hash unchanged) | Tokens saved (raw file - summary) |
|
|
88
|
+
| `cache_miss` | File changed or first access | 0 (no savings on first read) |
|
|
89
|
+
| `force_reread` | Explicit re-read requested | Raw file token count |
|
|
90
|
+
| `invalidation` | Cache entry cleared | — |
|
|
91
|
+
| `summary_served` | File matched via `search_by_purpose` | Estimated raw file tokens |
|
|
92
|
+
|
|
93
|
+
### How savings are calculated
|
|
94
|
+
|
|
95
|
+
Token estimates use the standard heuristic of **~4 characters per token**, which closely matches major LLM tokenizers (cl100k_base, o200k_base).
|
|
96
|
+
|
|
97
|
+
For each cache hit:
|
|
98
|
+
```
|
|
99
|
+
tokensSaved = ceil(rawFileChars / 4) - ceil(summaryJsonChars / 4)
|
|
100
|
+
```
|
|
54
101
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
102
|
+
- **rawFileChars** — the full file contents your agent would have consumed
|
|
103
|
+
- **summaryJsonChars** — the compact summary served instead (purpose, exports, imports, declarations, line count)
|
|
104
|
+
|
|
105
|
+
The reported savings represent real tokens that never entered your context window.
|
|
106
|
+
|
|
107
|
+
### Querying your savings
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
# All-time stats
|
|
111
|
+
get_token_report()
|
|
112
|
+
|
|
113
|
+
# Last 24 hours
|
|
114
|
+
get_token_report(period: "last_n_hours", hours: 24)
|
|
115
|
+
|
|
116
|
+
# Current session only
|
|
117
|
+
get_token_report(period: "session", session_id: "<id>")
|
|
118
|
+
|
|
119
|
+
# With cache health diagnostics
|
|
120
|
+
get_token_report(include_diagnostics: true)
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
The report includes:
|
|
124
|
+
- **Cache hit ratio** — percentage of requests served from cache
|
|
125
|
+
- **Estimated tokens saved** — cumulative tokens your agent didn't consume
|
|
126
|
+
- **Top files** — most frequently accessed files and their token impact
|
|
127
|
+
- **Event breakdown** — counts by event type
|
|
128
|
+
|
|
129
|
+
## Performance
|
|
130
|
+
|
|
131
|
+
Benchmarks measured on synthetic TypeScript projects with realistic imports and class structures:
|
|
132
|
+
|
|
133
|
+
| Scenario | Files | Raw Size | Summary Size | Compression | Tokens Saved | Speed |
|
|
134
|
+
|----------|-------|----------|--------------|-------------|--------------|-------|
|
|
135
|
+
| Explore project | 10 | 11.7 KB | 3.3 KB | 3.6x | ~2,100 | 3.7 ms/file |
|
|
136
|
+
| Explore project | 50 | 58.0 KB | 16.2 KB | 3.6x | ~10,700 | 0.7 ms/file |
|
|
137
|
+
| Explore project | 100 | 116.1 KB | 32.3 KB | 3.6x | ~21,500 | 0.4 ms/file |
|
|
138
|
+
| Explore project | 200 | 233.4 KB | 65.7 KB | 3.6x | ~42,900 | 0.3 ms/file |
|
|
139
|
+
|
|
140
|
+
~3.6x compression ratio at all scales. Sub-millisecond per file on cached reads.
|
|
141
|
+
|
|
142
|
+
Run benchmarks yourself: `npm run benchmark`
|
|
60
143
|
|
|
61
144
|
## Architecture
|
|
62
145
|
|
|
@@ -66,26 +149,34 @@ MCP Server (stdio transport)
|
|
|
66
149
|
├── Indexer Pipeline (scanner, summarizer, imports, diff-analyzer)
|
|
67
150
|
├── Dependency Graph (in-memory adjacency maps backed by SQLite)
|
|
68
151
|
├── Task Memory (CRUD, exploration tracking, frontier)
|
|
69
|
-
├── Telemetry (token tracking, sampling, export)
|
|
152
|
+
├── Telemetry (token tracking, sampling, export, retention)
|
|
70
153
|
├── Session Manager (cross-turn persistence)
|
|
71
154
|
└── Persistence Layer (SQLite with WAL mode)
|
|
72
155
|
```
|
|
73
156
|
|
|
74
|
-
##
|
|
157
|
+
## Configuration
|
|
75
158
|
|
|
76
|
-
|
|
159
|
+
Create a `.repo-memory.json` in your project root to customize behavior:
|
|
77
160
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
161
|
+
```json
|
|
162
|
+
{
|
|
163
|
+
"ignore": ["dist", "node_modules", "*.generated.ts"],
|
|
164
|
+
"maxFiles": 5000,
|
|
165
|
+
"gc": {
|
|
166
|
+
"cacheMaxAgeDays": 30
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
```
|
|
85
170
|
|
|
86
|
-
|
|
171
|
+
## Language Support
|
|
87
172
|
|
|
88
|
-
|
|
173
|
+
Summaries are extracted via regex analysis. Supported languages:
|
|
174
|
+
- **TypeScript / JavaScript** — exports, imports, declarations, purpose classification
|
|
175
|
+
- **Python** — functions, classes, `__all__`, `from`/`import` statements
|
|
176
|
+
- **Go** — exported names (uppercase), imports, type/func/var/const declarations
|
|
177
|
+
- **Rust** — `pub` items, `use`/`mod` statements, structs/enums/traits/impls
|
|
178
|
+
|
|
179
|
+
Config files (JSON, YAML, TOML) and other file types get basic classification.
|
|
89
180
|
|
|
90
181
|
## Development
|
|
91
182
|
|
package/dist/config.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
export interface ToolGroupConfig {
|
|
2
|
+
summaries?: boolean;
|
|
3
|
+
tasks?: boolean;
|
|
4
|
+
telemetry?: boolean;
|
|
5
|
+
}
|
|
1
6
|
export interface RepoMemoryConfig {
|
|
2
7
|
ignore?: string[];
|
|
3
8
|
maxFiles?: number;
|
|
@@ -6,6 +11,7 @@ export interface RepoMemoryConfig {
|
|
|
6
11
|
taskMaxAgeDays?: number;
|
|
7
12
|
telemetryMaxAgeDays?: number;
|
|
8
13
|
};
|
|
14
|
+
tools?: ToolGroupConfig;
|
|
9
15
|
}
|
|
10
16
|
export declare function loadConfig(projectRoot: string): RepoMemoryConfig;
|
|
11
17
|
export declare function clearConfigCache(): void;
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,EAAE,CAAC,EAAE;QACH,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,mBAAmB,CAAC,EAAE,MAAM,CAAC;KAC9B,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,eAAe;IAC9B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,EAAE,CAAC,EAAE;QACH,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,mBAAmB,CAAC,EAAE,MAAM,CAAC;KAC9B,CAAC;IACF,KAAK,CAAC,EAAE,eAAe,CAAC;CACzB;AAID,wBAAgB,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,gBAAgB,CAqBhE;AA6DD,wBAAgB,gBAAgB,IAAI,IAAI,CAEvC"}
|
package/dist/config.js
CHANGED
|
@@ -54,6 +54,21 @@ function validateConfig(raw) {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
+
if ('tools' in obj) {
|
|
58
|
+
if (typeof obj.tools !== 'object' || obj.tools === null || Array.isArray(obj.tools)) {
|
|
59
|
+
throw new Error('"tools" must be an object');
|
|
60
|
+
}
|
|
61
|
+
const tools = obj.tools;
|
|
62
|
+
config.tools = {};
|
|
63
|
+
for (const key of ['summaries', 'tasks', 'telemetry']) {
|
|
64
|
+
if (key in tools) {
|
|
65
|
+
if (typeof tools[key] !== 'boolean') {
|
|
66
|
+
throw new Error(`"tools.${key}" must be a boolean`);
|
|
67
|
+
}
|
|
68
|
+
config.tools[key] = tools[key];
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
57
72
|
return config;
|
|
58
73
|
}
|
|
59
74
|
export function clearConfigCache() {
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,MAAM,eAAe,GAAG,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAmB5C,MAAM,WAAW,GAAG,IAAI,GAAG,EAA4B,CAAC;AAExD,MAAM,UAAU,UAAU,CAAC,WAAmB;IAC5C,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAC5C,IAAI,MAAM;QAAE,OAAO,MAAM,CAAC;IAE1B,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;IACtD,IAAI,MAAM,GAAqB,EAAE,CAAC;IAElC,IAAI,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC3B,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;YAC9C,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC/B,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;QAClC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,2BAA2B,eAAe,KAAK,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CACpG,CAAC;QACJ,CAAC;IACH,CAAC;IAED,WAAW,CAAC,GAAG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CAAC;YACjC,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC9B,WAAW,CAAC,KAAK,EAAE,CAAC;AACtB,CAAC"}
|
package/dist/server.js
CHANGED
|
@@ -18,230 +18,256 @@ import { SessionManager } from './memory/session.js';
|
|
|
18
18
|
import { loadConfig } from './config.js';
|
|
19
19
|
const server = new McpServer({
|
|
20
20
|
name: 'repo-memory',
|
|
21
|
-
version: '0.
|
|
21
|
+
version: '0.6.0',
|
|
22
22
|
});
|
|
23
|
-
server
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
function registerTools(server, config) {
|
|
24
|
+
// === NAVIGATION GROUP (always on) ===
|
|
25
|
+
server.registerTool('get_project_map', {
|
|
26
|
+
title: 'Get Project Map',
|
|
27
|
+
description: 'Returns a structural overview of the project including directory tree, entry points, and key modules.',
|
|
28
|
+
inputSchema: {
|
|
29
|
+
project_root: z.string().describe('Absolute path to the project root'),
|
|
30
|
+
depth: z.number().optional().describe('Max directory depth to include'),
|
|
31
|
+
},
|
|
32
|
+
}, async ({ project_root, depth }) => {
|
|
33
|
+
const projectMap = await getProjectMap(project_root, depth);
|
|
34
|
+
return {
|
|
35
|
+
content: [{ type: 'text', text: JSON.stringify(projectMap) }],
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
server.registerTool('get_related_files', {
|
|
39
|
+
title: 'Get Related Files',
|
|
40
|
+
description: 'Returns files related to the given file, ranked by dependency proximity and relevance. Useful for finding what else to look at when exploring a file.',
|
|
41
|
+
inputSchema: {
|
|
42
|
+
path: z.string().describe('File path relative to project root'),
|
|
43
|
+
limit: z.number().optional().describe('Max results (default: 10)'),
|
|
44
|
+
task_id: z.string().optional().describe('Task ID for context-aware ranking'),
|
|
45
|
+
},
|
|
46
|
+
}, async ({ path, limit, task_id }) => {
|
|
31
47
|
const projectRoot = process.cwd();
|
|
32
|
-
const result = await
|
|
48
|
+
const result = await getRelatedFiles(projectRoot, path, { limit, taskId: task_id });
|
|
33
49
|
return {
|
|
34
50
|
content: [{ type: 'text', text: JSON.stringify(result) }],
|
|
35
51
|
};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
52
|
+
});
|
|
53
|
+
server.registerTool('get_dependency_graph', {
|
|
54
|
+
title: 'Get Dependency Graph',
|
|
55
|
+
description: 'Returns dependency graph information. If a path is given, returns its dependencies/dependents. If no path, returns a summary of the most connected files.',
|
|
56
|
+
inputSchema: {
|
|
57
|
+
path: z.string().optional().describe('File path to query, or omit for full graph summary'),
|
|
58
|
+
direction: z
|
|
59
|
+
.enum(['dependencies', 'dependents', 'both'])
|
|
60
|
+
.optional()
|
|
61
|
+
.describe('Query direction (default: both)'),
|
|
62
|
+
depth: z.number().optional().describe('Max traversal depth'),
|
|
63
|
+
symbol: z.string().optional().describe('Filter edges by import specifier (e.g., "UserService")'),
|
|
64
|
+
},
|
|
65
|
+
}, async ({ path, direction, depth, symbol }) => {
|
|
66
|
+
const projectRoot = process.cwd();
|
|
67
|
+
const result = await getDependencyGraphTool(projectRoot, path, direction, depth, symbol);
|
|
68
|
+
return {
|
|
69
|
+
content: [{ type: 'text', text: JSON.stringify(result) }],
|
|
70
|
+
};
|
|
71
|
+
});
|
|
72
|
+
server.registerTool('get_changed_files', {
|
|
73
|
+
title: 'Get Changed Files',
|
|
74
|
+
description: 'Returns files that have changed since the last check. Compares current file hashes against cached hashes.',
|
|
75
|
+
inputSchema: {
|
|
76
|
+
since: z.string().optional().describe('ISO timestamp or "last_check"'),
|
|
77
|
+
},
|
|
78
|
+
}, async ({ since }) => {
|
|
79
|
+
const projectRoot = process.cwd();
|
|
80
|
+
const result = await getChangedFiles(projectRoot, since);
|
|
40
81
|
return {
|
|
41
|
-
content: [
|
|
42
|
-
{
|
|
43
|
-
type: 'text',
|
|
44
|
-
text: JSON.stringify({
|
|
45
|
-
error: isNotFound ? 'file_not_found' : 'internal_error',
|
|
46
|
-
message,
|
|
47
|
-
path,
|
|
48
|
-
}),
|
|
49
|
-
},
|
|
50
|
-
],
|
|
51
|
-
isError: true,
|
|
82
|
+
content: [{ type: 'text', text: JSON.stringify(result) }],
|
|
52
83
|
};
|
|
84
|
+
});
|
|
85
|
+
// === SUMMARIES GROUP (off by default) ===
|
|
86
|
+
if (config.tools?.summaries) {
|
|
87
|
+
server.registerTool('get_file_summary', {
|
|
88
|
+
title: 'Get File Summary',
|
|
89
|
+
description: 'Returns a cached summary of a file. If the file has not changed since last read, returns the cached summary without re-reading. Use this instead of reading files directly to save tokens.',
|
|
90
|
+
inputSchema: {
|
|
91
|
+
path: z.string().describe('File path relative to project root'),
|
|
92
|
+
},
|
|
93
|
+
}, async ({ path }) => {
|
|
94
|
+
try {
|
|
95
|
+
const projectRoot = process.cwd();
|
|
96
|
+
const result = await getFileSummary(projectRoot, path);
|
|
97
|
+
return {
|
|
98
|
+
content: [{ type: 'text', text: JSON.stringify(result) }],
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
103
|
+
const isNotFound = error instanceof Error && 'code' in error && error.code === 'ENOENT';
|
|
104
|
+
return {
|
|
105
|
+
content: [
|
|
106
|
+
{
|
|
107
|
+
type: 'text',
|
|
108
|
+
text: JSON.stringify({
|
|
109
|
+
error: isNotFound ? 'file_not_found' : 'internal_error',
|
|
110
|
+
message,
|
|
111
|
+
path,
|
|
112
|
+
}),
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
isError: true,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
server.registerTool('batch_file_summaries', {
|
|
120
|
+
title: 'Batch File Summaries',
|
|
121
|
+
description: 'Get cached summaries for multiple files in one call. More efficient than calling get_file_summary repeatedly.',
|
|
122
|
+
inputSchema: {
|
|
123
|
+
paths: z.array(z.string()).describe('Array of file paths relative to project root'),
|
|
124
|
+
},
|
|
125
|
+
}, async ({ paths }) => {
|
|
126
|
+
const projectRoot = process.cwd();
|
|
127
|
+
const result = await batchFileSummaries(projectRoot, paths);
|
|
128
|
+
return {
|
|
129
|
+
content: [{ type: 'text', text: JSON.stringify(result) }],
|
|
130
|
+
};
|
|
131
|
+
});
|
|
132
|
+
server.registerTool('force_reread', {
|
|
133
|
+
title: 'Force Re-read',
|
|
134
|
+
description: 'Re-reads a file from disk, generates a fresh summary, and updates the cache. Use when you know a file has changed or want guaranteed-fresh data.',
|
|
135
|
+
inputSchema: {
|
|
136
|
+
path: z.string().describe('File path relative to project root'),
|
|
137
|
+
},
|
|
138
|
+
}, async ({ path }) => {
|
|
139
|
+
const projectRoot = process.cwd();
|
|
140
|
+
const result = await forceReread(projectRoot, path);
|
|
141
|
+
return {
|
|
142
|
+
content: [{ type: 'text', text: JSON.stringify(result) }],
|
|
143
|
+
};
|
|
144
|
+
});
|
|
145
|
+
server.registerTool('search_by_purpose', {
|
|
146
|
+
title: 'Search By Purpose',
|
|
147
|
+
description: 'Search cached file summaries by keyword. Matches against file purpose, exports, and declarations. Requires files to have been previously summarized.',
|
|
148
|
+
inputSchema: {
|
|
149
|
+
query: z.string().describe('Search keywords (e.g., "database", "auth middleware", "validation")'),
|
|
150
|
+
limit: z.number().optional().describe('Max results (default: 20)'),
|
|
151
|
+
},
|
|
152
|
+
}, async ({ query, limit }) => {
|
|
153
|
+
const projectRoot = process.cwd();
|
|
154
|
+
const result = searchByPurpose(projectRoot, query, limit);
|
|
155
|
+
return {
|
|
156
|
+
content: [{ type: 'text', text: JSON.stringify(result) }],
|
|
157
|
+
};
|
|
158
|
+
});
|
|
159
|
+
server.registerTool('invalidate', {
|
|
160
|
+
title: 'Invalidate Cache',
|
|
161
|
+
description: 'Invalidates cached entries. If a path is provided, only that entry is removed. If no path is provided, all entries are removed.',
|
|
162
|
+
inputSchema: {
|
|
163
|
+
path: z.string().optional().describe('File path to invalidate, or omit to invalidate all'),
|
|
164
|
+
},
|
|
165
|
+
}, async ({ path }) => {
|
|
166
|
+
const projectRoot = process.cwd();
|
|
167
|
+
const result = await invalidateCache(projectRoot, path);
|
|
168
|
+
return {
|
|
169
|
+
content: [{ type: 'text', text: JSON.stringify(result) }],
|
|
170
|
+
};
|
|
171
|
+
});
|
|
53
172
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
},
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}, async ({
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
})
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
const task = createTaskTool(projectRoot, name);
|
|
135
|
-
return {
|
|
136
|
-
content: [{ type: 'text', text: JSON.stringify(task) }],
|
|
137
|
-
};
|
|
138
|
-
});
|
|
139
|
-
server.registerTool('get_task_context', {
|
|
140
|
-
title: 'Get Task Context',
|
|
141
|
-
description: 'Returns task state, explored files, and frontier. If no task_id, returns list of all tasks.',
|
|
142
|
-
inputSchema: {
|
|
143
|
-
task_id: z.string().optional().describe('Task ID to query, or omit to list all tasks'),
|
|
144
|
-
},
|
|
145
|
-
}, async ({ task_id }) => {
|
|
146
|
-
const projectRoot = process.cwd();
|
|
147
|
-
const result = getTaskContext(projectRoot, task_id);
|
|
148
|
-
return {
|
|
149
|
-
content: [{ type: 'text', text: JSON.stringify(result) }],
|
|
150
|
-
};
|
|
151
|
-
});
|
|
152
|
-
server.registerTool('mark_explored', {
|
|
153
|
-
title: 'Mark Explored',
|
|
154
|
-
description: 'Marks a file as explored for a task, with optional status and notes.',
|
|
155
|
-
inputSchema: {
|
|
156
|
-
task_id: z.string().describe('Task ID'),
|
|
157
|
-
path: z.string().describe('File path relative to project root'),
|
|
158
|
-
status: z
|
|
159
|
-
.enum(['explored', 'skipped', 'flagged'])
|
|
160
|
-
.optional()
|
|
161
|
-
.describe('Exploration status (default: explored)'),
|
|
162
|
-
notes: z.string().optional().describe('Optional notes about the file'),
|
|
163
|
-
},
|
|
164
|
-
}, async ({ task_id, path, status, notes }) => {
|
|
165
|
-
const projectRoot = process.cwd();
|
|
166
|
-
const result = markExploredTool(projectRoot, task_id, path, status, notes);
|
|
167
|
-
return {
|
|
168
|
-
content: [{ type: 'text', text: JSON.stringify(result) }],
|
|
169
|
-
};
|
|
170
|
-
});
|
|
171
|
-
server.registerTool('get_token_report', {
|
|
172
|
-
title: 'Get Token Report',
|
|
173
|
-
description: 'Get aggregated token usage telemetry report showing cache efficiency and token savings',
|
|
174
|
-
inputSchema: {
|
|
175
|
-
period: z
|
|
176
|
-
.enum(['session', 'all', 'last_n_hours'])
|
|
177
|
-
.optional()
|
|
178
|
-
.describe('Time period for the report'),
|
|
179
|
-
hours: z
|
|
180
|
-
.number()
|
|
181
|
-
.optional()
|
|
182
|
-
.describe('Number of hours to look back (only for last_n_hours period)'),
|
|
183
|
-
session_id: z
|
|
184
|
-
.string()
|
|
185
|
-
.optional()
|
|
186
|
-
.describe('Session ID (only for session period)'),
|
|
187
|
-
include_diagnostics: z
|
|
188
|
-
.boolean()
|
|
189
|
-
.optional()
|
|
190
|
-
.describe('Include cache health diagnostics'),
|
|
191
|
-
},
|
|
192
|
-
}, async ({ period, hours, session_id, include_diagnostics }) => {
|
|
193
|
-
const projectRoot = process.cwd();
|
|
194
|
-
const report = getTokenReport(projectRoot, period, hours, session_id, include_diagnostics);
|
|
195
|
-
return {
|
|
196
|
-
content: [{ type: 'text', text: JSON.stringify(report, null, 2) }],
|
|
197
|
-
};
|
|
198
|
-
});
|
|
199
|
-
server.registerTool('batch_file_summaries', {
|
|
200
|
-
title: 'Batch File Summaries',
|
|
201
|
-
description: 'Get cached summaries for multiple files in one call. More efficient than calling get_file_summary repeatedly.',
|
|
202
|
-
inputSchema: {
|
|
203
|
-
paths: z.array(z.string()).describe('Array of file paths relative to project root'),
|
|
204
|
-
},
|
|
205
|
-
}, async ({ paths }) => {
|
|
206
|
-
const projectRoot = process.cwd();
|
|
207
|
-
const result = await batchFileSummaries(projectRoot, paths);
|
|
208
|
-
return {
|
|
209
|
-
content: [{ type: 'text', text: JSON.stringify(result) }],
|
|
210
|
-
};
|
|
211
|
-
});
|
|
212
|
-
server.registerTool('get_related_files', {
|
|
213
|
-
title: 'Get Related Files',
|
|
214
|
-
description: 'Returns files related to the given file, ranked by dependency proximity and relevance. Useful for finding what else to look at when exploring a file.',
|
|
215
|
-
inputSchema: {
|
|
216
|
-
path: z.string().describe('File path relative to project root'),
|
|
217
|
-
limit: z.number().optional().describe('Max results (default: 10)'),
|
|
218
|
-
task_id: z.string().optional().describe('Task ID for context-aware ranking'),
|
|
219
|
-
},
|
|
220
|
-
}, async ({ path, limit, task_id }) => {
|
|
221
|
-
const projectRoot = process.cwd();
|
|
222
|
-
const result = await getRelatedFiles(projectRoot, path, { limit, taskId: task_id });
|
|
223
|
-
return {
|
|
224
|
-
content: [{ type: 'text', text: JSON.stringify(result) }],
|
|
225
|
-
};
|
|
226
|
-
});
|
|
227
|
-
server.registerTool('search_by_purpose', {
|
|
228
|
-
title: 'Search By Purpose',
|
|
229
|
-
description: 'Search cached file summaries by keyword. Matches against file purpose, exports, and declarations. Requires files to have been previously summarized.',
|
|
230
|
-
inputSchema: {
|
|
231
|
-
query: z.string().describe('Search keywords (e.g., "database", "auth middleware", "validation")'),
|
|
232
|
-
limit: z.number().optional().describe('Max results (default: 20)'),
|
|
233
|
-
},
|
|
234
|
-
}, async ({ query, limit }) => {
|
|
235
|
-
const projectRoot = process.cwd();
|
|
236
|
-
const result = searchByPurpose(projectRoot, query, limit);
|
|
237
|
-
return {
|
|
238
|
-
content: [{ type: 'text', text: JSON.stringify(result) }],
|
|
239
|
-
};
|
|
240
|
-
});
|
|
173
|
+
// === TASKS GROUP (off by default) ===
|
|
174
|
+
if (config.tools?.tasks) {
|
|
175
|
+
server.registerTool('create_task', {
|
|
176
|
+
title: 'Create Task',
|
|
177
|
+
description: 'Creates a new investigation task for tracking file exploration.',
|
|
178
|
+
inputSchema: {
|
|
179
|
+
name: z.string().describe('Human-readable task name'),
|
|
180
|
+
},
|
|
181
|
+
}, async ({ name }) => {
|
|
182
|
+
const projectRoot = process.cwd();
|
|
183
|
+
const task = createTaskTool(projectRoot, name);
|
|
184
|
+
return {
|
|
185
|
+
content: [{ type: 'text', text: JSON.stringify(task) }],
|
|
186
|
+
};
|
|
187
|
+
});
|
|
188
|
+
server.registerTool('get_task_context', {
|
|
189
|
+
title: 'Get Task Context',
|
|
190
|
+
description: 'Returns task state, explored files, and frontier. If no task_id, returns list of all tasks.',
|
|
191
|
+
inputSchema: {
|
|
192
|
+
task_id: z.string().optional().describe('Task ID to query, or omit to list all tasks'),
|
|
193
|
+
},
|
|
194
|
+
}, async ({ task_id }) => {
|
|
195
|
+
const projectRoot = process.cwd();
|
|
196
|
+
const result = getTaskContext(projectRoot, task_id);
|
|
197
|
+
return {
|
|
198
|
+
content: [{ type: 'text', text: JSON.stringify(result) }],
|
|
199
|
+
};
|
|
200
|
+
});
|
|
201
|
+
server.registerTool('mark_explored', {
|
|
202
|
+
title: 'Mark Explored',
|
|
203
|
+
description: 'Marks a file as explored for a task, with optional status and notes.',
|
|
204
|
+
inputSchema: {
|
|
205
|
+
task_id: z.string().describe('Task ID'),
|
|
206
|
+
path: z.string().describe('File path relative to project root'),
|
|
207
|
+
status: z
|
|
208
|
+
.enum(['explored', 'skipped', 'flagged'])
|
|
209
|
+
.optional()
|
|
210
|
+
.describe('Exploration status (default: explored)'),
|
|
211
|
+
notes: z.string().optional().describe('Optional notes about the file'),
|
|
212
|
+
},
|
|
213
|
+
}, async ({ task_id, path, status, notes }) => {
|
|
214
|
+
const projectRoot = process.cwd();
|
|
215
|
+
const result = markExploredTool(projectRoot, task_id, path, status, notes);
|
|
216
|
+
return {
|
|
217
|
+
content: [{ type: 'text', text: JSON.stringify(result) }],
|
|
218
|
+
};
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
// === TELEMETRY GROUP (off by default) ===
|
|
222
|
+
if (config.tools?.telemetry) {
|
|
223
|
+
server.registerTool('get_token_report', {
|
|
224
|
+
title: 'Get Token Report',
|
|
225
|
+
description: 'Get aggregated token usage telemetry report showing cache efficiency and token savings',
|
|
226
|
+
inputSchema: {
|
|
227
|
+
period: z
|
|
228
|
+
.enum(['session', 'all', 'last_n_hours'])
|
|
229
|
+
.optional()
|
|
230
|
+
.describe('Time period for the report'),
|
|
231
|
+
hours: z
|
|
232
|
+
.number()
|
|
233
|
+
.optional()
|
|
234
|
+
.describe('Number of hours to look back (only for last_n_hours period)'),
|
|
235
|
+
session_id: z
|
|
236
|
+
.string()
|
|
237
|
+
.optional()
|
|
238
|
+
.describe('Session ID (only for session period)'),
|
|
239
|
+
include_diagnostics: z
|
|
240
|
+
.boolean()
|
|
241
|
+
.optional()
|
|
242
|
+
.describe('Include cache health diagnostics'),
|
|
243
|
+
},
|
|
244
|
+
}, async ({ period, hours, session_id, include_diagnostics }) => {
|
|
245
|
+
const projectRoot = process.cwd();
|
|
246
|
+
const report = getTokenReport(projectRoot, period, hours, session_id, include_diagnostics);
|
|
247
|
+
return {
|
|
248
|
+
content: [{ type: 'text', text: JSON.stringify(report, null, 2) }],
|
|
249
|
+
};
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
}
|
|
241
253
|
async function main() {
|
|
254
|
+
const projectRoot = process.cwd();
|
|
255
|
+
// Load config before tool registration
|
|
256
|
+
const config = loadConfig(projectRoot);
|
|
257
|
+
// Register tools based on config
|
|
258
|
+
registerTools(server, config);
|
|
259
|
+
// Connect transport
|
|
242
260
|
const transport = new StdioServerTransport();
|
|
243
261
|
await server.connect(transport);
|
|
244
|
-
|
|
262
|
+
// Log enabled tool groups
|
|
263
|
+
const enabledGroups = ['navigation'];
|
|
264
|
+
if (config.tools?.summaries)
|
|
265
|
+
enabledGroups.push('summaries');
|
|
266
|
+
if (config.tools?.tasks)
|
|
267
|
+
enabledGroups.push('tasks');
|
|
268
|
+
if (config.tools?.telemetry)
|
|
269
|
+
enabledGroups.push('telemetry');
|
|
270
|
+
process.stderr.write(`Tool groups: ${enabledGroups.join(', ')}\n`);
|
|
245
271
|
// Auto-start session
|
|
246
272
|
const sessionManager = new SessionManager(projectRoot);
|
|
247
273
|
const session = sessionManager.startSession({ source: 'mcp-connect' });
|
|
@@ -258,8 +284,6 @@ async function main() {
|
|
|
258
284
|
process.on('SIGINT', cleanup);
|
|
259
285
|
process.on('SIGTERM', cleanup);
|
|
260
286
|
process.on('beforeExit', cleanup);
|
|
261
|
-
// Load project config
|
|
262
|
-
const config = loadConfig(projectRoot);
|
|
263
287
|
// Run GC in background on startup (non-blocking)
|
|
264
288
|
runGC(projectRoot, config.gc).catch((err) => {
|
|
265
289
|
process.stderr.write(`GC warning: ${err instanceof Error ? err.message : String(err)}\n`);
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3F,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;IAC3B,IAAI,EAAE,aAAa;IACnB,OAAO,EAAE,OAAO;CACjB,CAAC,CAAC;AAEH,MAAM,CAAC,YAA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AM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACxF,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,OAAO,IAAI,CAAC,CAAC;IAClD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Token estimation utilities for telemetry tracking.
|
|
3
|
+
*
|
|
4
|
+
* Uses the widely-accepted heuristic of ~4 characters per token for English
|
|
5
|
+
* text and code. This matches OpenAI's documentation and empirical analysis
|
|
6
|
+
* across major LLM tokenizers (cl100k_base, o200k_base).
|
|
7
|
+
*
|
|
8
|
+
* For cache hit savings, we calculate:
|
|
9
|
+
* tokensAvoided = rawFileTokens - summaryTokens
|
|
10
|
+
*
|
|
11
|
+
* This represents the tokens the agent would have consumed reading the full
|
|
12
|
+
* file, minus the (much smaller) summary that was served instead.
|
|
13
|
+
*/
|
|
14
|
+
import type { FileSummary } from '../types.js';
|
|
15
|
+
/** Estimate token count from a string's character length. */
|
|
16
|
+
export declare function estimateTokens(text: string): number;
|
|
17
|
+
/** Estimate tokens saved by serving a summary instead of raw file contents. */
|
|
18
|
+
export declare function estimateTokensSaved(rawContents: string, summary: FileSummary): number;
|
|
19
|
+
//# sourceMappingURL=tokens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/telemetry/tokens.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI/C,6DAA6D;AAC7D,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,+EAA+E;AAC/E,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,MAAM,CAIrF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Token estimation utilities for telemetry tracking.
|
|
3
|
+
*
|
|
4
|
+
* Uses the widely-accepted heuristic of ~4 characters per token for English
|
|
5
|
+
* text and code. This matches OpenAI's documentation and empirical analysis
|
|
6
|
+
* across major LLM tokenizers (cl100k_base, o200k_base).
|
|
7
|
+
*
|
|
8
|
+
* For cache hit savings, we calculate:
|
|
9
|
+
* tokensAvoided = rawFileTokens - summaryTokens
|
|
10
|
+
*
|
|
11
|
+
* This represents the tokens the agent would have consumed reading the full
|
|
12
|
+
* file, minus the (much smaller) summary that was served instead.
|
|
13
|
+
*/
|
|
14
|
+
const CHARS_PER_TOKEN = 4;
|
|
15
|
+
/** Estimate token count from a string's character length. */
|
|
16
|
+
export function estimateTokens(text) {
|
|
17
|
+
return Math.ceil(text.length / CHARS_PER_TOKEN);
|
|
18
|
+
}
|
|
19
|
+
/** Estimate tokens saved by serving a summary instead of raw file contents. */
|
|
20
|
+
export function estimateTokensSaved(rawContents, summary) {
|
|
21
|
+
const rawTokens = estimateTokens(rawContents);
|
|
22
|
+
const summaryTokens = estimateTokens(JSON.stringify(summary));
|
|
23
|
+
return Math.max(0, rawTokens - summaryTokens);
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../src/telemetry/tokens.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,MAAM,eAAe,GAAG,CAAC,CAAC;AAE1B,6DAA6D;AAC7D,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,eAAe,CAAC,CAAC;AAClD,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,mBAAmB,CAAC,WAAmB,EAAE,OAAoB;IAC3E,MAAM,SAAS,GAAG,cAAc,CAAC,WAAW,CAAC,CAAC;IAC9C,MAAM,aAAa,GAAG,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;IAC9D,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,GAAG,aAAa,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"force-reread.d.ts","sourceRoot":"","sources":["../../src/tools/force-reread.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"force-reread.d.ts","sourceRoot":"","sources":["../../src/tools/force-reread.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C,wBAAsB,WAAW,CAC/B,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,WAAW,CAAC;IAAC,MAAM,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAc7F"}
|
|
@@ -3,6 +3,8 @@ import { join } from 'node:path';
|
|
|
3
3
|
import { hashContents } from '../cache/hash.js';
|
|
4
4
|
import { CacheStore } from '../cache/store.js';
|
|
5
5
|
import { summarizeFile } from '../indexer/summarizer.js';
|
|
6
|
+
import { TelemetryTracker } from '../telemetry/tracker.js';
|
|
7
|
+
import { estimateTokens } from '../telemetry/tokens.js';
|
|
6
8
|
import { validatePath } from '../utils/validate-path.js';
|
|
7
9
|
export async function forceReread(projectRoot, relativePath) {
|
|
8
10
|
relativePath = validatePath(projectRoot, relativePath);
|
|
@@ -12,6 +14,8 @@ export async function forceReread(projectRoot, relativePath) {
|
|
|
12
14
|
const summary = summarizeFile(relativePath, contents);
|
|
13
15
|
const store = new CacheStore(projectRoot);
|
|
14
16
|
store.setEntry(relativePath, hash, summary);
|
|
17
|
+
const tracker = new TelemetryTracker(projectRoot);
|
|
18
|
+
tracker.trackEvent('force_reread', relativePath, estimateTokens(contents));
|
|
15
19
|
return { path: relativePath, hash, summary, reread: true, reason: 'force_reread: explicitly requested' };
|
|
16
20
|
}
|
|
17
21
|
//# sourceMappingURL=force-reread.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"force-reread.js","sourceRoot":"","sources":["../../src/tools/force-reread.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"force-reread.js","sourceRoot":"","sources":["../../src/tools/force-reread.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,WAAmB,EACnB,YAAoB;IAEpB,YAAY,GAAG,YAAY,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;IACvD,MAAM,YAAY,GAAG,IAAI,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;IACrD,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IACvD,MAAM,IAAI,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;IACpC,MAAM,OAAO,GAAG,aAAa,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;IAEtD,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,WAAW,CAAC,CAAC;IAC1C,KAAK,CAAC,QAAQ,CAAC,YAAY,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAE5C,MAAM,OAAO,GAAG,IAAI,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAClD,OAAO,CAAC,UAAU,CAAC,cAAc,EAAE,YAAY,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC;IAE3E,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,oCAAoC,EAAE,CAAC;AAC3G,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-file-summary.d.ts","sourceRoot":"","sources":["../../src/tools/get-file-summary.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-file-summary.d.ts","sourceRoot":"","sources":["../../src/tools/get-file-summary.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,WAAW,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED,wBAAsB,cAAc,CAClC,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,iBAAiB,CAAC,CAwD5B"}
|
|
@@ -3,6 +3,8 @@ import { join } from 'node:path';
|
|
|
3
3
|
import { hashContents } from '../cache/hash.js';
|
|
4
4
|
import { CacheStore } from '../cache/store.js';
|
|
5
5
|
import { summarizeFile } from '../indexer/summarizer.js';
|
|
6
|
+
import { TelemetryTracker } from '../telemetry/tracker.js';
|
|
7
|
+
import { estimateTokensSaved } from '../telemetry/tokens.js';
|
|
6
8
|
import { validatePath } from '../utils/validate-path.js';
|
|
7
9
|
export async function getFileSummary(projectRoot, relativePath) {
|
|
8
10
|
relativePath = validatePath(projectRoot, relativePath);
|
|
@@ -16,7 +18,10 @@ export async function getFileSummary(projectRoot, relativePath) {
|
|
|
16
18
|
const cacheAge = cached
|
|
17
19
|
? Math.floor((Date.now() - cached.lastChecked) / 1000)
|
|
18
20
|
: null;
|
|
21
|
+
const tracker = new TelemetryTracker(projectRoot);
|
|
19
22
|
if (cached && cached.hash === currentHash && cached.summary) {
|
|
23
|
+
const tokensSaved = estimateTokensSaved(contents, cached.summary);
|
|
24
|
+
tracker.trackEvent('cache_hit', relativePath, tokensSaved);
|
|
20
25
|
return {
|
|
21
26
|
path: relativePath,
|
|
22
27
|
hash: currentHash,
|
|
@@ -40,6 +45,7 @@ export async function getFileSummary(projectRoot, relativePath) {
|
|
|
40
45
|
else {
|
|
41
46
|
reason = 'cache_miss: no summary in cache';
|
|
42
47
|
}
|
|
48
|
+
tracker.trackEvent('cache_miss', relativePath, 0);
|
|
43
49
|
return {
|
|
44
50
|
path: relativePath,
|
|
45
51
|
hash: currentHash,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-file-summary.js","sourceRoot":"","sources":["../../src/tools/get-file-summary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MA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AM;QACN,QAAQ;QACR,eAAe,EAAE,OAAO,CAAC,UAAU,KAAK,KAAK;KAC9C,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invalidate.d.ts","sourceRoot":"","sources":["../../src/tools/invalidate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"invalidate.d.ts","sourceRoot":"","sources":["../../src/tools/invalidate.ts"],"names":[],"mappings":"AAIA,wBAAsB,eAAe,CACnC,WAAW,EAAE,MAAM,EACnB,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC;IAAE,WAAW,EAAE,MAAM,GAAG,KAAK,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,CAAC,CAqBlE"}
|
package/dist/tools/invalidate.js
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import { CacheStore } from '../cache/store.js';
|
|
2
|
+
import { TelemetryTracker } from '../telemetry/tracker.js';
|
|
2
3
|
import { validatePath } from '../utils/validate-path.js';
|
|
3
4
|
export async function invalidateCache(projectRoot, path) {
|
|
4
5
|
if (path) {
|
|
5
6
|
path = validatePath(projectRoot, path);
|
|
6
7
|
}
|
|
7
8
|
const store = new CacheStore(projectRoot);
|
|
9
|
+
const tracker = new TelemetryTracker(projectRoot);
|
|
8
10
|
if (path) {
|
|
9
11
|
store.deleteEntry(path);
|
|
12
|
+
tracker.trackEvent('invalidation', path);
|
|
10
13
|
return { invalidated: path, entriesRemoved: 1 };
|
|
11
14
|
}
|
|
12
15
|
const entries = store.getAllEntries();
|
|
13
16
|
const count = entries.length;
|
|
14
17
|
for (const entry of entries) {
|
|
15
18
|
store.deleteEntry(entry.path);
|
|
19
|
+
tracker.trackEvent('invalidation', entry.path);
|
|
16
20
|
}
|
|
17
21
|
return { invalidated: 'all', entriesRemoved: count };
|
|
18
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invalidate.js","sourceRoot":"","sources":["../../src/tools/inv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EAAE,CAAC;QAC5B,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC9B,OAAO,CAAC,UAAU,CAAC,cAAc,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IACjD,CAAC;IAED,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC;AACvD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-by-purpose.d.ts","sourceRoot":"","sources":["../../src/tools/search-by-purpose.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"search-by-purpose.d.ts","sourceRoot":"","sources":["../../src/tools/search-by-purpose.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,eAAe,CAC7B,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,KAAK,CAAC,EAAE,MAAM,GACb,qBAAqB,CAuEvB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CacheStore } from '../cache/store.js';
|
|
2
|
+
import { TelemetryTracker } from '../telemetry/tracker.js';
|
|
2
3
|
export function searchByPurpose(projectRoot, query, limit) {
|
|
3
4
|
const store = new CacheStore(projectRoot);
|
|
4
5
|
const allEntries = store.getAllEntries();
|
|
@@ -41,9 +42,19 @@ export function searchByPurpose(projectRoot, query, limit) {
|
|
|
41
42
|
}
|
|
42
43
|
// Sort by score descending
|
|
43
44
|
results.sort((a, b) => b.score - a.score);
|
|
45
|
+
const matched = results.slice(0, effectiveLimit);
|
|
46
|
+
// Track each matched file as a summary_served event.
|
|
47
|
+
// Token estimate: approximate raw file tokens from lineCount (avg ~40 chars/line).
|
|
48
|
+
const tracker = new TelemetryTracker(projectRoot);
|
|
49
|
+
for (const result of matched) {
|
|
50
|
+
const entry = allEntries.find(e => e.path === result.path);
|
|
51
|
+
// Approximate raw file tokens from lineCount (avg ~40 chars/line, ~4 chars/token)
|
|
52
|
+
const estimatedRawTokens = entry?.summary ? entry.summary.lineCount * 10 : 0;
|
|
53
|
+
tracker.trackEvent('summary_served', result.path, estimatedRawTokens);
|
|
54
|
+
}
|
|
44
55
|
return {
|
|
45
56
|
query,
|
|
46
|
-
results:
|
|
57
|
+
results: matched.map(({ score: _score, ...rest }) => rest),
|
|
47
58
|
totalCached: allEntries.filter(e => e.summary).length,
|
|
48
59
|
};
|
|
49
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-by-purpose.js","sourceRoot":"","sources":["../../src/tools/search-by-purpose.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"search-by-purpose.js","sourceRoot":"","sources":["../../src/tools/search-by-purpose.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAgB3D,MAAM,UAAU,eAAe,CAC7B,WAAmB,EACnB,KAAa,EACb,KAAc;IAEd,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,WAAW,CAAC,CAAC;IAC1C,MAAM,UAAU,GAAG,KAAK,CAAC,aAAa,EAAE,CAAC;IACzC,MAAM,cAAc,GAAG,KAAK,IAAI,EAAE,CAAC;IAEnC,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAA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