@mneme-ai/mcp 1.1.1 → 1.2.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 +45 -344
- 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 +77 -0
- package/dist/tools/_capabilities.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 +70 -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 +451 -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,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Forensics — applied forensic science for code: Bayesian author attribution,
|
|
3
|
+
* stack-aware vuln hunt, insider-threat anomaly, ENFSI verbal scale.
|
|
4
|
+
*/
|
|
5
|
+
import { runCliJson } from "./_runtime.js";
|
|
6
|
+
export const forensicsTools = [
|
|
7
|
+
{
|
|
8
|
+
name: "mneme.forensics.vulns",
|
|
9
|
+
category: "forensics",
|
|
10
|
+
description: "Scan git history for security holes (51 patterns across SQL injection, XSS, hardcoded secrets, XXE, SSRF, " +
|
|
11
|
+
"auth bypass, CSRF, etc.). Each finding is Bayesian-filtered: posterior = stack-prior × AST-evidence, so non-applicable " +
|
|
12
|
+
"rules are dropped before they leave the scanner. " +
|
|
13
|
+
"Use this WHEN user asks: 'find security issues', 'vuln scan', 'CWE check', 'what security holes are hiding?'.",
|
|
14
|
+
triggers: [
|
|
15
|
+
"find security issues",
|
|
16
|
+
"vulnerability scan",
|
|
17
|
+
"หา bug ความปลอดภัย",
|
|
18
|
+
"scan for SQL injection",
|
|
19
|
+
],
|
|
20
|
+
inputSchema: {
|
|
21
|
+
type: "object",
|
|
22
|
+
properties: {
|
|
23
|
+
top: { type: "number", description: "Top N findings (default 50)" },
|
|
24
|
+
minPosterior: { type: "number", description: "Minimum posterior threshold (default 0.3)" },
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
handler: async (rt, args) => {
|
|
28
|
+
const cliArgs = [];
|
|
29
|
+
if (args["top"])
|
|
30
|
+
cliArgs.push("--top", String(args["top"]));
|
|
31
|
+
if (args["minPosterior"])
|
|
32
|
+
cliArgs.push("--min-posterior", String(args["minPosterior"]));
|
|
33
|
+
const data = await runCliJson(rt.meta.rootPath, "forensics vulns", cliArgs);
|
|
34
|
+
const findings = data?.findings?.length ?? 0;
|
|
35
|
+
const wisdom = findings === 0
|
|
36
|
+
? "No vulnerabilities surfaced above the posterior threshold. Clean."
|
|
37
|
+
: `${findings} candidate vulnerabilit${findings === 1 ? "y" : "ies"} surfaced. Each is a CANDIDATE for human review — verify before action.`;
|
|
38
|
+
return {
|
|
39
|
+
data,
|
|
40
|
+
wisdom,
|
|
41
|
+
followUp: findings > 0 ? ["mneme.forensics.show", "mneme.forensics.suppress"] : [],
|
|
42
|
+
confidence: { level: "medium", notes: "Findings are heuristic — Bayesian-filtered but always verify before treating as confirmed." },
|
|
43
|
+
};
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: "mneme.forensics.anomaly",
|
|
48
|
+
category: "forensics",
|
|
49
|
+
description: "Insider-threat / credential-compromise detector: flag commits whose timing, file footprint, or style deviates " +
|
|
50
|
+
"from the author's baseline. Use this WHEN user asks: 'any suspicious commits?', 'insider threat scan', " +
|
|
51
|
+
"'is this account compromised?', 'unusual commits'.",
|
|
52
|
+
triggers: [
|
|
53
|
+
"any suspicious commits?",
|
|
54
|
+
"insider threat scan",
|
|
55
|
+
"compromised account check",
|
|
56
|
+
],
|
|
57
|
+
inputSchema: { type: "object", properties: {} },
|
|
58
|
+
handler: async (rt) => {
|
|
59
|
+
const data = await runCliJson(rt.meta.rootPath, "forensics anomaly");
|
|
60
|
+
const flagged = data?.anomalies?.length ?? 0;
|
|
61
|
+
const wisdom = flagged === 0
|
|
62
|
+
? "No anomalies detected — all commits match author baselines."
|
|
63
|
+
: `${flagged} suspicious commit${flagged === 1 ? "" : "s"} flagged. Each deviates from the author's normal pattern (timing, files, or style).`;
|
|
64
|
+
return {
|
|
65
|
+
data,
|
|
66
|
+
wisdom,
|
|
67
|
+
followUp: flagged > 0 ? ["mneme.forensics.match", "mneme.forensics.attribute"] : [],
|
|
68
|
+
confidence: { level: "medium", notes: "Anomaly ≠ proof of malice. Treat as 'investigate', not 'accuse'." },
|
|
69
|
+
};
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: "mneme.forensics.match",
|
|
74
|
+
category: "forensics",
|
|
75
|
+
description: "Likelihood-ratio test: 'Did Alice REALLY write this commit?'. Returns ENFSI verbal-scale verdict + LR. " +
|
|
76
|
+
"Use this WHEN user asks: 'is this commit really by X?', 'verify authorship', 'did Alice write a3f9b21?'.",
|
|
77
|
+
triggers: [
|
|
78
|
+
"did Alice write this commit?",
|
|
79
|
+
"verify commit authorship",
|
|
80
|
+
"ตรวจสอบ author จริงๆ",
|
|
81
|
+
],
|
|
82
|
+
inputSchema: {
|
|
83
|
+
type: "object",
|
|
84
|
+
properties: {
|
|
85
|
+
commit: { type: "string", description: "Commit hash or HEAD-relative ref" },
|
|
86
|
+
author: { type: "string", description: "Suspected author email" },
|
|
87
|
+
},
|
|
88
|
+
required: ["commit", "author"],
|
|
89
|
+
},
|
|
90
|
+
handler: async (rt, args) => {
|
|
91
|
+
const data = await runCliJson(rt.meta.rootPath, "forensics match", [String(args["commit"]), String(args["author"])]);
|
|
92
|
+
const verdict = data?.verdict ?? "?";
|
|
93
|
+
const wisdom = `ENFSI verdict: ${verdict}. Likelihood ratio shown in data.lr. Higher LR = stronger evidence FOR the claimed author.`;
|
|
94
|
+
return {
|
|
95
|
+
data,
|
|
96
|
+
wisdom,
|
|
97
|
+
followUp: ["mneme.forensics.attribute"],
|
|
98
|
+
confidence: { level: "medium", notes: "Stylometric matching, not cryptographic proof." },
|
|
99
|
+
};
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: "mneme.forensics.attribute",
|
|
104
|
+
category: "forensics",
|
|
105
|
+
description: "Rank ALL candidate authors for a commit by stylometric likelihood. " +
|
|
106
|
+
"Use this WHEN user asks: 'who most likely wrote this?', 'attribute this commit', 'authorship ranking'.",
|
|
107
|
+
triggers: [
|
|
108
|
+
"who most likely wrote this commit?",
|
|
109
|
+
"attribute this commit",
|
|
110
|
+
],
|
|
111
|
+
inputSchema: {
|
|
112
|
+
type: "object",
|
|
113
|
+
properties: {
|
|
114
|
+
commit: { type: "string", description: "Commit hash or HEAD-relative ref (default HEAD)" },
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
handler: async (rt, args) => {
|
|
118
|
+
const cliArgs = args["commit"] ? [String(args["commit"])] : [];
|
|
119
|
+
const data = await runCliJson(rt.meta.rootPath, "forensics attribute", cliArgs);
|
|
120
|
+
const top = data?.ranking?.[0];
|
|
121
|
+
const wisdom = top
|
|
122
|
+
? `Most likely author: ${top.author} (likelihood ratio ${top.lr.toFixed(2)}). Full ranking in data.ranking.`
|
|
123
|
+
: "No candidates ranked.";
|
|
124
|
+
return {
|
|
125
|
+
data,
|
|
126
|
+
wisdom,
|
|
127
|
+
followUp: top ? ["mneme.forensics.match"] : [],
|
|
128
|
+
confidence: { level: "medium" },
|
|
129
|
+
};
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
name: "mneme.forensics.show",
|
|
134
|
+
category: "forensics",
|
|
135
|
+
description: "Open a single forensics finding by ID — full context, the line of code, recommended fix. " +
|
|
136
|
+
"Use this WHEN user wants to dig into a specific finding from `mneme.forensics.vulns`.",
|
|
137
|
+
triggers: [
|
|
138
|
+
"show finding 988c6155",
|
|
139
|
+
"details of this vuln",
|
|
140
|
+
],
|
|
141
|
+
inputSchema: {
|
|
142
|
+
type: "object",
|
|
143
|
+
properties: {
|
|
144
|
+
id: { type: "string", description: "Finding ID from vulns scan" },
|
|
145
|
+
},
|
|
146
|
+
required: ["id"],
|
|
147
|
+
},
|
|
148
|
+
handler: async (rt, args) => {
|
|
149
|
+
const data = await runCliJson(rt.meta.rootPath, "show", [String(args["id"])]);
|
|
150
|
+
return {
|
|
151
|
+
data,
|
|
152
|
+
wisdom: "Finding context loaded. The data includes file/line, code excerpt, CWE, and any recommended fix.",
|
|
153
|
+
followUp: ["mneme.forensics.suppress"],
|
|
154
|
+
confidence: { level: "high" },
|
|
155
|
+
};
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
name: "mneme.forensics.suppress",
|
|
160
|
+
category: "forensics",
|
|
161
|
+
description: "Mark a finding as a false positive — won't appear in future scans. Saved to .mneme/suppressions.json. " +
|
|
162
|
+
"Use this WHEN user has reviewed a finding and confirmed it's not a real issue.",
|
|
163
|
+
triggers: [
|
|
164
|
+
"suppress this finding",
|
|
165
|
+
"mark as false positive",
|
|
166
|
+
],
|
|
167
|
+
inputSchema: {
|
|
168
|
+
type: "object",
|
|
169
|
+
properties: {
|
|
170
|
+
id: { type: "string", description: "Finding ID" },
|
|
171
|
+
reason: { type: "string", description: "Why this is a false positive" },
|
|
172
|
+
},
|
|
173
|
+
required: ["id"],
|
|
174
|
+
},
|
|
175
|
+
handler: async (rt, args) => {
|
|
176
|
+
const cliArgs = [String(args["id"])];
|
|
177
|
+
if (args["reason"])
|
|
178
|
+
cliArgs.push("--reason", String(args["reason"]));
|
|
179
|
+
const data = await runCliJson(rt.meta.rootPath, "suppress", cliArgs);
|
|
180
|
+
return {
|
|
181
|
+
data,
|
|
182
|
+
wisdom: `Finding suppressed. Future scans will skip it.`,
|
|
183
|
+
followUp: [],
|
|
184
|
+
confidence: { level: "high" },
|
|
185
|
+
};
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
];
|
|
189
|
+
//# sourceMappingURL=forensics.js.map
|
|
@@ -0,0 +1 @@
|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OAAO;gBACL,IAAI;gBACJ,MAAM,EAAE,gDAAgD;gBACxD,QAAQ,EAAE,EAAE;gBACZ,UAAU,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;aAC9B,CAAC;QACJ,CAAC;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Insights — applied storytelling, regret-mining, and prediction over git history.
|
|
3
|
+
* 24 tools that surface narrative, friction, and risk patterns the user can act on.
|
|
4
|
+
*/
|
|
5
|
+
import type { MnemeTool } from "./_types.js";
|
|
6
|
+
export declare const insightsTools: MnemeTool[];
|
|
7
|
+
//# sourceMappingURL=insights.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insights.d.ts","sourceRoot":"","sources":["../../src/tools/insights.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAoB7C,eAAO,MAAM,aAAa,EAAE,SAAS,EAkNpC,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Insights — applied storytelling, regret-mining, and prediction over git history.
|
|
3
|
+
* 24 tools that surface narrative, friction, and risk patterns the user can act on.
|
|
4
|
+
*/
|
|
5
|
+
import { passthroughHandler } from "./_runtime.js";
|
|
6
|
+
const passthrough = (name, description, triggers, cli, argMap = () => [], inputSchema = { type: "object", properties: {} }, followUp = [], wisdom = () => "Result returned — summarize key fields for the user.") => ({
|
|
7
|
+
name,
|
|
8
|
+
category: "insights",
|
|
9
|
+
description,
|
|
10
|
+
triggers,
|
|
11
|
+
inputSchema,
|
|
12
|
+
handler: passthroughHandler(cli, argMap, { wisdom, followUp, confidence: "medium" }),
|
|
13
|
+
});
|
|
14
|
+
export const insightsTools = [
|
|
15
|
+
passthrough("mneme.insights.ghost", "Half-finished features and stale TODOs haunting the repo — files born and forgotten. Use WHEN user asks: 'what is haunting my repo?', 'ghost code', 'half-finished features'.", ["ghost code", "half-finished features", "stale TODOs"], "ghost", (a) => (a["topN"] ? ["--top", String(a["topN"])] : []), { type: "object", properties: { topN: { type: "number" } } }, ["mneme.insights.runaway", "mneme.insights.fossil"], (d) => `Found ${d?.ghosts?.length ?? 0} ghost files. Each is born + forgotten — review for deletion.`),
|
|
16
|
+
passthrough("mneme.insights.regret", "Commits that were shipped and immediately fixed/reverted — instant-regret detector. Use WHEN user asks: 'what did we ship and regret?', 'recent reverts/hotfixes'.", ["shipped and regretted", "recent reverts"], "regret", (a) => (a["windowDays"] ? ["--window-days", String(a["windowDays"])] : []), { type: "object", properties: { windowDays: { type: "number" } } }, ["mneme.insights.premortem", "mneme.audit.conscience"], (d) => `${d?.regrets?.length ?? 0} regrets found. Use to identify recurring failure patterns.`),
|
|
17
|
+
passthrough("mneme.insights.paradox", "Architectural flip-flops — A→B→A decisions over time. Use WHEN user asks: 'have we changed our minds repeatedly?', 'architectural paradoxes'.", ["architectural flip-flops", "decisions reversed"], "paradox", () => [], { type: "object", properties: {} }, ["mneme.insights.decisions"]),
|
|
18
|
+
passthrough("mneme.insights.oracle", "Predict next-window co-edits + author collisions on the same file. Use WHEN user asks: 'who will edit X next?', 'predict collisions'.", ["predict next edits", "author collisions"], "oracle", () => [], { type: "object", properties: {} }),
|
|
19
|
+
passthrough("mneme.insights.premortem", "Predict regret risk for a proposed change, grounded in similar past attempts. Use WHEN user asks: 'will this be regretted?', 'risk of doing X', 'pre-mortem'.", ["pre-mortem of this change", "predict regret"], "premortem", (a) => (a["intent"] ? [String(a["intent"])] : []), { type: "object", properties: { intent: { type: "string", description: "Proposed change in plain English" } }, required: ["intent"] }, ["mneme.audit.conscience", "mneme.memory.blast"], (d) => `Pre-mortem verdict in data.risk. Top historical analogues in data.precedents.`),
|
|
20
|
+
passthrough("mneme.insights.time_machine", "Tell a file's life as eras: birth → rewrite → firefight → plateau → evolution. Use WHEN user asks: 'tell me the story of this file', 'evolution of src/auth.ts'.", ["story of this file", "file evolution"], "time-machine", (a) => [String(a["file"])], { type: "object", properties: { file: { type: "string" } }, required: ["file"] }, ["mneme.insights.story", "mneme.people.lineage"]),
|
|
21
|
+
passthrough("mneme.insights.story", "Narrate the evolution of a topic across acts (with optional LLM polish). Use WHEN user asks: 'how did X evolve?', 'history of payments'.", ["how did X evolve", "story of feature"], "story", (a) => [String(a["topic"])], { type: "object", properties: { topic: { type: "string" } }, required: ["topic"] }, ["mneme.insights.chronicle"]),
|
|
22
|
+
passthrough("mneme.insights.decisions", "Auto-extract architectural decisions (ADRs) from commit history. Use WHEN user asks: 'list our ADRs', 'architectural decisions'.", ["ADR list", "architectural decisions"], "decisions", () => [], { type: "object", properties: {} }, ["mneme.insights.story", "mneme.insights.paradox"]),
|
|
23
|
+
passthrough("mneme.insights.mirror", "Onboarding dossier on a topic: 5 PRs, 3 people, 2 incidents. Use WHEN user asks: 'onboard me on payments', 'mirror for new hire on X'.", ["onboarding on payments", "mirror dossier"], "mirror", (a) => [String(a["topic"])], { type: "object", properties: { topic: { type: "string" } }, required: ["topic"] }, ["mneme.people.who_knows", "mneme.insights.story"]),
|
|
24
|
+
passthrough("mneme.insights.rumor", "Tribal phrases mentioned in commits/PRs but never documented. Use WHEN user asks: 'what slang does our team use?', 'undocumented terms'.", ["tribal slang", "undocumented terms"], "rumor", () => [], { type: "object", properties: {} }),
|
|
25
|
+
passthrough("mneme.insights.fossil", "Files deleted from HEAD but still alive in git history. Use WHEN user asks: 'show deleted files', 'ghost code from history'.", ["deleted files in history", "fossils"], "fossil", () => [], { type: "object", properties: {} }, ["mneme.insights.ghost"]),
|
|
26
|
+
passthrough("mneme.insights.runaway", "Files growing silently across many commits — leak indicator. Use WHEN user asks: 'files growing silently', 'scope creep'.", ["files growing silently", "scope creep"], "runaway", () => [], { type: "object", properties: {} }, ["mneme.insights.ghost"]),
|
|
27
|
+
passthrough("mneme.insights.drift", "Topical drift — features → refactors → firefights → polish over time. Use WHEN user asks: 'what's our work pattern?', 'topical drift'.", ["topical drift", "work pattern over time"], "drift", () => [], { type: "object", properties: {} }),
|
|
28
|
+
passthrough("mneme.insights.chronicle", "Auto-generate a chaptered narrative documentary of the whole repo. Use WHEN user asks: 'documentary of our repo', 'chronicle'.", ["documentary of repo", "chronicle"], "chronicle", () => [], { type: "object", properties: {} }, ["mneme.insights.story"]),
|
|
29
|
+
passthrough("mneme.insights.constellation", "Graph view: files as stars, authors as orbitals, commits as edges. Use WHEN user asks: 'visualize our repo', 'star map'.", ["constellation view", "visual repo map"], "constellation", () => [], { type: "object", properties: {} }),
|
|
30
|
+
passthrough("mneme.insights.cluster", "Find topic islands — semantic clustering of commit messages. Use WHEN user asks: 'group commits by topic', 'topic clusters'.", ["topic clusters", "group commits"], "cluster", () => [], { type: "object", properties: {} }),
|
|
31
|
+
passthrough("mneme.insights.network", "Author network — who collaborates with whom (co-edit + co-time + co-topic). Use WHEN user asks: 'collaboration graph', 'who works with whom'.", ["collaboration graph", "author network"], "network", () => [], { type: "object", properties: {} }, ["mneme.people.telepathy", "mneme.people.nemesis"]),
|
|
32
|
+
passthrough("mneme.insights.manage", "Engineering management dashboard — health, succession, skill matrix, trajectory. Use WHEN user asks: 'manager dashboard', 'team health for VP'.", ["manager dashboard", "team health summary"], "manage", () => [], { type: "object", properties: {} }, ["mneme.people.nervous_system"]),
|
|
33
|
+
passthrough("mneme.insights.export_bundle", "One bundle: DNA + drift + chronicle + oracle + constellation + clusters + network + manage + ghost. Use WHEN user asks: 'export everything', 'full repo bundle'.", ["export full bundle", "everything in one file"], "export-bundle", () => [], { type: "object", properties: {} }),
|
|
34
|
+
passthrough("mneme.insights.dream", "Speculative ideas grounded in the codebase's own patterns. Use WHEN user asks: 'what should we build next?', 'speculative ideas'.", ["speculative ideas", "what should we build next"], "dream", () => [], { type: "object", properties: {} }),
|
|
35
|
+
passthrough("mneme.insights.echo", "Find past incidents resembling the current one. Use WHEN user asks: 'has this happened before?', 'similar past incidents'.", ["has this happened before", "similar past incidents"], "echo", (a) => (a["query"] ? ["--query", String(a["query"])] : []), { type: "object", properties: { query: { type: "string" } } }),
|
|
36
|
+
passthrough("mneme.insights.stack_trace", "Paste a stack trace, get historical context per frame. Use WHEN user asks: 'explain this stack trace', 'historical context for error'.", ["explain stack trace", "historical context per frame"], "stack-trace", () => [], { type: "object", properties: { from: { type: "string", description: "Path to error log" } } }),
|
|
37
|
+
passthrough("mneme.insights.commit_coach", "Pre-commit AI partner — message, reviewers, scope, past warnings. Use WHEN user asks: 'review my staged commit', 'commit coach'.", ["pre-commit review", "commit coach"], "commit-coach", () => [], { type: "object", properties: {} }),
|
|
38
|
+
passthrough("mneme.insights.crystal_ball", "Predict CI / follow-up failure probability before pushing. Use WHEN user asks: 'will CI fail?', 'crystal ball'.", ["will CI fail?", "predict push outcome"], "crystal-ball", () => [], { type: "object", properties: {} }, ["mneme.audit.certify"]),
|
|
39
|
+
];
|
|
40
|
+
//# sourceMappingURL=insights.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insights.js","sourceRoot":"","sources":["../../src/tools/insights.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAGnD,MAAM,WAAW,GAAG,CAClB,IAAY,EACZ,WAAmB,EACnB,QAAkB,EAClB,GAAW,EACX,SAAmD,GAAG,EAAE,CAAC,EAAE,EAC3D,cAAwC,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE,EAC1E,WAAqB,EAAE,EACvB,SAAiC,GAAG,EAAE,CAAC,sDAAsD,EAClF,EAAE,CAAC,CAAC;IACf,IAAI;IACJ,QAAQ,EAAE,UAAU;IACpB,WAAW;IACX,QAAQ;IACR,WAAW;IACX,OAAO,EAAE,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC;CACrF,CAAC,CAAC;AAEH,MAAM,CAA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EAAE,QAAQ,EAAE,WAAW,EAAE,mBAAmB,EAAE,EAAE,EAAE,CAC/F;IACD,WAAW,CACT,6BAA6B,EAC7B,kIAAkI,EAClI,CAAC,mBAAmB,EAAE,cAAc,CAAC,EACrC,cAAc,EACd,GAAG,EAAE,CAAC,EAAE,EACR,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE,CACnC;IACD,WAAW,CACT,6BAA6B,EAC7B,iHAAiH,EACjH,CAAC,eAAe,EAAE,sBAAsB,CAAC,EACzC,cAAc,EACd,GAAG,EAAE,CAAC,EAAE,EACR,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE,EAClC,CAAC,qBAAqB,CAAC,CACxB;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lab.d.ts","sourceRoot":"","sources":["../../src/tools/lab.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAoB7C,eAAO,MAAM,QAAQ,EAAE,SAAS,EAuH/B,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lab — the Periodic Table + Second Brain + Wisdom Mutant engine.
|
|
3
|
+
* Compose, library, run, calibrate, adapt, feedback.
|
|
4
|
+
*/
|
|
5
|
+
import { passthroughHandler } from "./_runtime.js";
|
|
6
|
+
const lab = (name, description, triggers, cli, argMap = () => [], inputSchema = { type: "object", properties: {} }, followUp = [], wisdom = () => "Result returned — summarize key fields for the user.") => ({
|
|
7
|
+
name,
|
|
8
|
+
category: "lab",
|
|
9
|
+
description,
|
|
10
|
+
triggers,
|
|
11
|
+
inputSchema,
|
|
12
|
+
handler: passthroughHandler(cli, argMap, { wisdom, followUp, confidence: "medium" }),
|
|
13
|
+
});
|
|
14
|
+
export const labTools = [
|
|
15
|
+
lab("mneme.lab.periodic_table", "Browse Mneme's compositional layers — elements (primitives), atoms (parameterized), molecules (commands), compounds. Use WHEN user asks: 'what primitives does Mneme have?', 'show the periodic table', 'compose new tools'.", ["show periodic table", "what primitives are available"], "periodic-table", (a) => {
|
|
16
|
+
const out = [];
|
|
17
|
+
if (a["id"])
|
|
18
|
+
out.push(String(a["id"]));
|
|
19
|
+
if (a["kind"])
|
|
20
|
+
out.push("--kind", String(a["kind"]));
|
|
21
|
+
if (a["tag"])
|
|
22
|
+
out.push("--tag", String(a["tag"]));
|
|
23
|
+
return out;
|
|
24
|
+
}, {
|
|
25
|
+
type: "object",
|
|
26
|
+
properties: {
|
|
27
|
+
id: { type: "string", description: "Optional primitive id to focus" },
|
|
28
|
+
kind: { type: "string", description: "element | atom | molecule | compound" },
|
|
29
|
+
tag: { type: "string" },
|
|
30
|
+
},
|
|
31
|
+
}),
|
|
32
|
+
lab("mneme.lab.compose", "Translate natural-language intent into a runnable molecule plan from the periodic table. Use WHEN user asks: 'compose a workflow for X', 'plan steps to do Y'.", ["compose a workflow", "plan steps for goal"], "compose", (a) => {
|
|
33
|
+
const out = [String(a["intent"] ?? "")];
|
|
34
|
+
if (a["execute"])
|
|
35
|
+
out.push("--execute");
|
|
36
|
+
return out;
|
|
37
|
+
}, {
|
|
38
|
+
type: "object",
|
|
39
|
+
properties: {
|
|
40
|
+
intent: { type: "string", description: "Natural-language goal" },
|
|
41
|
+
execute: { type: "boolean", description: "Run the plan after composing" },
|
|
42
|
+
},
|
|
43
|
+
required: ["intent"],
|
|
44
|
+
}, ["mneme.lab.run", "mneme.lab.library"]),
|
|
45
|
+
lab("mneme.lab.run", "Run a saved molecule plan by alias or id. Use WHEN user asks: 'run X recipe', 'execute saved plan'.", ["run saved recipe", "execute molecule plan"], "run", (a) => {
|
|
46
|
+
const out = [String(a["needle"] ?? "")];
|
|
47
|
+
if (a["execute"])
|
|
48
|
+
out.push("--execute");
|
|
49
|
+
return out;
|
|
50
|
+
}, {
|
|
51
|
+
type: "object",
|
|
52
|
+
properties: {
|
|
53
|
+
needle: { type: "string", description: "Alias or id of the recipe" },
|
|
54
|
+
execute: { type: "boolean", description: "Actually run (default dry-run)" },
|
|
55
|
+
},
|
|
56
|
+
required: ["needle"],
|
|
57
|
+
}),
|
|
58
|
+
lab("mneme.lab.library", "List/manage saved molecule recipes. Use WHEN user asks: 'show saved recipes', 'promote a recipe', 'forget recipe'.", ["show saved recipes", "library of plans"], "library", (a) => {
|
|
59
|
+
const out = [];
|
|
60
|
+
if (a["promote"])
|
|
61
|
+
out.push("--promote", String(a["promote"]));
|
|
62
|
+
if (a["alias"])
|
|
63
|
+
out.push("--alias", String(a["alias"]));
|
|
64
|
+
if (a["eligible"])
|
|
65
|
+
out.push("--eligible");
|
|
66
|
+
if (a["archived"])
|
|
67
|
+
out.push("--archived");
|
|
68
|
+
if (a["forget"])
|
|
69
|
+
out.push("--forget", String(a["forget"]));
|
|
70
|
+
return out;
|
|
71
|
+
}, {
|
|
72
|
+
type: "object",
|
|
73
|
+
properties: {
|
|
74
|
+
promote: { type: "string" },
|
|
75
|
+
alias: { type: "string" },
|
|
76
|
+
eligible: { type: "boolean" },
|
|
77
|
+
archived: { type: "boolean" },
|
|
78
|
+
forget: { type: "string" },
|
|
79
|
+
},
|
|
80
|
+
}),
|
|
81
|
+
lab("mneme.lab.adapt", "Mneme inspects this repo and recommends 1-3 next commands. Use WHEN user asks: 'what should I run next?', 'recommend commands for me'.", ["what should I run next", "recommend commands"], "adapt"),
|
|
82
|
+
lab("mneme.lab.feedback", "Tell Mneme an answer was helpful (up) or wrong (down) — feeds the Wisdom Mutant calibrator. Use WHEN user gives feedback on a previous answer.", ["this answer was good/bad", "feedback on previous result"], "feedback", (a) => [String(a["id"] ?? ""), String(a["vote"] ?? "")], {
|
|
83
|
+
type: "object",
|
|
84
|
+
properties: {
|
|
85
|
+
id: { type: "string", description: "Answer id from a previous call" },
|
|
86
|
+
vote: { type: "string", description: "up | down" },
|
|
87
|
+
},
|
|
88
|
+
required: ["id", "vote"],
|
|
89
|
+
}),
|
|
90
|
+
lab("mneme.lab.calibrate", "Re-tune search knobs against accumulated feedback. Use WHEN user asks: 'recalibrate Mneme', 're-tune search'.", ["recalibrate Mneme", "retune"], "calibrate"),
|
|
91
|
+
lab("mneme.lab.htc_stats", "Coverage + compression ratio of HTC (hierarchical compressed memory) — how much of the repo is summarised. Use WHEN user asks: 'HTC coverage', 'compression stats'.", ["HTC coverage", "compression stats"], "htc-stats"),
|
|
92
|
+
];
|
|
93
|
+
//# sourceMappingURL=lab.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lab.js","sourceRoot":"","sources":["../../src/tools/lab.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAGnD,MAAM,GAAG,GAAG,CACV,IAAY,EACZ,WAAmB,EACnB,QAAkB,EAClB,GAAW,EACX,SAAmD,GAAG,EAAE,CAAC,EAAE,EAC3D,cAAwC,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE,EAC1E,WAAqB,EAAE,EACvB,SAAiC,GAAG,EAAE,CAAC,sDAAsD,EAClF,EAAE,CAAC,CAAC;IACf,IAAI;IACJ,QAAQ,EAAE,KAAK;IACf,WAAW;IACX,QAAQ;IACR,WAAW;IACX,OAAO,EAAE,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC;CACrF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,QAAQ,GAAgB;IACnC,GAAG,CACD,0BAA0B,EAC1B,8NAA8N,EAC9N,CAAC,qBAAqB,EAAE,+BAA+B,CAAC,EACxD,gBAAgB,EAChB,CAAC,CAAC,EAAE,EAAE;QACJ,MAAM,GAAG,GAAa,EAAE,CAAC;QACzB,IAAI,CAAC,CAAC,IAAI,CAAC;YAAE,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,C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;CACF,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
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 type { MnemeTool } from "./_types.js";
|
|
9
|
+
export declare const memoryTools: MnemeTool[];
|
|
10
|
+
//# sourceMappingURL=memory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/tools/memory.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,eAAO,MAAM,WAAW,EAAE,SAAS,EA2YlC,CAAC"}
|