@stackmemoryai/stackmemory 0.2.6 → 0.2.7

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 (203) hide show
  1. package/README.md +245 -83
  2. package/dist/scripts/cancel-duplicate-tasks.d.ts +7 -0
  3. package/dist/scripts/cancel-duplicate-tasks.d.ts.map +1 -0
  4. package/dist/scripts/cancel-duplicate-tasks.js +171 -0
  5. package/dist/scripts/cancel-duplicate-tasks.js.map +1 -0
  6. package/dist/scripts/list-linear-tasks.d.ts +6 -0
  7. package/dist/scripts/list-linear-tasks.d.ts.map +1 -0
  8. package/dist/scripts/list-linear-tasks.js +122 -0
  9. package/dist/scripts/list-linear-tasks.js.map +1 -0
  10. package/dist/scripts/merge-linear-duplicates-safe.d.ts +7 -0
  11. package/dist/scripts/merge-linear-duplicates-safe.d.ts.map +1 -0
  12. package/dist/scripts/merge-linear-duplicates-safe.js +265 -0
  13. package/dist/scripts/merge-linear-duplicates-safe.js.map +1 -0
  14. package/dist/scripts/merge-linear-duplicates.d.ts +7 -0
  15. package/dist/scripts/merge-linear-duplicates.d.ts.map +1 -0
  16. package/dist/scripts/merge-linear-duplicates.js +126 -0
  17. package/dist/scripts/merge-linear-duplicates.js.map +1 -0
  18. package/dist/scripts/show-linear-summary.d.ts +6 -0
  19. package/dist/scripts/show-linear-summary.d.ts.map +1 -0
  20. package/dist/scripts/show-linear-summary.js +117 -0
  21. package/dist/scripts/show-linear-summary.js.map +1 -0
  22. package/dist/src/cli/__tests__/index.test.d.ts +5 -0
  23. package/dist/src/cli/__tests__/index.test.d.ts.map +1 -0
  24. package/dist/src/cli/__tests__/index.test.js +726 -0
  25. package/dist/src/cli/__tests__/index.test.js.map +1 -0
  26. package/dist/src/cli/auto-detect.d.ts +61 -0
  27. package/dist/src/cli/auto-detect.d.ts.map +1 -0
  28. package/dist/src/cli/auto-detect.js +350 -0
  29. package/dist/src/cli/auto-detect.js.map +1 -0
  30. package/dist/src/cli/claude-sm.d.ts +7 -0
  31. package/dist/src/cli/claude-sm.d.ts.map +1 -0
  32. package/dist/src/cli/claude-sm.js +357 -0
  33. package/dist/src/cli/claude-sm.js.map +1 -0
  34. package/dist/src/cli/commands/context.d.ts +7 -0
  35. package/dist/src/cli/commands/context.d.ts.map +1 -0
  36. package/dist/src/cli/commands/context.js +365 -0
  37. package/dist/src/cli/commands/context.js.map +1 -0
  38. package/dist/src/cli/commands/linear-test.d.ts +6 -0
  39. package/dist/src/cli/commands/linear-test.d.ts.map +1 -0
  40. package/dist/src/cli/commands/linear-test.js +123 -0
  41. package/dist/src/cli/commands/linear-test.js.map +1 -0
  42. package/dist/src/cli/commands/linear.d.ts +6 -0
  43. package/dist/src/cli/commands/linear.d.ts.map +1 -0
  44. package/dist/src/cli/commands/linear.js +317 -0
  45. package/dist/src/cli/commands/linear.js.map +1 -0
  46. package/dist/src/cli/commands/log.d.ts +7 -0
  47. package/dist/src/cli/commands/log.d.ts.map +1 -0
  48. package/dist/src/cli/commands/log.js +168 -0
  49. package/dist/src/cli/commands/log.js.map +1 -0
  50. package/dist/src/cli/commands/onboard.d.ts +8 -0
  51. package/dist/src/cli/commands/onboard.d.ts.map +1 -0
  52. package/dist/src/cli/commands/onboard.js +363 -0
  53. package/dist/src/cli/commands/onboard.js.map +1 -0
  54. package/dist/src/cli/commands/projects.js +1 -1
  55. package/dist/src/cli/commands/projects.js.map +1 -1
  56. package/dist/src/cli/commands/search.d.ts +7 -0
  57. package/dist/src/cli/commands/search.d.ts.map +1 -0
  58. package/dist/src/cli/commands/search.js +162 -0
  59. package/dist/src/cli/commands/search.js.map +1 -0
  60. package/dist/src/cli/commands/session.d.ts +7 -0
  61. package/dist/src/cli/commands/session.d.ts.map +1 -0
  62. package/dist/src/cli/commands/session.js +222 -0
  63. package/dist/src/cli/commands/session.js.map +1 -0
  64. package/dist/src/cli/commands/tasks.d.ts +7 -0
  65. package/dist/src/cli/commands/tasks.d.ts.map +1 -0
  66. package/dist/src/cli/commands/tasks.js +229 -0
  67. package/dist/src/cli/commands/tasks.js.map +1 -0
  68. package/dist/src/cli/commands/webhook.d.ts +3 -0
  69. package/dist/src/cli/commands/webhook.d.ts.map +1 -0
  70. package/dist/src/cli/commands/webhook.js +157 -0
  71. package/dist/src/cli/commands/webhook.js.map +1 -0
  72. package/dist/src/cli/commands/worktree.d.ts +8 -0
  73. package/dist/src/cli/commands/worktree.d.ts.map +1 -0
  74. package/dist/src/cli/commands/worktree.js +339 -0
  75. package/dist/src/cli/commands/worktree.js.map +1 -0
  76. package/dist/src/cli/index.d.ts +2 -1
  77. package/dist/src/cli/index.d.ts.map +1 -1
  78. package/dist/src/cli/index.js +290 -50
  79. package/dist/src/cli/index.js.map +1 -1
  80. package/dist/src/cli/utils/viewer.d.ts.map +1 -1
  81. package/dist/src/cli/utils/viewer.js +3 -1
  82. package/dist/src/cli/utils/viewer.js.map +1 -1
  83. package/dist/src/core/context/__tests__/frame-manager.test.d.ts +5 -0
  84. package/dist/src/core/context/__tests__/frame-manager.test.d.ts.map +1 -0
  85. package/dist/src/core/context/__tests__/frame-manager.test.js +892 -0
  86. package/dist/src/core/context/__tests__/frame-manager.test.js.map +1 -0
  87. package/dist/src/core/context/auto-context.d.ts +22 -0
  88. package/dist/src/core/context/auto-context.d.ts.map +1 -0
  89. package/dist/src/core/context/auto-context.js +77 -0
  90. package/dist/src/core/context/auto-context.js.map +1 -0
  91. package/dist/src/core/context/frame-manager.d.ts +4 -0
  92. package/dist/src/core/context/frame-manager.d.ts.map +1 -1
  93. package/dist/src/core/context/frame-manager.js +350 -144
  94. package/dist/src/core/context/frame-manager.js.map +1 -1
  95. package/dist/src/core/errors/__tests__/error-handling.test.d.ts +5 -0
  96. package/dist/src/core/errors/__tests__/error-handling.test.d.ts.map +1 -0
  97. package/dist/src/core/errors/__tests__/error-handling.test.js +239 -0
  98. package/dist/src/core/errors/__tests__/error-handling.test.js.map +1 -0
  99. package/dist/src/core/errors/index.d.ts +135 -0
  100. package/dist/src/core/errors/index.d.ts.map +1 -0
  101. package/dist/src/core/errors/index.js +274 -0
  102. package/dist/src/core/errors/index.js.map +1 -0
  103. package/dist/src/core/errors/recovery.d.ts +86 -0
  104. package/dist/src/core/errors/recovery.d.ts.map +1 -0
  105. package/dist/src/core/errors/recovery.js +274 -0
  106. package/dist/src/core/errors/recovery.js.map +1 -0
  107. package/dist/src/core/projects/project-manager.d.ts.map +1 -1
  108. package/dist/src/core/projects/project-manager.js +240 -122
  109. package/dist/src/core/projects/project-manager.js.map +1 -1
  110. package/dist/src/core/session/index.d.ts +2 -0
  111. package/dist/src/core/session/index.d.ts.map +1 -0
  112. package/dist/src/core/session/index.js +2 -0
  113. package/dist/src/core/session/index.js.map +1 -0
  114. package/dist/src/core/session/session-manager.d.ts +69 -0
  115. package/dist/src/core/session/session-manager.d.ts.map +1 -0
  116. package/dist/src/core/session/session-manager.js +311 -0
  117. package/dist/src/core/session/session-manager.js.map +1 -0
  118. package/dist/src/core/utils/update-checker.d.ts.map +1 -1
  119. package/dist/src/core/utils/update-checker.js +82 -25
  120. package/dist/src/core/utils/update-checker.js.map +1 -1
  121. package/dist/src/core/worktree/worktree-manager.d.ts +110 -0
  122. package/dist/src/core/worktree/worktree-manager.d.ts.map +1 -0
  123. package/dist/src/core/worktree/worktree-manager.js +456 -0
  124. package/dist/src/core/worktree/worktree-manager.js.map +1 -0
  125. package/dist/src/features/analytics/core/analytics-service.d.ts +6 -0
  126. package/dist/src/features/analytics/core/analytics-service.d.ts.map +1 -1
  127. package/dist/src/features/analytics/core/analytics-service.js +125 -10
  128. package/dist/src/features/analytics/core/analytics-service.js.map +1 -1
  129. package/dist/src/features/analytics/queries/metrics-queries.d.ts.map +1 -1
  130. package/dist/src/features/analytics/queries/metrics-queries.js +220 -163
  131. package/dist/src/features/analytics/queries/metrics-queries.js.map +1 -1
  132. package/dist/src/features/browser/browser-mcp.d.ts.map +1 -1
  133. package/dist/src/features/browser/browser-mcp.js +3 -0
  134. package/dist/src/features/browser/browser-mcp.js.map +1 -1
  135. package/dist/src/features/tasks/__tests__/pebbles-task-store.test.d.ts +5 -0
  136. package/dist/src/features/tasks/__tests__/pebbles-task-store.test.d.ts.map +1 -0
  137. package/dist/src/features/tasks/__tests__/pebbles-task-store.test.js +712 -0
  138. package/dist/src/features/tasks/__tests__/pebbles-task-store.test.js.map +1 -0
  139. package/dist/src/features/tasks/pebbles-task-store.d.ts +4 -0
  140. package/dist/src/features/tasks/pebbles-task-store.d.ts.map +1 -1
  141. package/dist/src/features/tasks/pebbles-task-store.js +299 -141
  142. package/dist/src/features/tasks/pebbles-task-store.js.map +1 -1
  143. package/dist/src/integrations/linear/__tests__/auth.test.d.ts +5 -0
  144. package/dist/src/integrations/linear/__tests__/auth.test.d.ts.map +1 -0
  145. package/dist/src/integrations/linear/__tests__/auth.test.js +517 -0
  146. package/dist/src/integrations/linear/__tests__/auth.test.js.map +1 -0
  147. package/dist/src/integrations/linear/__tests__/sync-service.test.d.ts +5 -0
  148. package/dist/src/integrations/linear/__tests__/sync-service.test.d.ts.map +1 -0
  149. package/dist/src/integrations/linear/__tests__/sync-service.test.js +700 -0
  150. package/dist/src/integrations/linear/__tests__/sync-service.test.js.map +1 -0
  151. package/dist/src/integrations/linear/client.d.ts +28 -1
  152. package/dist/src/integrations/linear/client.d.ts.map +1 -1
  153. package/dist/src/integrations/linear/client.js +87 -0
  154. package/dist/src/integrations/linear/client.js.map +1 -1
  155. package/dist/src/integrations/linear/sync-service.d.ts +25 -0
  156. package/dist/src/integrations/linear/sync-service.d.ts.map +1 -0
  157. package/dist/src/integrations/linear/sync-service.js +198 -0
  158. package/dist/src/integrations/linear/sync-service.js.map +1 -0
  159. package/dist/src/integrations/linear/sync.d.ts +23 -1
  160. package/dist/src/integrations/linear/sync.d.ts.map +1 -1
  161. package/dist/src/integrations/linear/sync.js +156 -9
  162. package/dist/src/integrations/linear/sync.js.map +1 -1
  163. package/dist/src/integrations/linear/types.d.ts +75 -0
  164. package/dist/src/integrations/linear/types.d.ts.map +1 -0
  165. package/dist/src/integrations/linear/types.js +2 -0
  166. package/dist/src/integrations/linear/types.js.map +1 -0
  167. package/dist/src/integrations/linear/webhook-server.d.ts +32 -0
  168. package/dist/src/integrations/linear/webhook-server.d.ts.map +1 -0
  169. package/dist/src/integrations/linear/webhook-server.js +188 -0
  170. package/dist/src/integrations/linear/webhook-server.js.map +1 -0
  171. package/dist/src/integrations/linear/webhook.d.ts +95 -0
  172. package/dist/src/integrations/linear/webhook.d.ts.map +1 -0
  173. package/dist/src/integrations/linear/webhook.js +204 -0
  174. package/dist/src/integrations/linear/webhook.js.map +1 -0
  175. package/dist/src/integrations/mcp/__tests__/server.test.d.ts +5 -0
  176. package/dist/src/integrations/mcp/__tests__/server.test.d.ts.map +1 -0
  177. package/dist/src/integrations/mcp/__tests__/server.test.js +790 -0
  178. package/dist/src/integrations/mcp/__tests__/server.test.js.map +1 -0
  179. package/dist/src/integrations/mcp/server.d.ts +6 -0
  180. package/dist/src/integrations/mcp/server.d.ts.map +1 -1
  181. package/dist/src/integrations/mcp/server.js +490 -54
  182. package/dist/src/integrations/mcp/server.js.map +1 -1
  183. package/dist/src/servers/production/auth-middleware.d.ts +2 -2
  184. package/dist/src/servers/production/auth-middleware.d.ts.map +1 -1
  185. package/dist/src/servers/production/auth-middleware.js +1 -1
  186. package/dist/src/servers/production/auth-middleware.js.map +1 -1
  187. package/dist/src/services/config-service.d.ts +44 -0
  188. package/dist/src/services/config-service.d.ts.map +1 -0
  189. package/dist/src/services/config-service.js +61 -0
  190. package/dist/src/services/config-service.js.map +1 -0
  191. package/dist/src/services/context-service.d.ts +17 -0
  192. package/dist/src/services/context-service.d.ts.map +1 -0
  193. package/dist/src/services/context-service.js +88 -0
  194. package/dist/src/services/context-service.js.map +1 -0
  195. package/dist/src/types/task.d.ts +17 -0
  196. package/dist/src/types/task.d.ts.map +1 -0
  197. package/dist/src/types/task.js +2 -0
  198. package/dist/src/types/task.js.map +1 -0
  199. package/dist/src/utils/logger.d.ts +13 -0
  200. package/dist/src/utils/logger.d.ts.map +1 -0
  201. package/dist/src/utils/logger.js +52 -0
  202. package/dist/src/utils/logger.js.map +1 -0
  203. package/package.json +16 -3
