@stackmemoryai/stackmemory 1.10.5 → 1.12.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 +104 -23
- package/dist/src/cli/claude-sm.js +266 -84
- package/dist/src/cli/codex-sm.js +185 -33
- package/dist/src/cli/commands/bench.js +209 -2
- package/dist/src/cli/commands/cache.js +126 -0
- package/dist/src/cli/commands/daemon.js +41 -0
- package/dist/src/cli/commands/handoff.js +40 -9
- package/dist/src/cli/commands/onboard.js +70 -3
- package/dist/src/cli/commands/optimize.js +117 -0
- package/dist/src/cli/commands/orchestrate.js +230 -5
- package/dist/src/cli/commands/orchestrator.js +312 -24
- package/dist/src/cli/commands/pack.js +322 -0
- package/dist/src/cli/commands/search.js +40 -1
- package/dist/src/cli/commands/setup.js +177 -7
- package/dist/src/cli/commands/skills.js +10 -1
- package/dist/src/cli/commands/state.js +265 -0
- package/dist/src/cli/gemini-sm.js +19 -29
- package/dist/src/cli/index.js +90 -29
- package/dist/src/cli/opencode-sm.js +38 -21
- package/dist/src/cli/utils/determinism-watcher.js +66 -0
- package/dist/src/cli/utils/real-cli-bin.js +44 -0
- package/dist/src/core/cache/content-cache.js +238 -0
- package/dist/src/core/cache/index.js +11 -0
- package/dist/src/core/cache/token-estimator.js +16 -0
- package/dist/src/core/context/frame-database.js +38 -30
- package/dist/src/core/cross-search/cross-project-search.js +269 -0
- package/dist/src/core/{merge → cross-search}/index.js +6 -4
- package/dist/src/core/database/sqlite-adapter.js +0 -83
- package/dist/src/core/extensions/provider-adapter.js +5 -0
- package/dist/src/core/models/model-router.js +22 -2
- package/dist/src/core/monitoring/logger.js +2 -1
- package/dist/src/core/optimization/trace-optimizer.js +413 -0
- package/dist/src/core/provenance/confidence-scorer.js +128 -0
- package/dist/src/core/provenance/index.js +40 -0
- package/dist/src/core/provenance/provenance-store.js +194 -0
- package/dist/src/core/provenance/types.js +82 -0
- package/dist/src/core/session/project-handoff.js +64 -0
- package/dist/src/core/session/session-manager.js +28 -0
- package/dist/src/core/shared-state/canonical-store.js +564 -0
- package/dist/src/core/skill-packs/index.js +18 -0
- package/dist/src/core/skill-packs/parser.js +42 -0
- package/dist/src/core/skill-packs/registry.js +224 -0
- package/dist/src/core/skill-packs/types.js +66 -0
- package/dist/src/core/trace/trace-event-store.js +282 -0
- package/dist/src/core/trace/trace-event.js +4 -0
- package/dist/src/daemon/daemon-config.js +7 -0
- package/dist/src/daemon/services/github-service.js +126 -0
- package/dist/src/daemon/unified-daemon.js +30 -0
- package/dist/src/features/sweep/pty-wrapper.js +13 -5
- package/dist/src/hooks/schemas.js +2 -0
- package/dist/src/integrations/claude-code/subagent-client.js +89 -0
- package/dist/src/integrations/github/pr-state.js +158 -0
- package/dist/src/integrations/linear/client.js +4 -1
- package/dist/src/integrations/mcp/handlers/cross-search-handlers.js +188 -0
- package/dist/src/integrations/mcp/handlers/index.js +40 -59
- package/dist/src/integrations/mcp/server.js +425 -311
- package/dist/src/integrations/mcp/tool-alias-registry.js +370 -0
- package/dist/src/integrations/mcp/tool-definitions.js +98 -229
- package/dist/src/integrations/ralph/context/stackmemory-context-loader.js +3 -40
- package/dist/src/integrations/ralph/learning/pattern-learner.js +1 -20
- package/dist/src/integrations/ralph/swarm/swarm-coordinator.js +0 -2
- package/dist/src/mcp/stackmemory-mcp-server.js +315 -0
- package/dist/src/orchestrators/multimodal/determinism.js +243 -0
- package/dist/src/orchestrators/multimodal/harness.js +147 -77
- package/dist/src/orchestrators/multimodal/providers.js +44 -3
- package/dist/src/utils/hook-installer.js +0 -8
- package/package.json +10 -1
- package/packs/coding/python-fastapi/instructions.md +60 -0
- package/packs/coding/python-fastapi/pack.yaml +28 -0
- package/packs/coding/typescript-react/instructions.md +47 -0
- package/packs/coding/typescript-react/pack.yaml +28 -0
- package/packs/core/commands/capture.md +32 -0
- package/packs/core/commands/learn.md +73 -0
- package/packs/core/commands/next.md +36 -0
- package/packs/core/commands/restart.md +58 -0
- package/packs/core/commands/restore.md +29 -0
- package/packs/core/commands/start.md +57 -0
- package/packs/core/commands/stop.md +65 -0
- package/packs/core/commands/summary.md +40 -0
- package/packs/core/manifest.json +24 -0
- package/packs/ops/decision-recovery/instructions.md +65 -0
- package/packs/ops/decision-recovery/pack.yaml +89 -0
- package/dist/src/cli/commands/team.js +0 -168
- package/dist/src/core/context/shared-context-layer.js +0 -620
- package/dist/src/core/context/stack-merge-resolver.js +0 -748
- package/dist/src/core/merge/conflict-detector.js +0 -430
- package/dist/src/core/merge/resolution-engine.js +0 -557
- package/dist/src/core/merge/stack-diff.js +0 -531
- package/dist/src/core/merge/unified-merge-resolver.js +0 -302
- package/dist/src/integrations/mcp/handlers/cord-handlers.js +0 -397
- package/dist/src/integrations/mcp/handlers/team-handlers.js +0 -211
- /package/dist/src/core/{merge → cache}/types.js +0 -0
|
@@ -21,11 +21,10 @@ class MCPToolDefinitions {
|
|
|
21
21
|
...this.getDiffMemTools(),
|
|
22
22
|
...this.getGreptileTools(),
|
|
23
23
|
...this.getProviderTools(),
|
|
24
|
-
...this.getTeamTools(),
|
|
25
|
-
...this.getCordTools(),
|
|
26
24
|
...this.getDigestTools(),
|
|
27
25
|
...this.getDesirePathTools(),
|
|
28
|
-
...this.getProvenantTools()
|
|
26
|
+
...this.getProvenantTools(),
|
|
27
|
+
...this.getCrossSearchTools()
|
|
29
28
|
];
|
|
30
29
|
}
|
|
31
30
|
/**
|
|
@@ -35,7 +34,7 @@ class MCPToolDefinitions {
|
|
|
35
34
|
return [
|
|
36
35
|
{
|
|
37
36
|
name: "get_context",
|
|
38
|
-
description: "Get current project context and active frame information",
|
|
37
|
+
description: "Get current project context and active frame information. Aliases: context, get_ctx, sm_context, fetch_context",
|
|
39
38
|
inputSchema: {
|
|
40
39
|
type: "object",
|
|
41
40
|
properties: {
|
|
@@ -53,7 +52,7 @@ class MCPToolDefinitions {
|
|
|
53
52
|
},
|
|
54
53
|
{
|
|
55
54
|
name: "add_decision",
|
|
56
|
-
description: "Record a decision, constraint, or important information",
|
|
55
|
+
description: "Record a decision, constraint, or important information. Aliases: record_decision, log_decision, save_decision",
|
|
57
56
|
inputSchema: {
|
|
58
57
|
type: "object",
|
|
59
58
|
properties: {
|
|
@@ -72,7 +71,7 @@ class MCPToolDefinitions {
|
|
|
72
71
|
},
|
|
73
72
|
{
|
|
74
73
|
name: "start_frame",
|
|
75
|
-
description: "Start a new frame (task/subtask) on the call stack",
|
|
74
|
+
description: "Start a new frame (task/subtask) on the call stack. Aliases: push_frame, open_frame, begin_frame",
|
|
76
75
|
inputSchema: {
|
|
77
76
|
type: "object",
|
|
78
77
|
properties: {
|
|
@@ -179,7 +178,7 @@ class MCPToolDefinitions {
|
|
|
179
178
|
return [
|
|
180
179
|
{
|
|
181
180
|
name: "create_task",
|
|
182
|
-
description: "Create a new task",
|
|
181
|
+
description: "Create a new task. Aliases: new_task, add_task, sm_task",
|
|
183
182
|
inputSchema: {
|
|
184
183
|
type: "object",
|
|
185
184
|
properties: {
|
|
@@ -243,7 +242,7 @@ class MCPToolDefinitions {
|
|
|
243
242
|
},
|
|
244
243
|
{
|
|
245
244
|
name: "get_active_tasks",
|
|
246
|
-
description: "Get active tasks with optional filtering",
|
|
245
|
+
description: "Get active tasks with optional filtering. Aliases: list_tasks, tasks, sm_tasks, active_tasks",
|
|
247
246
|
inputSchema: {
|
|
248
247
|
type: "object",
|
|
249
248
|
properties: {
|
|
@@ -613,6 +612,11 @@ class MCPToolDefinitions {
|
|
|
613
612
|
description: "Which agent implements code"
|
|
614
613
|
},
|
|
615
614
|
maxIters: { type: "number", default: 2 },
|
|
615
|
+
verificationCommands: {
|
|
616
|
+
type: "array",
|
|
617
|
+
items: { type: "string" },
|
|
618
|
+
description: "Optional repro/test commands that must pass after implementation"
|
|
619
|
+
},
|
|
616
620
|
recordFrame: { type: "boolean", default: true },
|
|
617
621
|
execute: { type: "boolean", default: true }
|
|
618
622
|
},
|
|
@@ -698,7 +702,7 @@ class MCPToolDefinitions {
|
|
|
698
702
|
return [
|
|
699
703
|
{
|
|
700
704
|
name: "smart_context",
|
|
701
|
-
description: "LLM-driven context retrieval - intelligently selects relevant frames based on query",
|
|
705
|
+
description: "LLM-driven context retrieval - intelligently selects relevant frames based on query. Aliases: smart, sm_smart, intelligent_context",
|
|
702
706
|
inputSchema: {
|
|
703
707
|
type: "object",
|
|
704
708
|
properties: {
|
|
@@ -740,7 +744,7 @@ class MCPToolDefinitions {
|
|
|
740
744
|
return [
|
|
741
745
|
{
|
|
742
746
|
name: "sm_discover",
|
|
743
|
-
description: "Discover relevant files based on current context. Extracts keywords from active frames and searches codebase for related files.",
|
|
747
|
+
description: "Discover relevant files based on current context. Extracts keywords from active frames and searches codebase for related files. Aliases: discover, sm_explore, explore",
|
|
744
748
|
inputSchema: {
|
|
745
749
|
type: "object",
|
|
746
750
|
properties: {
|
|
@@ -815,7 +819,7 @@ class MCPToolDefinitions {
|
|
|
815
819
|
},
|
|
816
820
|
{
|
|
817
821
|
name: "sm_search",
|
|
818
|
-
description: "Search across StackMemory context - frames, events, decisions, and tasks.",
|
|
822
|
+
description: "Search across StackMemory context - frames, events, decisions, and tasks. Aliases: search, context_search, sm_find, sm_context_search",
|
|
819
823
|
inputSchema: {
|
|
820
824
|
type: "object",
|
|
821
825
|
properties: {
|
|
@@ -847,7 +851,7 @@ class MCPToolDefinitions {
|
|
|
847
851
|
return [
|
|
848
852
|
{
|
|
849
853
|
name: "sm_edit",
|
|
850
|
-
description: "Fuzzy file edit \u2014 fallback when Claude Code's Edit tool fails on whitespace or indentation mismatches. Uses four-tier matching: exact, whitespace-normalized, indentation-insensitive, and line-level fuzzy (Levenshtein).",
|
|
854
|
+
description: "Fuzzy file edit \u2014 fallback when Claude Code's Edit tool fails on whitespace or indentation mismatches. Uses four-tier matching: exact, whitespace-normalized, indentation-insensitive, and line-level fuzzy (Levenshtein). Aliases: fuzzy_edit, edit, sm_fuzzy_edit",
|
|
851
855
|
inputSchema: {
|
|
852
856
|
type: "object",
|
|
853
857
|
properties: {
|
|
@@ -1129,7 +1133,7 @@ class MCPToolDefinitions {
|
|
|
1129
1133
|
return [
|
|
1130
1134
|
{
|
|
1131
1135
|
name: "delegate_to_model",
|
|
1132
|
-
description: "Route a prompt to a specific provider/model. Uses smart cost-based routing by default.",
|
|
1136
|
+
description: "Route a prompt to a specific provider/model. Uses smart cost-based routing by default. Aliases: delegate, route, send_to_model",
|
|
1133
1137
|
inputSchema: {
|
|
1134
1138
|
type: "object",
|
|
1135
1139
|
properties: {
|
|
@@ -1212,7 +1216,7 @@ class MCPToolDefinitions {
|
|
|
1212
1216
|
return [
|
|
1213
1217
|
{
|
|
1214
1218
|
name: "sm_digest",
|
|
1215
|
-
description: "Generate a chronological activity digest for a time period",
|
|
1219
|
+
description: "Generate a chronological activity digest for a time period. Aliases: digest, activity_digest, daily_digest",
|
|
1216
1220
|
inputSchema: {
|
|
1217
1221
|
type: "object",
|
|
1218
1222
|
properties: {
|
|
@@ -1234,7 +1238,7 @@ class MCPToolDefinitions {
|
|
|
1234
1238
|
return [
|
|
1235
1239
|
{
|
|
1236
1240
|
name: "sm_desire_paths",
|
|
1237
|
-
description: 'Analyze failed tool calls (desire paths) \u2014 what agents want but cannot get. Use mode "summary" for aggregated counts or "list" for recent failures.',
|
|
1241
|
+
description: 'Analyze failed tool calls (desire paths) \u2014 what agents want but cannot get. Use mode "summary" for aggregated counts or "list" for recent failures. Aliases: desire_paths, desires, failed_tools',
|
|
1238
1242
|
inputSchema: {
|
|
1239
1243
|
type: "object",
|
|
1240
1244
|
properties: {
|
|
@@ -1264,214 +1268,6 @@ class MCPToolDefinitions {
|
|
|
1264
1268
|
}
|
|
1265
1269
|
];
|
|
1266
1270
|
}
|
|
1267
|
-
/**
|
|
1268
|
-
* Multi-agent team collaboration tools
|
|
1269
|
-
*/
|
|
1270
|
-
getTeamTools() {
|
|
1271
|
-
return [
|
|
1272
|
-
{
|
|
1273
|
-
name: "team_context_get",
|
|
1274
|
-
description: "Get context from other agents working on the same project. Returns recent frames and shared anchors from other sessions.",
|
|
1275
|
-
inputSchema: {
|
|
1276
|
-
type: "object",
|
|
1277
|
-
properties: {
|
|
1278
|
-
limit: {
|
|
1279
|
-
type: "number",
|
|
1280
|
-
default: 10,
|
|
1281
|
-
description: "Max frames to return"
|
|
1282
|
-
},
|
|
1283
|
-
types: {
|
|
1284
|
-
type: "array",
|
|
1285
|
-
items: { type: "string" },
|
|
1286
|
-
description: "Filter by frame types"
|
|
1287
|
-
},
|
|
1288
|
-
since: {
|
|
1289
|
-
type: "number",
|
|
1290
|
-
description: "Only frames created after this timestamp (epoch ms)"
|
|
1291
|
-
}
|
|
1292
|
-
}
|
|
1293
|
-
}
|
|
1294
|
-
},
|
|
1295
|
-
{
|
|
1296
|
-
name: "team_context_share",
|
|
1297
|
-
description: "Share a piece of context with other agents working on the same project. Creates a high-priority anchor visible to team_context_get.",
|
|
1298
|
-
inputSchema: {
|
|
1299
|
-
type: "object",
|
|
1300
|
-
properties: {
|
|
1301
|
-
content: {
|
|
1302
|
-
type: "string",
|
|
1303
|
-
description: "The context to share"
|
|
1304
|
-
},
|
|
1305
|
-
type: {
|
|
1306
|
-
type: "string",
|
|
1307
|
-
enum: [
|
|
1308
|
-
"FACT",
|
|
1309
|
-
"DECISION",
|
|
1310
|
-
"CONSTRAINT",
|
|
1311
|
-
"INTERFACE_CONTRACT",
|
|
1312
|
-
"TODO",
|
|
1313
|
-
"RISK"
|
|
1314
|
-
],
|
|
1315
|
-
default: "FACT",
|
|
1316
|
-
description: "Type of context"
|
|
1317
|
-
},
|
|
1318
|
-
priority: {
|
|
1319
|
-
type: "number",
|
|
1320
|
-
minimum: 1,
|
|
1321
|
-
maximum: 10,
|
|
1322
|
-
default: 8,
|
|
1323
|
-
description: "Priority level (1-10)"
|
|
1324
|
-
}
|
|
1325
|
-
},
|
|
1326
|
-
required: ["content"]
|
|
1327
|
-
}
|
|
1328
|
-
},
|
|
1329
|
-
{
|
|
1330
|
-
name: "team_search",
|
|
1331
|
-
description: "Search across all agents' context in the project. Uses full-text search across all sessions.",
|
|
1332
|
-
inputSchema: {
|
|
1333
|
-
type: "object",
|
|
1334
|
-
properties: {
|
|
1335
|
-
query: {
|
|
1336
|
-
type: "string",
|
|
1337
|
-
description: "Search query"
|
|
1338
|
-
},
|
|
1339
|
-
limit: {
|
|
1340
|
-
type: "number",
|
|
1341
|
-
default: 20,
|
|
1342
|
-
description: "Maximum results to return"
|
|
1343
|
-
},
|
|
1344
|
-
include_events: {
|
|
1345
|
-
type: "boolean",
|
|
1346
|
-
default: false,
|
|
1347
|
-
description: "Include events in results"
|
|
1348
|
-
}
|
|
1349
|
-
},
|
|
1350
|
-
required: ["query"]
|
|
1351
|
-
}
|
|
1352
|
-
}
|
|
1353
|
-
];
|
|
1354
|
-
}
|
|
1355
|
-
/**
|
|
1356
|
-
* Cord task orchestration tools
|
|
1357
|
-
*/
|
|
1358
|
-
getCordTools() {
|
|
1359
|
-
return [
|
|
1360
|
-
{
|
|
1361
|
-
name: "cord_spawn",
|
|
1362
|
-
description: "Create a subtask with clean context (spawn). Child sees only its prompt and completed blocker results.",
|
|
1363
|
-
inputSchema: {
|
|
1364
|
-
type: "object",
|
|
1365
|
-
properties: {
|
|
1366
|
-
goal: {
|
|
1367
|
-
type: "string",
|
|
1368
|
-
description: "What this task should accomplish"
|
|
1369
|
-
},
|
|
1370
|
-
prompt: {
|
|
1371
|
-
type: "string",
|
|
1372
|
-
description: "Detailed instructions for the task"
|
|
1373
|
-
},
|
|
1374
|
-
blocked_by: {
|
|
1375
|
-
type: "array",
|
|
1376
|
-
items: { type: "string" },
|
|
1377
|
-
description: "Task IDs that must complete before this can start"
|
|
1378
|
-
},
|
|
1379
|
-
parent_id: {
|
|
1380
|
-
type: "string",
|
|
1381
|
-
description: "Parent task ID"
|
|
1382
|
-
}
|
|
1383
|
-
},
|
|
1384
|
-
required: ["goal"]
|
|
1385
|
-
}
|
|
1386
|
-
},
|
|
1387
|
-
{
|
|
1388
|
-
name: "cord_fork",
|
|
1389
|
-
description: "Create a subtask with full sibling context (fork). Child sees its prompt, blocker results, AND completed sibling results.",
|
|
1390
|
-
inputSchema: {
|
|
1391
|
-
type: "object",
|
|
1392
|
-
properties: {
|
|
1393
|
-
goal: {
|
|
1394
|
-
type: "string",
|
|
1395
|
-
description: "What this task should accomplish"
|
|
1396
|
-
},
|
|
1397
|
-
prompt: {
|
|
1398
|
-
type: "string",
|
|
1399
|
-
description: "Detailed instructions for the task"
|
|
1400
|
-
},
|
|
1401
|
-
blocked_by: {
|
|
1402
|
-
type: "array",
|
|
1403
|
-
items: { type: "string" },
|
|
1404
|
-
description: "Task IDs that must complete before this can start"
|
|
1405
|
-
},
|
|
1406
|
-
parent_id: {
|
|
1407
|
-
type: "string",
|
|
1408
|
-
description: "Parent task ID"
|
|
1409
|
-
}
|
|
1410
|
-
},
|
|
1411
|
-
required: ["goal"]
|
|
1412
|
-
}
|
|
1413
|
-
},
|
|
1414
|
-
{
|
|
1415
|
-
name: "cord_complete",
|
|
1416
|
-
description: "Mark a cord task as completed with a result. Automatically unblocks dependent tasks.",
|
|
1417
|
-
inputSchema: {
|
|
1418
|
-
type: "object",
|
|
1419
|
-
properties: {
|
|
1420
|
-
task_id: {
|
|
1421
|
-
type: "string",
|
|
1422
|
-
description: "Task ID to complete"
|
|
1423
|
-
},
|
|
1424
|
-
result: {
|
|
1425
|
-
type: "string",
|
|
1426
|
-
description: "The result/output of this task"
|
|
1427
|
-
}
|
|
1428
|
-
},
|
|
1429
|
-
required: ["task_id", "result"]
|
|
1430
|
-
}
|
|
1431
|
-
},
|
|
1432
|
-
{
|
|
1433
|
-
name: "cord_ask",
|
|
1434
|
-
description: "Create an ask task \u2014 a question that needs an answer before dependent tasks can proceed.",
|
|
1435
|
-
inputSchema: {
|
|
1436
|
-
type: "object",
|
|
1437
|
-
properties: {
|
|
1438
|
-
question: {
|
|
1439
|
-
type: "string",
|
|
1440
|
-
description: "The question to ask"
|
|
1441
|
-
},
|
|
1442
|
-
options: {
|
|
1443
|
-
type: "array",
|
|
1444
|
-
items: { type: "string" },
|
|
1445
|
-
description: "Optional list of answer choices"
|
|
1446
|
-
},
|
|
1447
|
-
parent_id: {
|
|
1448
|
-
type: "string",
|
|
1449
|
-
description: "Parent task ID"
|
|
1450
|
-
}
|
|
1451
|
-
},
|
|
1452
|
-
required: ["question"]
|
|
1453
|
-
}
|
|
1454
|
-
},
|
|
1455
|
-
{
|
|
1456
|
-
name: "cord_tree",
|
|
1457
|
-
description: "View the cord task tree with context scoping. Shows which tasks are active, blocked, or completed.",
|
|
1458
|
-
inputSchema: {
|
|
1459
|
-
type: "object",
|
|
1460
|
-
properties: {
|
|
1461
|
-
task_id: {
|
|
1462
|
-
type: "string",
|
|
1463
|
-
description: "Root task ID to show subtree (omit for full project tree)"
|
|
1464
|
-
},
|
|
1465
|
-
include_results: {
|
|
1466
|
-
type: "boolean",
|
|
1467
|
-
default: false,
|
|
1468
|
-
description: "Include task results in output"
|
|
1469
|
-
}
|
|
1470
|
-
}
|
|
1471
|
-
}
|
|
1472
|
-
}
|
|
1473
|
-
];
|
|
1474
|
-
}
|
|
1475
1271
|
/**
|
|
1476
1272
|
* Provenant decision graph tools
|
|
1477
1273
|
*/
|
|
@@ -1479,7 +1275,7 @@ class MCPToolDefinitions {
|
|
|
1479
1275
|
return [
|
|
1480
1276
|
{
|
|
1481
1277
|
name: "provenant_search",
|
|
1482
|
-
description: "Search the decision graph for past decisions, patterns, and context by meaning",
|
|
1278
|
+
description: "Search the decision graph for past decisions, patterns, and context by meaning. Aliases: decision_search, search_decisions",
|
|
1483
1279
|
inputSchema: {
|
|
1484
1280
|
type: "object",
|
|
1485
1281
|
properties: {
|
|
@@ -1506,7 +1302,7 @@ class MCPToolDefinitions {
|
|
|
1506
1302
|
},
|
|
1507
1303
|
{
|
|
1508
1304
|
name: "provenant_log",
|
|
1509
|
-
description: "Log a decision to the graph. Use when a product or technical decision is made during a session.",
|
|
1305
|
+
description: "Log a decision to the graph. Use when a product or technical decision is made during a session. Aliases: decision_log, log_decision_graph",
|
|
1510
1306
|
inputSchema: {
|
|
1511
1307
|
type: "object",
|
|
1512
1308
|
properties: {
|
|
@@ -1570,6 +1366,81 @@ class MCPToolDefinitions {
|
|
|
1570
1366
|
}
|
|
1571
1367
|
];
|
|
1572
1368
|
}
|
|
1369
|
+
/**
|
|
1370
|
+
* Cross-project search tools
|
|
1371
|
+
*/
|
|
1372
|
+
getCrossSearchTools() {
|
|
1373
|
+
return [
|
|
1374
|
+
{
|
|
1375
|
+
name: "sm_cross_search",
|
|
1376
|
+
description: "Search frames across all registered project databases using FTS5/BM25. Returns results ranked by relevance with source project attribution.",
|
|
1377
|
+
inputSchema: {
|
|
1378
|
+
type: "object",
|
|
1379
|
+
properties: {
|
|
1380
|
+
query: {
|
|
1381
|
+
type: "string",
|
|
1382
|
+
description: "Search query (natural language or keywords)"
|
|
1383
|
+
},
|
|
1384
|
+
limit: {
|
|
1385
|
+
type: "number",
|
|
1386
|
+
default: 20,
|
|
1387
|
+
description: "Maximum results to return"
|
|
1388
|
+
},
|
|
1389
|
+
exclude_current: {
|
|
1390
|
+
type: "boolean",
|
|
1391
|
+
default: false,
|
|
1392
|
+
description: "Exclude the current project from results (useful when searching for external context)"
|
|
1393
|
+
}
|
|
1394
|
+
},
|
|
1395
|
+
required: ["query"]
|
|
1396
|
+
}
|
|
1397
|
+
},
|
|
1398
|
+
{
|
|
1399
|
+
name: "sm_cross_discover",
|
|
1400
|
+
description: "Auto-discover project databases by scanning common directories for .stackmemory/context.db files.",
|
|
1401
|
+
inputSchema: {
|
|
1402
|
+
type: "object",
|
|
1403
|
+
properties: {
|
|
1404
|
+
paths: {
|
|
1405
|
+
type: "array",
|
|
1406
|
+
items: { type: "string" },
|
|
1407
|
+
description: "Custom directory paths to scan (defaults to ~/Dev, ~/Projects, etc.)"
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1411
|
+
},
|
|
1412
|
+
{
|
|
1413
|
+
name: "sm_cross_register",
|
|
1414
|
+
description: "Manually register a project database for cross-project search.",
|
|
1415
|
+
inputSchema: {
|
|
1416
|
+
type: "object",
|
|
1417
|
+
properties: {
|
|
1418
|
+
name: {
|
|
1419
|
+
type: "string",
|
|
1420
|
+
description: "Project display name"
|
|
1421
|
+
},
|
|
1422
|
+
path: {
|
|
1423
|
+
type: "string",
|
|
1424
|
+
description: "Project root directory path"
|
|
1425
|
+
},
|
|
1426
|
+
db_path: {
|
|
1427
|
+
type: "string",
|
|
1428
|
+
description: "Path to the SQLite context.db file (e.g. /path/to/project/.stackmemory/context.db)"
|
|
1429
|
+
}
|
|
1430
|
+
},
|
|
1431
|
+
required: ["name", "path", "db_path"]
|
|
1432
|
+
}
|
|
1433
|
+
},
|
|
1434
|
+
{
|
|
1435
|
+
name: "sm_cross_list",
|
|
1436
|
+
description: "List all project databases registered for cross-project search.",
|
|
1437
|
+
inputSchema: {
|
|
1438
|
+
type: "object",
|
|
1439
|
+
properties: {}
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
];
|
|
1443
|
+
}
|
|
1573
1444
|
/**
|
|
1574
1445
|
* Get tool definition by name
|
|
1575
1446
|
*/
|
|
@@ -1607,16 +1478,14 @@ class MCPToolDefinitions {
|
|
|
1607
1478
|
return this.getGreptileTools();
|
|
1608
1479
|
case "provider":
|
|
1609
1480
|
return this.getProviderTools();
|
|
1610
|
-
case "team":
|
|
1611
|
-
return this.getTeamTools();
|
|
1612
|
-
case "cord":
|
|
1613
|
-
return this.getCordTools();
|
|
1614
1481
|
case "digest":
|
|
1615
1482
|
return this.getDigestTools();
|
|
1616
1483
|
case "desire_paths":
|
|
1617
1484
|
return this.getDesirePathTools();
|
|
1618
1485
|
case "provenant":
|
|
1619
1486
|
return this.getProvenantTools();
|
|
1487
|
+
case "cross_search":
|
|
1488
|
+
return this.getProvenantTools();
|
|
1620
1489
|
default:
|
|
1621
1490
|
return [];
|
|
1622
1491
|
}
|
|
@@ -4,7 +4,6 @@ const __filename = __fileURLToPath(import.meta.url);
|
|
|
4
4
|
const __dirname = __pathDirname(__filename);
|
|
5
5
|
import { logger } from "../../../core/monitoring/logger.js";
|
|
6
6
|
import { FrameManager } from "../../../core/context/index.js";
|
|
7
|
-
import { sharedContextLayer } from "../../../core/context/shared-context-layer.js";
|
|
8
7
|
import { ContextRetriever } from "../../../core/retrieval/context-retriever.js";
|
|
9
8
|
import { sessionManager } from "../../../core/session/index.js";
|
|
10
9
|
import { ContextBudgetManager } from "./context-budget-manager.js";
|
|
@@ -43,7 +42,6 @@ class StackMemoryContextLoader {
|
|
|
43
42
|
async initialize() {
|
|
44
43
|
try {
|
|
45
44
|
await sessionManager.initialize();
|
|
46
|
-
await sharedContextLayer.initialize();
|
|
47
45
|
const session = await sessionManager.getOrCreateSession({});
|
|
48
46
|
if (session.database) {
|
|
49
47
|
this.frameManager = new FrameManager(
|
|
@@ -195,49 +193,14 @@ class StackMemoryContextLoader {
|
|
|
195
193
|
/**
|
|
196
194
|
* Extract relevant patterns from historical data
|
|
197
195
|
*/
|
|
198
|
-
async extractRelevantPatterns(
|
|
199
|
-
|
|
200
|
-
const context = await sharedContextLayer.getSharedContext();
|
|
201
|
-
if (!context) return [];
|
|
202
|
-
const relevantPatterns = [];
|
|
203
|
-
for (const pattern of context.globalPatterns) {
|
|
204
|
-
const relevance = this.calculatePatternRelevance(
|
|
205
|
-
taskDescription,
|
|
206
|
-
pattern.pattern
|
|
207
|
-
);
|
|
208
|
-
if (relevance >= 0.5) {
|
|
209
|
-
relevantPatterns.push({
|
|
210
|
-
pattern: pattern.pattern,
|
|
211
|
-
type: pattern.type,
|
|
212
|
-
frequency: pattern.frequency,
|
|
213
|
-
lastSeen: pattern.lastSeen,
|
|
214
|
-
relevance,
|
|
215
|
-
resolution: pattern.resolution,
|
|
216
|
-
examples: await this.getPatternExamples(pattern.pattern)
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
return relevantPatterns.sort(
|
|
221
|
-
(a, b) => b.relevance * Math.log(b.frequency + 1) - a.relevance * Math.log(a.frequency + 1)
|
|
222
|
-
).slice(0, 8);
|
|
223
|
-
} catch (error) {
|
|
224
|
-
logger.error("Failed to extract patterns", error);
|
|
225
|
-
return [];
|
|
226
|
-
}
|
|
196
|
+
async extractRelevantPatterns(_taskDescription) {
|
|
197
|
+
return [];
|
|
227
198
|
}
|
|
228
199
|
/**
|
|
229
200
|
* Load recent decisions that might be relevant
|
|
230
201
|
*/
|
|
231
202
|
async loadRecentDecisions() {
|
|
232
|
-
|
|
233
|
-
const context = await sharedContextLayer.getSharedContext();
|
|
234
|
-
if (!context) return [];
|
|
235
|
-
const cutoff = Date.now() - 7 * 24 * 60 * 60 * 1e3;
|
|
236
|
-
return context.decisionLog.filter((d) => d.timestamp >= cutoff && d.outcome === "success").sort((a, b) => b.timestamp - a.timestamp).slice(0, 5);
|
|
237
|
-
} catch (error) {
|
|
238
|
-
logger.error("Failed to load recent decisions", error);
|
|
239
|
-
return [];
|
|
240
|
-
}
|
|
203
|
+
return [];
|
|
241
204
|
}
|
|
242
205
|
/**
|
|
243
206
|
* Load project-specific context
|
|
@@ -4,7 +4,6 @@ const __filename = __fileURLToPath(import.meta.url);
|
|
|
4
4
|
const __dirname = __pathDirname(__filename);
|
|
5
5
|
import { logger } from "../../../core/monitoring/logger.js";
|
|
6
6
|
import { FrameManager } from "../../../core/context/index.js";
|
|
7
|
-
import { sharedContextLayer } from "../../../core/context/shared-context-layer.js";
|
|
8
7
|
import { sessionManager } from "../../../core/session/index.js";
|
|
9
8
|
class PatternLearner {
|
|
10
9
|
frameManager;
|
|
@@ -22,7 +21,6 @@ class PatternLearner {
|
|
|
22
21
|
async initialize() {
|
|
23
22
|
try {
|
|
24
23
|
await sessionManager.initialize();
|
|
25
|
-
await sharedContextLayer.initialize();
|
|
26
24
|
const session = await sessionManager.getOrCreateSession({});
|
|
27
25
|
if (session.database) {
|
|
28
26
|
this.frameManager = new FrameManager(
|
|
@@ -318,24 +316,7 @@ class PatternLearner {
|
|
|
318
316
|
* Save learned patterns to shared context
|
|
319
317
|
*/
|
|
320
318
|
async saveLearnedPatterns(patterns) {
|
|
321
|
-
|
|
322
|
-
const context = await sharedContextLayer.getSharedContext();
|
|
323
|
-
if (!context) return;
|
|
324
|
-
const contextPatterns = patterns.map((p) => ({
|
|
325
|
-
pattern: p.pattern,
|
|
326
|
-
type: this.mapPatternType(p.type),
|
|
327
|
-
frequency: p.frequency,
|
|
328
|
-
lastSeen: Date.now(),
|
|
329
|
-
resolution: p.strategy
|
|
330
|
-
}));
|
|
331
|
-
context.globalPatterns.push(...contextPatterns);
|
|
332
|
-
context.globalPatterns.sort((a, b) => b.frequency - a.frequency);
|
|
333
|
-
context.globalPatterns = context.globalPatterns.slice(0, 100);
|
|
334
|
-
await sharedContextLayer.updateSharedContext(context);
|
|
335
|
-
logger.info(`Saved ${patterns.length} patterns to shared context`);
|
|
336
|
-
} catch (error) {
|
|
337
|
-
logger.error("Failed to save patterns", error);
|
|
338
|
-
}
|
|
319
|
+
logger.debug(`Skipping shared pattern save (${patterns.length} patterns)`);
|
|
339
320
|
}
|
|
340
321
|
/**
|
|
341
322
|
* Map pattern types to shared context types
|
|
@@ -8,7 +8,6 @@ import * as path from "path";
|
|
|
8
8
|
import { logger } from "../../../core/monitoring/logger.js";
|
|
9
9
|
import { FrameManager } from "../../../core/context/index.js";
|
|
10
10
|
import { sessionManager } from "../../../core/session/index.js";
|
|
11
|
-
import { sharedContextLayer } from "../../../core/context/shared-context-layer.js";
|
|
12
11
|
import { RalphStackMemoryBridge } from "../bridge/ralph-stackmemory-bridge.js";
|
|
13
12
|
import { GitWorkflowManager } from "./git-workflow-manager.js";
|
|
14
13
|
import { SwarmRegistry } from "../monitoring/swarm-registry.js";
|
|
@@ -94,7 +93,6 @@ class SwarmCoordinator {
|
|
|
94
93
|
async initialize() {
|
|
95
94
|
try {
|
|
96
95
|
await sessionManager.initialize();
|
|
97
|
-
await sharedContextLayer.initialize();
|
|
98
96
|
const session = await sessionManager.getOrCreateSession({});
|
|
99
97
|
if (session.database) {
|
|
100
98
|
this.frameManager = new FrameManager(
|