@mneme-ai/mcp 1.1.1 → 1.3.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/dist/index.d.ts.map +1 -1
- package/dist/index.js +75 -343
- package/dist/index.js.map +1 -1
- package/dist/tools/_capabilities.d.ts +14 -0
- package/dist/tools/_capabilities.d.ts.map +1 -0
- package/dist/tools/_capabilities.js +90 -0
- package/dist/tools/_capabilities.js.map +1 -0
- package/dist/tools/_lifecycle.d.ts +51 -0
- package/dist/tools/_lifecycle.d.ts.map +1 -0
- package/dist/tools/_lifecycle.js +124 -0
- package/dist/tools/_lifecycle.js.map +1 -0
- package/dist/tools/_molecules.d.ts +22 -0
- package/dist/tools/_molecules.d.ts.map +1 -0
- package/dist/tools/_molecules.js +142 -0
- package/dist/tools/_molecules.js.map +1 -0
- package/dist/tools/_registry.d.ts +16 -0
- package/dist/tools/_registry.d.ts.map +1 -0
- package/dist/tools/_registry.js +57 -0
- package/dist/tools/_registry.js.map +1 -0
- package/dist/tools/_runtime.d.ts +32 -0
- package/dist/tools/_runtime.d.ts.map +1 -0
- package/dist/tools/_runtime.js +78 -0
- package/dist/tools/_runtime.js.map +1 -0
- package/dist/tools/_smart_do.d.ts +14 -0
- package/dist/tools/_smart_do.d.ts.map +1 -0
- package/dist/tools/_smart_do.js +49 -0
- package/dist/tools/_smart_do.js.map +1 -0
- package/dist/tools/_types.d.ts +118 -0
- package/dist/tools/_types.d.ts.map +1 -0
- package/dist/tools/_types.js +34 -0
- package/dist/tools/_types.js.map +1 -0
- package/dist/tools/audit.d.ts +9 -0
- package/dist/tools/audit.d.ts.map +1 -0
- package/dist/tools/audit.js +233 -0
- package/dist/tools/audit.js.map +1 -0
- package/dist/tools/forensics.d.ts +7 -0
- package/dist/tools/forensics.d.ts.map +1 -0
- package/dist/tools/forensics.js +189 -0
- package/dist/tools/forensics.js.map +1 -0
- package/dist/tools/insights.d.ts +7 -0
- package/dist/tools/insights.d.ts.map +1 -0
- package/dist/tools/insights.js +40 -0
- package/dist/tools/insights.js.map +1 -0
- package/dist/tools/lab.d.ts +7 -0
- package/dist/tools/lab.d.ts.map +1 -0
- package/dist/tools/lab.js +93 -0
- package/dist/tools/lab.js.map +1 -0
- package/dist/tools/memory.d.ts +10 -0
- package/dist/tools/memory.d.ts.map +1 -0
- package/dist/tools/memory.js +463 -0
- package/dist/tools/memory.js.map +1 -0
- package/dist/tools/meta.d.ts +7 -0
- package/dist/tools/meta.d.ts.map +1 -0
- package/dist/tools/meta.js +20 -0
- package/dist/tools/meta.js.map +1 -0
- package/dist/tools/people.d.ts +10 -0
- package/dist/tools/people.d.ts.map +1 -0
- package/dist/tools/people.js +73 -0
- package/dist/tools/people.js.map +1 -0
- package/dist/tools/quality.d.ts +6 -0
- package/dist/tools/quality.d.ts.map +1 -0
- package/dist/tools/quality.js +57 -0
- package/dist/tools/quality.js.map +1 -0
- package/dist/tools/quant.d.ts +7 -0
- package/dist/tools/quant.d.ts.map +1 -0
- package/dist/tools/quant.js +26 -0
- package/dist/tools/quant.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,463 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Memory tools — Q&A, semantic search, citations, blast-radius.
|
|
3
|
+
*
|
|
4
|
+
* These are the "ask the codebase a question" verbs. The AI student should
|
|
5
|
+
* pick from this category whenever the user wants to know WHY code exists,
|
|
6
|
+
* what changed, or what a commit might affect.
|
|
7
|
+
*/
|
|
8
|
+
import { retrieve, git, htc } from "@mneme-ai/core";
|
|
9
|
+
export const memoryTools = [
|
|
10
|
+
{
|
|
11
|
+
name: "mneme.memory.ask",
|
|
12
|
+
category: "memory",
|
|
13
|
+
description: "Answer a natural-language question about the repo's history and intent. " +
|
|
14
|
+
"Returns a synthesized verdict with 5-15 cited commits/PRs that justify the answer. " +
|
|
15
|
+
"Use this WHEN the user asks: 'why does X exist?', 'when did we add Y?', 'what was the reason for Z?', " +
|
|
16
|
+
"'how does this work?', or any other curiosity about WHY code looks the way it does.",
|
|
17
|
+
triggers: [
|
|
18
|
+
"ทำไม parseAmount ใช้ try/catch?",
|
|
19
|
+
"why does the webhook handler retry 3 times?",
|
|
20
|
+
"เมื่อไหร่ที่เราเพิ่ม rate limiting?",
|
|
21
|
+
"what was the rationale behind the JWT migration?",
|
|
22
|
+
],
|
|
23
|
+
inputSchema: {
|
|
24
|
+
type: "object",
|
|
25
|
+
properties: {
|
|
26
|
+
question: { type: "string", description: "Natural-language question" },
|
|
27
|
+
topK: { type: "number", description: "Max cited commits (default 8)" },
|
|
28
|
+
},
|
|
29
|
+
required: ["question"],
|
|
30
|
+
},
|
|
31
|
+
handler: async (rt, args) => {
|
|
32
|
+
const question = String(args["question"] ?? "");
|
|
33
|
+
const topK = typeof args["topK"] === "number" ? args["topK"] : 8;
|
|
34
|
+
const result = await retrieve.ask(question, {
|
|
35
|
+
store: rt.store,
|
|
36
|
+
embedder: rt.embedder,
|
|
37
|
+
repo: rt.meta,
|
|
38
|
+
topK,
|
|
39
|
+
});
|
|
40
|
+
const compressed = compressedAbstractsFor(rt, result.searchResults);
|
|
41
|
+
const cited = result.citations.length;
|
|
42
|
+
const confidence = cited >= 3 ? "high" : cited >= 1 ? "medium" : "low";
|
|
43
|
+
const wisdom = cited === 0
|
|
44
|
+
? "I couldn't find supporting commits — the repo may not contain history about this question. Tell the user the answer is unverifiable here."
|
|
45
|
+
: `Based on ${cited} cited commit${cited === 1 ? "" : "s"}, here's what the repo says: ${result.summary}`;
|
|
46
|
+
return {
|
|
47
|
+
data: {
|
|
48
|
+
question: result.question,
|
|
49
|
+
summary: result.summary,
|
|
50
|
+
citations: result.citations,
|
|
51
|
+
results: result.searchResults.map((s) => toSearchPayload(s, compressed)),
|
|
52
|
+
},
|
|
53
|
+
wisdom,
|
|
54
|
+
followUp: cited > 0
|
|
55
|
+
? ["mneme.memory.why", "mneme.insights.story", "mneme.people.who_knows"]
|
|
56
|
+
: ["mneme.memory.search_commits"],
|
|
57
|
+
confidence: { level: confidence },
|
|
58
|
+
secondBrain: {
|
|
59
|
+
presentation: "Quote `wisdom` directly. Cite each commit hash inline like `(per a3f9b21)` — never invent hashes. " +
|
|
60
|
+
"If citations are < 3, tell the user the answer is best-effort and offer to widen the search.",
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: "mneme.memory.why",
|
|
67
|
+
category: "memory",
|
|
68
|
+
description: "Explain why a specific FILE (or line range within it) exists by combining git blame with related commits. " +
|
|
69
|
+
"Returns the originating commits ranked by line ownership. " +
|
|
70
|
+
"Use this WHEN the user asks: 'who wrote this line?', 'why is THIS function here?', " +
|
|
71
|
+
"'what introduced src/auth.ts:47?', 'origin of this code'.",
|
|
72
|
+
triggers: [
|
|
73
|
+
"why does src/auth.ts use JWT?",
|
|
74
|
+
"ใครเขียนบรรทัดที่ 47?",
|
|
75
|
+
"origin of this function",
|
|
76
|
+
"explain why this file exists",
|
|
77
|
+
],
|
|
78
|
+
inputSchema: {
|
|
79
|
+
type: "object",
|
|
80
|
+
properties: {
|
|
81
|
+
file: { type: "string", description: "Path relative to repo root" },
|
|
82
|
+
startLine: { type: "number", description: "Optional 1-indexed start line" },
|
|
83
|
+
endLine: { type: "number", description: "Optional 1-indexed end line" },
|
|
84
|
+
},
|
|
85
|
+
required: ["file"],
|
|
86
|
+
},
|
|
87
|
+
handler: async (rt, args) => {
|
|
88
|
+
const file = String(args["file"] ?? "");
|
|
89
|
+
const sl = typeof args["startLine"] === "number" ? args["startLine"] : undefined;
|
|
90
|
+
const el = typeof args["endLine"] === "number" ? args["endLine"] : undefined;
|
|
91
|
+
const blamed = await git.blame(rt.meta.rootPath, file, sl, el);
|
|
92
|
+
const tally = new Map();
|
|
93
|
+
for (const b of blamed)
|
|
94
|
+
tally.set(b.commitHash, (tally.get(b.commitHash) ?? 0) + 1);
|
|
95
|
+
const top = Array.from(tally.entries())
|
|
96
|
+
.sort((a, b) => b[1] - a[1])
|
|
97
|
+
.slice(0, 8)
|
|
98
|
+
.map(([h, count]) => ({
|
|
99
|
+
commit: rt.store.getCommit(h) ?? null,
|
|
100
|
+
hash: h,
|
|
101
|
+
lineCount: count,
|
|
102
|
+
}));
|
|
103
|
+
const owner = top[0]?.commit?.authorName ?? "unknown";
|
|
104
|
+
const wisdom = top.length
|
|
105
|
+
? `${file}${sl ? `:${sl}${el && el !== sl ? `-${el}` : ""}` : ""} traces back to ${top.length} commit${top.length === 1 ? "" : "s"}. The dominant author is ${owner}. Walk the citations to understand the WHY.`
|
|
106
|
+
: `No git history found for ${file} — the file may be unstaged or untracked.`;
|
|
107
|
+
return {
|
|
108
|
+
data: { file, startLine: sl, endLine: el, originating: top },
|
|
109
|
+
wisdom,
|
|
110
|
+
followUp: top.length
|
|
111
|
+
? ["mneme.people.atrophy", "mneme.people.lineage", "mneme.insights.time_machine"]
|
|
112
|
+
: [],
|
|
113
|
+
confidence: { level: top.length ? "high" : "low" },
|
|
114
|
+
secondBrain: {
|
|
115
|
+
presentation: "Lead with the dominant author + commit hash. Then list the top 3 originating commits as bullet points. " +
|
|
116
|
+
"If the user asks 'why is this the way it is?' — proactively offer file_archaeology composition.",
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
name: "mneme.memory.search_commits",
|
|
123
|
+
category: "memory",
|
|
124
|
+
description: "Hybrid (lexical + semantic) search over indexed commits and PRs. " +
|
|
125
|
+
"Use this when the user wants to find commits matching a concept, not a specific file. " +
|
|
126
|
+
"Use this WHEN the user asks: 'find commits about X', 'show me PRs related to Y', " +
|
|
127
|
+
"'what work has happened on Z?'. Use mneme.memory.ask instead when the user wants " +
|
|
128
|
+
"a synthesized answer rather than a list of commits.",
|
|
129
|
+
triggers: [
|
|
130
|
+
"find all commits about rate limiting",
|
|
131
|
+
"show PRs that touched the cache layer",
|
|
132
|
+
"ค้นหา commit เกี่ยวกับ payments",
|
|
133
|
+
],
|
|
134
|
+
inputSchema: {
|
|
135
|
+
type: "object",
|
|
136
|
+
properties: {
|
|
137
|
+
query: { type: "string", description: "Natural-language search query" },
|
|
138
|
+
topK: { type: "number", description: "Max results (default 8)" },
|
|
139
|
+
},
|
|
140
|
+
required: ["query"],
|
|
141
|
+
},
|
|
142
|
+
handler: async (rt, args) => {
|
|
143
|
+
const query = String(args["query"] ?? "");
|
|
144
|
+
const topK = typeof args["topK"] === "number" ? args["topK"] : 8;
|
|
145
|
+
const results = await retrieve.search(query, {
|
|
146
|
+
store: rt.store,
|
|
147
|
+
embedder: rt.embedder,
|
|
148
|
+
repo: rt.meta,
|
|
149
|
+
topK,
|
|
150
|
+
});
|
|
151
|
+
const compressed = compressedAbstractsFor(rt, results);
|
|
152
|
+
const wisdom = results.length
|
|
153
|
+
? `Found ${results.length} matching commits. Top hit: "${results[0]?.commit.subject ?? "?"}" (${results[0]?.commit.shortHash}).`
|
|
154
|
+
: "No commits matched. Try broadening the query or check if the repo is indexed (mneme.memory.status).";
|
|
155
|
+
return {
|
|
156
|
+
data: results.map((sr) => toSearchPayload(sr, compressed)),
|
|
157
|
+
wisdom,
|
|
158
|
+
followUp: results.length ? ["mneme.memory.ask", "mneme.insights.story"] : ["mneme.memory.status"],
|
|
159
|
+
confidence: { level: results.length ? "high" : "low" },
|
|
160
|
+
};
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
name: "mneme.memory.status",
|
|
165
|
+
category: "memory",
|
|
166
|
+
description: "Report what's indexed in this repo's Mneme memory: total commits, embedded chunks, entities, embedder choice. " +
|
|
167
|
+
"Use this WHEN the user asks 'is the index up to date?', 'how many commits did Mneme see?', " +
|
|
168
|
+
"or as a sanity check before an ask/search returns no results.",
|
|
169
|
+
triggers: [
|
|
170
|
+
"is mneme indexed?",
|
|
171
|
+
"how many commits do you see?",
|
|
172
|
+
"status ของ index",
|
|
173
|
+
],
|
|
174
|
+
inputSchema: { type: "object", properties: {} },
|
|
175
|
+
handler: async (rt) => {
|
|
176
|
+
const data = {
|
|
177
|
+
commits: rt.store.countCommits(),
|
|
178
|
+
chunks: rt.store.countChunks(),
|
|
179
|
+
embedded: rt.store.countChunksWithEmbedding(),
|
|
180
|
+
entities: rt.store.countEntities(),
|
|
181
|
+
entitiesEmbedded: rt.store.countEntitiesWithEmbedding(),
|
|
182
|
+
synthesizedNotes: rt.store.countSynthesizedNotes(),
|
|
183
|
+
embedder: rt.store.getMeta("embedder"),
|
|
184
|
+
repoRoot: rt.meta.rootPath,
|
|
185
|
+
host: rt.meta.host,
|
|
186
|
+
owner: rt.meta.owner,
|
|
187
|
+
repo: rt.meta.repo,
|
|
188
|
+
};
|
|
189
|
+
const wisdom = data.commits === 0
|
|
190
|
+
? "Repo is NOT indexed yet — the user must run `mneme index` once before Q&A will work."
|
|
191
|
+
: `Index has ${data.commits} commits, ${data.embedded}/${data.chunks} chunks embedded with ${data.embedder ?? "an unknown embedder"}.`;
|
|
192
|
+
return {
|
|
193
|
+
data,
|
|
194
|
+
wisdom,
|
|
195
|
+
followUp: data.commits === 0 ? [] : ["mneme.memory.ask", "mneme.memory.search_commits"],
|
|
196
|
+
confidence: { level: "high" },
|
|
197
|
+
};
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
name: "mneme.memory.list_entities",
|
|
202
|
+
category: "memory",
|
|
203
|
+
description: "List indexed source-code entities (functions, classes, types, exported variables) with optional filtering by " +
|
|
204
|
+
"language/kind/path-prefix. Use this WHEN the user wants to enumerate symbols in a folder, find all classes, " +
|
|
205
|
+
"or get an entity ID before calling mneme.memory.find_similar.",
|
|
206
|
+
triggers: [
|
|
207
|
+
"list all functions in src/auth/",
|
|
208
|
+
"what classes are exported?",
|
|
209
|
+
"show me every type defined in core",
|
|
210
|
+
],
|
|
211
|
+
inputSchema: {
|
|
212
|
+
type: "object",
|
|
213
|
+
properties: {
|
|
214
|
+
kind: { type: "string", description: "function | class | type | variable | module" },
|
|
215
|
+
language: { type: "string", description: "typescript | tsx | javascript | jsx | python | go | rust | ruby | php" },
|
|
216
|
+
pathPrefix: { type: "string", description: "Only entities under this path" },
|
|
217
|
+
limit: { type: "number", description: "Max rows (default 100, max 500)" },
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
handler: async (rt, args) => {
|
|
221
|
+
const where = [];
|
|
222
|
+
const params = [];
|
|
223
|
+
if (args["kind"]) {
|
|
224
|
+
where.push("kind = ?");
|
|
225
|
+
params.push(String(args["kind"]));
|
|
226
|
+
}
|
|
227
|
+
if (args["language"]) {
|
|
228
|
+
where.push("language = ?");
|
|
229
|
+
params.push(String(args["language"]));
|
|
230
|
+
}
|
|
231
|
+
if (args["pathPrefix"]) {
|
|
232
|
+
where.push("file_path LIKE ?");
|
|
233
|
+
params.push(`${String(args["pathPrefix"])}%`);
|
|
234
|
+
}
|
|
235
|
+
const limit = typeof args["limit"] === "number" ? Math.min(500, args["limit"]) : 100;
|
|
236
|
+
const sql = "SELECT id, kind, name, file_path, start_line, end_line, signature, language FROM entities" +
|
|
237
|
+
(where.length ? " WHERE " + where.join(" AND ") : "") +
|
|
238
|
+
" ORDER BY file_path, start_line LIMIT ?";
|
|
239
|
+
const rows = rt.store.db.prepare(sql).all(...params, limit);
|
|
240
|
+
const wisdom = rows.length
|
|
241
|
+
? `Found ${rows.length} entit${rows.length === 1 ? "y" : "ies"} matching the filter.`
|
|
242
|
+
: "No entities match — try without filters, or check that `mneme entities` has been run.";
|
|
243
|
+
return {
|
|
244
|
+
data: { entities: rows, count: rows.length },
|
|
245
|
+
wisdom,
|
|
246
|
+
followUp: rows.length ? ["mneme.memory.find_similar", "mneme.quality.clones"] : [],
|
|
247
|
+
confidence: { level: "high" },
|
|
248
|
+
};
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
name: "mneme.memory.find_similar",
|
|
253
|
+
category: "memory",
|
|
254
|
+
description: "Given an entity ID OR a code snippet, return the top-K most semantically similar entities elsewhere in the repo. " +
|
|
255
|
+
"Use this WHEN the user wants to find duplicate-shaped code, similar functions across files, or " +
|
|
256
|
+
"candidates to refactor into a shared utility. Provide either entityId (preferred) OR snippet.",
|
|
257
|
+
triggers: [
|
|
258
|
+
"find functions similar to validateEmail",
|
|
259
|
+
"any code that looks like this snippet?",
|
|
260
|
+
"duplicates of this helper",
|
|
261
|
+
],
|
|
262
|
+
inputSchema: {
|
|
263
|
+
type: "object",
|
|
264
|
+
properties: {
|
|
265
|
+
entityId: { type: "string", description: "Existing entity id (from mneme.memory.list_entities)" },
|
|
266
|
+
snippet: { type: "string", description: "Or a code snippet to compare against" },
|
|
267
|
+
topK: { type: "number", description: "Max similar entities (default 5)" },
|
|
268
|
+
},
|
|
269
|
+
},
|
|
270
|
+
handler: async (rt, args) => {
|
|
271
|
+
const topK = typeof args["topK"] === "number" ? args["topK"] : 5;
|
|
272
|
+
const entityId = args["entityId"] ? String(args["entityId"]) : undefined;
|
|
273
|
+
const snippet = args["snippet"] ? String(args["snippet"]) : undefined;
|
|
274
|
+
let queryVec = null;
|
|
275
|
+
if (entityId) {
|
|
276
|
+
const row = rt.store.db
|
|
277
|
+
.prepare("SELECT embedding FROM entities WHERE id = ?")
|
|
278
|
+
.get(entityId);
|
|
279
|
+
if (!row?.embedding) {
|
|
280
|
+
return {
|
|
281
|
+
data: { matches: [] },
|
|
282
|
+
wisdom: `No embedding stored for entity ${entityId}. Tell the user to run \`mneme entities\` first.`,
|
|
283
|
+
confidence: { level: "low" },
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
const blob = row.embedding;
|
|
287
|
+
const copy = new Uint8Array(blob.byteLength);
|
|
288
|
+
copy.set(blob);
|
|
289
|
+
queryVec = new Float32Array(copy.buffer, 0, copy.byteLength / 4);
|
|
290
|
+
}
|
|
291
|
+
else if (snippet) {
|
|
292
|
+
const [v] = await rt.embedder.embed([snippet]);
|
|
293
|
+
queryVec = v ?? null;
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
return {
|
|
297
|
+
data: { matches: [] },
|
|
298
|
+
wisdom: "Need either entityId or snippet to search by similarity.",
|
|
299
|
+
confidence: { level: "low" },
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
if (!queryVec)
|
|
303
|
+
return { data: { matches: [] }, wisdom: "No query vector.", confidence: { level: "low" } };
|
|
304
|
+
const candidates = [];
|
|
305
|
+
for (const e of rt.store.iterEmbeddedEntities()) {
|
|
306
|
+
if (!e.embedding)
|
|
307
|
+
continue;
|
|
308
|
+
if (entityId && e.id === entityId)
|
|
309
|
+
continue;
|
|
310
|
+
if (e.embedding.length !== queryVec.length)
|
|
311
|
+
continue;
|
|
312
|
+
let dot = 0;
|
|
313
|
+
let na = 0;
|
|
314
|
+
let nb = 0;
|
|
315
|
+
for (let i = 0; i < queryVec.length; i++) {
|
|
316
|
+
const av = queryVec[i];
|
|
317
|
+
const bv = e.embedding[i];
|
|
318
|
+
dot += av * bv;
|
|
319
|
+
na += av * av;
|
|
320
|
+
nb += bv * bv;
|
|
321
|
+
}
|
|
322
|
+
const denom = Math.sqrt(na) * Math.sqrt(nb);
|
|
323
|
+
const sim = denom === 0 ? 0 : dot / denom;
|
|
324
|
+
candidates.push({ entity: { ...e, embedding: undefined }, score: sim });
|
|
325
|
+
}
|
|
326
|
+
candidates.sort((a, b) => b.score - a.score);
|
|
327
|
+
const matches = candidates.slice(0, topK);
|
|
328
|
+
const top = matches[0];
|
|
329
|
+
const wisdom = top
|
|
330
|
+
? `Top match scores ${(top.score * 100).toFixed(1)}% similarity. Higher than ~85% suggests near-duplicates worth refactoring.`
|
|
331
|
+
: "No similar entities found in the indexed corpus.";
|
|
332
|
+
return {
|
|
333
|
+
data: { matches },
|
|
334
|
+
wisdom,
|
|
335
|
+
followUp: matches.length ? ["mneme.quality.clones"] : [],
|
|
336
|
+
confidence: { level: matches.length ? "medium" : "low" },
|
|
337
|
+
};
|
|
338
|
+
},
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
name: "mneme.memory.blast",
|
|
342
|
+
category: "memory",
|
|
343
|
+
description: "Predict the BLAST RADIUS of shipping a commit: which past incidents share its file footprint, plus a " +
|
|
344
|
+
"base-rate verdict (LOW / MED / HIGH). Use this WHEN the user asks 'is this commit safe to ship?', " +
|
|
345
|
+
"'what could break if I merge this?', 'has my file footprint caused incidents before?'. " +
|
|
346
|
+
"Pass a commit hash, short hash, or HEAD-relative ref like HEAD~3.",
|
|
347
|
+
triggers: [
|
|
348
|
+
"is HEAD safe to ship?",
|
|
349
|
+
"what's the blast radius of commit a3f9b21?",
|
|
350
|
+
"predict incidents from this PR",
|
|
351
|
+
],
|
|
352
|
+
inputSchema: {
|
|
353
|
+
type: "object",
|
|
354
|
+
properties: {
|
|
355
|
+
commit: { type: "string", description: "Commit hash, short hash, or HEAD-relative ref" },
|
|
356
|
+
windowHours: { type: "number", description: "Look-ahead window in hours (default 72)" },
|
|
357
|
+
},
|
|
358
|
+
required: ["commit"],
|
|
359
|
+
},
|
|
360
|
+
handler: async (rt, args) => {
|
|
361
|
+
const ref = String(args["commit"] ?? "");
|
|
362
|
+
if (!ref) {
|
|
363
|
+
return { data: { matches: [] }, wisdom: "blast requires a commit ref.", confidence: { level: "low" } };
|
|
364
|
+
}
|
|
365
|
+
const r = await git.execGit(["rev-parse", ref], { cwd: rt.meta.rootPath });
|
|
366
|
+
if (r.code !== 0) {
|
|
367
|
+
return {
|
|
368
|
+
data: { matches: [] },
|
|
369
|
+
wisdom: `Cannot resolve commit "${ref}" — check the ref exists.`,
|
|
370
|
+
confidence: { level: "low" },
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
const hash = r.stdout.trim();
|
|
374
|
+
const c = rt.store.getCommit(hash);
|
|
375
|
+
if (!c) {
|
|
376
|
+
return {
|
|
377
|
+
data: { matches: [] },
|
|
378
|
+
wisdom: `Commit ${hash.slice(0, 8)} is not indexed. Tell the user to run \`mneme index\`.`,
|
|
379
|
+
confidence: { level: "low" },
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
const incidents = rt.store.db.prepare("SELECT * FROM incidents").all();
|
|
383
|
+
const cFiles = new Set(c.files.map((p) => p.replace(/\\/g, "/").toLowerCase()));
|
|
384
|
+
const matches = incidents
|
|
385
|
+
.map((i) => {
|
|
386
|
+
const inc = {
|
|
387
|
+
id: String(i.id),
|
|
388
|
+
title: String(i.title),
|
|
389
|
+
affected: i.affected_files ? JSON.parse(String(i.affected_files)) : [],
|
|
390
|
+
};
|
|
391
|
+
const overlap = inc.affected.filter((f) => cFiles.has(f.replace(/\\/g, "/").toLowerCase()));
|
|
392
|
+
return overlap.length > 0 ? { incident: inc, overlap } : null;
|
|
393
|
+
})
|
|
394
|
+
.filter((x) => x !== null);
|
|
395
|
+
const verdict = matches.length === 0 ? "LOW" : matches.length <= 2 ? "MED" : "HIGH";
|
|
396
|
+
const wisdom = matches.length === 0
|
|
397
|
+
? `LOW risk: commit ${c.shortHash} touches ${c.files.length} files, none overlap with past incidents.`
|
|
398
|
+
: `${verdict} risk: commit ${c.shortHash} touches ${matches.length} file${matches.length === 1 ? "" : "s"} that have caused incidents before. Recommend extra review.`;
|
|
399
|
+
return {
|
|
400
|
+
data: { commit: c.shortHash, fileCount: c.files.length, matches, verdict },
|
|
401
|
+
wisdom,
|
|
402
|
+
followUp: matches.length ? ["mneme.insights.premortem", "mneme.audit.certify"] : [],
|
|
403
|
+
confidence: { level: "medium" },
|
|
404
|
+
secondBrain: {
|
|
405
|
+
presentation: "Open with the verdict (LOW/MED/HIGH) in bold. If matches > 0, list each historical incident with its date " +
|
|
406
|
+
"and the overlapping files. If verdict is HIGH, explicitly recommend extra review before merge.",
|
|
407
|
+
},
|
|
408
|
+
};
|
|
409
|
+
},
|
|
410
|
+
},
|
|
411
|
+
];
|
|
412
|
+
// ──────────────────────────────────────────────────────────────────────────
|
|
413
|
+
// helpers shared across tools in this module
|
|
414
|
+
// ──────────────────────────────────────────────────────────────────────────
|
|
415
|
+
function compressedAbstractsFor(rt, results) {
|
|
416
|
+
try {
|
|
417
|
+
const cached = htc.getAllAbstracts(rt.store);
|
|
418
|
+
if (cached.size === 0)
|
|
419
|
+
return undefined;
|
|
420
|
+
const out = new Map();
|
|
421
|
+
for (const r of results) {
|
|
422
|
+
const hit = cached.get(r.commit.hash);
|
|
423
|
+
if (hit)
|
|
424
|
+
out.set(r.commit.hash, hit.abstract);
|
|
425
|
+
}
|
|
426
|
+
return out.size > 0 ? out : undefined;
|
|
427
|
+
}
|
|
428
|
+
catch {
|
|
429
|
+
return undefined;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
function toSearchPayload(s, compressed) {
|
|
433
|
+
if (compressed && compressed.has(s.commit.hash)) {
|
|
434
|
+
return {
|
|
435
|
+
score: s.score,
|
|
436
|
+
commit: {
|
|
437
|
+
hash: s.commit.hash,
|
|
438
|
+
shortHash: s.commit.shortHash,
|
|
439
|
+
date: s.commit.authorDate.slice(0, 10),
|
|
440
|
+
author: s.commit.authorName,
|
|
441
|
+
abstract: compressed.get(s.commit.hash),
|
|
442
|
+
prNumber: s.commit.prNumber,
|
|
443
|
+
},
|
|
444
|
+
compressed: true,
|
|
445
|
+
matchedKinds: Array.from(new Set(s.matchedChunks.map((c) => c.kind))),
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
return {
|
|
449
|
+
score: s.score,
|
|
450
|
+
commit: {
|
|
451
|
+
hash: s.commit.hash,
|
|
452
|
+
shortHash: s.commit.shortHash,
|
|
453
|
+
author: s.commit.authorName,
|
|
454
|
+
date: s.commit.authorDate,
|
|
455
|
+
subject: s.commit.subject,
|
|
456
|
+
body: s.commit.body,
|
|
457
|
+
files: s.commit.files,
|
|
458
|
+
prNumber: s.commit.prNumber,
|
|
459
|
+
},
|
|
460
|
+
matchedKinds: Array.from(new Set(s.matchedChunks.map((c) => c.kind))),
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
//# sourceMappingURL=memory.js.map
|
|
@@ -0,0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,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;SACtE,CAAC;IACJ,CAAC;IACD,OAAO;QACL,KAAK,EAAE,CAAC,CAAC,KAAK;QACd,MAAM,EAAE;YACN,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI;YACnB,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,SAAS;YAC7B,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,UAAU;YAC3B,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,UAAU;YACzB,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO;YACzB,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI;YACnB,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK;YACrB,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ;SAC5B;QACD,YAAY,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;KACtE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Meta — informational tools that don't compute over the repo:
|
|
3
|
+
* doctor, wisdom meditation, manifesto, advanced command list.
|
|
4
|
+
*/
|
|
5
|
+
import type { MnemeTool } from "./_types.js";
|
|
6
|
+
export declare const metaTools: MnemeTool[];
|
|
7
|
+
//# sourceMappingURL=meta.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../src/tools/meta.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAmB7C,eAAO,MAAM,SAAS,EAAE,SAAS,EA8BhC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Meta — informational tools that don't compute over the repo:
|
|
3
|
+
* doctor, wisdom meditation, manifesto, advanced command list.
|
|
4
|
+
*/
|
|
5
|
+
import { passthroughHandler } from "./_runtime.js";
|
|
6
|
+
const meta = (name, description, triggers, cli, argMap = () => [], inputSchema = { type: "object", properties: {} }, wisdom = () => "Result returned.") => ({
|
|
7
|
+
name,
|
|
8
|
+
category: "meta",
|
|
9
|
+
description,
|
|
10
|
+
triggers,
|
|
11
|
+
inputSchema,
|
|
12
|
+
handler: passthroughHandler(cli, argMap, { wisdom, confidence: "high" }),
|
|
13
|
+
});
|
|
14
|
+
export const metaTools = [
|
|
15
|
+
meta("mneme.meta.doctor", "Environment probe: hardware, embedder availability (Ollama/OpenAI/HuggingFace), Mneme readiness. Use WHEN user asks: 'is Mneme set up?', 'doctor', 'environment check'.", ["is mneme set up", "doctor probe"], "doctor", () => [], { type: "object", properties: {} }, () => "Environment probe complete. Use the data fields to advise on missing dependencies."),
|
|
16
|
+
meta("mneme.meta.wisdom", "Pull a short meditation from the Mneme manifesto. Use WHEN user asks: 'wisdom of the day', 'manifesto quote'.", ["wisdom quote", "manifesto meditation"], "wisdom", (a) => (a["count"] ? ["-n", String(a["count"])] : []), { type: "object", properties: { count: { type: "number" } } }),
|
|
17
|
+
meta("mneme.meta.manifesto", "Read the full Mneme manifesto canon. Use WHEN user asks: 'show the manifesto', 'philosophy of Mneme'.", ["show manifesto", "Mneme philosophy"], "manifesto"),
|
|
18
|
+
meta("mneme.meta.advanced", "List every Mneme command including hidden phase-2/3/4 ones. Use WHEN user asks: 'list everything', 'all commands including hidden'.", ["list every command", "all hidden commands"], "advanced"),
|
|
19
|
+
];
|
|
20
|
+
//# sourceMappingURL=meta.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meta.js","sourceRoot":"","sources":["../../src/tools/meta.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAE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D,IAAI,CACF,qBAAqB,EACrB,qIAAqI,EACrI,CAAC,oBAAoB,EAAE,qBAAqB,CAAC,EAC7C,UAAU,CACX;CACF,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* People analytics — what GitHub cannot see.
|
|
3
|
+
*
|
|
4
|
+
* Pragmatic wiring: most tools route to the CLI command via passthrough so
|
|
5
|
+
* the MCP layer doesn't need to mirror every internal API signature. The
|
|
6
|
+
* wisdom layer is what makes the AI's response richer than raw JSON.
|
|
7
|
+
*/
|
|
8
|
+
import type { MnemeTool } from "./_types.js";
|
|
9
|
+
export declare const peopleTools: MnemeTool[];
|
|
10
|
+
//# sourceMappingURL=people.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"people.d.ts","sourceRoot":"","sources":["../../src/tools/people.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAyB7C,eAAO,MAAM,WAAW,EAAE,SAAS,EAyIlC,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* People analytics — what GitHub cannot see.
|
|
3
|
+
*
|
|
4
|
+
* Pragmatic wiring: most tools route to the CLI command via passthrough so
|
|
5
|
+
* the MCP layer doesn't need to mirror every internal API signature. The
|
|
6
|
+
* wisdom layer is what makes the AI's response richer than raw JSON.
|
|
7
|
+
*/
|
|
8
|
+
import { passthroughHandler } from "./_runtime.js";
|
|
9
|
+
const peep = (name, description, triggers, cli, argMap = () => [], inputSchema = { type: "object", properties: {} }, followUp = [], wisdom = () => "Result returned — summarize key fields for the user.", notes) => ({
|
|
10
|
+
name,
|
|
11
|
+
category: "people",
|
|
12
|
+
description,
|
|
13
|
+
triggers,
|
|
14
|
+
inputSchema,
|
|
15
|
+
handler: passthroughHandler(cli, argMap, {
|
|
16
|
+
wisdom,
|
|
17
|
+
followUp,
|
|
18
|
+
confidence: notes ? "medium" : "high",
|
|
19
|
+
}),
|
|
20
|
+
});
|
|
21
|
+
export const peopleTools = [
|
|
22
|
+
peep("mneme.people.atrophy", "Knowledge-atrophy clock per (author × area), based on Ebbinghaus forgetting curve over commit recency. " +
|
|
23
|
+
"Returns a freshness score 0-100 + 'days until forgotten' estimate. " +
|
|
24
|
+
"Use this WHEN user asks: 'who's forgetting what?', 'is Alice still on top of auth?', " +
|
|
25
|
+
"'knowledge half-life', 'expertise decay'. Without --author returns top fading-knowledge per person.", ["ใครยังจำเรื่อง payments ได้บ้าง", "is Alice still on top of auth?", "knowledge that's fading"], "atrophy", (a) => (a["authorEmail"] ? [String(a["authorEmail"])] : []), {
|
|
26
|
+
type: "object",
|
|
27
|
+
properties: {
|
|
28
|
+
authorEmail: { type: "string", description: "Optional: focus on a single author's knowledge map" },
|
|
29
|
+
topN: { type: "number", description: "Top N areas (default 10)" },
|
|
30
|
+
},
|
|
31
|
+
}, ["mneme.people.passport", "mneme.people.bus_factor", "mneme.people.telepathy"], (d) => {
|
|
32
|
+
const records = d?.records?.length ?? 0;
|
|
33
|
+
return records === 0
|
|
34
|
+
? "No atrophy data — repo may be tiny or unindexed."
|
|
35
|
+
: `Knowledge atrophy report: ${records} (author × area) entries scored. Lower scores = fading knowledge.`;
|
|
36
|
+
}),
|
|
37
|
+
peep("mneme.people.telepathy", "Find author pairs who NEVER co-author commits but write similar code shapes — invisible teams. " +
|
|
38
|
+
"Use WHEN user asks: 'invisible teams', 'who collaborates without knowing it?', 'parallel evolution'.", ["invisible teams", "who's solving the same problems?", "ทีมล่องหน"], "telepathy", (a) => (a["topN"] ? ["--top", String(a["topN"])] : []), { type: "object", properties: { topN: { type: "number" } } }, ["mneme.people.passport", "mneme.people.influence"], (d) => {
|
|
39
|
+
const pairs = d?.pairs?.length ?? 0;
|
|
40
|
+
return pairs === 0
|
|
41
|
+
? "No telepathy pairs detected — repo may be too small or single-author."
|
|
42
|
+
: `${pairs} telepathic pair${pairs === 1 ? "" : "s"}. Each pair writes similar code without ever co-authoring.`;
|
|
43
|
+
}),
|
|
44
|
+
peep("mneme.people.nemesis", "Author pairs who consistently rewrite or revert each other's work — engineering friction. " +
|
|
45
|
+
"Use WHEN user asks: 'where is friction?', 'pairs that need conflict mediation'.", ["where is engineering friction?", "who rewrites whose code?"], "nemesis", (a) => (a["topN"] ? ["--top", String(a["topN"])] : []), { type: "object", properties: { topN: { type: "number" } } }, ["mneme.people.lineage", "mneme.insights.regret"], () => "Friction pairs returned. Treat as 'investigate', not 'judge' — friction is observable, root cause isn't."),
|
|
46
|
+
peep("mneme.people.influence", "Cultural alphas — PageRank of code-pattern adoption. Identifies authors whose patterns OTHERS copy. " +
|
|
47
|
+
"Volume-independent: a junior with 3 widely-copied patterns scores higher than a senior who churns 1000 LOC. " +
|
|
48
|
+
"Use WHEN user asks: 'who shapes the codebase culture?', 'trend-setters', 'cultural leaders'.", ["who sets coding patterns", "ใครเขียน pattern ที่คนอื่นลอก", "trend-setters"], "influence", (a) => (a["topN"] ? ["--top", String(a["topN"])] : []), { type: "object", properties: { topN: { type: "number" } } }, ["mneme.people.passport", "mneme.people.lineage"], () => "Influence ranking returned. Note: PageRank measures adoption, not quality — alphas may set BAD patterns too."),
|
|
49
|
+
peep("mneme.people.lineage", "Trace SEMANTIC ownership of a target file/symbol — whose interpretation of whose intent is in this code now? " +
|
|
50
|
+
"Returns ownership shares + role inference (originator / finisher / refactorer / janitor). " +
|
|
51
|
+
"Use WHEN user asks: 'who owns this code conceptually?', 'whose vision is in src/auth.ts?'.", ["semantic ownership of src/auth.ts", "whose vision is in this code?"], "lineage", (a) => [String(a["target"] ?? "")], { type: "object", properties: { target: { type: "string", description: "File path, file:line, or symbol name" } }, required: ["target"] }, ["mneme.people.passport", "mneme.people.atrophy"]),
|
|
52
|
+
peep("mneme.people.passport", "Per-engineer dossier composing DNA + expertise + telepathic teammates + influence + atrophy. " +
|
|
53
|
+
"Use WHEN user asks: 'tell me about Alice', 'profile for alice@', 'one-pager for this engineer'.", ["tell me about alice@bank.com", "profile of this engineer"], "passport", (a) => (a["authorEmail"] ? [String(a["authorEmail"])] : []), { type: "object", properties: { authorEmail: { type: "string" } }, required: ["authorEmail"] }, ["mneme.people.atrophy", "mneme.people.influence", "mneme.people.lineage"], () => "Passport dossier returned. Cross-reference with atrophy + lineage for full context."),
|
|
54
|
+
peep("mneme.people.who_knows", "Find people most likely to know about a topic, ranked by recent + sustained engagement. " +
|
|
55
|
+
"Use WHEN user asks: 'who knows about X?', 'expert on payments?', 'point of contact for Y'.", ["who knows about rate limiting", "expert on payments", "ใครรู้เรื่อง auth"], "who-knows", (a) => [String(a["topic"] ?? "")], { type: "object", properties: { topic: { type: "string" } }, required: ["topic"] }, ["mneme.people.passport", "mneme.people.atrophy"]),
|
|
56
|
+
peep("mneme.people.bus_factor", "Identify single-point-of-knowledge holders — files where one author owns ≥75%. " +
|
|
57
|
+
"Use WHEN user asks: 'where's the bus factor?', 'knowledge at risk if X leaves?'.", ["bus factor", "knowledge at risk if alice leaves"], "bus-factor", (a) => (a["topN"] ? ["--top", String(a["topN"])] : []), { type: "object", properties: { topN: { type: "number" } } }, ["mneme.people.passport", "mneme.people.atrophy", "mneme.people.telepathy"]),
|
|
58
|
+
peep("mneme.people.nervous_system", "Flagship combined report: passports + telepathy + atrophy + influence + neuroanatomy. " +
|
|
59
|
+
"Use WHEN user asks: 'team health snapshot', 'big-picture team view', 'export everything for the board'.", ["team health report", "nervous-system snapshot"], "nervous-system", (a) => (a["topN"] ? ["--top", String(a["topN"])] : []), { type: "object", properties: { topN: { type: "number" } } }, ["mneme.people.passport", "mneme.people.atrophy", "mneme.people.influence"], () => "Full nervous-system report returned. Headline metrics in data.hero.metrics."),
|
|
60
|
+
peep("mneme.people.promise", "Promise-debt ledger — every 'I'll fix this later' / TODO / FIXME from commits + PRs, with author + age. " +
|
|
61
|
+
"Use WHEN user asks: 'unkept promises', 'TODO debt', 'who has the most stale promises?'.", ["TODO debt by author", "stale promises"], "promise", (a) => {
|
|
62
|
+
const out = [];
|
|
63
|
+
if (a["status"])
|
|
64
|
+
out.push("--status", String(a["status"]));
|
|
65
|
+
return out;
|
|
66
|
+
}, {
|
|
67
|
+
type: "object",
|
|
68
|
+
properties: {
|
|
69
|
+
status: { type: "string", description: "open | stale | kept" },
|
|
70
|
+
},
|
|
71
|
+
}, ["mneme.quality.karma", "mneme.insights.ghost"], () => "Promise extraction is heuristic — false positives possible from TODO-style design markers."),
|
|
72
|
+
];
|
|
73
|
+
//# sourceMappingURL=people.js.map
|