package/README.md CHANGED
@@ -4,10 +4,10 @@
4
4
 
5
5
  StackMemory is a **memory runtime** for AI coding and writing tools that preserves full project context across:
6
6
 
7
- * chat thread resets
8
- * model switching
9
- * editor restarts
10
- * long-running repos with thousands of interactions
7
+ - chat thread resets
8
+ - model switching
9
+ - editor restarts
10
+ - long-running repos with thousands of interactions
11
11
 
12
12
  Instead of a linear chat log, StackMemory organizes memory as a **call stack** of scoped work (frames), allowing context to naturally unwind without lossy compaction.
13
13
 
@@ -19,16 +19,16 @@ Instead of a linear chat log, StackMemory organizes memory as a **call stack** o
19
19
 
20
20
  Modern AI tools forget:
21
21
 
22
- * why decisions were made
23
- * which constraints still apply
24
- * what changed earlier in the repo
25
- * what tools already ran and why
22
+ - why decisions were made
23
+ - which constraints still apply
24
+ - what changed earlier in the repo
25
+ - what tools already ran and why
26
26
 
27
27
  StackMemory fixes this by:
28
28
 
29
- * storing **everything losslessly** (events, tool calls, decisions)
30
- * injecting only the **relevant working set** into model context
31
- * keeping memory **project-scoped**, not chat-scoped
29
+ - storing **everything losslessly** (events, tool calls, decisions)
30
+ - injecting only the **relevant working set** into model context
31
+ - keeping memory **project-scoped**, not chat-scoped
32
32
 
