@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.
Files changed (92) hide show
  1. package/README.md +104 -23
  2. package/dist/src/cli/claude-sm.js +266 -84
  3. package/dist/src/cli/codex-sm.js +185 -33
  4. package/dist/src/cli/commands/bench.js +209 -2
  5. package/dist/src/cli/commands/cache.js +126 -0
  6. package/dist/src/cli/commands/daemon.js +41 -0
  7. package/dist/src/cli/commands/handoff.js +40 -9
  8. package/dist/src/cli/commands/onboard.js +70 -3
  9. package/dist/src/cli/commands/optimize.js +117 -0
  10. package/dist/src/cli/commands/orchestrate.js +230 -5
  11. package/dist/src/cli/commands/orchestrator.js +312 -24
  12. package/dist/src/cli/commands/pack.js +322 -0
  13. package/dist/src/cli/commands/search.js +40 -1
  14. package/dist/src/cli/commands/setup.js +177 -7
  15. package/dist/src/cli/commands/skills.js +10 -1
  16. package/dist/src/cli/commands/state.js +265 -0
  17. package/dist/src/cli/gemini-sm.js +19 -29
  18. package/dist/src/cli/index.js +90 -29
  19. package/dist/src/cli/opencode-sm.js +38 -21
  20. package/dist/src/cli/utils/determinism-watcher.js +66 -0
  21. package/dist/src/cli/utils/real-cli-bin.js +44 -0
  22. package/dist/src/core/cache/content-cache.js +238 -0
  23. package/dist/src/core/cache/index.js +11 -0
  24. package/dist/src/core/cache/token-estimator.js +16 -0
  25. package/dist/src/core/context/frame-database.js +38 -30
  26. package/dist/src/core/cross-search/cross-project-search.js +269 -0
  27. package/dist/src/core/{merge → cross-search}/index.js +6 -4
  28. package/dist/src/core/database/sqlite-adapter.js +0 -83
  29. package/dist/src/core/extensions/provider-adapter.js +5 -0
  30. package/dist/src/core/models/model-router.js +22 -2
  31. package/dist/src/core/monitoring/logger.js +2 -1
  32. package/dist/src/core/optimization/trace-optimizer.js +413 -0
  33. package/dist/src/core/provenance/confidence-scorer.js +128 -0
  34. package/dist/src/core/provenance/index.js +40 -0
  35. package/dist/src/core/provenance/provenance-store.js +194 -0
  36. package/dist/src/core/provenance/types.js +82 -0
  37. package/dist/src/core/session/project-handoff.js +64 -0
  38. package/dist/src/core/session/session-manager.js +28 -0
  39. package/dist/src/core/shared-state/canonical-store.js +564 -0
  40. package/dist/src/core/skill-packs/index.js +18 -0
  41. package/dist/src/core/skill-packs/parser.js +42 -0
  42. package/dist/src/core/skill-packs/registry.js +224 -0
  43. package/dist/src/core/skill-packs/types.js +66 -0
  44. package/dist/src/core/trace/trace-event-store.js +282 -0
  45. package/dist/src/core/trace/trace-event.js +4 -0
  46. package/dist/src/daemon/daemon-config.js +7 -0
  47. package/dist/src/daemon/services/github-service.js +126 -0
  48. package/dist/src/daemon/unified-daemon.js +30 -0
  49. package/dist/src/features/sweep/pty-wrapper.js +13 -5
  50. package/dist/src/hooks/schemas.js +2 -0
  51. package/dist/src/integrations/claude-code/subagent-client.js +89 -0
  52. package/dist/src/integrations/github/pr-state.js +158 -0
  53. package/dist/src/integrations/linear/client.js +4 -1
  54. package/dist/src/integrations/mcp/handlers/cross-search-handlers.js +188 -0
  55. package/dist/src/integrations/mcp/handlers/index.js +40 -59
  56. package/dist/src/integrations/mcp/server.js +425 -311
  57. package/dist/src/integrations/mcp/tool-alias-registry.js +370 -0
  58. package/dist/src/integrations/mcp/tool-definitions.js +98 -229
  59. package/dist/src/integrations/ralph/context/stackmemory-context-loader.js +3 -40
  60. package/dist/src/integrations/ralph/learning/pattern-learner.js +1 -20
  61. package/dist/src/integrations/ralph/swarm/swarm-coordinator.js +0 -2
  62. package/dist/src/mcp/stackmemory-mcp-server.js +315 -0
  63. package/dist/src/orchestrators/multimodal/determinism.js +243 -0
  64. package/dist/src/orchestrators/multimodal/harness.js +147 -77
  65. package/dist/src/orchestrators/multimodal/providers.js +44 -3
  66. package/dist/src/utils/hook-installer.js +0 -8
  67. package/package.json +10 -1
  68. package/packs/coding/python-fastapi/instructions.md +60 -0
  69. package/packs/coding/python-fastapi/pack.yaml +28 -0
  70. package/packs/coding/typescript-react/instructions.md +47 -0
  71. package/packs/coding/typescript-react/pack.yaml +28 -0
  72. package/packs/core/commands/capture.md +32 -0
  73. package/packs/core/commands/learn.md +73 -0
  74. package/packs/core/commands/next.md +36 -0
  75. package/packs/core/commands/restart.md +58 -0
  76. package/packs/core/commands/restore.md +29 -0
  77. package/packs/core/commands/start.md +57 -0
  78. package/packs/core/commands/stop.md +65 -0
  79. package/packs/core/commands/summary.md +40 -0
  80. package/packs/core/manifest.json +24 -0
  81. package/packs/ops/decision-recovery/instructions.md +65 -0
  82. package/packs/ops/decision-recovery/pack.yaml +89 -0
  83. package/dist/src/cli/commands/team.js +0 -168
  84. package/dist/src/core/context/shared-context-layer.js +0 -620
  85. package/dist/src/core/context/stack-merge-resolver.js +0 -748
  86. package/dist/src/core/merge/conflict-detector.js +0 -430
  87. package/dist/src/core/merge/resolution-engine.js +0 -557
  88. package/dist/src/core/merge/stack-diff.js +0 -531
  89. package/dist/src/core/merge/unified-merge-resolver.js +0 -302
  90. package/dist/src/integrations/mcp/handlers/cord-handlers.js +0 -397
  91. package/dist/src/integrations/mcp/handlers/team-handlers.js +0 -211
  92. /package/dist/src/core/{merge → cache}/types.js +0 -0
