@stackmemoryai/stackmemory 1.10.5 → 1.14.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 (225) hide show
  1. package/LICENSE +131 -64
  2. package/README.md +107 -24
  3. package/bin/claude-sm +16 -1
  4. package/bin/claude-smd +16 -1
  5. package/bin/codex-smd +16 -1
  6. package/bin/gemini-sm +16 -1
  7. package/bin/hermes-sm +21 -0
  8. package/bin/hermes-smd +21 -0
  9. package/bin/opencode-sm +16 -1
  10. package/dist/src/cli/claude-sm.js +266 -84
  11. package/dist/src/cli/codex-sm.js +225 -33
  12. package/dist/src/cli/commands/bench.js +209 -2
  13. package/dist/src/cli/commands/brain.js +206 -0
  14. package/dist/src/cli/commands/cache.js +126 -0
  15. package/dist/src/cli/commands/company-os.js +184 -0
  16. package/dist/src/cli/commands/context.js +5 -0
  17. package/dist/src/cli/commands/daemon.js +41 -0
  18. package/dist/src/cli/commands/handoff.js +40 -9
  19. package/dist/src/cli/commands/onboard.js +70 -3
  20. package/dist/src/cli/commands/operator.js +127 -0
  21. package/dist/src/cli/commands/optimize.js +117 -0
  22. package/dist/src/cli/commands/orchestrate.js +232 -5
  23. package/dist/src/cli/commands/orchestrator.js +315 -26
  24. package/dist/src/cli/commands/pack.js +322 -0
  25. package/dist/src/cli/commands/patterns.js +254 -0
  26. package/dist/src/cli/commands/portal.js +161 -0
  27. package/dist/src/cli/commands/scaffold.js +92 -0
  28. package/dist/src/cli/commands/search.js +40 -1
  29. package/dist/src/cli/commands/setup.js +178 -11
  30. package/dist/src/cli/commands/skills.js +10 -1
  31. package/dist/src/cli/commands/state.js +265 -0
  32. package/dist/src/cli/commands/sync.js +253 -0
  33. package/dist/src/cli/commands/tasks.js +130 -1
  34. package/dist/src/cli/commands/vision.js +221 -0
  35. package/dist/src/cli/gemini-sm.js +19 -29
  36. package/dist/src/cli/hermes-sm.js +224 -0
  37. package/dist/src/cli/index.js +105 -39
  38. package/dist/src/cli/opencode-sm.js +38 -21
  39. package/dist/src/cli/utils/determinism-watcher.js +66 -0
  40. package/dist/src/cli/utils/real-cli-bin.js +116 -0
  41. package/dist/src/core/brain/brain-store.js +187 -0
  42. package/dist/src/core/brain/brain-sync.js +193 -0
  43. package/dist/src/core/brain/index.js +78 -0
  44. package/dist/src/core/brain/types.js +10 -0
  45. package/dist/src/core/cache/content-cache.js +238 -0
  46. package/dist/src/{integrations/diffmem → core/cache}/index.js +5 -5
  47. package/dist/src/core/cache/token-estimator.js +39 -0
  48. package/dist/src/core/config/feature-flags.js +2 -6
  49. package/dist/src/core/context/frame-database.js +79 -27
  50. package/dist/src/core/context/recursive-context-manager.js +1 -1
  51. package/dist/src/core/context/rehydration.js +2 -1
  52. package/dist/src/core/cross-search/cross-project-search.js +269 -0
  53. package/dist/src/core/cross-search/index.js +10 -0
  54. package/dist/src/core/database/sqlite-adapter.js +14 -84
  55. package/dist/src/core/extensions/provider-adapter.js +5 -0
  56. package/dist/src/core/models/model-router.js +54 -2
  57. package/dist/src/core/models/provider-pricing.js +58 -4
  58. package/dist/src/core/monitoring/logger.js +2 -1
  59. package/dist/src/core/optimization/trace-optimizer.js +413 -0
  60. package/dist/src/core/patterns/index.js +22 -0
  61. package/dist/src/core/patterns/pattern-applier.js +39 -0
  62. package/dist/src/core/patterns/pattern-observer.js +157 -0
  63. package/dist/src/core/patterns/pattern-store.js +259 -0
  64. package/dist/src/core/patterns/types.js +19 -0
  65. package/dist/src/core/provenance/confidence-scorer.js +128 -0
  66. package/dist/src/core/provenance/index.js +40 -0
  67. package/dist/src/core/provenance/provenance-store.js +194 -0
  68. package/dist/src/core/provenance/types.js +82 -0
  69. package/dist/src/core/retrieval/llm-context-retrieval.js +5 -4
  70. package/dist/src/core/retrieval/unified-context-assembler.js +11 -66
  71. package/dist/src/core/session/project-handoff.js +64 -0
  72. package/dist/src/core/session/session-manager.js +28 -0
  73. package/dist/src/core/shared-state/canonical-store.js +564 -0
  74. package/dist/src/core/skill-packs/index.js +18 -0
  75. package/dist/src/core/skill-packs/parser.js +42 -0
  76. package/dist/src/core/skill-packs/registry.js +224 -0
  77. package/dist/src/core/skill-packs/types.js +79 -0
  78. package/dist/src/core/storage/cloud-sync-manager.js +116 -0
  79. package/dist/src/core/storage/cloud-sync.js +574 -0
  80. package/dist/src/core/storage/two-tier-storage.js +5 -1
  81. package/dist/src/core/tasks/master-tasks-template.js +43 -0
  82. package/dist/src/core/tasks/md-task-parser.js +138 -0
  83. package/dist/src/core/trace/trace-event-store.js +282 -0
  84. package/dist/src/core/vision/index.js +27 -0
  85. package/dist/src/core/vision/signals.js +79 -0
  86. package/dist/src/core/vision/types.js +22 -0
  87. package/dist/src/core/vision/vision-file.js +146 -0
  88. package/dist/src/core/vision/vision-loop.js +220 -0
  89. package/dist/src/core/wiki/wiki-compiler.js +103 -1
  90. package/dist/src/daemon/daemon-config.js +52 -0
  91. package/dist/src/daemon/services/desire-path-service.js +566 -0
  92. package/dist/src/daemon/services/github-service.js +126 -0
  93. package/dist/src/daemon/services/research-stream-service.js +320 -0
  94. package/dist/src/daemon/services/telemetry-service.js +192 -0
  95. package/dist/src/daemon/unified-daemon.js +58 -1
  96. package/dist/src/features/browser/cli-browser-agent.js +417 -0
  97. package/dist/src/features/browser/stagehand-workflows.js +578 -0
  98. package/dist/src/features/operator/adapter-factory.js +62 -0
  99. package/dist/src/features/operator/browser-adapter.js +109 -0
  100. package/dist/src/features/operator/desktop-adapter.js +125 -0
  101. package/dist/src/features/operator/index.js +39 -0
  102. package/dist/src/features/operator/llm-decision.js +137 -0
  103. package/dist/src/features/operator/operator-logger.js +92 -0
  104. package/dist/src/features/operator/overnight-runner.js +327 -0
  105. package/dist/src/features/operator/screen-adapter.js +91 -0
  106. package/dist/src/features/operator/session-manager.js +127 -0
  107. package/dist/src/features/operator/state-machine.js +227 -0
  108. package/dist/src/features/operator/task-queue.js +81 -0
  109. package/dist/src/features/portal/index.js +26 -0
  110. package/dist/src/features/portal/server.js +240 -0
  111. package/dist/src/features/portal/types.js +14 -0
  112. package/dist/src/features/portal/ui.js +195 -0
  113. package/dist/src/features/sweep/pty-wrapper.js +13 -5
  114. package/dist/src/features/tasks/task-aware-context.js +2 -1
  115. package/dist/src/features/tui/simple-monitor.js +0 -23
  116. package/dist/src/features/tui/swarm-monitor.js +8 -66
  117. package/dist/src/features/web/client/hooks/use-socket.js +12 -0
  118. package/dist/src/{core/merge/index.js → features/web/client/lib/utils.js} +8 -4
  119. package/dist/src/features/web/client/next-env.d.js +4 -0
  120. package/dist/src/features/web/client/stores/session-store.js +12 -0
  121. package/dist/src/features/web/server/gcp-billing.js +76 -0
  122. package/dist/src/features/web/server/index.js +10 -0
  123. package/dist/src/features/web/server/spend-calculator.js +228 -0
  124. package/dist/src/hooks/schemas.js +6 -1
  125. package/dist/src/integrations/anthropic/client.js +3 -2
  126. package/dist/src/integrations/claude-code/agent-bridge.js +0 -3
  127. package/dist/src/integrations/claude-code/subagent-client.js +307 -11
  128. package/dist/src/integrations/claude-code/task-coordinator.js +2 -1
  129. package/dist/src/integrations/github/pr-state.js +158 -0
  130. package/dist/src/integrations/linear/client.js +4 -1
  131. package/dist/src/integrations/linear/webhook-retry.js +196 -0
  132. package/dist/src/integrations/linear/webhook-server.js +18 -22
  133. package/dist/src/integrations/mcp/handlers/cloud-sync-handlers.js +101 -0
  134. package/dist/src/integrations/mcp/handlers/index.js +40 -84
  135. package/dist/src/integrations/mcp/server.js +542 -641
  136. package/dist/src/integrations/mcp/tool-alias-registry.js +297 -0
  137. package/dist/src/integrations/mcp/tool-definitions.js +152 -682
  138. package/dist/src/mcp/stackmemory-mcp-server.js +571 -231
  139. package/dist/src/orchestrators/multimodal/determinism.js +244 -0
  140. package/dist/src/orchestrators/multimodal/harness.js +149 -78
  141. package/dist/src/orchestrators/multimodal/providers.js +44 -3
  142. package/dist/src/skills/recursive-agent-orchestrator.js +2 -4
  143. package/dist/src/utils/hook-installer.js +0 -8
  144. package/dist/src/utils/process-cleanup.js +1 -7
  145. package/docs/README.md +42 -0
  146. package/docs/guides/README_INSTALL.md +208 -0
  147. package/package.json +27 -9
  148. package/packs/coding/python-fastapi/instructions.md +60 -0
  149. package/packs/coding/python-fastapi/pack.yaml +28 -0
  150. package/packs/coding/typescript-react/instructions.md +47 -0
  151. package/packs/coding/typescript-react/pack.yaml +28 -0
  152. package/packs/core/commands/capture.md +32 -0
  153. package/packs/core/commands/learn.md +73 -0
  154. package/packs/core/commands/next.md +36 -0
  155. package/packs/core/commands/restart.md +58 -0
  156. package/packs/core/commands/restore.md +29 -0
  157. package/packs/core/commands/start.md +57 -0
  158. package/packs/core/commands/stop.md +65 -0
  159. package/packs/core/commands/summary.md +40 -0
  160. package/packs/core/manifest.json +24 -0
  161. package/packs/ops/decision-recovery/instructions.md +65 -0
  162. package/packs/ops/decision-recovery/pack.yaml +89 -0
  163. package/scripts/claude-code-wrapper.sh +11 -0
  164. package/scripts/claude-sm-setup.sh +12 -1
  165. package/scripts/codex-wrapper.sh +11 -0
  166. package/scripts/git-hooks/branch-context-manager.sh +11 -0
  167. package/scripts/git-hooks/post-checkout-stackmemory.sh +11 -0
  168. package/scripts/git-hooks/post-commit-stackmemory.sh +11 -0
  169. package/scripts/git-hooks/pre-commit-stackmemory.sh +11 -0
  170. package/scripts/hooks/cleanup-shell.sh +12 -1
  171. package/scripts/hooks/task-complete.sh +12 -1
  172. package/scripts/install-code-execution-hooks.sh +12 -1
  173. package/scripts/install-sweep-hook.sh +12 -0
  174. package/scripts/install.sh +11 -0
  175. package/scripts/opencode-wrapper.sh +11 -0
  176. package/scripts/portal/cloud-init.yaml +69 -0
  177. package/scripts/portal/setup.sh +69 -0
  178. package/scripts/portal/stackmemory-portal.service +34 -0
  179. package/scripts/setup-claude-integration.sh +12 -1
  180. package/scripts/smoke-init-db.sh +23 -0
  181. package/scripts/stackmemory-daemon.sh +11 -0
  182. package/scripts/verify-dist.cjs +11 -4
  183. package/dist/src/cli/commands/ralph.js +0 -1053
  184. package/dist/src/cli/commands/team.js +0 -168
  185. package/dist/src/core/context/shared-context-layer.js +0 -620
  186. package/dist/src/core/context/stack-merge-resolver.js +0 -748
  187. package/dist/src/core/merge/conflict-detector.js +0 -430
  188. package/dist/src/core/merge/resolution-engine.js +0 -557
  189. package/dist/src/core/merge/stack-diff.js +0 -531
  190. package/dist/src/core/merge/unified-merge-resolver.js +0 -302
  191. package/dist/src/hooks/diffmem-hooks.js +0 -376
  192. package/dist/src/integrations/diffmem/client.js +0 -208
  193. package/dist/src/integrations/diffmem/config.js +0 -14
  194. package/dist/src/integrations/greptile/client.js +0 -101
  195. package/dist/src/integrations/greptile/config.js +0 -14
  196. package/dist/src/integrations/greptile/index.js +0 -11
  197. package/dist/src/integrations/mcp/handlers/cord-handlers.js +0 -397
  198. package/dist/src/integrations/mcp/handlers/diffmem-handlers.js +0 -455
  199. package/dist/src/integrations/mcp/handlers/greptile-handlers.js +0 -456
  200. package/dist/src/integrations/mcp/handlers/provider-handlers.js +0 -227
  201. package/dist/src/integrations/mcp/handlers/team-handlers.js +0 -211
  202. package/dist/src/integrations/ralph/bridge/ralph-stackmemory-bridge.js +0 -863
  203. package/dist/src/integrations/ralph/context/context-budget-manager.js +0 -308
  204. package/dist/src/integrations/ralph/context/stackmemory-context-loader.js +0 -391
  205. package/dist/src/integrations/ralph/index.js +0 -17
  206. package/dist/src/integrations/ralph/learning/pattern-learner.js +0 -435
  207. package/dist/src/integrations/ralph/lifecycle/iteration-lifecycle.js +0 -448
  208. package/dist/src/integrations/ralph/loopmax.js +0 -488
  209. package/dist/src/integrations/ralph/monitoring/swarm-dashboard.js +0 -293
  210. package/dist/src/integrations/ralph/monitoring/swarm-registry.js +0 -107
  211. package/dist/src/integrations/ralph/orchestration/multi-loop-orchestrator.js +0 -508
  212. package/dist/src/integrations/ralph/patterns/compounding-engineering-pattern.js +0 -407
  213. package/dist/src/integrations/ralph/patterns/extended-coherence-sessions.js +0 -495
  214. package/dist/src/integrations/ralph/patterns/oracle-worker-pattern.js +0 -387
  215. package/dist/src/integrations/ralph/performance/performance-optimizer.js +0 -357
  216. package/dist/src/integrations/ralph/recovery/crash-recovery.js +0 -461
  217. package/dist/src/integrations/ralph/state/state-reconciler.js +0 -420
  218. package/dist/src/integrations/ralph/swarm/git-workflow-manager.js +0 -444
  219. package/dist/src/integrations/ralph/swarm/swarm-coordinator.js +0 -1007
  220. package/dist/src/integrations/ralph/visualization/ralph-debugger.js +0 -635
  221. package/scripts/ralph-loop-implementation.js +0 -404
  222. /package/dist/src/core/{merge → cache}/types.js +0 -0
  223. /package/dist/src/{integrations/diffmem/types.js → core/storage/cloud-sync-types.js} +0 -0
  224. /package/dist/src/{integrations/greptile/types.js → core/trace/trace-event.js} +0 -0
  225. /package/dist/src/{integrations/ralph → features/operator}/types.js +0 -0