33
33
  ---
34
34
 
@@ -45,9 +45,9 @@ StackMemory fixes this by:
45
45
 
46
46
  Frames can span:
47
47
 
48
- * multiple chat turns
49
- * multiple tool calls
50
- * multiple sessions
48
+ - multiple chat turns
49
+ - multiple tool calls
50
+ - multiple sessions
51
51
 
52
52
  ---
53
53
 
@@ -55,19 +55,19 @@ Frames can span:
55
55
 
56
56
  ### Hosted (default)
57
57
 
58
- * Cloud-backed memory runtime
59
- * Fast indexing + retrieval
60
- * Durable storage
61
- * Per-project pricing
62
- * Works out-of-the-box
58
+ - Cloud-backed memory runtime
59
+ - Fast indexing + retrieval
60
+ - Durable storage
61
+ - Per-project pricing
62
+ - Works out-of-the-box
63
63
 
64
64
  ### Open-source local mirror
65
65
 
66
- * SQLite-based
67
- * Fully inspectable
68
- * Offline / air-gapped
69
- * Intentionally **N versions behind**
70
- * No sync, no org features
66
+ - SQLite-based
67
+ - Fully inspectable
68
+ - Offline / air-gapped
69
+ - Intentionally **N versions behind**
70
+ - No sync, no org features
71
71
 
