wyrm-mcp 6.12.0 → 6.13.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/auto-capture.d.ts +32 -0
- package/dist/auto-capture.d.ts.map +1 -0
- package/dist/auto-capture.js +136 -0
- package/dist/auto-capture.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +40 -1
- package/dist/index.js.map +1 -1
- package/dist/tool-profiles.d.ts.map +1 -1
- package/dist/tool-profiles.js +1 -0
- package/dist/tool-profiles.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ArtifactKind } from './memory-artifacts.js';
|
|
2
|
+
export type CandidateKind = 'truth' | 'failure' | 'decision' | 'pattern' | 'lesson';
|
|
3
|
+
export interface MemoryCandidate {
|
|
4
|
+
kind: CandidateKind;
|
|
5
|
+
text: string;
|
|
6
|
+
confidence: number;
|
|
7
|
+
}
|
|
8
|
+
export interface ExtractResult {
|
|
9
|
+
candidates: MemoryCandidate[];
|
|
10
|
+
method: 'llm' | 'deterministic';
|
|
11
|
+
model?: string;
|
|
12
|
+
}
|
|
13
|
+
/** Robustly pull a candidate array out of an LLM response (small models wrap JSON in prose/markdown). */
|
|
14
|
+
export declare function parseCandidates(raw: string): MemoryCandidate[];
|
|
15
|
+
/** No-LLM extractor: segment into statements, keep durable-looking ones, classify. */
|
|
16
|
+
export declare function extractDeterministic(text: string): MemoryCandidate[];
|
|
17
|
+
/**
|
|
18
|
+
* Extract candidate memories from text. Tries the configured local LLM first
|
|
19
|
+
* (if any), falls back to deterministic. Never throws.
|
|
20
|
+
*/
|
|
21
|
+
export declare function extractCandidates(text: string, opts?: {
|
|
22
|
+
model?: string;
|
|
23
|
+
ollamaUrl?: string;
|
|
24
|
+
}): Promise<ExtractResult>;
|
|
25
|
+
/** Map a candidate to its review-queue memory-artifact shape (needs_review=1). */
|
|
26
|
+
export declare function candidateToArtifact(c: MemoryCandidate): {
|
|
27
|
+
kind: ArtifactKind;
|
|
28
|
+
problem: string;
|
|
29
|
+
tags: string[];
|
|
30
|
+
confidence: number;
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=auto-capture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto-capture.d.ts","sourceRoot":"","sources":["../src/auto-capture.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAC;AACpF,MAAM,WAAW,eAAe;IAAG,IAAI,EAAE,aAAa,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;CAAE;AAC3F,MAAM,WAAW,aAAa;IAAG,UAAU,EAAE,eAAe,EAAE,CAAC;IAAC,MAAM,EAAE,KAAK,GAAG,eAAe,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CAAE;AAoBlH,yGAAyG;AACzG,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,EAAE,CAqB9D;AAgBD,sFAAsF;AACtF,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,EAAE,CAmBpE;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAO,GAChD,OAAO,CAAC,aAAa,CAAC,CAQxB;AAED,kFAAkF;AAClF,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,eAAe,GAAG;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAWnI"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-extraction (bet #2) — turn freeform text (a session, notes, a transcript)
|
|
3
|
+
* into candidate memories that land in the REVIEW QUEUE for operator approval.
|
|
4
|
+
*
|
|
5
|
+
* Closes the "just talk, it remembers" gap WITHOUT an expensive cloud LLM, via a
|
|
6
|
+
* pluggable LOCAL extractor:
|
|
7
|
+
* - LLM: any Ollama model (`WYRM_EXTRACT_MODEL`) — the slot the future DragonSpark
|
|
8
|
+
* nano-LLM drops into. Structured JSON out, robustly parsed.
|
|
9
|
+
* - Deterministic fallback: sentence segmentation + signal markers + classifyCapture,
|
|
10
|
+
* used when no model is configured or the LLM is unreachable.
|
|
11
|
+
* Always produces candidates, never blocks a write, never throws. Candidates are
|
|
12
|
+
* stored with needs_review=1 so the operator vets them (wyrm_review) — nothing
|
|
13
|
+
* auto-trusted, matching Wyrm's distillation-queue discipline.
|
|
14
|
+
*
|
|
15
|
+
* @copyright 2024-2026 Ghost Protocol (Pvt) Ltd.
|
|
16
|
+
* @license AGPL-3.0-or-later — dual-licensed; commercial terms: ghosts.lk@proton.me. See LICENSE.
|
|
17
|
+
*/
|
|
18
|
+
import { classifyCapture } from './capture.js';
|
|
19
|
+
const KINDS = ['truth', 'failure', 'decision', 'pattern', 'lesson'];
|
|
20
|
+
const EXTRACT_PROMPT = (text) => `You extract DURABLE, REUSABLE memories from a developer's working notes/transcript.
|
|
21
|
+
Output ONLY a JSON array, no prose. Each item: {"kind": one of ["truth","failure","decision","pattern","lesson"], "text": "<one self-contained sentence>"}.
|
|
22
|
+
- truth: a validated fact/constraint ("X uses Y", "Z is required").
|
|
23
|
+
- failure: an approach that FAILED and why (so it is not repeated).
|
|
24
|
+
- decision: a choice made + the reason ("chose A because B").
|
|
25
|
+
- pattern: a reusable approach that worked.
|
|
26
|
+
- lesson: a general insight learned.
|
|
27
|
+
Skip chit-chat, questions, and ephemeral status. Extract 0-8 items; fewer + higher-quality wins. If nothing durable, output [].
|
|
28
|
+
|
|
29
|
+
NOTES:
|
|
30
|
+
"""
|
|
31
|
+
${text.slice(0, 8000)}
|
|
32
|
+
"""
|
|
33
|
+
JSON:`;
|
|
34
|
+
/** Robustly pull a candidate array out of an LLM response (small models wrap JSON in prose/markdown). */
|
|
35
|
+
export function parseCandidates(raw) {
|
|
36
|
+
const m = raw.match(/\[[\s\S]*\]/);
|
|
37
|
+
if (!m)
|
|
38
|
+
return [];
|
|
39
|
+
let arr;
|
|
40
|
+
try {
|
|
41
|
+
arr = JSON.parse(m[0]);
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return [];
|
|
45
|
+
}
|
|
46
|
+
if (!Array.isArray(arr))
|
|
47
|
+
return [];
|
|
48
|
+
const out = [];
|
|
49
|
+
const seen = new Set();
|
|
50
|
+
for (const it of arr) {
|
|
51
|
+
if (!it || typeof it !== 'object')
|
|
52
|
+
continue;
|
|
53
|
+
const kind = it.kind;
|
|
54
|
+
const text = it.text;
|
|
55
|
+
if (typeof text !== 'string' || text.trim().length < 8)
|
|
56
|
+
continue;
|
|
57
|
+
const t = text.trim().slice(0, 1000);
|
|
58
|
+
const key = t.toLowerCase().replace(/\s+/g, ' ').slice(0, 80);
|
|
59
|
+
if (seen.has(key))
|
|
60
|
+
continue;
|
|
61
|
+
seen.add(key);
|
|
62
|
+
out.push({ kind: KINDS.includes(kind) ? kind : 'pattern', text: t, confidence: 0.6 });
|
|
63
|
+
if (out.length >= 12)
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
return out;
|
|
67
|
+
}
|
|
68
|
+
async function extractViaLLM(text, model, url) {
|
|
69
|
+
try {
|
|
70
|
+
const res = await fetch(`${url.replace(/\/$/, '')}/api/generate`, {
|
|
71
|
+
method: 'POST',
|
|
72
|
+
headers: { 'Content-Type': 'application/json' },
|
|
73
|
+
body: JSON.stringify({ model, prompt: EXTRACT_PROMPT(text), stream: false, options: { temperature: 0 } }),
|
|
74
|
+
signal: AbortSignal.timeout(120_000),
|
|
75
|
+
});
|
|
76
|
+
if (!res.ok)
|
|
77
|
+
return null;
|
|
78
|
+
const data = await res.json();
|
|
79
|
+
return data.response ? parseCandidates(data.response) : null;
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/** No-LLM extractor: segment into statements, keep durable-looking ones, classify. */
|
|
86
|
+
export function extractDeterministic(text) {
|
|
87
|
+
const segs = text.split(/(?<=[.!?])\s+|\n+/).map((s) => s.trim()).filter((s) => s.length >= 20 && s.length <= 400);
|
|
88
|
+
const out = [];
|
|
89
|
+
const seen = new Set();
|
|
90
|
+
for (const s of segs) {
|
|
91
|
+
if (!/\b(use[sd]?|decided|because|fail(s|ed)?|error|always|never|must|should|learned|lesson|turned out|prefer|avoid|root cause|fixed|broke|requires?)\b/i.test(s))
|
|
92
|
+
continue;
|
|
93
|
+
const key = s.toLowerCase().replace(/\s+/g, ' ').slice(0, 80);
|
|
94
|
+
if (seen.has(key))
|
|
95
|
+
continue;
|
|
96
|
+
seen.add(key);
|
|
97
|
+
const c = classifyCapture(s);
|
|
98
|
+
const kind = /\b(fail(s|ed)?|error|broke|bug|mistake)\b/i.test(s) ? 'failure'
|
|
99
|
+
: c.type === 'truth' ? 'truth'
|
|
100
|
+
: /\bbecause\b/i.test(s) ? 'decision'
|
|
101
|
+
: c.subtype === 'lesson' ? 'lesson'
|
|
102
|
+
: 'pattern';
|
|
103
|
+
out.push({ kind, text: s, confidence: (c.confidence ?? 60) / 100 });
|
|
104
|
+
if (out.length >= 8)
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
return out;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Extract candidate memories from text. Tries the configured local LLM first
|
|
111
|
+
* (if any), falls back to deterministic. Never throws.
|
|
112
|
+
*/
|
|
113
|
+
export async function extractCandidates(text, opts = {}) {
|
|
114
|
+
const url = opts.ollamaUrl || process.env.WYRM_OLLAMA_URL || 'http://localhost:11434';
|
|
115
|
+
const model = opts.model || process.env.WYRM_EXTRACT_MODEL || '';
|
|
116
|
+
if (model) {
|
|
117
|
+
const llm = await extractViaLLM(text, model, url);
|
|
118
|
+
if (llm && llm.length)
|
|
119
|
+
return { candidates: llm, method: 'llm', model };
|
|
120
|
+
}
|
|
121
|
+
return { candidates: extractDeterministic(text), method: 'deterministic' };
|
|
122
|
+
}
|
|
123
|
+
/** Map a candidate to its review-queue memory-artifact shape (needs_review=1). */
|
|
124
|
+
export function candidateToArtifact(c) {
|
|
125
|
+
const map = {
|
|
126
|
+
failure: 'anti_pattern',
|
|
127
|
+
decision: 'reasoning_trace',
|
|
128
|
+
lesson: 'lesson',
|
|
129
|
+
pattern: 'pattern',
|
|
130
|
+
truth: 'heuristic',
|
|
131
|
+
};
|
|
132
|
+
// A stable signature for dedup against re-extraction of the same text.
|
|
133
|
+
const sig = 'ax:' + c.text.toLowerCase().replace(/\s+/g, ' ').trim().slice(0, 64);
|
|
134
|
+
return { kind: map[c.kind], problem: c.text, tags: ['auto-extract', `intent:${c.kind}`, sig], confidence: c.confidence };
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=auto-capture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto-capture.js","sourceRoot":"","sources":["../src/auto-capture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAO/C,MAAM,KAAK,GAA6B,CAAC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;AAE9F,MAAM,cAAc,GAAG,CAAC,IAAY,EAAU,EAAE,CAC9C;;;;;;;;;;;EAWA,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC;;MAEf,CAAC;AAEP,yGAAyG;AACzG,MAAM,UAAU,eAAe,CAAC,GAA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,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,UAAU,EAAE,CAAC;AAC3H,CAAC"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;GAeG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;GAeG;AAsCH,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -25,6 +25,7 @@ import { embedAll, removeAll, statusAll, WYRM_SERVER_INSTRUCTIONS } from "./prio
|
|
|
25
25
|
import { installClaudeCodeHooks, installClaudeStatusline } from "./autoconfig.js";
|
|
26
26
|
import { validateAtomicSkill, deploySkill } from "./skill-author.js";
|
|
27
27
|
import { harvestProjects } from "./harvest.js";
|
|
28
|
+
import { extractCandidates, candidateToArtifact } from "./auto-capture.js";
|
|
28
29
|
import { ICON } from "./icons.js";
|
|
29
30
|
import { WyrmSync } from "./sync.js";
|
|
30
31
|
import { createContextBundle } from "./summarizer.js";
|
|
@@ -80,7 +81,7 @@ import { readFileSync as _versionReadFile, existsSync as _versionExists } from "
|
|
|
80
81
|
// Update when adding/removing MCP tools so wyrm_capabilities reports accurately.
|
|
81
82
|
// The ListToolsRequestSchema handler is the single source of truth at runtime —
|
|
82
83
|
// this constant is just for the self-description and the postinstall pitch.
|
|
83
|
-
const WYRM_TOOL_COUNT =
|
|
84
|
+
const WYRM_TOOL_COUNT = 135;
|
|
84
85
|
// Spec — design tokens + references for creative workflows (5.9.0)
|
|
85
86
|
let _designSystem = null;
|
|
86
87
|
function designSystem() {
|
|
@@ -1056,6 +1057,19 @@ function buildAllTools() {
|
|
|
1056
1057
|
},
|
|
1057
1058
|
},
|
|
1058
1059
|
},
|
|
1060
|
+
{
|
|
1061
|
+
name: "wyrm_auto_capture",
|
|
1062
|
+
description: "Auto-extract durable memories from freeform text (a session transcript, notes, a chat) into the REVIEW QUEUE. A LOCAL extractor — a configurable Ollama model (WYRM_EXTRACT_MODEL / the `model` arg) if set, else a deterministic heuristic — pulls out truths, failures, decisions, patterns, and lessons as needs_review candidates; approve/reject with wyrm_review (nothing auto-trusted). Closes the 'just talk, it remembers' gap without a cloud LLM. Deduped + idempotent.",
|
|
1063
|
+
inputSchema: {
|
|
1064
|
+
type: "object",
|
|
1065
|
+
properties: {
|
|
1066
|
+
projectPath: { type: "string", description: "Project to file the extracted candidates under" },
|
|
1067
|
+
text: { type: "string", description: "Freeform text to extract durable memories from" },
|
|
1068
|
+
model: { type: "string", description: "Optional Ollama model for extraction (overrides WYRM_EXTRACT_MODEL); omit for deterministic extraction" },
|
|
1069
|
+
},
|
|
1070
|
+
required: ["projectPath", "text"],
|
|
1071
|
+
},
|
|
1072
|
+
},
|
|
1059
1073
|
// Data Lake Operations
|
|
1060
1074
|
{
|
|
1061
1075
|
name: "wyrm_data_insert",
|
|
@@ -3124,6 +3138,31 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
3124
3138
|
(sample ? `\n\nSample:\n${sample}` : '') +
|
|
3125
3139
|
`\n\nApprove/reject with wyrm_review.` }] };
|
|
3126
3140
|
}
|
|
3141
|
+
case "wyrm_auto_capture": {
|
|
3142
|
+
const { projectPath: acPath, text: acText, model: acModel } = args;
|
|
3143
|
+
const acProject = db.getProject(acPath);
|
|
3144
|
+
if (!acProject)
|
|
3145
|
+
return { content: [{ type: "text", text: `Project not found: ${acPath}` }], isError: true };
|
|
3146
|
+
if (!acText || acText.trim().length < 20)
|
|
3147
|
+
return { content: [{ type: "text", text: "Provide at least ~20 chars of text to extract from." }], isError: true };
|
|
3148
|
+
const { candidates, method, model: usedModel } = await extractCandidates(acText, { model: acModel });
|
|
3149
|
+
const rawDb = db.getDatabase();
|
|
3150
|
+
let added = 0, skipped = 0;
|
|
3151
|
+
for (const c of candidates) {
|
|
3152
|
+
const a = candidateToArtifact(c);
|
|
3153
|
+
const sig = a.tags[a.tags.length - 1]; // the 'ax:' dedup signature
|
|
3154
|
+
if (rawDb.prepare("SELECT 1 FROM memory_artifacts WHERE project_id = ? AND tags LIKE ? LIMIT 1").get(acProject.id, '%' + sig + '%')) {
|
|
3155
|
+
skipped++;
|
|
3156
|
+
continue;
|
|
3157
|
+
}
|
|
3158
|
+
memory.add(acProject.id, { kind: a.kind, problem: a.problem, tags: a.tags, confidence: a.confidence, needsReview: 1, createdBy: 'auto-extract' });
|
|
3159
|
+
added++;
|
|
3160
|
+
}
|
|
3161
|
+
if (added > 0)
|
|
3162
|
+
cache.invalidate();
|
|
3163
|
+
const lines = candidates.slice(0, 8).map((c) => ` • [${c.kind}] ${c.text.slice(0, 80)}`).join('\n');
|
|
3164
|
+
return { content: [{ type: "text", text: `${ICON.brand} Auto-capture (${method}${usedModel ? ` · ${usedModel}` : ''}) — ${added} candidate(s) → review queue, ${skipped} already present.\n${lines}\n\nApprove/reject with wyrm_review.` }] };
|
|
3165
|
+
}
|
|
3127
3166
|
// ==================== DATA LAKE ====================
|
|
3128
3167
|
case "wyrm_data_insert": {
|
|
3129
3168
|
const argErr = requireArgs(['projectPath', 'category', 'key', 'value']);
|