package/docs/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # StackMemory Documentation
2
+
3
+ ## Quick Start
4
+
5
+ - **[Setup Guide](SETUP.md)** - Installation, Railway deployment, Linear/Claude integration
6
+ - **[Features](FEATURES.md)** - Context persistence, TUI, storage, browser testing
7
+ - **[Development](DEVELOPMENT.md)** - Testing, architecture, quality gates, security
8
+ - **[API Reference](API_REFERENCE.md)** - Commands, MCP tools, REST endpoints
9
+
10
+ ## Core Documents
11
+
12
+ - **[SPEC.md](SPEC.md)** - Technical specification and system architecture
13
+ - **[AGENTS.md](AGENTS.md)** - Agent system and skill management
14
+ - **[BM25+RLM Search](BM25-RLM-10DAY-FINAL.md)** - Next-gen code search (10-day implementation)
15
+
16
+ ## Specialized Areas
17
+
18
+ ### Architecture
19
+ - [Technical Architecture](architecture/TECHNICAL_ARCHITECTURE.md) - System design patterns
20
+ - [Deployment](architecture/DEPLOYMENT.md) - Infrastructure and scaling
21
+ - [Multi-Project Support](architecture/MULTI_PROJECT.md) - Project isolation
22
+
23
+ ### Integrations
24
+ - [Linear Integration](integrations/) - Task management sync
25
+ - [Browser MCP](integrations/) - Web testing capabilities
26
+ - [Database Migration](postgres-migration-plan.md) - PostgreSQL transition
27
+
28
+ ### Development
29
+ - [Session Persistence](session-persistence-design.md) - Context survival design
30
+ - [Query Language](query-language.md) - Context query syntax
31
+ - [Testing Agent](testing-agent.md) - Automated testing framework
32
+
33
+ ## Archives
34
+ Historical documentation in [archives/](archives/) - implementation summaries, security reports, migration guides.
35
+
36
+ ## Documentation Standards
37
+
38
+ - Technical accuracy over marketing language
39
+ - Real metrics and benchmarks
40
+ - Practical code examples
41
+ - Version-specific information
42
+ - Clear troubleshooting guides
@@ -0,0 +1,208 @@
1
+ # 🚀 StackMemory Quick Installation
2
+
3
+ ## One-Command Install (Global for ALL Claude Instances)
4
+
5
+ ```bash
6
+ # Clone and install globally
7
+ git clone https://github.com/yourusername/stackmemory.git
8
+ cd stackmemory
9
+ ./install.sh
10
+ ```
11
+
12
+ **That's it!** StackMemory is now available in:
13
+ - ✅ ALL Claude Code instances
14
+ - ✅ ANY git repository
15
+ - ✅ Automatically starts with Claude
16
+
17
+ ---
18
+
19
+ ## 🎯 What the Installer Does
20
+
21
+ 1. **Installs globally** to `~/.stackmemory`
22
+ 2. **Configures Claude Code** MCP automatically
23
+ 3. **Creates `stackmemory` command** available everywhere
24
+ 4. **Auto-detects** git repositories
25
+ 5. **No manual configuration needed**
26
+
27
+ ---
28
+
29
+ ## 📝 After Installation
30
+
31
+ ### Restart Claude Code
32
+ Close and reopen Claude Code to load the MCP server.
33
+
34
+ ### Test It Works
35
+ In Claude Code, ask:
36
+ - "What's the project context?"
37
+ - "Add decision: We're using PostgreSQL"
38
+ - "Start task: Implementing authentication"
39
+
40
+ ### Use in Any Git Repo
41
+ ```bash
42
+ cd your-project
43
+ stackmemory init # One-time setup
44
+ stackmemory status # Check what's stored
45
+ stackmemory test # Run quality tests
46
+ ```
47
+
48
+ ---
49
+
50
+ ## 🔧 Manual Installation (Alternative)
51
+
52
+ If the installer doesn't work, manually configure:
53
+
54
+ ### 1. Find your Claude config directory:
55
+ - **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
56
+ - **Linux**: `~/.config/claude/claude_desktop_config.json`
57
+
58
+ ### 2. Add this configuration:
59
+ ```json
60
+ {
61
+ "mcpServers": {
62
+ "stackmemory": {
63
+ "command": "node",
64
+ "args": ["/path/to/stackmemory/dist/src/mcp-server.js"],
65
+ "env": {
66
+ "STACKMEMORY_GLOBAL": "true"
67
+ }
68
+ }
69
+ }
70
+ }
71
+ ```
72
+
73
+ ### 3. Build StackMemory:
74
+ ```bash
75
+ cd stackmemory
76
+ npm install
77
+ npm run build
78
+ ```
79
+
80
+ ### 4. Restart Claude Code
81
+
82
+ ---
83
+
84
+ ## 🧪 Test Suite
85
+
86
+ Run the test to verify context quality:
87
+
88
+ ```bash
89
+ # In any project with StackMemory initialized
90
+ stackmemory test
91
+ ```
92
+
93
+ This will:
94
+ - Simulate multiple sessions
95
+ - Test context recall accuracy
96
+ - Measure relevance over time
97
+ - Generate performance report
98
+ - Export CSV with detailed metrics
99
+
100
+ ### Reading Test Results
101
+
102
+ ```
103
+ 📊 Test Results Summary
104
+
105
+ Overall Performance:
106
+ Recall Accuracy: ████████░░ 82.3%
107
+ Context Relevance: ██████░░░░ 61.5%
108
+ Importance Stability: ████████░░ 85.2%
109
+ Avg Response Time: 15ms
110
+
111
+ Learning Curve:
112
+ Session 1→2: 📈 +15.2% improvement
113
+ Session 2→3: 📈 +8.7% improvement
114
+ ```
115
+
116
+ ---
117
+
118
+ ## 🌍 Global Commands
119
+
120
+ Once installed, these commands work anywhere:
121
+
122
+ | Command | Description |
123
+ |---------|-------------|
124
+ | `stackmemory` | Start MCP server in current directory |
125
+ | `stackmemory init` | Initialize in current git repo |
126
+ | `stackmemory status` | Show stored contexts and metrics |
127
+ | `stackmemory test` | Run quality test suite |
128
+
129
+ ---
130
+
131
+ ## 🔍 Verify Installation
132
+
133
+ Check if properly installed:
134
+
135
+ ```bash
136
+ # Check command exists
137
+ which stackmemory
138
+
139
+ # Check Claude config
140
+ cat ~/Library/Application\ Support/Claude/claude_desktop_config.json | grep stackmemory
141
+
142
+ # Test in a git repo
143
+ cd any-git-repo
144
+ stackmemory init
145
+ stackmemory status
146
+ ```
147
+
148
+ ---
149
+
150
+ ## ⚡ Performance Metrics
151
+
152
+ After a week of usage, check metrics:
153
+
154
+ ```bash
155
+ stackmemory status
156
+ ```
157
+
158
+ You'll see:
159
+ - **Top contexts by importance** (what matters most)
160
+ - **Access patterns** (what's used frequently)
161
+ - **Attention scores** (what influences responses)
162
+ - **Decay indicators** (what's becoming stale)
163
+
164
+ ---
165
+
166
+ ## 🐛 Troubleshooting
167
+
168
+ ### Claude Code doesn't see StackMemory
169
+ 1. Check config file location
170
+ 2. Restart Claude Code completely
171
+ 3. Check logs: `tail -f /tmp/stackmemory.log`
172
+
173
+ ### Command not found
174
+ ```bash
175
+ export PATH="$HOME/.local/bin:$PATH"
176
+ source ~/.bashrc
177
+ ```
178
+
179
+ ### Permission denied
180
+ ```bash
181
+ chmod +x ~/.local/bin/stackmemory
182
+ ```
183
+
184
+ ---
185
+
186
+ ## 📊 Monitoring Context Quality
187
+
188
+ The system tracks:
189
+ - **Recall accuracy**: Can it remember decisions?
190
+ - **Relevance**: Is retrieved context useful?
191
+ - **Learning rate**: Does it improve over time?
192
+
193
+ View metrics:
194
+ ```bash
195
+ sqlite3 ~/.stackmemory/attention.db "SELECT * FROM learned_importance ORDER BY importance DESC LIMIT 10;"
196
+ ```
197
+
198
+ ---
199
+
200
+ ## 🚀 That's It!
201
+
202
+ StackMemory is now running globally across all your Claude Code instances. It will:
203
+ - ✅ Learn what context matters
204
+ - ✅ Improve over time
205
+ - ✅ Work in every git repository
206
+ - ✅ Share context across sessions
207
+
208
+ No further configuration needed!
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stackmemoryai/stackmemory",
3
- "version": "1.10.5",
4
- "description": "Lossless, project-scoped memory for AI coding tools. Durable context across sessions with 56 MCP tools, FTS5 search, conductor orchestrator, loop/watch monitoring, snapshot capture, pre-flight overlap checks, Claude/Codex/OpenCode wrappers, Linear sync, and automatic hooks.",
3
+ "version": "1.14.0",
4
+ "description": "Lossless, project-scoped memory for AI coding tools. Durable context across sessions with MCP tools, FTS5 search, cloud sync, trace optimization, Claude/Codex/OpenCode/Gemini wrappers, skill packs, and automatic hooks.",
5
5
  "engines": {
6
6
  "node": ">=20.0.0",
7
7
  "npm": ">=10.0.0"
@@ -15,13 +15,16 @@
15
15
  "claude-sm": "bin/claude-sm",
16
16
  "claude-smd": "bin/claude-smd",
17
17
  "opencode-sm": "bin/opencode-sm",
18
- "gemini-sm": "bin/gemini-sm"
18
+ "gemini-sm": "bin/gemini-sm",
19
+ "hermes-sm": "bin/hermes-sm",
20
+ "hermes-smd": "bin/hermes-smd"
19
21
  },
20
22
  "files": [
21
23
  "bin",
22
24
  "dist/src",
23
25
  "scripts/git-hooks",
24
26
  "scripts/hooks",
27
+ "scripts/portal",
25
28
  "scripts/setup",
26
29
  "scripts/setup.sh",
27
30
  "scripts/install.sh",
@@ -39,12 +42,13 @@
39
42
  "scripts/codex-wrapper.sh",
40
43
  "scripts/opencode-wrapper.sh",
41
44
  "scripts/stackmemory-daemon.sh",
42
- "scripts/ralph-loop-implementation.js",
43
45
  "scripts/setup-claude-integration.sh",
44
46
  "scripts/setup-claude-integration.js",
45
47
  "scripts/verify-dist.cjs",
46
48
  "scripts/smoke-init-db.sh",
47
49
  "templates",
50
+ "packs",
51
+ "docs/guides/README_INSTALL.md",
48
52
  "README.md",
49
53
  "LICENSE"
50
54
  ],
@@ -57,7 +61,7 @@
57
61
  "url": "https://github.com/stackmemoryai/stackmemory/issues"
58
62
  },
59
63
  "author": "StackMemory AI",
60
- "license": "BUSL-1.1",
64
+ "license": "PolyForm-Noncommercial-1.0.0",
61
65
  "publishConfig": {
62
66
  "access": "public"
63
67
  },
@@ -114,6 +118,11 @@
114
118
  "test:run": "vitest run",
115
119
  "test:pre-publish": "./scripts/test-pre-publish-quick.sh",
116
120
  "test:pre-commit": "vitest related --run --reporter=dot --silent --bail=1",
121
+ "determinism:smoke": "node --import tsx src/cli/index.ts bench determinism --task \"Determinism probe\" --runs 5",
122
+ "determinism:watch": "node --import tsx src/cli/index.ts bench determinism --task \"Determinism probe\" --runs 3 --watch",
123
+ "determinism:latest": "node --import tsx src/cli/index.ts bench determinism --latest --json",
124
+ "determinism:test": "npx vitest run src/orchestrators/multimodal/__tests__/determinism.test.ts --reporter=dot",
125
+ "determinism:pre-commit": "bash scripts/determinism-pre-commit.sh",
117
126
  "prepublishOnly": "npm run build && npm run verify:dist && npm run test:pre-publish",
118
127
  "quality": "npm run lint && npm run test:run && npm run build",
119
128
  "dev": "tsx watch src/integrations/mcp/server.ts",
@@ -128,14 +137,15 @@
128
137
  "daemons:stop": "node scripts/claude-sm-autostart.js stop",
129
138
  "daemon:session": "node dist/daemon/session-daemon.js",
130
139
  "daemon:session:start": "node dist/daemon/session-daemon.js --session-id",
131
- "diffmem:start": "PYTHONPATH=packages/diffmem/src packages/diffmem/.venv/bin/uvicorn diffmem.server:app --host 127.0.0.1 --port 8000",
132
- "diffmem:setup": "cd packages/diffmem && python3 -m venv .venv && .venv/bin/pip install -r requirements-server.txt -e .",
133
140
  "daemon:start": "node dist/daemon/unified-daemon.js",
134
141
  "daemon:stop": "node dist/cli/index.js daemon stop",
135
142
  "daemon:status": "node dist/cli/index.js daemon status",
136
143
  "sync:start": "node scripts/background-sync-manager.js",
137
144
  "sync:setup": "./scripts/setup-background-sync.sh",
138
145
  "eval:cord": "npx tsx scripts/evals/cord-vs-flat-eval.ts",
146
+ "gepa:eval": "node scripts/gepa/eval-phases.js",
147
+ "gepa:eval:json": "node scripts/gepa/eval-phases.js --json",
148
+ "gepa:mine": "node scripts/gepa/gold/mine-traces.js",
139
149
  "prepare": "echo 'Prepare step completed'",
140
150
  "verify:dist": "node scripts/verify-dist.cjs",
141
151
  "test:smoke-db": "bash scripts/smoke-init-db.sh",
@@ -147,6 +157,7 @@
147
157
  "@anthropic-ai/tokenizer": "^0.0.4",
148
158
  "@aws-sdk/client-s3": "^3.958.0",
149
159
  "@browsermcp/mcp": "^0.1.3",
160
+ "@google-cloud/bigquery": "^7.9.4",
150
161
  "@google-cloud/storage": "^7.18.0",
151
162
  "@linear/sdk": "^68.1.0",
152
163
  "@modelcontextprotocol/sdk": "^1.25.3",
@@ -154,7 +165,7 @@
154
165
  "@types/blessed": "^0.1.27",
155
166
  "@types/inquirer": "^9.0.9",
156
167
  "@types/pg": "^8.16.0",
157
- "better-sqlite3": "^9.6.0",
168
+ "better-sqlite3": "^12.10.0",
158
169
  "chalk": "^5.3.0",
159
170
  "cli-table3": "^0.6.5",
160
171
  "commander": "^11.1.0",
@@ -167,11 +178,13 @@
167
178
  "helmet": "^8.1.0",
168
179
  "ignore": "^7.0.5",
169
180
  "inquirer": "^9.3.8",
181
+ "js-tiktoken": "^1.0.21",
170
182
  "msgpackr": "^1.10.1",
171
183
  "node-pty": "^1.1.0",
172
184
  "open": "^11.0.0",
173
185
  "ora": "^9.0.0",
174
186
  "pg": "^8.17.1",
187
+ "raindrop-ai": "^0.1.1",
175
188
  "rate-limiter-flexible": "^9.0.1",
176
189
  "shell-escape": "^0.2.0",
177
190
  "socket.io": "^4.6.0",
@@ -209,9 +222,14 @@
209
222
  ]
