wyrm-mcp 6.9.2 → 6.11.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.js CHANGED
@@ -545,6 +545,7 @@ try {
545
545
  const provider = (process.env.WYRM_VECTOR_PROVIDER || 'auto');
546
546
  if (provider !== 'none') {
547
547
  vectorStore = createVectorStore({ provider }, db.getDatabase());
548
+ memory.setVectorStore(vectorStore); // enable hybrid recall (FTS ⊕ dense vectors, RRF)
548
549
  // Content resolver for the indexing pipeline
549
550
  const resolveContent = (type, id) => {
550
551
  try {
@@ -1279,7 +1280,7 @@ function buildAllTools() {
1279
1280
  },
1280
1281
  {
1281
1282
  name: "wyrm_reindex",
1282
- description: "Rebuild embeddings for a project or all projects. Regenerates vectors for sessions, quests, and data.",
1283
+ description: "Rebuild embeddings for a project or all projects. Regenerates vectors for sessions, quests, data, and memory artifacts (the latter power hybrid recall).",
1283
1284
  inputSchema: {
1284
1285
  type: "object",
1285
1286
  properties: {
@@ -3717,11 +3718,11 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
3717
3718
  const rcProject = db.getProject(rcPath);
3718
3719
  if (!rcProject)
3719
3720
  return { content: [{ type: "text", text: `Project not found: ${rcPath}` }], isError: true };
3720
- const results = memory.recall(rcProject.id, rcQuery, {
3721
- kind: rcKind,
3722
- limit: rcLimit ?? 10,
3723
- minConfidence: rcMinConf,
3724
- });
3721
+ // Hybrid (FTS ⊕ vectors, RRF) when a vector store is available; lexical otherwise.
3722
+ const rcOpts = { kind: rcKind, limit: rcLimit ?? 10, minConfidence: rcMinConf };
3723
+ const results = vectorStore
3724
+ ? await memory.recallHybrid(rcProject.id, rcQuery, rcOpts)
3725
+ : memory.recall(rcProject.id, rcQuery, rcOpts);
3725
3726
  // Track access for memory decay
3726
3727
  if (results.length > 0) {
3727
3728
  const rawDbRecall = db.getDatabase();
@@ -4075,6 +4076,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
4075
4076
  }
4076
4077
  // Update global vector store
4077
4078
  vectorStore = createVectorStore(providerConfig, db.getDatabase());
4079
+ memory.setVectorStore(vectorStore); // keep hybrid recall pointed at the live store
4078
4080
  if (indexingPipeline)
4079
4081
  indexingPipeline.updateStore(vectorStore);
4080
4082
  const stats = vectorStore.getStats();
@@ -4174,6 +4176,27 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
4174
4176
  indexed++;
4175
4177
  }
4176
4178
  }
4179
+ // Memory artifacts (active only) — powers hybrid recall (FTS ⊕ vectors)
4180
+ const artifacts = db.getDatabase().prepare('SELECT id, problem, validated_fix FROM memory_artifacts WHERE project_id = ? AND needs_review = 0 AND supersedes_id IS NULL').all(projectId);
4181
+ for (const a of artifacts) {
4182
+ const content = [a.problem, a.validated_fix].filter(Boolean).join(' ');
4183
+ if (content && !dryRun) {
4184
+ try {
4185
+ const hash = await vectorStore.addVector(content, 'artifact', a.id, projectId);
4186
+ if (hash)
4187
+ indexed++;
4188
+ else
4189
+ skipped++;
4190
+ }
4191
+ catch (err) {
4192
+ logger.error('Reindex artifact failed', { projectId, artifactId: a.id, error: err.message });
4193
+ skipped++;
4194
+ }
4195
+ }
4196
+ else if (content) {
4197
+ indexed++;
4198
+ }
4199
+ }
4177
4200
  }
4178
4201
  return {
4179
4202
  content: [{