72
72
  > OSS is for trust and inspection.
73
73
  > Hosted is for scale, performance, and teams.
@@ -78,9 +78,9 @@ Frames can span:
78
78
 
79
79
  StackMemory integrates as an **MCP tool** and is invoked on **every interaction** in:
80
80
 
81
- * Claude Code
82
- * compatible editors
83
- * future MCP-enabled tools
81
+ - Claude Code
82
+ - compatible editors
83
+ - future MCP-enabled tools
84
84
 
85
85
  The editor never manages memory directly — it simply asks StackMemory for the **context bundle**.
86
86
 
@@ -101,44 +101,87 @@ This creates a **project-scoped memory space** tied to the repo.
101
101
 
102
102
  ---
103
103
 
104
- ### Step 2: Install MCP client
104
+ ### Step 2: Install StackMemory
105
105
 
106
106
  ```bash
107
- npm install -g stackmemory-mcp
107
+ npm install -g @stackmemoryai/stackmemory@latest
108
108
  ```
109
109
 
110
- or via binary:
110
+ ---
111
+
112
+ ### Step 3: Setup Claude Code Integration (Automated)
111
113
 
112
114
  ```bash
113
- curl -fsSL https://stackmemory.dev/install | sh
115
+ # Automatic setup - configures MCP and session hooks
116
+ npm run claude:setup
114
117
  ```
115
118
 
116
- ---
119
+ This automatically:
117
120
 
118
- ### Step 3: Configure Claude Code / editor
121
+ - Creates `~/.claude/stackmemory-mcp.json` MCP configuration
122
+ - Sets up session initialization hooks
123
+ - Updates `~/.claude/config.json` with StackMemory integration
119
124
 
120
- Add StackMemory as an MCP tool:
125
+ **Manual setup alternative:**
121
126
 