210
223
  },
211
224
  "optionalDependencies": {
225
+ "@browserbasehq/stagehand": "^3.4.0",
212
226
  "@xenova/transformers": "^2.17.2",
213
227
  "blessed": "^0.1.81",
214
228
  "blessed-contrib": "^4.11.0",
215
- "chokidar": "^5.0.0"
229
+ "chokidar": "^5.0.0",
230
+ "playwright": "^1.60.0"
231
+ },
232
+ "overrides": {
233
+ "better-sqlite3": "^12.10.0"
216
234
  }
217
235
  }
@@ -0,0 +1,60 @@
1
+ # coding/python-fastapi
2
+
3
+ ## Python Conventions
4
+
5
+ - **Python 3.11+.** Use modern syntax: `match/case`, `type` aliases, `ExceptionGroup`.
6
+ - **Type hints everywhere.** All function signatures, return types, and class attributes. Use `from __future__ import annotations` for forward references.
7
+ - **Pydantic v2 for data validation.** `BaseModel` for schemas, `model_validator` for complex validation. Never use raw dicts for API I/O.
8
+ - **Async by default.** Use `async def` for route handlers and DB operations. Use `asyncio.gather` for concurrent I/O.
9
+ - **No global mutable state.** Use dependency injection via FastAPI's `Depends()`.
10
+ - **Naming.** snake_case for functions/variables. PascalCase for classes. UPPER_SNAKE for constants.
11
+
12
+ ## FastAPI Patterns
13
+
14
+ - **Router per domain.** `app/routers/users.py`, `app/routers/items.py`. Mount with `app.include_router()`.
15
+ - **Pydantic schemas for I/O.** Separate `Create`, `Update`, `Response` schemas. Never expose ORM models directly.
16
+ - **Dependency injection.** DB sessions, auth, config — all via `Depends()`. Define in `app/dependencies.py`.
17
+ - **Status codes.** Use `status.HTTP_201_CREATED` for creates, `HTTP_204_NO_CONTENT` for deletes. Raise `HTTPException` with proper codes.
18
+ - **Background tasks.** Use `BackgroundTasks` for fire-and-forget. Use Celery/ARQ for durable jobs.
19
+ - **Middleware.** CORS, request logging, error handling. Define in `app/middleware.py`.
20
+
21
+ ## Project Structure
22
+
23
+ ```
24
+ app/
25
+ main.py # FastAPI app instance + startup
26
+ core/
27
+ config.py # Settings via pydantic-settings
28
+ security.py # Auth utilities
29
+ routers/ # APIRouter modules
30
+ models/ # SQLAlchemy/SQLModel ORM models
31
+ schemas/ # Pydantic request/response models
32
+ dependencies.py # Shared Depends() callables
33
+ middleware.py # Middleware stack
34
+ tests/
35
+ conftest.py # Fixtures (test client, DB)
36
+ test_*.py # Test modules
37
+ ```
38
+
39
+ ## Database
40
+
41
+ - **SQLAlchemy 2.0 style.** `select()` not `query()`. Mapped classes with `Mapped[]` annotations.
42
+ - **Alembic for migrations.** Auto-generate with `alembic revision --autogenerate`. Never edit the DB schema manually.
43
+ - **Session management.** Async sessions via `async_sessionmaker`. Yield in dependency.
44
+ - **Connection pooling.** Configure `pool_size`, `max_overflow` in production.
45
+
46
+ ## Testing
47
+
48
+ - **pytest + httpx.** Use `AsyncClient` with `app` for integration tests.
49
+ - **Fixtures for DB.** Create test database, run migrations, yield session, rollback.
50
+ - **Factory pattern for test data.** Use `factory_boy` or simple fixture functions.
51
+ - **Test the API, not internals.** Call endpoints via client, assert response shape + status.
52
+
53
+ ## Common Anti-Patterns to Catch
54
+
55
+ - Synchronous DB calls in async handlers → blocks the event loop
56
+ - Raw SQL without parameterization → SQL injection risk
57
+ - Returning ORM models from endpoints → use Pydantic response models
58
+ - Missing `async` on route handlers with I/O → blocks worker threads
59
+ - Hardcoded secrets → use environment variables via pydantic-settings
60
+ - Missing input validation → always validate via Pydantic schemas
@@ -0,0 +1,28 @@
1
+ name: coding/python-fastapi
2
+ version: 1.0.0
3
+ description: Python + FastAPI conventions, patterns, and guardrails for AI coding agents
4
+ author: stackmemory
5
+ license: MIT
6
+ runtime:
7
+ type: local
8
+ ingestion:
9
+ sources: []
10
+ ontology:
11
+ entities:
12
+ - endpoint
13
+ - model
14
+ - schema
15
+ - dependency
16
+ - middleware
17
+ relations:
18
+ - handles
19
+ - validates
20
+ - depends-on
21
+ mcp:
22
+ tools: []
23
+ examples:
24
+ - input: "Create a CRUD API endpoint"
25
+ output: "Use Pydantic models for request/response, dependency injection for DB session, proper HTTP status codes, async handlers"
26
+ - input: "How should I structure a FastAPI project?"
27
+ output: "app/ with routers/, models/, schemas/, dependencies/, core/ (config, security). Use APIRouter per domain."
28
+ instructions: instructions.md
@@ -0,0 +1,47 @@
1
+ # coding/typescript-react
2
+
3
+ ## TypeScript Conventions
4
+
5
+ - **Strict mode always.** `"strict": true` in tsconfig.json. No `any` unless genuinely unavoidable — use `unknown` and narrow.
6
+ - **ESM imports.** Always add `.js` extension to relative imports in ESM projects. Use `type` imports for type-only references.
7
+ - **Prefer interfaces** for object shapes. Use `type` for unions, intersections, and mapped types.
8
+ - **No enums.** Use `as const` objects or union types instead. Enums have runtime cost and poor tree-shaking.
9
+ - **Error handling.** Return `undefined` over throwing. If you must throw, use typed error classes. Never `catch (e: any)`.
10
+ - **Naming.** PascalCase for types/interfaces/components. camelCase for variables/functions. UPPER_SNAKE for constants.
11
+
12
+ ## React Patterns
13
+
14
+ - **Functional components only.** No class components.
15
+ - **Custom hooks for data fetching.** Extract `useQuery`/`useMutation` patterns into `use*` hooks. Never fetch in component body.
16
+ - **State management.** useState for local, useReducer for complex local, Context for cross-tree, Zustand/Jotai for global.
17
+ - **Memoization.** Don't prematurely memo. Use `React.memo` only when profiler shows re-render cost. `useMemo`/`useCallback` for referential stability when passed to children.
18
+ - **Keys.** Never use array index as key. Use stable IDs from data.
19
+ - **Error boundaries.** Wrap route-level components. Use `react-error-boundary` library.
20
+
21
+ ## File Structure
22
+
23
+ ```
24
+ src/
25
+ components/ # Shared UI components
26
+ features/ # Feature-scoped modules (components + hooks + types)
27
+ hooks/ # Shared custom hooks
28
+ lib/ # Non-React utilities
29
+ types/ # Shared type definitions
30
+ routes/ # Route components (if not using file-based routing)
31
+ ```
32
+
33
+ ## Testing
34
+
35
+ - **Vitest or Jest** for unit tests. React Testing Library for component tests.
36
+ - **Test behavior, not implementation.** Query by role/text, not test-id.
37
+ - **No snapshot tests** unless testing serialized output.
38
+ - **Mock at boundaries.** Mock API calls (MSW), not internal modules.
39
+
40
+ ## Common Anti-Patterns to Catch
41
+
42
+ - `useEffect` with missing dependencies → use ESLint exhaustive-deps rule
43
+ - Prop drilling > 2 levels → extract to Context or composition
44
+ - Giant components > 200 lines → split into smaller components
45
+ - Inline styles → use CSS modules, Tailwind, or styled-components
46
+ - `any` type assertions → narrow with type guards
47
+ - Non-null assertions (`!`) → handle the null case explicitly
@@ -0,0 +1,28 @@
1
+ name: coding/typescript-react
2
+ version: 1.0.0
3
+ description: TypeScript + React conventions, patterns, and guardrails for AI coding agents
4
+ author: stackmemory
5
+ license: MIT
6
+ runtime:
7
+ type: local
8
+ ingestion:
9
+ sources: []
10
+ ontology:
11
+ entities:
12
+ - component
13
+ - hook
14
+ - context
15
+ - route
16
+ - api-endpoint
17
+ relations:
18
+ - renders
19
+ - depends-on
20
+ - provides
21
+ mcp:
22
+ tools: []
23
+ examples:
24
+ - input: "Create a React component that fetches data"
25
+ output: "Use a custom hook with useEffect + useState, handle loading/error states, return typed JSX"
26
+ - input: "How should I structure my TypeScript types?"
27
+ output: "Prefer interfaces for object shapes, use type for unions/intersections, export from a types.ts barrel file"
28
+ instructions: instructions.md
@@ -0,0 +1,32 @@
1
+ # /capture — Save session context via StackMemory
2
+
3
+ Run `stackmemory capture` to commit current work and generate a handoff prompt for the next session.
4
+
5
+ ## Usage
6
+
7
+ `$ARGUMENTS` — optional flags passed directly to `stackmemory capture`.
8
+
9
+ ## Behavior
10
+
11
+ 1. Run `stackmemory capture $ARGUMENTS`
12
+ 2. Display the generated handoff prompt
13
+ 3. If `--copy` flag is present, confirm the prompt was copied to clipboard
14
+
15
+ ## Common flags
16
+
17
+ | Flag | Effect |
18
+ |------|--------|
19
+ | `-m "message"` | Custom commit message |
20
+ | `--no-commit` | Skip git commit, just generate handoff |
21
+ | `--copy` | Copy handoff prompt to clipboard |
22
+ | `--format ultra` | Ultra-compact pipe-delimited format |
23
+ | `--format verbose` | Full markdown format |
24
+
25
+ ## Examples
26
+
27
+ ```
28
+ /capture # Default capture with auto-format
29
+ /capture -m "privacy policy PR" # With custom message
30
+ /capture --copy # Capture and copy to clipboard
31
+ /capture --no-commit --copy # Just generate handoff, no commit
32
+ ```
@@ -0,0 +1,73 @@
1
+ # /learn — Review session and identify what to update
2
+
3
+ Run /summary internally, then audit what scripts, skills, commands, or memories need updating based on this session's work.
4
+
5
+ ## Execution
6
+
7
+ ### Phase 1: Session Review (silent)
8
+
9
+ Internally run the /summary logic — review conversation history for all actions, decisions, patterns, and corrections. Do NOT output the summary separately.
10
+
11
+ ### Phase 2: Audit (parallel)
12
+
13
+ Compare session activity against persistent artifacts:
14
+
15
+ 1. **Memory** — Read `MEMORY.md` from project memory dir
16
+ - Any new patterns, gotchas, or decisions that should be saved?
17
+ - Any existing memories now stale or contradicted by this session?
18
+ - Any user corrections/feedback worth persisting?
19
+
20
+ 2. **CLAUDE.md** — Read project and global CLAUDE.md
21
+ - Any new commands, paths, or conventions discovered?
22
+ - Any documented patterns that are now wrong?
23
+
24
+ 3. **Skills/Commands** — Glob `~/.claude/commands/*.md` and project `.claude/commands/*.md`
25
+ - Any skills that broke or need updating?
26
+ - Any new workflow worth turning into a skill?
27
+
28
+ 4. **Scripts** — Check `scripts/`, `.husky/`, hook files
29
+ - Any scripts created or modified this session?
30
+ - Any hooks that failed and need fixing?
31
+
32
+ 5. **Wiki** — If wiki exists, check for stale articles
33
+ - Any new entities or concepts from this session?
34
+
35
+ ### Phase 3: Report
36
+
37
+ Output in this format:
38
+
39
+ ```
40
+ ## Session Learnings
41
+
42
+ **What happened:**
43
+ - [1-line per action/outcome]
44
+
45
+ **Updates needed:**
46
+
47
+ | Target | Action | Detail |
48
+ |--------|--------|--------|
49
+ | memory/X.md | create/update/delete | [what and why] |
50
+ | CLAUDE.md | update | [section + change] |
51
+ | commands/X.md | create/update | [what] |
52
+ | scripts/X | update | [what] |
53
+ | wiki/X.md | create/update | [what] |
54
+
55
+ **No action needed:**
56
+ - [artifacts reviewed but current]
57
+ ```
58
+
59
+ ### Phase 4: Execute (with confirmation)
60
+
61
+ Ask: "Apply these updates? (all / pick / skip)"
62
+
63
+ - **all**: Apply every update in the table
64
+ - **pick**: Let user select which ones
65
+ - **skip**: Report only, no changes
66
+
67
+ ## Rules
68
+
69
+ - Don't create memories for ephemeral task details — only durable learnings
70
+ - Don't update CLAUDE.md for one-off patterns — only if it'll recur
71
+ - Bias toward updating existing memories over creating new ones
72
+ - Keep the report under 30 lines — dense, not verbose
73
+ - If nothing needs updating, say so in one line and stop
@@ -0,0 +1,36 @@
1
+ # /next — What should I do next?
2
+
3
+ Read context and suggest the highest-impact next action.
4
+
5
+ ## Context to gather (parallel)
6
+
7
+ 1. **Git state**: `git status`, `git branch --show-current`, `git log --oneline -3`
8
+ 2. **Open PR for branch**: `/opt/homebrew/bin/gh pr view --json title,state,reviews,checks 2>/dev/null`
9
+ 3. **GHA status**: `/opt/homebrew/bin/gh run list --branch $(git branch --show-current) --limit 1 --json status,conclusion,name 2>/dev/null`
10
+ 4. **Memory**: Read `MEMORY.md` and `project_todos_queue.md` from the project memory directory
11
+ 5. **Uncommitted work**: `git diff --stat HEAD`
12
+
13
+ ## Decision logic
14
+
15
+ Evaluate in priority order. Pick the FIRST that applies:
16
+
17
+ 1. **Uncommitted changes exist** → suggest commit or continue current work
18
+ 2. **PR open + CI failing** → suggest fix CI failures
19
+ 3. **PR open + Greptile comments** → suggest `/greptile-fix`
20
+ 4. **PR open + CI passing + no reviews** → suggest waiting or starting next task
21
+ 5. **On feature branch, no PR** → suggest `/pr`
22
+ 6. **On master, clean** → suggest next task from queue (pick highest priority unchecked item)
23
+
24
+ ## Output format
25
+
26
+ ```
27
+ ## Next up
28
+
29
+ [One sentence: what to do and why]
30
+
31
+ A) [Primary action — the recommendation]
32
+ B) [Alternative action]
33
+ C) [Skip — pick something else from queue]
34
+ ```
35
+
36
+ Always present A/B/C options. Keep it to 5 lines max. No preamble.