@@ -0,0 +1,370 @@
1
+ import { fileURLToPath as __fileURLToPath } from 'url';
2
+ import { dirname as __pathDirname } from 'path';
3
+ const __filename = __fileURLToPath(import.meta.url);
4
+ const __dirname = __pathDirname(__filename);
5
+ const TOOL_ALIASES = {
6
+ // --- Context tools ---
7
+ context: "get_context",
8
+ get_ctx: "get_context",
9
+ sm_context: "get_context",
10
+ sm_get_context: "get_context",
11
+ fetch_context: "get_context",
12
+ read_context: "get_context",
13
+ record_decision: "add_decision",
14
+ log_decision: "add_decision",
15
+ save_decision: "add_decision",
16
+ sm_decision: "add_decision",
17
+ push_frame: "start_frame",
18
+ open_frame: "start_frame",
19
+ begin_frame: "start_frame",
20
+ new_frame: "start_frame",
21
+ pop_frame: "close_frame",
22
+ end_frame: "close_frame",
23
+ finish_frame: "close_frame",
24
+ anchor: "add_anchor",
25
+ sm_anchor: "add_anchor",
26
+ save_anchor: "add_anchor",
27
+ hot_stack: "get_hot_stack",
28
+ stack: "get_hot_stack",
29
+ sm_stack: "get_hot_stack",
30
+ // --- Task tools ---
31
+ new_task: "create_task",
32
+ add_task: "create_task",
33
+ sm_task: "create_task",
34
+ sm_create_task: "create_task",
35
+ update_task: "update_task_status",
36
+ set_task_status: "update_task_status",
37
+ task_update: "update_task_status",
38
+ list_tasks: "get_active_tasks",
39
+ tasks: "get_active_tasks",
40
+ sm_tasks: "get_active_tasks",
41
+ active_tasks: "get_active_tasks",
42
+ task_metrics: "get_task_metrics",
43
+ metrics: "get_task_metrics",
44
+ // --- Search & Discovery ---
45
+ sm_context_search: "sm_search",
46
+ search: "sm_search",
47
+ context_search: "sm_search",
48
+ sm_find: "sm_search",
49
+ find: "sm_search",
50
+ discover: "sm_discover",
51
+ sm_explore: "sm_discover",
52
+ explore: "sm_discover",
53
+ related: "sm_related_files",
54
+ find_related: "sm_related_files",
55
+ session_summary: "sm_session_summary",
56
+ summary: "sm_session_summary",
57
+ // --- Save/Load context (old MCP server) ---
58
+ sm_save: "save_context",
59
+ sm_context_save: "save_context",
60
+ store_context: "save_context",
61
+ sm_load: "load_context",
62
+ sm_context_load: "load_context",
63
+ retrieve_context: "load_context",
64
+ // --- Linear tools ---
65
+ linear_issues: "linear_get_tasks",
66
+ linear_list: "linear_get_tasks",
67
+ get_linear_tasks: "linear_get_tasks",
68
+ linear_update: "linear_update_task",
69
+ update_linear: "linear_update_task",
70
+ linear_comment: "linear_create_comment",
71
+ comment_on_issue: "linear_create_comment",
72
+ linear_comments: "linear_list_comments",
73
+ // --- Trace tools ---
74
+ traces: "get_traces",
75
+ sm_traces: "get_traces",
76
+ list_traces: "get_traces",
77
+ trace_stats: "get_trace_statistics",
78
+ trace_statistics: "get_trace_statistics",
79
+ // --- Smart context ---
80
+ smart: "smart_context",
81
+ sm_smart: "smart_context",
82
+ intelligent_context: "smart_context",
83
+ sm_summary: "get_summary",
84
+ project_summary: "get_summary",
85
+ // --- Planning tools ---
86
+ plan: "plan_only",
87
+ generate_plan: "plan_only",
88
+ sm_plan: "plan_only",
89
+ codex: "call_codex",
90
+ run_codex: "call_codex",
91
+ claude: "call_claude",
92
+ ask_claude: "call_claude",
93
+ gate: "plan_gate",
94
+ plan_and_gate: "plan_gate",
95
+ approve: "approve_plan",
96
+ execute_plan: "approve_plan",
97
+ // --- Pending tools ---
98
+ pending: "pending_list",
99
+ list_pending: "pending_list",
100
+ clear_pending: "pending_clear",
101
+ show_pending: "pending_show",
102
+ // --- Edit tools ---
103
+ fuzzy_edit: "sm_edit",
104
+ edit: "sm_edit",
105
+ sm_fuzzy_edit: "sm_edit",
106
+ // --- DiffMem tools ---
107
+ user_context: "diffmem_get_user_context",
108
+ get_user_context: "diffmem_get_user_context",
109
+ user_memory: "diffmem_get_user_context",
110
+ store_learning: "diffmem_store_learning",
111
+ learn: "diffmem_store_learning",
112
+ remember: "diffmem_store_learning",
113
+ memory_search: "diffmem_search",
114
+ search_memory: "diffmem_search",
115
+ diffmem: "diffmem_status",
116
+ memory_status: "diffmem_status",
117
+ // --- Digest tools ---
118
+ digest: "sm_digest",
119
+ activity_digest: "sm_digest",
120
+ daily_digest: "sm_digest",
121
+ // --- Desire paths ---
122
+ desire_paths: "sm_desire_paths",
123
+ desires: "sm_desire_paths",
124
+ failed_tools: "sm_desire_paths",
125
+ // --- Provider tools ---
126
+ delegate: "delegate_to_model",
127
+ route: "delegate_to_model",
128
+ send_to_model: "delegate_to_model",
129
+ batch: "batch_submit",
130
+ submit_batch: "batch_submit",
131
+ check_batch: "batch_check",
132
+ batch_status: "batch_check",
133
+ // --- Greptile tools ---
134
+ pr_comments: "greptile_pr_comments",
135
+ review_comments: "greptile_pr_comments",
136
+ pr_details: "greptile_pr_details",
137
+ pr_info: "greptile_pr_details",
138
+ list_prs: "greptile_list_prs",
139
+ prs: "greptile_list_prs",
140
+ trigger_review: "greptile_trigger_review",
141
+ review_pr: "greptile_trigger_review",
142
+ search_patterns: "greptile_search_patterns",
143
+ patterns: "greptile_search_patterns",
144
+ create_pattern: "greptile_create_pattern",
145
+ add_pattern: "greptile_create_pattern",
146
+ greptile: "greptile_status",
147
+ // --- Provenant tools ---
148
+ decision_search: "provenant_search",
149
+ search_decisions: "provenant_search",
150
+ log_decision_graph: "provenant_log",
151
+ decision_log: "provenant_log",
152
+ decision_status: "provenant_status",
153
+ graph_status: "provenant_status",
154
+ contradictions: "provenant_contradictions",
155
+ conflicts: "provenant_contradictions",
156
+ resolve: "provenant_resolve",
157
+ resolve_contradiction: "provenant_resolve"
158
+ };
159
+ const PARAM_ALIASES = {
160
+ // Agents often send `query` for search-like tools
161
+ sm_search: {
162
+ search_term: "query",
163
+ search: "query",
164
+ text: "query",
165
+ q: "query",
166
+ max: "limit",
167
+ max_results: "limit",
168
+ count: "limit"
169
+ },
170
+ sm_discover: {
171
+ search: "query",
172
+ q: "query",
173
+ search_query: "query",
174
+ max: "maxFiles",
175
+ max_files: "maxFiles",
176
+ limit: "maxFiles",
177
+ include: "includePatterns",
178
+ exclude: "excludePatterns"
179
+ },
180
+ get_context: {
181
+ search: "query",
182
+ q: "query",
183
+ text: "query",
184
+ max: "limit",
185
+ max_results: "limit",
186
+ count: "limit"
187
+ },
188
+ smart_context: {
189
+ search: "query",
190
+ q: "query",
191
+ tokens: "tokenBudget",
192
+ token_budget: "tokenBudget",
193
+ max_tokens: "tokenBudget",
194
+ budget: "tokenBudget",
195
+ refresh: "forceRefresh",
196
+ force: "forceRefresh"
197
+ },
198
+ get_active_tasks: {
199
+ state: "status",
200
+ max: "limit",
201
+ max_results: "limit",
202
+ count: "limit",
203
+ query: "search",
204
+ q: "search"
205
+ },
206
+ linear_get_tasks: {
207
+ status: "state",
208
+ max: "limit",
209
+ max_results: "limit",
210
+ count: "limit",
211
+ q: "search",
212
+ query: "search",
213
+ team: "team_id",
214
+ assignee: "assignee_id"
215
+ },
216
+ add_decision: {
217
+ text: "content",
218
+ decision: "content",
219
+ value: "content",
220
+ kind: "type",
221
+ category: "type"
222
+ },
223
+ add_anchor: {
224
+ content: "text",
225
+ value: "text",
226
+ anchor: "text",
227
+ kind: "type",
228
+ category: "type",
229
+ importance: "priority",
230
+ weight: "priority"
231
+ },
232
+ start_frame: {
233
+ title: "name",
234
+ goal: "name",
235
+ label: "name",
236
+ kind: "type",
237
+ frame_type: "type"
238
+ },
239
+ create_task: {
240
+ name: "title",
241
+ goal: "title",
242
+ label: "title",
243
+ desc: "description",
244
+ detail: "description",
245
+ details: "description"
246
+ },
247
+ sm_desire_paths: {
248
+ type: "category",
249
+ kind: "category",
250
+ max: "limit",
251
+ max_results: "limit",
252
+ lookback: "days",
253
+ period: "days"
254
+ },
255
+ delegate_to_model: {
256
+ text: "prompt",
257
+ message: "prompt",
258
+ input: "prompt",
259
+ tokens: "maxTokens",
260
+ max_tokens: "maxTokens",
261
+ temp: "temperature",
262
+ task: "taskType",
263
+ task_type: "taskType"
264
+ },
265
+ provenant_search: {
266
+ text: "query",
267
+ search: "query",
268
+ q: "query",
269
+ max: "limit",
270
+ max_results: "limit",
271
+ from: "since",
272
+ after: "since",
273
+ by: "actor",
274
+ who: "actor"
275
+ },
276
+ provenant_log: {
277
+ decision: "content",
278
+ text: "content",
279
+ value: "content",
280
+ by: "actor",
281
+ who: "actor",
282
+ why: "reasoning",
283
+ reason: "reasoning",
284
+ rationale: "reasoning"
285
+ },
286
+ diffmem_store_learning: {
287
+ insight: "content",
288
+ text: "content",
289
+ value: "content",
290
+ type: "category",
291
+ kind: "category"
292
+ },
293
+ diffmem_search: {
294
+ text: "query",
295
+ search: "query",
296
+ q: "query",
297
+ max: "limit",
298
+ max_results: "limit",
299
+ time: "timeRange",
300
+ range: "timeRange",
301
+ time_range: "timeRange",
302
+ min_confidence: "minConfidence",
303
+ threshold: "minConfidence"
304
+ },
305
+ sm_edit: {
306
+ path: "file_path",
307
+ file: "file_path",
308
+ find: "old_string",
309
+ search: "old_string",
310
+ replace: "new_string",
311
+ replacement: "new_string"
312
+ },
313
+ sm_digest: {
314
+ time: "period",
315
+ range: "period",
316
+ timeframe: "period"
317
+ },
318
+ get_summary: {
319
+ refresh: "forceRefresh",
320
+ force: "forceRefresh"
321
+ }
322
+ };
323
+ function resolveToolAlias(name) {
324
+ const alias = TOOL_ALIASES[name];
325
+ if (alias) {
326
+ return { canonicalName: alias, wasAlias: true, originalName: name };
327
+ }
328
+ return { canonicalName: name, wasAlias: false, originalName: name };
329
+ }
330
+ function resolveParamAliases(toolName, params) {
331
+ const aliases = PARAM_ALIASES[toolName];
332
+ if (!aliases) {
333
+ return { resolvedParams: { ...params }, renames: {} };
334
+ }
335
+ const resolved = {};
336
+ const renames = {};
337
+ for (const [key, value] of Object.entries(params)) {
338
+ if (!aliases[key]) {
339
+ resolved[key] = value;
340
+ }
341
+ }
342
+ for (const [key, value] of Object.entries(params)) {
343
+ const canonicalKey = aliases[key];
344
+ if (canonicalKey && !(canonicalKey in resolved)) {
345
+ resolved[canonicalKey] = value;
346
+ renames[key] = canonicalKey;
347
+ }
348
+ }
349
+ return { resolvedParams: resolved, renames };
350
+ }
351
+ function getAliasesForTool(canonicalName) {
352
+ return Object.entries(TOOL_ALIASES).filter(([, target]) => target === canonicalName).map(([alias]) => alias);
353
+ }
354
+ function getToolsWithAliases() {
355
+ return Array.from(new Set(Object.values(TOOL_ALIASES)));
356
+ }
357
+ function getAliasRegistry() {
358
+ return TOOL_ALIASES;
359
+ }
360
+ function getParamAliasRegistry() {
361
+ return PARAM_ALIASES;
362
+ }
363
+ export {
364
+ getAliasRegistry,
365
+ getAliasesForTool,
366
+ getParamAliasRegistry,
367
+ getToolsWithAliases,
368
+ resolveParamAliases,
369
+ resolveToolAlias
370
+ };