122
- ```json
127
+ <details>
128
+ <summary>Click to expand manual setup steps</summary>
129
+
130
+ Create MCP configuration:
131
+
132
+ ```bash
133
+ mkdir -p ~/.claude
134
+ cat > ~/.claude/stackmemory-mcp.json << 'EOF'
123
135
  {
124
- "tools": {
136
+ "mcpServers": {
125
137
  "stackmemory": {
126
- "command": "stackmemory-mcp",
127
- "args": ["--project", "github:org/repo"]
138
+ "command": "stackmemory",
139
+ "args": ["mcp-server"],
140
+ "env": { "NODE_ENV": "production" }
128
141
  }
129
142
  }
130
143
  }
144
+ EOF
131
145
  ```
132
146
 
133
- That's it.
147
+ Update Claude config:
148
+
149
+ ```json
150
+ {
151
+ "mcp": {
152
+ "configFiles": ["~/.claude/stackmemory-mcp.json"]
153
+ }
154
+ }
155
+ ```
156
+
157
+ </details>
158
+
159
+ **That's it.**
160
+
161
+ Every Claude Code session now automatically:
162
+
163
+ 1. **Captures all tool calls** - Bash, Edit, Read, Write operations get logged
164
+ 2. **Maintains frame stack** - Task/subtask context persists across sessions
165
+ 3. **References previous work** - Decisions, constraints, and artifacts automatically surface
166
+ 4. **Syncs with Linear** - Bidirectional task synchronization when configured
134
167
 
135
- Every message now:
168
+ Available MCP tools in Claude Code:
136
169
 
137
- 1. Gets logged losslessly
138
- 2. Updates the call stack
139
- 3. Retrieves the correct context automatically
170
+ | Tool | Description |
171
+ | -------------------- | ------------------------------------------ |
172
+ | `get_context` | Retrieve relevant context for current work |
173
+ | `add_decision` | Record a decision with rationale |
174
+ | `start_frame` | Begin a new context frame |
175
+ | `close_frame` | Close current frame with summary |
176
+ | `create_task` | Create a new task |
177
+ | `update_task_status` | Update task status |
178
+ | `get_active_tasks` | List active tasks (with filters) |
179
+ | `get_task_metrics` | Get task analytics |
180
+ | `linear_sync` | Sync with Linear |
181
+ | `linear_update_task` | Update Linear issue |
182
+ | `linear_get_tasks` | Get tasks from Linear |
140
183
 
141
- No prompts to manage. No summaries to babysit.
184
+ No prompts to manage. No summaries to babysit. Just seamless context continuity.
142
185
 
143
186
  ---
144
187
 
@@ -190,24 +233,20 @@ All project memory lives locally.
190
233
  On every message/tool call:
191
234
 
192
235
  1. **Ingest**
193
-
194
- * New message delta is appended as events
236
+ - New message delta is appended as events
195
237
 
196
238
  2. **Index**
197
-
198
- * Anchors updated
199
- * Digests generated when frames close
239
+ - Anchors updated
240
+ - Digests generated when frames close
200
241
 
201
242
  3. **Retrieve**
202
-
203
- * Active call stack (hot)
204
- * Relevant digests (warm)
205
- * Pointers to raw data (cold)
243
+ - Active call stack (hot)
244
+ - Relevant digests (warm)
245
+ - Pointers to raw data (cold)
206
246
 
207
247
  4. **Return context bundle**
208
-
209
- * Sized to token budget
210
- * No global compaction
248
+ - Sized to token budget
249
+ - No global compaction
211
250
 
212
251
  ---
213
252
 
@@ -236,16 +275,16 @@ On every message/tool call:
236
275
 
237
276
  ### Free tier (hosted)
238
277
 
239
- * 1 project
240
- * Up to **X MB stored**
241
- * Up to **Y MB retrieval egress / month**
278
+ - 1 project
279
+ - Up to **X MB stored**
280
+ - Up to **Y MB retrieval egress / month**
242
281
 
243
282
  ### Paid tiers
244
283
 
245
- * Per-project pricing
246
- * Higher storage + retrieval
247
- * Team sharing
248
- * Org controls
284
+ - Per-project pricing
285
+ - Higher storage + retrieval
286
+ - Team sharing
287
+ - Org controls
249
288
 
250
289
  **No seat-based pricing.**
251
290
 
@@ -258,6 +297,7 @@ StackMemory can automatically save context when using Claude Code, ensuring your
258
297
  ### Quick Setup
259
298
 
260
299
  1. **Install the wrapper script**:
300
+
261
301
  ```bash
262
302
  # Make scripts executable
263
303
  chmod +x scripts/claude-code-wrapper.sh scripts/stackmemory-daemon.sh
@@ -268,6 +308,7 @@ source ~/.zshrc
268
308
  ```
269
309
 
270
310
  2. **Use Claude Code with auto-save**:
311
+
271
312
  ```bash
272
313
  # Instead of: claude-code
273
314
  # Use: claude
@@ -278,7 +319,9 @@ source ~/.zshrc
278
319
  ### Integration Methods
279
320
 
280
321
  #### 1. Shell Wrapper (Recommended)
322
+
281
323
  Automatically saves context when Claude Code exits:
324
+
282
325
  ```bash
283
326
  # Basic usage
284
327
  claude
@@ -291,7 +334,9 @@ claude --auto-sync --sync-interval=10
291
334
  ```
292
335
 
293
336
  #### 2. Linear Auto-Sync Daemon
337
+
294
338
  Continuously syncs with Linear in the background:
339
+
295
340
  ```bash
296
341
  # Start auto-sync (default: 5 minutes)
297
342
  ./scripts/linear-auto-sync.sh start
@@ -310,11 +355,14 @@ Continuously syncs with Linear in the background:
310
355
  ```
311
356
 
312
357
  **Requirements:**
358
+
313
359
  - Set `LINEAR_API_KEY` environment variable
314
360
  - Run in a StackMemory-initialized project
315
361
 
316
362
  #### 3. Background Daemon
363
+
317
364
  Continuously saves context every 5 minutes:
365
+
318
366
  ```bash
319
367
  # Start daemon
320
368
  ./scripts/stackmemory-daemon.sh &
@@ -327,14 +375,18 @@ kill $(cat /tmp/stackmemory-daemon.pid)
327
375
  ```
328
376
 
329
377
  #### 4. Git Hooks
378
+
330
379
  Save context automatically on git commits:
380
+
331
381
  ```bash
332
382
  # Install in current repo
333
383
  ./scripts/setup-git-hooks.sh
334
384
  ```
335
385
 
336
386
  #### 5. Manual Function
387
+
337
388
  Add to `~/.zshrc`:
389
+
338
390
  ```bash
339
391
  claude_with_sm() {
340
392
  claude "$@"
@@ -361,20 +413,20 @@ claude_with_sm() {
361
413
 
362
414
  ## Guarantees
363
415
 
364
- * ✅ Lossless storage (no destructive compaction)
365
- * ✅ Project-scoped isolation
366
- * ✅ Survives new chat threads
367
- * ✅ Survives model switching
368
- * ✅ Inspectable local mirror
416
+ - ✅ Lossless storage (no destructive compaction)
417
+ - ✅ Project-scoped isolation
418
+ - ✅ Survives new chat threads
419
+ - ✅ Survives model switching
420
+ - ✅ Inspectable local mirror
369
421
 
370
422
  ---
371
423
 
372
424
  ## Non-goals
373
425
 
374
- * ❌ Chat UI
375
- * ❌ Vector DB replacement
376
- * ❌ Tool execution runtime
377
- * ❌ Prompt engineering framework
426
+ - ❌ Chat UI
427
+ - ❌ Vector DB replacement
428
+ - ❌ Tool execution runtime
429
+ - ❌ Prompt engineering framework
378
430
 
379
431
  ---
380
432
 
@@ -386,40 +438,150 @@ claude_with_sm() {
386
438
 
387
439
  ---
388
440
 
441
+ ## CLI Commands Reference
442
+
443
+ StackMemory provides a comprehensive CLI for task management, context tracking, and Linear integration.
444
+
445
+ ### Core Commands
446
+
447
+ ```bash
448
+ stackmemory init # Initialize StackMemory in current project
449
+ stackmemory status # Show current StackMemory status
450
+ stackmemory progress # Show recent changes and progress
451
+ ```
452
+
453
+ ### Task Management
454
+
455
+ ```bash
456
+ # List tasks
457
+ stackmemory tasks list # List all active tasks
458
+ stackmemory tasks list --status pending # Filter by status
459
+ stackmemory tasks list --priority high # Filter by priority
460
+ stackmemory tasks list --query "bug" # Search in title/description
461
+ stackmemory tasks list --all # Include completed tasks
462
+
463
+ # Manage tasks
464
+ stackmemory task add "Fix login bug" --priority high --tags "bug,auth"
465
+ stackmemory task show <task-id> # Show task details
466
+ stackmemory task start <task-id> # Start working on task
467
+ stackmemory task done <task-id> # Mark task complete
468
+ ```
469
+
470
+ ### Search
471
+
472
+ ```bash
473
+ stackmemory search "analytics" # Search tasks and context
474
+ stackmemory search "api" --tasks # Search only tasks
475
+ stackmemory search "decision" --context # Search only context
476
+ ```
477
+
478
+ ### Activity Log
479
+
480
+ ```bash
481
+ stackmemory log # View recent activity
482
+ stackmemory log --lines 50 # Show more entries
483
+ stackmemory log --type task # Filter by type (task, frame, event, sync)
484
+ stackmemory log --follow # Watch for changes in real-time
485
+ ```
486
+
487
+ ### Context Stack Management
488
+
489
+ ```bash
490
+ # View context
491
+ stackmemory context show # Show current context stack
492
+ stackmemory context show --verbose # Show detailed frame info
493
+
494
+ # Manage context frames
495
+ stackmemory context push "feature-work" --type task
496
+ stackmemory context push "debug-session" --type session
497
+ stackmemory context add decision "Using SQLite for storage"
498
+ stackmemory context add observation "API returns 404 on missing user"
499
+ stackmemory context pop # Pop top frame
500
+ stackmemory context pop --all # Clear entire stack
501
+ ```
502
+
503
+ ### Analytics Dashboard
504
+
505
+ ```bash
506
+ stackmemory analytics --view # Terminal dashboard
507
+ stackmemory analytics --port 3000 # Web dashboard
508
+ stackmemory analytics --sync # Sync before displaying
509
+ stackmemory analytics --export json # Export metrics as JSON
510
+ stackmemory analytics --export csv # Export as CSV
511
+ ```
512
+
513
+ ### Linear Integration
514
+
515
+ ```bash
516
+ # Setup
517
+ stackmemory linear setup # OAuth setup
518
+ stackmemory linear status # Check connection
519
+
520
+ # Sync
521
+ stackmemory linear sync # Bidirectional sync
522
+ stackmemory linear sync --direction from_linear
523
+ stackmemory linear sync --direction to_linear
524
+
525
+ # Auto-sync
526
+ stackmemory linear auto-sync --start # Start background sync
527
+ stackmemory linear auto-sync --stop # Stop background sync
528
+ stackmemory linear auto-sync --status # Check sync status
529
+
530
+ # Update tasks
531
+ stackmemory linear update ENG-123 --status in-progress
532
+ stackmemory linear update ENG-123 --status done
533
+
534
+ # Configure
535
+ stackmemory linear config --show
536
+ stackmemory linear config --set-interval 15
537
+ ```
538
+
539
+ ### MCP Server
540
+
541
+ ```bash
542
+ stackmemory mcp-server # Start MCP server for Claude
543
+ stackmemory mcp-server --port 3001 # Custom port
544
+ ```
545
+
546
+ ---
547
+
389
548
  ## Status
390
549
 
391
- * Hosted: **Private beta**
392
- * OSS mirror: **Early preview**
393
- * MCP integration: **Stable**
550
+ - Hosted: **Private beta**
551
+ - OSS mirror: **Early preview**
552
+ - MCP integration: **Stable**
553
+ - CLI: **v0.2.7** - Full task, context, and Linear management
394
554
 
395
555
  ---
396
556
 
397
557
  ## Roadmap (high level)
398
558
 
399
- * Team / org projects
400
- * Cross-repo memory
401
- * Background project compilers
402
- * Fine-grained retention policies
403
- * Editor UX surfacing frame boundaries
559
+ - Team / org projects
560
+ - Cross-repo memory
561
+ - Background project compilers
562
+ - Fine-grained retention policies
563
+ - Editor UX surfacing frame boundaries
404
564
 
405
565
  ---
406
566
 
407
567
  ## License
408
568
 
409
- * Hosted service: Proprietary
410
- * Open-source mirror: Apache 2.0 / MIT (TBD)
569
+ - Hosted service: Proprietary
570
+ - Open-source mirror: Apache 2.0 / MIT (TBD)
411
571
 
412
572
  ---
413
573
 
414
574
  ## Additional Resources
415
575
 
416
576
  ### ML System Design
577
+
417
578
  - [ML System Insights](./ML_SYSTEM_INSIGHTS.md) - Comprehensive analysis of 300+ production ML systems
418
579
  - [Agent Instructions](./AGENTS.md) - Specific guidance for AI agents working with ML systems
419
580
 
420
581
  ### Documentation
582
+
421
583
  - [Product Requirements](./PRD.md) - Detailed product specifications
422
584
  - [Technical Architecture](./TECHNICAL_ARCHITECTURE.md) - System design and database schemas
423
585
  - [Beads Integration](./BEADS_INTEGRATION.md) - Git-native memory patterns from Beads ecosystem
424
586
 
425
- ---
587
+ ---
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Script to cancel duplicate Linear tasks
4
+ * Uses the actual Linear API to find and cancel duplicates
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=cancel-duplicate-tasks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cancel-duplicate-tasks.d.ts","sourceRoot":"","sources":["../../scripts/cancel-duplicate-tasks.ts"],"names":[],"mappings":";AAEA;;;GAGG"}
@@ -0,0 +1,171 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Script to cancel duplicate Linear tasks
4
+ * Uses the actual Linear API to find and cancel duplicates
5
+ */
6
+ import { readFileSync } from 'fs';
7
+ import { join } from 'path';
8
+ // Define patterns to identify duplicate tasks
9
+ const duplicatePatterns = [
10
+ { pattern: 'Linear API Integration', keepFirst: true },
11
+ { pattern: 'Performance Optimization', keepFirst: true },
12
+ { pattern: 'Security Audit', keepFirst: true },
13
+ { pattern: '[HIGH] Implement Proper Error Handling', keepFirst: true },
14
+ { pattern: '[HIGH] Implement Comprehensive Testing Suite', keepFirst: true },
15
+ ];
16
+ async function cancelDuplicateTasks(dryRun = true) {
17
+ const mode = dryRun ? '🔍 DRY RUN MODE' : '⚡ LIVE MODE';
18
+ console.log(`\n${mode} - Cancel duplicate Linear tasks\n`);
19
+ console.log('='.repeat(60));
20
+ // Load Linear tokens
21
+ const tokensPath = join(process.cwd(), '.stackmemory', 'linear-tokens.json');
22
+ let accessToken;
23
+ try {
24
+ const tokensData = readFileSync(tokensPath, 'utf8');
25
+ const tokens = JSON.parse(tokensData);
26
+ accessToken = tokens.accessToken;
27
+ console.log('✅ Loaded Linear authentication tokens\n');
28
+ }
29
+ catch {
30
+ console.error('❌ Failed to load Linear tokens. Please run: stackmemory linear setup');
31
+ process.exit(1);
32
+ }
33
+ // GraphQL helper
34
+ const linearApiUrl = 'https://api.linear.app/graphql';
35
+ async function graphqlRequest(query, variables = {}) {
36
+ const response = await fetch(linearApiUrl, {
37
+ method: 'POST',
38
+ headers: {
39
+ Authorization: `Bearer ${accessToken}`,
40
+ 'Content-Type': 'application/json',
41
+ },
42
+ body: JSON.stringify({ query, variables }),
43
+ });
44
+ if (!response.ok) {
45
+ throw new Error(`Linear API error: ${response.status} ${response.statusText}`);
46
+ }
47
+ const result = (await response.json());
48
+ if (result.errors) {
49
+ throw new Error(`GraphQL errors: ${JSON.stringify(result.errors)}`);
50
+ }
51
+ return result.data;
52
+ }
53
+ // First, get all issues
54
+ console.log('Fetching all issues...\n');
55
+ const issuesQuery = `
56
+ query {
57
+ issues(first: 250, filter: { state: { type: { nin: ["completed", "canceled"] } } }) {
58
+ nodes {
59
+ id
60
+ identifier
61
+ title
62
+ description
63
+ createdAt
64
+ state {
65
+ id
66
+ name
67
+ type
68
+ }
69
+ team {
70
+ id
71
+ key
72
+ states {
73
+ nodes {
74
+ id
75
+ name
76
+ type
77
+ }
78
+ }
79
+ }
80
+ }
81
+ }
82
+ }
83
+ `;
84
+ const issuesData = (await graphqlRequest(issuesQuery));
85
+ const allIssues = issuesData.issues.nodes;
86
+ console.log(`Found ${allIssues.length} active issues\n`);
87
+ // Get canceled state from the first issue's team
88
+ const canceledState = allIssues[0]?.team?.states?.nodes?.find((s) => s.type === 'canceled');
89
+ if (!canceledState) {
90
+ console.error('❌ No canceled state found in workflow');
91
+ process.exit(1);
92
+ }
93
+ // Group issues by pattern
94
+ const groupedIssues = new Map();
95
+ for (const pattern of duplicatePatterns) {
96
+ const matches = allIssues.filter((issue) => issue.title.includes(pattern.pattern));
97
+ if (matches.length > 1) {
98
+ // Sort by creation date to keep the oldest
99
+ matches.sort((a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime());
100
+ groupedIssues.set(pattern.pattern, matches);
101
+ }
102
+ }
103
+ // Process each group
104
+ let totalCanceled = 0;
105
+ let totalKept = 0;
106
+ for (const [pattern, issues] of groupedIssues.entries()) {
107
+ console.log(`\n📋 Pattern: "${pattern}"`);
108
+ console.log(` Found ${issues.length} matching issues:`);
109
+ const [primary, ...duplicates] = issues;
110
+ console.log(` ✅ Keep: ${primary.identifier} - ${primary.title}`);
111
+ totalKept++;
112
+ for (const duplicate of duplicates) {
113
+ console.log(` ${dryRun ? '🔍' : '❌'} Cancel: ${duplicate.identifier} - ${duplicate.title}`);
114
+ if (!dryRun) {
115
+ try {
116
+ const cancelMutation = `
117
+ mutation CancelIssue($id: String!, $stateId: String!) {
118
+ issueUpdate(
119
+ id: $id,
120
+ input: {
121
+ stateId: $stateId,
122
+ description: "Duplicate task - kept ${primary.identifier}"
123
+ }
124
+ ) {
125
+ success
126
+ issue {
127
+ identifier
128
+ state {
129
+ name
130
+ }
131
+ }
132
+ }
133
+ }
134
+ `;
135
+ await graphqlRequest(cancelMutation, {
136
+ id: duplicate.id,
137
+ stateId: canceledState.id,
138
+ });
139
+ console.log(` ✅ Successfully canceled ${duplicate.identifier}`);
140
+ totalCanceled++;
141
+ }
142
+ catch (error) {
143
+ console.log(` ❌ Failed to cancel ${duplicate.identifier}: ${error.message}`);
144
+ }
145
+ }
146
+ else {
147
+ totalCanceled++;
148
+ }
149
+ }
150
+ }
151
+ // Summary
152
+ console.log('\n' + '='.repeat(60));
153
+ console.log(`\n✨ ${dryRun ? 'DRY RUN' : 'CLEANUP'} COMPLETE!\n`);
154
+ console.log('📊 Summary:');
155
+ console.log(` Duplicate groups found: ${groupedIssues.size}`);
156
+ console.log(` Tasks to keep: ${totalKept}`);
157
+ console.log(` Tasks ${dryRun ? 'to cancel' : 'canceled'}: ${totalCanceled}`);
158
+ console.log(` Total active tasks: ${allIssues.length}`);
159
+ console.log(` Tasks after cleanup: ${allIssues.length - totalCanceled}`);
160
+ if (dryRun) {
161
+ console.log('\n💡 To execute these changes, run with --execute flag');
162
+ }
163
+ }
164
+ // Parse command line arguments
165
+ const isDryRun = !process.argv.includes('--execute');
166
+ // Run the cleanup
167
+ cancelDuplicateTasks(isDryRun).catch((error) => {
168
+ console.error('❌ Fatal error:', error);
169
+ process.exit(1);
170
+ });
171
+ //# sourceMappingURL=cancel-duplicate-tasks.js.map