ai-memory-layer 2.0.1 → 3.0.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 (186) hide show
  1. package/CHANGELOG.md +19 -12
  2. package/README.md +435 -320
  3. package/bin/memory-server.mjs +0 -0
  4. package/dist/adapters/memory/embeddings.d.ts.map +1 -1
  5. package/dist/adapters/memory/embeddings.js +12 -1
  6. package/dist/adapters/memory/embeddings.js.map +1 -1
  7. package/dist/adapters/memory/index.d.ts.map +1 -1
  8. package/dist/adapters/memory/index.js +1281 -48
  9. package/dist/adapters/memory/index.js.map +1 -1
  10. package/dist/adapters/postgres/index.d.ts +1 -0
  11. package/dist/adapters/postgres/index.d.ts.map +1 -1
  12. package/dist/adapters/postgres/index.js +1770 -42
  13. package/dist/adapters/postgres/index.js.map +1 -1
  14. package/dist/adapters/sqlite/embeddings.d.ts.map +1 -1
  15. package/dist/adapters/sqlite/embeddings.js +49 -12
  16. package/dist/adapters/sqlite/embeddings.js.map +1 -1
  17. package/dist/adapters/sqlite/index.d.ts.map +1 -1
  18. package/dist/adapters/sqlite/index.js +1720 -38
  19. package/dist/adapters/sqlite/index.js.map +1 -1
  20. package/dist/adapters/sqlite/mappers.d.ts +39 -4
  21. package/dist/adapters/sqlite/mappers.d.ts.map +1 -1
  22. package/dist/adapters/sqlite/mappers.js +87 -0
  23. package/dist/adapters/sqlite/mappers.js.map +1 -1
  24. package/dist/adapters/sqlite/schema.d.ts +1 -1
  25. package/dist/adapters/sqlite/schema.d.ts.map +1 -1
  26. package/dist/adapters/sqlite/schema.js +297 -1
  27. package/dist/adapters/sqlite/schema.js.map +1 -1
  28. package/dist/adapters/sync-to-async.d.ts.map +1 -1
  29. package/dist/adapters/sync-to-async.js +54 -0
  30. package/dist/adapters/sync-to-async.js.map +1 -1
  31. package/dist/contracts/async-storage.d.ts +61 -1
  32. package/dist/contracts/async-storage.d.ts.map +1 -1
  33. package/dist/contracts/cognitive.d.ts +37 -0
  34. package/dist/contracts/cognitive.d.ts.map +1 -0
  35. package/dist/contracts/cognitive.js +24 -0
  36. package/dist/contracts/cognitive.js.map +1 -0
  37. package/dist/contracts/coordination.d.ts +101 -0
  38. package/dist/contracts/coordination.d.ts.map +1 -0
  39. package/dist/contracts/coordination.js +26 -0
  40. package/dist/contracts/coordination.js.map +1 -0
  41. package/dist/contracts/embedding.d.ts +1 -1
  42. package/dist/contracts/embedding.d.ts.map +1 -1
  43. package/dist/contracts/errors.d.ts +28 -0
  44. package/dist/contracts/errors.d.ts.map +1 -0
  45. package/dist/contracts/errors.js +41 -0
  46. package/dist/contracts/errors.js.map +1 -0
  47. package/dist/contracts/identity.d.ts +2 -0
  48. package/dist/contracts/identity.d.ts.map +1 -1
  49. package/dist/contracts/identity.js +26 -1
  50. package/dist/contracts/identity.js.map +1 -1
  51. package/dist/contracts/observability.d.ts +2 -1
  52. package/dist/contracts/observability.d.ts.map +1 -1
  53. package/dist/contracts/observability.js +11 -0
  54. package/dist/contracts/observability.js.map +1 -1
  55. package/dist/contracts/profile.d.ts +29 -0
  56. package/dist/contracts/profile.d.ts.map +1 -0
  57. package/dist/contracts/profile.js +2 -0
  58. package/dist/contracts/profile.js.map +1 -0
  59. package/dist/contracts/session-state.d.ts +10 -0
  60. package/dist/contracts/session-state.d.ts.map +1 -0
  61. package/dist/contracts/session-state.js +2 -0
  62. package/dist/contracts/session-state.js.map +1 -0
  63. package/dist/contracts/storage.d.ts +73 -1
  64. package/dist/contracts/storage.d.ts.map +1 -1
  65. package/dist/contracts/storage.js +16 -1
  66. package/dist/contracts/storage.js.map +1 -1
  67. package/dist/contracts/temporal.d.ts +112 -0
  68. package/dist/contracts/temporal.d.ts.map +1 -0
  69. package/dist/contracts/temporal.js +31 -0
  70. package/dist/contracts/temporal.js.map +1 -0
  71. package/dist/contracts/types.d.ts +135 -0
  72. package/dist/contracts/types.d.ts.map +1 -1
  73. package/dist/contracts/types.js +27 -0
  74. package/dist/contracts/types.js.map +1 -1
  75. package/dist/core/associations.d.ts +18 -0
  76. package/dist/core/associations.d.ts.map +1 -0
  77. package/dist/core/associations.js +185 -0
  78. package/dist/core/associations.js.map +1 -0
  79. package/dist/core/circuit-breaker.d.ts +9 -0
  80. package/dist/core/circuit-breaker.d.ts.map +1 -1
  81. package/dist/core/circuit-breaker.js +13 -1
  82. package/dist/core/circuit-breaker.js.map +1 -1
  83. package/dist/core/cognitive.d.ts +5 -0
  84. package/dist/core/cognitive.d.ts.map +1 -0
  85. package/dist/core/cognitive.js +120 -0
  86. package/dist/core/cognitive.js.map +1 -0
  87. package/dist/core/context.d.ts +72 -1
  88. package/dist/core/context.d.ts.map +1 -1
  89. package/dist/core/context.js +471 -45
  90. package/dist/core/context.js.map +1 -1
  91. package/dist/core/episodic.d.ts +28 -0
  92. package/dist/core/episodic.d.ts.map +1 -0
  93. package/dist/core/episodic.js +371 -0
  94. package/dist/core/episodic.js.map +1 -0
  95. package/dist/core/formatter.d.ts +4 -0
  96. package/dist/core/formatter.d.ts.map +1 -1
  97. package/dist/core/formatter.js +103 -0
  98. package/dist/core/formatter.js.map +1 -1
  99. package/dist/core/maintenance.d.ts +1 -0
  100. package/dist/core/maintenance.d.ts.map +1 -1
  101. package/dist/core/maintenance.js +75 -0
  102. package/dist/core/maintenance.js.map +1 -1
  103. package/dist/core/manager.d.ts +159 -7
  104. package/dist/core/manager.d.ts.map +1 -1
  105. package/dist/core/manager.js +740 -31
  106. package/dist/core/manager.js.map +1 -1
  107. package/dist/core/orchestrator.d.ts.map +1 -1
  108. package/dist/core/orchestrator.js +210 -178
  109. package/dist/core/orchestrator.js.map +1 -1
  110. package/dist/core/playbook.d.ts +35 -0
  111. package/dist/core/playbook.d.ts.map +1 -0
  112. package/dist/core/playbook.js +184 -0
  113. package/dist/core/playbook.js.map +1 -0
  114. package/dist/core/profile.d.ts +8 -0
  115. package/dist/core/profile.d.ts.map +1 -0
  116. package/dist/core/profile.js +103 -0
  117. package/dist/core/profile.js.map +1 -0
  118. package/dist/core/quick.d.ts +5 -0
  119. package/dist/core/quick.d.ts.map +1 -1
  120. package/dist/core/quick.js +10 -1
  121. package/dist/core/quick.js.map +1 -1
  122. package/dist/core/runtime.d.ts +17 -1
  123. package/dist/core/runtime.d.ts.map +1 -1
  124. package/dist/core/runtime.js +88 -5
  125. package/dist/core/runtime.js.map +1 -1
  126. package/dist/core/streaming.d.ts +1 -1
  127. package/dist/core/streaming.d.ts.map +1 -1
  128. package/dist/core/temporal.d.ts +29 -0
  129. package/dist/core/temporal.d.ts.map +1 -0
  130. package/dist/core/temporal.js +447 -0
  131. package/dist/core/temporal.js.map +1 -0
  132. package/dist/core/validation.d.ts +3 -0
  133. package/dist/core/validation.d.ts.map +1 -1
  134. package/dist/core/validation.js +25 -10
  135. package/dist/core/validation.js.map +1 -1
  136. package/dist/core/workspace-detect.d.ts +17 -0
  137. package/dist/core/workspace-detect.d.ts.map +1 -0
  138. package/dist/core/workspace-detect.js +55 -0
  139. package/dist/core/workspace-detect.js.map +1 -0
  140. package/dist/embeddings/resilience.d.ts.map +1 -1
  141. package/dist/embeddings/resilience.js +19 -8
  142. package/dist/embeddings/resilience.js.map +1 -1
  143. package/dist/index.d.ts +21 -4
  144. package/dist/index.d.ts.map +1 -1
  145. package/dist/index.js +9 -0
  146. package/dist/index.js.map +1 -1
  147. package/dist/integrations/claude-agent.d.ts +6 -0
  148. package/dist/integrations/claude-agent.d.ts.map +1 -1
  149. package/dist/integrations/claude-agent.js +5 -1
  150. package/dist/integrations/claude-agent.js.map +1 -1
  151. package/dist/integrations/claude-tools.d.ts +5 -4
  152. package/dist/integrations/claude-tools.d.ts.map +1 -1
  153. package/dist/integrations/claude-tools.js +155 -2
  154. package/dist/integrations/claude-tools.js.map +1 -1
  155. package/dist/integrations/middleware.d.ts +6 -0
  156. package/dist/integrations/middleware.d.ts.map +1 -1
  157. package/dist/integrations/middleware.js +11 -1
  158. package/dist/integrations/middleware.js.map +1 -1
  159. package/dist/integrations/openai-tools.d.ts +5 -4
  160. package/dist/integrations/openai-tools.d.ts.map +1 -1
  161. package/dist/integrations/openai-tools.js +170 -2
  162. package/dist/integrations/openai-tools.js.map +1 -1
  163. package/dist/integrations/vercel-ai.d.ts +6 -0
  164. package/dist/integrations/vercel-ai.d.ts.map +1 -1
  165. package/dist/integrations/vercel-ai.js +4 -0
  166. package/dist/integrations/vercel-ai.js.map +1 -1
  167. package/dist/server/http-server.d.ts +8 -0
  168. package/dist/server/http-server.d.ts.map +1 -1
  169. package/dist/server/http-server.js +976 -58
  170. package/dist/server/http-server.js.map +1 -1
  171. package/dist/server/mcp-server.d.ts +8 -0
  172. package/dist/server/mcp-server.d.ts.map +1 -1
  173. package/dist/server/mcp-server.js +1157 -37
  174. package/dist/server/mcp-server.js.map +1 -1
  175. package/dist/server/parsing.d.ts +12 -0
  176. package/dist/server/parsing.d.ts.map +1 -0
  177. package/dist/server/parsing.js +42 -0
  178. package/dist/server/parsing.js.map +1 -0
  179. package/dist/summarizers/prompts.d.ts +4 -0
  180. package/dist/summarizers/prompts.d.ts.map +1 -1
  181. package/dist/summarizers/prompts.js +42 -0
  182. package/dist/summarizers/prompts.js.map +1 -1
  183. package/docs/ULTIMATE_MEMORY_LAYER_ROADMAP.md +291 -0
  184. package/docs/prd.json +1498 -0
  185. package/openapi.yaml +1945 -112
  186. package/package.json +4 -2
package/docs/prd.json ADDED
@@ -0,0 +1,1498 @@
1
+ {
2
+ "goal": "Implement the Ultimate Memory Layer Roadmap: 7 features across 4 phases — episodic recall, cognitive taxonomy, materialized profiles, workspace onboarding, procedural playbooks, typed associations, and session snapshots. Source of truth: docs/ULTIMATE_MEMORY_LAYER_ROADMAP.md.",
3
+ "fast_checks_default": [
4
+ "npm run lint",
5
+ "npm run test",
6
+ "npm run eval:memory-quality"
7
+ ],
8
+ "current_task_id": null,
9
+ "last_completed_task_id": null,
10
+ "iteration": 0,
11
+ "tasks": [
12
+ {
13
+ "id": "t1",
14
+ "desc": "Add episodic recall types to contracts: EpisodeDetailLevel, EpisodeRecap, EpisodeSourceReference, EpisodeSearchOptions, EpisodeSummary, ReflectOptions, ReflectResult, and EPISODE_DETAIL_LEVELS const array.",
15
+ "acceptance_criteria": [
16
+ "All 6 interfaces and 1 type alias exported from src/contracts/types.ts",
17
+ "EPISODE_DETAIL_LEVELS const exported with values ['abstract', 'overview', 'full']",
18
+ "EpisodeRecap includes sourceType field with 'episodic' | 'declarative' | 'mixed' union",
19
+ "EpisodeSourceReference.type supports 'turn' | 'working_memory' | 'knowledge'",
20
+ "npm run lint passes"
21
+ ],
22
+ "files": [
23
+ "src/contracts/types.ts"
24
+ ],
25
+ "fast_checks": [
26
+ "npm run lint"
27
+ ],
28
+ "dependencies": [],
29
+ "priority": 0,
30
+ "lane": "contracts",
31
+ "parallel_safe": true,
32
+ "tranche_safe": true,
33
+ "done": true
34
+ },
35
+ {
36
+ "id": "t2",
37
+ "desc": "Create cognitive memory taxonomy contract: CognitiveMemoryType, CognitiveMemoryItem, CognitiveSearchOptions, CognitiveSearchResult types, plus mapKnowledgeClassToCognitive and mapCognitiveToKnowledgeClasses mapping functions.",
38
+ "acceptance_criteria": [
39
+ "New file src/contracts/cognitive.ts with all types exported",
40
+ "CognitiveMemoryType is 'episodic' | 'semantic' | 'procedural' | 'working'",
41
+ "mapKnowledgeClassToCognitive maps: identity/preference/constraint/project_fact/episodic_fact/strategy/anti_pattern -> semantic, procedure -> procedural",
42
+ "mapCognitiveToKnowledgeClasses is the inverse mapping",
43
+ "npm run lint passes"
44
+ ],
45
+ "files": [
46
+ "src/contracts/cognitive.ts"
47
+ ],
48
+ "fast_checks": [
49
+ "npm run lint"
50
+ ],
51
+ "dependencies": [],
52
+ "priority": 0,
53
+ "lane": "contracts",
54
+ "parallel_safe": true,
55
+ "tranche_safe": true,
56
+ "done": true
57
+ },
58
+ {
59
+ "id": "t3",
60
+ "desc": "Schema migration v9->v10: add episode_recap column to working_memory in SQLite, Postgres, and in-memory adapters.",
61
+ "acceptance_criteria": [
62
+ "CURRENT_SCHEMA_VERSION bumped to 10 in src/adapters/sqlite/schema.ts",
63
+ "ALTER TABLE working_memory ADD COLUMN episode_recap TEXT in SQLite migration path",
64
+ "ALTER TABLE working_memory ADD COLUMN episode_recap JSONB in Postgres schema",
65
+ "In-memory adapter WorkingMemory records support optional episode_recap field",
66
+ "Existing tests still pass"
67
+ ],
68
+ "files": [
69
+ "src/adapters/sqlite/schema.ts",
70
+ "src/adapters/postgres/schema.sql",
71
+ "src/adapters/memory/index.ts"
72
+ ],
73
+ "fast_checks": [
74
+ "npm run test"
75
+ ],
76
+ "dependencies": [
77
+ "t1"
78
+ ],
79
+ "priority": 1,
80
+ "lane": "adapters",
81
+ "parallel_safe": true,
82
+ "tranche_safe": true,
83
+ "done": true
84
+ },
85
+ {
86
+ "id": "t4",
87
+ "desc": "Add episodic recap and reflect synthesis prompts to summarizers: EPISODIC_RECAP_SYSTEM_PROMPT and REFLECT_SYNTHESIS_SYSTEM_PROMPT that instruct the model to produce JSON matching EpisodeRecap and ReflectResult.",
88
+ "acceptance_criteria": [
89
+ "EPISODIC_RECAP_SYSTEM_PROMPT exported from src/summarizers/prompts.ts",
90
+ "REFLECT_SYNTHESIS_SYSTEM_PROMPT exported from src/summarizers/prompts.ts",
91
+ "EPISODIC_RECAP_PROMPT_VERSION and REFLECT_SYNTHESIS_PROMPT_VERSION exported",
92
+ "Recap prompt instructs structured JSON output: objective, actions, outcomes, artifacts, unresolvedItems",
93
+ "Reflect prompt instructs cross-memory synthesis with source attribution",
94
+ "npm run lint passes"
95
+ ],
96
+ "files": [
97
+ "src/summarizers/prompts.ts"
98
+ ],
99
+ "fast_checks": [
100
+ "npm run lint"
101
+ ],
102
+ "dependencies": [
103
+ "t1"
104
+ ],
105
+ "priority": 1,
106
+ "lane": "core",
107
+ "parallel_safe": true,
108
+ "tranche_safe": true,
109
+ "done": true
110
+ },
111
+ {
112
+ "id": "t5",
113
+ "desc": "Core episodic recall module: searchEpisodes, summarizeEpisode, reflect functions that search turns+working memory, produce structured EpisodeSummary recaps with detail levels, and synthesize cross-memory reflections with source attribution.",
114
+ "acceptance_criteria": [
115
+ "New file src/core/episodic.ts with 3 exported async functions",
116
+ "searchEpisodes groups results by session, calls summarizer with episodic recap prompt",
117
+ "summarizeEpisode supports abstract (objective+outcomes), overview (+actions), full (+artifacts+excerpts) detail levels",
118
+ "reflect gathers episodic + optionally declarative knowledge, reports sourceType accurately",
119
+ "All functions preserve source references back to turn/working_memory IDs",
120
+ "Episode summaries are never silently promoted to trusted knowledge",
121
+ "Unit tests pass"
122
+ ],
123
+ "files": [
124
+ "src/core/episodic.ts",
125
+ "src/__tests__/episodic.test.ts"
126
+ ],
127
+ "fast_checks": null,
128
+ "dependencies": [
129
+ "t1",
130
+ "t3",
131
+ "t4"
132
+ ],
133
+ "priority": 2,
134
+ "lane": "core",
135
+ "parallel_safe": false,
136
+ "tranche_safe": false,
137
+ "done": true
138
+ },
139
+ {
140
+ "id": "t6",
141
+ "desc": "Core cognitive facade module: thin layer that delegates to manager.search, manager.searchEpisodes, manager.getContext and maps results into the public CognitiveMemoryType taxonomy.",
142
+ "acceptance_criteria": [
143
+ "New file src/core/cognitive.ts",
144
+ "searchCognitive function accepts CognitiveSearchOptions and returns CognitiveSearchResult",
145
+ "Results correctly grouped in byType record",
146
+ "Internal trust/knowledge state preserved in metadata but public type is simplified",
147
+ "npm run lint passes"
148
+ ],
149
+ "files": [
150
+ "src/core/cognitive.ts"
151
+ ],
152
+ "fast_checks": [
153
+ "npm run lint"
154
+ ],
155
+ "dependencies": [
156
+ "t2",
157
+ "t5"
158
+ ],
159
+ "priority": 3,
160
+ "lane": "core",
161
+ "parallel_safe": false,
162
+ "tranche_safe": false,
163
+ "done": true
164
+ },
165
+ {
166
+ "id": "t7",
167
+ "desc": "Add episodic + cognitive methods to MemoryManager interface and implementation: searchEpisodes, summarizeEpisode, reflect, searchCognitive.",
168
+ "acceptance_criteria": [
169
+ "4 new methods added to MemoryManager interface in src/core/manager.ts",
170
+ "Implementation delegates to src/core/episodic.ts and src/core/cognitive.ts",
171
+ "Existing MemoryManager tests still pass",
172
+ "New methods have unit test coverage"
173
+ ],
174
+ "files": [
175
+ "src/core/manager.ts",
176
+ "src/__tests__/manager.test.ts"
177
+ ],
178
+ "fast_checks": null,
179
+ "dependencies": [
180
+ "t5",
181
+ "t6"
182
+ ],
183
+ "priority": 4,
184
+ "lane": "core",
185
+ "parallel_safe": false,
186
+ "tranche_safe": false,
187
+ "done": true
188
+ },
189
+ {
190
+ "id": "t8",
191
+ "desc": "HTTP endpoints for episodic recall + cognitive search: GET /v1/episodes, POST /v1/episodes/summarize, POST /v1/reflect, GET /v1/memory.",
192
+ "acceptance_criteria": [
193
+ "GET /v1/episodes accepts q, detail, limit query params",
194
+ "POST /v1/episodes/summarize accepts session_id and detailLevel in body",
195
+ "POST /v1/reflect accepts query, detailLevel, includeDeclarative, timeRange in body",
196
+ "GET /v1/memory accepts q, types (comma-separated), limit for cognitive search",
197
+ "All endpoints return proper API envelope format",
198
+ "Existing HTTP tests still pass"
199
+ ],
200
+ "files": [
201
+ "src/server/http-server.ts"
202
+ ],
203
+ "fast_checks": null,
204
+ "dependencies": [
205
+ "t7"
206
+ ],
207
+ "priority": 5,
208
+ "lane": "server",
209
+ "parallel_safe": true,
210
+ "tranche_safe": true,
211
+ "done": true
212
+ },
213
+ {
214
+ "id": "t9",
215
+ "desc": "MCP tools for episodic recall + cognitive: memory_search_episodes, memory_summarize_episode, memory_reflect, memory_search_cognitive.",
216
+ "acceptance_criteria": [
217
+ "4 new tools added to TOOLS array in src/server/mcp-server.ts",
218
+ "Tool schemas match the API signatures from t7",
219
+ "Tool handlers delegate to manager methods",
220
+ "Existing MCP tests still pass"
221
+ ],
222
+ "files": [
223
+ "src/server/mcp-server.ts"
224
+ ],
225
+ "fast_checks": null,
226
+ "dependencies": [
227
+ "t7"
228
+ ],
229
+ "priority": 5,
230
+ "lane": "server",
231
+ "parallel_safe": true,
232
+ "tranche_safe": true,
233
+ "done": true
234
+ },
235
+ {
236
+ "id": "t10",
237
+ "desc": "OpenAPI spec additions for episodic + cognitive endpoints: /v1/episodes, /v1/episodes/summarize, /v1/reflect, /v1/memory with full request/response schemas under new episodic and cognitive tags.",
238
+ "acceptance_criteria": [
239
+ "4 new paths added to openapi.yaml",
240
+ "New tags: episodic, cognitive",
241
+ "Request/response schemas match TypeScript types from t1 and t2",
242
+ "Spec validates (no YAML errors)"
243
+ ],
244
+ "files": [
245
+ "openapi.yaml"
246
+ ],
247
+ "fast_checks": null,
248
+ "dependencies": [
249
+ "t7"
250
+ ],
251
+ "priority": 5,
252
+ "lane": "docs",
253
+ "parallel_safe": true,
254
+ "tranche_safe": true,
255
+ "done": true
256
+ },
257
+ {
258
+ "id": "t11",
259
+ "desc": "Framework integration tool schemas for episodic + cognitive: add tool definitions to Claude tools and OpenAI tools integrations.",
260
+ "acceptance_criteria": [
261
+ "Episodic + cognitive tool schemas added to src/integrations/claude-tools.ts",
262
+ "Matching OpenAI function tool definitions added to src/integrations/openai-tools.ts",
263
+ "npm run lint passes"
264
+ ],
265
+ "files": [
266
+ "src/integrations/claude-tools.ts",
267
+ "src/integrations/openai-tools.ts"
268
+ ],
269
+ "fast_checks": [
270
+ "npm run lint"
271
+ ],
272
+ "dependencies": [
273
+ "t7"
274
+ ],
275
+ "priority": 5,
276
+ "lane": "integrations",
277
+ "parallel_safe": true,
278
+ "tranche_safe": true,
279
+ "done": true
280
+ },
281
+ {
282
+ "id": "t12",
283
+ "desc": "Export all Phase 1 types and functions from src/index.ts: episodic types, cognitive types, mapping functions.",
284
+ "acceptance_criteria": [
285
+ "All episodic types from t1 exported",
286
+ "All cognitive types and mapping functions from t2 exported",
287
+ "npm run lint passes"
288
+ ],
289
+ "files": [
290
+ "src/index.ts"
291
+ ],
292
+ "fast_checks": [
293
+ "npm run lint"
294
+ ],
295
+ "dependencies": [
296
+ "t7"
297
+ ],
298
+ "priority": 5,
299
+ "lane": "contracts",
300
+ "parallel_safe": true,
301
+ "tranche_safe": true,
302
+ "done": true
303
+ },
304
+ {
305
+ "id": "t13",
306
+ "desc": "Python client additions for episodic + cognitive: models (EpisodeRecap, EpisodeSummary, ReflectResult, CognitiveMemoryItem, CognitiveSearchResult) and client methods (search_episodes, summarize_episode, reflect, search_cognitive) on both sync and async clients.",
307
+ "acceptance_criteria": [
308
+ "Models added to clients/python/memory_layer_client/models.py",
309
+ "4 methods added to MemoryClient and AsyncMemoryClient in client.py",
310
+ "Methods hit correct HTTP endpoints from t8",
311
+ "Python lint passes (ruff check)"
312
+ ],
313
+ "files": [
314
+ "clients/python/memory_layer_client/models.py",
315
+ "clients/python/memory_layer_client/client.py"
316
+ ],
317
+ "fast_checks": null,
318
+ "dependencies": [
319
+ "t8"
320
+ ],
321
+ "priority": 6,
322
+ "lane": "python",
323
+ "parallel_safe": true,
324
+ "tranche_safe": true,
325
+ "done": true
326
+ },
327
+ {
328
+ "id": "t14",
329
+ "desc": "Episodic recall evals: new eval module with metrics for episodic_retrieval_precision, episodic_recap_completeness, reflect_source_attribution, episodic_isolation. Register in quality gate and set baselines.",
330
+ "acceptance_criteria": [
331
+ "New file evals/memory-quality/episodic-recall.mjs",
332
+ "4 metrics implemented and passing",
333
+ "Metrics registered in evals/memory-quality/index.mjs",
334
+ "Baselines added to evals/memory-quality/baseline.json",
335
+ "npm run eval:memory-quality passes with all metrics"
336
+ ],
337
+ "files": [
338
+ "evals/memory-quality/episodic-recall.mjs",
339
+ "evals/memory-quality/index.mjs",
340
+ "evals/memory-quality/baseline.json"
341
+ ],
342
+ "fast_checks": [
343
+ "npm run eval:memory-quality"
344
+ ],
345
+ "dependencies": [
346
+ "t7"
347
+ ],
348
+ "priority": 6,
349
+ "lane": "evals",
350
+ "parallel_safe": true,
351
+ "tranche_safe": true,
352
+ "done": true
353
+ },
354
+ {
355
+ "id": "t15",
356
+ "desc": "Phase 1 verification gate: all existing tests pass, all 14 original metrics 100/100, no regression, new episodic metrics pass, platform quality green.",
357
+ "acceptance_criteria": [
358
+ "npm run test passes",
359
+ "npm run eval:memory-quality passes (original 14 + new 4 metrics)",
360
+ "npm run eval:memory-quality:delta shows no regression",
361
+ "npm run eval:platform-quality passes"
362
+ ],
363
+ "files": [],
364
+ "fast_checks": [
365
+ "npm run test",
366
+ "npm run eval:memory-quality",
367
+ "npm run eval:memory-quality:delta",
368
+ "npm run eval:platform-quality"
369
+ ],
370
+ "dependencies": [
371
+ "t8",
372
+ "t9",
373
+ "t10",
374
+ "t11",
375
+ "t12",
376
+ "t13",
377
+ "t14"
378
+ ],
379
+ "priority": 7,
380
+ "lane": "verification",
381
+ "parallel_safe": false,
382
+ "tranche_safe": false,
383
+ "done": true
384
+ },
385
+ {
386
+ "id": "t16",
387
+ "desc": "Profile types contract: ProfileView, ProfileSection, ProfileEntry, Profile, ProfileOptions types in a new src/contracts/profile.ts file.",
388
+ "acceptance_criteria": [
389
+ "New file src/contracts/profile.ts with all types exported",
390
+ "ProfileView is 'user' | 'operator' | 'workspace'",
391
+ "ProfileSection is 'identity' | 'preferences' | 'communication' | 'constraints' | 'workflows'",
392
+ "ProfileEntry includes knowledgeId, trustScore, knowledgeState, confidence, lastConfirmedAt",
393
+ "Profile.sections is Record<ProfileSection, ProfileEntry[]>",
394
+ "npm run lint passes"
395
+ ],
396
+ "files": [
397
+ "src/contracts/profile.ts"
398
+ ],
399
+ "fast_checks": [
400
+ "npm run lint"
401
+ ],
402
+ "dependencies": [
403
+ "t15"
404
+ ],
405
+ "priority": 8,
406
+ "lane": "contracts",
407
+ "parallel_safe": true,
408
+ "tranche_safe": true,
409
+ "done": true
410
+ },
411
+ {
412
+ "id": "t17",
413
+ "desc": "Core profile materializer: getProfile and classifyProfileSection functions that query knowledge by scope level, classify into profile sections, return structured Profile.",
414
+ "acceptance_criteria": [
415
+ "New file src/core/profile.ts",
416
+ "getProfile queries knowledge at correct scope level per view (user=scope_id, operator=system_id, workspace=workspace_id)",
417
+ "classifyProfileSection maps: identity->identity, preference->preferences, constraint->constraints, procedure+strategy->workflows",
418
+ "Communication-related preferences classified under communication section",
419
+ "Disputed and retired knowledge excluded by default",
420
+ "Unit tests pass"
421
+ ],
422
+ "files": [
423
+ "src/core/profile.ts",
424
+ "src/__tests__/profile.test.ts"
425
+ ],
426
+ "fast_checks": null,
427
+ "dependencies": [
428
+ "t16"
429
+ ],
430
+ "priority": 9,
431
+ "lane": "core",
432
+ "parallel_safe": false,
433
+ "tranche_safe": false,
434
+ "done": true
435
+ },
436
+ {
437
+ "id": "t18",
438
+ "desc": "Workspace detection module: detectWorkspace, workspaceIdFromGitRemote, workspaceIdFromPath functions for auto-detecting workspace from git remote or directory path.",
439
+ "acceptance_criteria": [
440
+ "New file src/core/workspace-detect.ts",
441
+ "detectWorkspace uses git remote get-url origin with fallback to directory hash",
442
+ "workspaceIdFromGitRemote produces stable hash from remote URL",
443
+ "workspaceIdFromPath produces stable hash from absolute path",
444
+ "Falls back to directory path hash when not in a git repo",
445
+ "Unit tests pass"
446
+ ],
447
+ "files": [
448
+ "src/core/workspace-detect.ts",
449
+ "src/__tests__/workspace-detect.test.ts"
450
+ ],
451
+ "fast_checks": null,
452
+ "dependencies": [
453
+ "t15"
454
+ ],
455
+ "priority": 8,
456
+ "lane": "core",
457
+ "parallel_safe": true,
458
+ "tranche_safe": true,
459
+ "done": true
460
+ },
461
+ {
462
+ "id": "t19",
463
+ "desc": "MemoryManager getProfile method + formatter integration: add getProfile to manager, add optional profile to SessionBootstrap, update formatBootstrapForPrompt to include Profile section.",
464
+ "acceptance_criteria": [
465
+ "getProfile(options?: ProfileOptions) added to MemoryManager interface and impl",
466
+ "SessionBootstrap in src/core/formatter.ts has optional profile field",
467
+ "formatBootstrapForPrompt includes 'Profile' section when profile data present",
468
+ "Existing formatter tests still pass"
469
+ ],
470
+ "files": [
471
+ "src/core/manager.ts",
472
+ "src/core/formatter.ts",
473
+ "src/core/runtime.ts"
474
+ ],
475
+ "fast_checks": null,
476
+ "dependencies": [
477
+ "t17"
478
+ ],
479
+ "priority": 10,
480
+ "lane": "core",
481
+ "parallel_safe": false,
482
+ "tranche_safe": false,
483
+ "done": true
484
+ },
485
+ {
486
+ "id": "t20",
487
+ "desc": "Add autoDetectWorkspace option to createMemory factory in quick.ts: when true and no explicit workspace_id, call detectWorkspace and merge result.",
488
+ "acceptance_criteria": [
489
+ "autoDetectWorkspace?: boolean added to CreateMemoryOptions",
490
+ "When true and no workspace_id provided, detectWorkspace is called",
491
+ "Detected workspace_id merged into scope",
492
+ "When false or workspace_id explicit, detection skipped",
493
+ "npm run lint passes"
494
+ ],
495
+ "files": [
496
+ "src/core/quick.ts"
497
+ ],
498
+ "fast_checks": [
499
+ "npm run lint"
500
+ ],
501
+ "dependencies": [
502
+ "t18"
503
+ ],
504
+ "priority": 10,
505
+ "lane": "core",
506
+ "parallel_safe": true,
507
+ "tranche_safe": true,
508
+ "done": true
509
+ },
510
+ {
511
+ "id": "t21",
512
+ "desc": "Add autoDetectWorkspace option to MCP and HTTP server configs: auto-detect from process.cwd() when set and no scope provided.",
513
+ "acceptance_criteria": [
514
+ "autoDetectWorkspace?: boolean added to McpServerConfig",
515
+ "autoDetectWorkspace?: boolean added to HttpServerConfig",
516
+ "When true, detected workspace used as default scope",
517
+ "Existing server tests still pass"
518
+ ],
519
+ "files": [
520
+ "src/server/mcp-server.ts",
521
+ "src/server/http-server.ts"
522
+ ],
523
+ "fast_checks": null,
524
+ "dependencies": [
525
+ "t20"
526
+ ],
527
+ "priority": 11,
528
+ "lane": "server",
529
+ "parallel_safe": false,
530
+ "tranche_safe": false,
531
+ "done": true
532
+ },
533
+ {
534
+ "id": "t22",
535
+ "desc": "HTTP endpoint for profile: GET /v1/profile with view, sections, min_trust query params.",
536
+ "acceptance_criteria": [
537
+ "GET /v1/profile accepts view, sections (comma-separated), min_trust query params",
538
+ "Returns Profile object in API envelope",
539
+ "Defaults to user view when no view specified",
540
+ "Existing HTTP tests still pass"
541
+ ],
542
+ "files": [
543
+ "src/server/http-server.ts"
544
+ ],
545
+ "fast_checks": null,
546
+ "dependencies": [
547
+ "t19"
548
+ ],
549
+ "priority": 12,
550
+ "lane": "server",
551
+ "parallel_safe": true,
552
+ "tranche_safe": true,
553
+ "done": true
554
+ },
555
+ {
556
+ "id": "t23",
557
+ "desc": "MCP tool for profile: memory_get_profile with view and sections params.",
558
+ "acceptance_criteria": [
559
+ "memory_get_profile tool added to MCP server TOOLS array",
560
+ "Accepts view (enum) and sections (array) params",
561
+ "Delegates to manager.getProfile",
562
+ "Existing MCP tests still pass"
563
+ ],
564
+ "files": [
565
+ "src/server/mcp-server.ts"
566
+ ],
567
+ "fast_checks": null,
568
+ "dependencies": [
569
+ "t19"
570
+ ],
571
+ "priority": 12,
572
+ "lane": "server",
573
+ "parallel_safe": true,
574
+ "tranche_safe": true,
575
+ "done": true
576
+ },
577
+ {
578
+ "id": "t24",
579
+ "desc": "OpenAPI spec additions for profile endpoint under new profiles tag.",
580
+ "acceptance_criteria": [
581
+ "GET /v1/profile path added to openapi.yaml",
582
+ "New tag: profiles",
583
+ "Request/response schemas match Profile types from t16",
584
+ "Spec validates"
585
+ ],
586
+ "files": [
587
+ "openapi.yaml"
588
+ ],
589
+ "fast_checks": null,
590
+ "dependencies": [
591
+ "t19"
592
+ ],
593
+ "priority": 12,
594
+ "lane": "docs",
595
+ "parallel_safe": true,
596
+ "tranche_safe": true,
597
+ "done": true
598
+ },
599
+ {
600
+ "id": "t25",
601
+ "desc": "Export Phase 2 types from src/index.ts: profile types, workspace detection functions.",
602
+ "acceptance_criteria": [
603
+ "All profile types from t16 exported",
604
+ "Workspace detection functions from t18 exported (detectWorkspace, workspaceIdFromGitRemote, workspaceIdFromPath)",
605
+ "npm run lint passes"
606
+ ],
607
+ "files": [
608
+ "src/index.ts"
609
+ ],
610
+ "fast_checks": [
611
+ "npm run lint"
612
+ ],
613
+ "dependencies": [
614
+ "t19",
615
+ "t20"
616
+ ],
617
+ "priority": 12,
618
+ "lane": "contracts",
619
+ "parallel_safe": true,
620
+ "tranche_safe": true,
621
+ "done": true
622
+ },
623
+ {
624
+ "id": "t26",
625
+ "desc": "Python client additions for profile: Profile and ProfileEntry models, get_profile method on sync and async clients.",
626
+ "acceptance_criteria": [
627
+ "Profile, ProfileEntry models added to models.py",
628
+ "get_profile method on MemoryClient and AsyncMemoryClient",
629
+ "Method hits GET /v1/profile endpoint",
630
+ "Python lint passes"
631
+ ],
632
+ "files": [
633
+ "clients/python/memory_layer_client/models.py",
634
+ "clients/python/memory_layer_client/client.py"
635
+ ],
636
+ "fast_checks": null,
637
+ "dependencies": [
638
+ "t22"
639
+ ],
640
+ "priority": 13,
641
+ "lane": "python",
642
+ "parallel_safe": true,
643
+ "tranche_safe": true,
644
+ "done": true
645
+ },
646
+ {
647
+ "id": "t27",
648
+ "desc": "Evals for profiles + workspace: profile_completeness, profile_trust_filtering, profile_provenance metrics, plus workspace_auto_detect scenario.",
649
+ "acceptance_criteria": [
650
+ "New file evals/memory-quality/profiles.mjs with 3 metrics",
651
+ "workspace_auto_detect scenario added to evals/scenario-evals.mjs",
652
+ "Metrics registered in index.mjs, baselines updated",
653
+ "All evals pass"
654
+ ],
655
+ "files": [
656
+ "evals/memory-quality/profiles.mjs",
657
+ "evals/memory-quality/index.mjs",
658
+ "evals/memory-quality/baseline.json",
659
+ "evals/scenario-evals.mjs"
660
+ ],
661
+ "fast_checks": [
662
+ "npm run eval:memory-quality"
663
+ ],
664
+ "dependencies": [
665
+ "t19",
666
+ "t21"
667
+ ],
668
+ "priority": 13,
669
+ "lane": "evals",
670
+ "parallel_safe": true,
671
+ "tranche_safe": true,
672
+ "done": true
673
+ },
674
+ {
675
+ "id": "t28",
676
+ "desc": "Phase 2 verification gate: all tests pass, all metrics green, no regression, platform quality green.",
677
+ "acceptance_criteria": [
678
+ "npm run test passes",
679
+ "npm run eval:memory-quality passes (original + Phase 1 + Phase 2 metrics)",
680
+ "npm run eval:memory-quality:delta shows no regression",
681
+ "npm run eval:platform-quality passes"
682
+ ],
683
+ "files": [],
684
+ "fast_checks": [
685
+ "npm run test",
686
+ "npm run eval:memory-quality",
687
+ "npm run eval:memory-quality:delta",
688
+ "npm run eval:platform-quality"
689
+ ],
690
+ "dependencies": [
691
+ "t21",
692
+ "t22",
693
+ "t23",
694
+ "t24",
695
+ "t25",
696
+ "t26",
697
+ "t27"
698
+ ],
699
+ "priority": 14,
700
+ "lane": "verification",
701
+ "parallel_safe": false,
702
+ "tranche_safe": false,
703
+ "done": true
704
+ },
705
+ {
706
+ "id": "t29",
707
+ "desc": "Playbook types: PlaybookStatus, Playbook, NewPlaybook, PlaybookRevision, NewPlaybookRevision, PLAYBOOK_STATUSES const in src/contracts/types.ts.",
708
+ "acceptance_criteria": [
709
+ "All playbook types and interfaces exported from src/contracts/types.ts",
710
+ "Playbook extends NormalizedMemoryScope with all specified fields",
711
+ "NewPlaybook extends MemoryScope with required title/description/instructions",
712
+ "PlaybookRevision includes playbook_id, instructions, revision_reason, source_session_id",
713
+ "PLAYBOOK_STATUSES const exported",
714
+ "npm run lint passes"
715
+ ],
716
+ "files": [
717
+ "src/contracts/types.ts"
718
+ ],
719
+ "fast_checks": [
720
+ "npm run lint"
721
+ ],
722
+ "dependencies": [
723
+ "t28"
724
+ ],
725
+ "priority": 15,
726
+ "lane": "contracts",
727
+ "parallel_safe": false,
728
+ "tranche_safe": false,
729
+ "done": true
730
+ },
731
+ {
732
+ "id": "t30",
733
+ "desc": "Schema migration v10->v11: playbooks table with FTS5 + triggers, playbook_revisions table with FK, scoping columns and indexes. SQLite, Postgres, in-memory.",
734
+ "acceptance_criteria": [
735
+ "CURRENT_SCHEMA_VERSION bumped to 11",
736
+ "playbooks table created with all columns matching Playbook interface",
737
+ "playbooks_fts virtual table with triggers following turns_fts pattern",
738
+ "playbook_revisions table with FK to playbooks(id) ON DELETE CASCADE",
739
+ "idx_pb_scope index on scoping columns",
740
+ "Postgres schema.sql has equivalent table definitions",
741
+ "In-memory adapter has playbooks and playbookRevisions arrays",
742
+ "Existing tests still pass"
743
+ ],
744
+ "files": [
745
+ "src/adapters/sqlite/schema.ts",
746
+ "src/adapters/postgres/schema.sql",
747
+ "src/adapters/memory/index.ts"
748
+ ],
749
+ "fast_checks": [
750
+ "npm run test"
751
+ ],
752
+ "dependencies": [
753
+ "t29"
754
+ ],
755
+ "priority": 16,
756
+ "lane": "adapters",
757
+ "parallel_safe": true,
758
+ "tranche_safe": true,
759
+ "done": true
760
+ },
761
+ {
762
+ "id": "t31",
763
+ "desc": "Storage adapter contracts for playbooks: add insertPlaybook, getPlaybookById, getActivePlaybooks, searchPlaybooks, updatePlaybook, recordPlaybookUse, insertPlaybookRevision, getPlaybookRevisions to StorageAdapter and AsyncStorageAdapter interfaces.",
764
+ "acceptance_criteria": [
765
+ "8 new methods added to StorageAdapter in src/contracts/storage.ts",
766
+ "8 matching async methods added to AsyncStorageAdapter in src/contracts/async-storage.ts",
767
+ "Method signatures match Playbook/NewPlaybook/PlaybookRevision types",
768
+ "npm run lint passes"
769
+ ],
770
+ "files": [
771
+ "src/contracts/storage.ts",
772
+ "src/contracts/async-storage.ts"
773
+ ],
774
+ "fast_checks": [
775
+ "npm run lint"
776
+ ],
777
+ "dependencies": [
778
+ "t29"
779
+ ],
780
+ "priority": 16,
781
+ "lane": "contracts",
782
+ "parallel_safe": true,
783
+ "tranche_safe": true,
784
+ "done": true
785
+ },
786
+ {
787
+ "id": "t32",
788
+ "desc": "Implement playbook storage adapter methods in all 3 adapters (SQLite, Postgres, in-memory) and sync-to-async wrapper.",
789
+ "acceptance_criteria": [
790
+ "SQLite adapter implements all 8 playbook methods with FTS5 search",
791
+ "Postgres adapter implements all 8 playbook methods",
792
+ "In-memory adapter implements all 8 playbook methods",
793
+ "sync-to-async.ts wraps all new sync methods",
794
+ "All adapters pass existing tests"
795
+ ],
796
+ "files": [
797
+ "src/adapters/sqlite/index.ts",
798
+ "src/adapters/postgres/index.ts",
799
+ "src/adapters/memory/index.ts",
800
+ "src/adapters/sync-to-async.ts"
801
+ ],
802
+ "fast_checks": null,
803
+ "dependencies": [
804
+ "t30",
805
+ "t31"
806
+ ],
807
+ "priority": 17,
808
+ "lane": "adapters",
809
+ "parallel_safe": false,
810
+ "tranche_safe": false,
811
+ "done": true
812
+ },
813
+ {
814
+ "id": "t33",
815
+ "desc": "Core playbook logic: createPlaybookFromTask (gathers session turns, summarizes into structured instructions), revisePlaybook, findRelevantPlaybooks.",
816
+ "acceptance_criteria": [
817
+ "New file src/core/playbook.ts with 3 exported async functions",
818
+ "createPlaybookFromTask gathers session turns + working memory, calls summarizer",
819
+ "revisePlaybook stores revision and updates playbook instructions",
820
+ "findRelevantPlaybooks uses FTS + scope search with relevance ranking",
821
+ "Unit tests pass"
822
+ ],
823
+ "files": [
824
+ "src/core/playbook.ts",
825
+ "src/__tests__/playbook.test.ts"
826
+ ],
827
+ "fast_checks": null,
828
+ "dependencies": [
829
+ "t32"
830
+ ],
831
+ "priority": 18,
832
+ "lane": "core",
833
+ "parallel_safe": false,
834
+ "tranche_safe": false,
835
+ "done": true
836
+ },
837
+ {
838
+ "id": "t34",
839
+ "desc": "Context builder + formatter integration for playbooks: add relevantPlaybooks to MemoryContext, search for up to 3 relevant playbooks in buildMemoryContext, add Relevant Playbooks section to formatter.",
840
+ "acceptance_criteria": [
841
+ "relevantPlaybooks: Playbook[] added to MemoryContext interface",
842
+ "buildMemoryContext searches for relevant playbooks when query available (max 3)",
843
+ "Formatter includes 'Relevant Playbooks' section in output",
844
+ "Default is empty array (backwards compatible)",
845
+ "Existing context tests still pass"
846
+ ],
847
+ "files": [
848
+ "src/core/context.ts",
849
+ "src/core/formatter.ts"
850
+ ],
851
+ "fast_checks": null,
852
+ "dependencies": [
853
+ "t33"
854
+ ],
855
+ "priority": 19,
856
+ "lane": "core",
857
+ "parallel_safe": false,
858
+ "tranche_safe": false,
859
+ "done": true
860
+ },
861
+ {
862
+ "id": "t35",
863
+ "desc": "MemoryManager playbook methods: createPlaybook, createPlaybookFromTask, revisePlaybook, getPlaybook, listPlaybooks, searchPlaybooks, recordPlaybookUse.",
864
+ "acceptance_criteria": [
865
+ "7 new methods added to MemoryManager interface and implementation",
866
+ "Methods delegate to src/core/playbook.ts and adapter",
867
+ "Existing manager tests still pass",
868
+ "New methods have unit test coverage"
869
+ ],
870
+ "files": [
871
+ "src/core/manager.ts",
872
+ "src/__tests__/manager.test.ts"
873
+ ],
874
+ "fast_checks": null,
875
+ "dependencies": [
876
+ "t34"
877
+ ],
878
+ "priority": 20,
879
+ "lane": "core",
880
+ "parallel_safe": false,
881
+ "tranche_safe": false,
882
+ "done": true
883
+ },
884
+ {
885
+ "id": "t36",
886
+ "desc": "HTTP endpoints for playbooks: POST /v1/playbooks, GET /v1/playbooks, GET /v1/playbooks/:id, PUT /v1/playbooks/:id, POST /v1/playbooks/:id/revise, POST /v1/playbooks/:id/use, POST /v1/playbooks/from-task.",
887
+ "acceptance_criteria": [
888
+ "7 routes added to HTTP server",
889
+ "All return proper API envelope format",
890
+ "CRUD operations work correctly",
891
+ "Existing HTTP tests still pass"
892
+ ],
893
+ "files": [
894
+ "src/server/http-server.ts"
895
+ ],
896
+ "fast_checks": null,
897
+ "dependencies": [
898
+ "t35"
899
+ ],
900
+ "priority": 21,
901
+ "lane": "server",
902
+ "parallel_safe": true,
903
+ "tranche_safe": true,
904
+ "done": true
905
+ },
906
+ {
907
+ "id": "t37",
908
+ "desc": "MCP tools for playbooks: memory_create_playbook, memory_search_playbooks, memory_revise_playbook.",
909
+ "acceptance_criteria": [
910
+ "3 new tools added to MCP server",
911
+ "Tool schemas match manager method signatures",
912
+ "Existing MCP tests still pass"
913
+ ],
914
+ "files": [
915
+ "src/server/mcp-server.ts"
916
+ ],
917
+ "fast_checks": null,
918
+ "dependencies": [
919
+ "t35"
920
+ ],
921
+ "priority": 21,
922
+ "lane": "server",
923
+ "parallel_safe": true,
924
+ "tranche_safe": true,
925
+ "done": true
926
+ },
927
+ {
928
+ "id": "t38",
929
+ "desc": "OpenAPI spec + exports for playbooks: new playbooks tag with all 7 endpoints, export playbook types from index.ts.",
930
+ "acceptance_criteria": [
931
+ "7 new paths under playbooks tag in openapi.yaml",
932
+ "Request/response schemas match Playbook types",
933
+ "All playbook types exported from src/index.ts",
934
+ "Spec validates"
935
+ ],
936
+ "files": [
937
+ "openapi.yaml",
938
+ "src/index.ts"
939
+ ],
940
+ "fast_checks": [
941
+ "npm run lint"
942
+ ],
943
+ "dependencies": [
944
+ "t35"
945
+ ],
946
+ "priority": 21,
947
+ "lane": "docs",
948
+ "parallel_safe": true,
949
+ "tranche_safe": true,
950
+ "done": true
951
+ },
952
+ {
953
+ "id": "t39",
954
+ "desc": "Python client for playbooks: Playbook and PlaybookRevision models, create_playbook, search_playbooks, get_playbook, revise_playbook, record_playbook_use, create_playbook_from_task methods.",
955
+ "acceptance_criteria": [
956
+ "Models added to models.py",
957
+ "6 methods added to sync and async clients",
958
+ "Methods hit correct HTTP endpoints from t36",
959
+ "Python lint passes"
960
+ ],
961
+ "files": [
962
+ "clients/python/memory_layer_client/models.py",
963
+ "clients/python/memory_layer_client/client.py"
964
+ ],
965
+ "fast_checks": null,
966
+ "dependencies": [
967
+ "t36"
968
+ ],
969
+ "priority": 22,
970
+ "lane": "python",
971
+ "parallel_safe": true,
972
+ "tranche_safe": true,
973
+ "done": true
974
+ },
975
+ {
976
+ "id": "t40",
977
+ "desc": "Playbook evals: playbook_creation_quality, playbook_retrieval_relevance, playbook_revision_continuity metrics.",
978
+ "acceptance_criteria": [
979
+ "New file evals/memory-quality/playbooks.mjs",
980
+ "3 metrics implemented and passing",
981
+ "Registered in index.mjs, baselines updated",
982
+ "npm run eval:memory-quality passes"
983
+ ],
984
+ "files": [
985
+ "evals/memory-quality/playbooks.mjs",
986
+ "evals/memory-quality/index.mjs",
987
+ "evals/memory-quality/baseline.json"
988
+ ],
989
+ "fast_checks": [
990
+ "npm run eval:memory-quality"
991
+ ],
992
+ "dependencies": [
993
+ "t35"
994
+ ],
995
+ "priority": 22,
996
+ "lane": "evals",
997
+ "parallel_safe": true,
998
+ "tranche_safe": true,
999
+ "done": true
1000
+ },
1001
+ {
1002
+ "id": "t41",
1003
+ "desc": "Association types: AssociationType, AssociationTargetKind, Association, NewAssociation, ASSOCIATION_TYPES, ASSOCIATION_TARGET_KINDS in src/contracts/types.ts.",
1004
+ "acceptance_criteria": [
1005
+ "All association types exported from src/contracts/types.ts",
1006
+ "AssociationType is 8-value union: related_to, supports, contradicts, supersedes, depends_on, solves, applies_to, derived_from",
1007
+ "AssociationTargetKind is: knowledge, playbook, working_memory, work_item",
1008
+ "Association extends NormalizedMemoryScope with source/target kind+id, type, confidence, auto_generated",
1009
+ "Both const arrays exported",
1010
+ "npm run lint passes"
1011
+ ],
1012
+ "files": [
1013
+ "src/contracts/types.ts"
1014
+ ],
1015
+ "fast_checks": [
1016
+ "npm run lint"
1017
+ ],
1018
+ "dependencies": [
1019
+ "t35"
1020
+ ],
1021
+ "priority": 23,
1022
+ "lane": "contracts",
1023
+ "parallel_safe": false,
1024
+ "tranche_safe": false,
1025
+ "done": true
1026
+ },
1027
+ {
1028
+ "id": "t42",
1029
+ "desc": "Schema migration v11->v12: associations table with unique constraint, source/target indexes, scope index. SQLite, Postgres, in-memory.",
1030
+ "acceptance_criteria": [
1031
+ "CURRENT_SCHEMA_VERSION bumped to 12",
1032
+ "associations table with UNIQUE(source_kind, source_id, target_kind, target_id, association_type)",
1033
+ "idx_assoc_source and idx_assoc_target indexes",
1034
+ "idx_assoc_scope index on scoping columns",
1035
+ "Postgres equivalent in schema.sql",
1036
+ "In-memory adapter has associations array",
1037
+ "Existing tests still pass"
1038
+ ],
1039
+ "files": [
1040
+ "src/adapters/sqlite/schema.ts",
1041
+ "src/adapters/postgres/schema.sql",
1042
+ "src/adapters/memory/index.ts"
1043
+ ],
1044
+ "fast_checks": [
1045
+ "npm run test"
1046
+ ],
1047
+ "dependencies": [
1048
+ "t41"
1049
+ ],
1050
+ "priority": 24,
1051
+ "lane": "adapters",
1052
+ "parallel_safe": false,
1053
+ "tranche_safe": false,
1054
+ "done": true
1055
+ },
1056
+ {
1057
+ "id": "t43",
1058
+ "desc": "Storage adapter contracts + implementations for associations: insertAssociation, getAssociationsFrom, getAssociationsTo, deleteAssociation in all adapters.",
1059
+ "acceptance_criteria": [
1060
+ "4 methods added to StorageAdapter and AsyncStorageAdapter interfaces",
1061
+ "Implemented in SQLite, Postgres, in-memory adapters",
1062
+ "sync-to-async.ts updated",
1063
+ "All adapter tests pass"
1064
+ ],
1065
+ "files": [
1066
+ "src/contracts/storage.ts",
1067
+ "src/contracts/async-storage.ts",
1068
+ "src/adapters/sqlite/index.ts",
1069
+ "src/adapters/postgres/index.ts",
1070
+ "src/adapters/memory/index.ts",
1071
+ "src/adapters/sync-to-async.ts"
1072
+ ],
1073
+ "fast_checks": null,
1074
+ "dependencies": [
1075
+ "t42"
1076
+ ],
1077
+ "priority": 25,
1078
+ "lane": "adapters",
1079
+ "parallel_safe": false,
1080
+ "tranche_safe": false,
1081
+ "done": true
1082
+ },
1083
+ {
1084
+ "id": "t44",
1085
+ "desc": "Core associations module: traverseAssociations (BFS, maxDepth=2, maxNodes=20) and autoDetectAssociations (creates supports/contradicts/related_to edges during extraction).",
1086
+ "acceptance_criteria": [
1087
+ "New file src/core/associations.ts",
1088
+ "traverseAssociations does bounded BFS traversal returning AssociationGraph {nodes, edges}",
1089
+ "maxDepth defaults to 2, maxNodes defaults to 20",
1090
+ "autoDetectAssociations creates edges based on semantic similarity and contradiction detection",
1091
+ "Unit tests verify traversal bounds are respected"
1092
+ ],
1093
+ "files": [
1094
+ "src/core/associations.ts",
1095
+ "src/__tests__/associations.test.ts"
1096
+ ],
1097
+ "fast_checks": null,
1098
+ "dependencies": [
1099
+ "t43"
1100
+ ],
1101
+ "priority": 26,
1102
+ "lane": "core",
1103
+ "parallel_safe": false,
1104
+ "tranche_safe": false,
1105
+ "done": true
1106
+ },
1107
+ {
1108
+ "id": "t45",
1109
+ "desc": "Orchestrator integration: call autoDetectAssociations after extractKnowledge, create supersedes association on supersedeKnowledgeMemory.",
1110
+ "acceptance_criteria": [
1111
+ "autoDetectAssociations called in orchestrator after new knowledge created",
1112
+ "supersedes association created when knowledge is superseded",
1113
+ "Existing orchestrator tests still pass"
1114
+ ],
1115
+ "files": [
1116
+ "src/core/orchestrator.ts"
1117
+ ],
1118
+ "fast_checks": null,
1119
+ "dependencies": [
1120
+ "t44"
1121
+ ],
1122
+ "priority": 27,
1123
+ "lane": "core",
1124
+ "parallel_safe": true,
1125
+ "tranche_safe": true,
1126
+ "done": true
1127
+ },
1128
+ {
1129
+ "id": "t46",
1130
+ "desc": "Context builder enhancement: single-hop association expansion for supports and related_to edges, add associatedKnowledge field to MemoryContext.",
1131
+ "acceptance_criteria": [
1132
+ "associatedKnowledge: KnowledgeMemory[] added to MemoryContext",
1133
+ "buildMemoryContext does single-hop expansion via supports + related_to associations",
1134
+ "Only includes associations above minimum threshold",
1135
+ "Default is empty array (backwards compatible)",
1136
+ "Existing context tests still pass"
1137
+ ],
1138
+ "files": [
1139
+ "src/core/context.ts"
1140
+ ],
1141
+ "fast_checks": null,
1142
+ "dependencies": [
1143
+ "t44"
1144
+ ],
1145
+ "priority": 27,
1146
+ "lane": "core",
1147
+ "parallel_safe": true,
1148
+ "tranche_safe": true,
1149
+ "done": true
1150
+ },
1151
+ {
1152
+ "id": "t47",
1153
+ "desc": "MemoryManager association methods: addAssociation, getAssociations, traverseAssociations, removeAssociation.",
1154
+ "acceptance_criteria": [
1155
+ "4 new methods added to MemoryManager interface and implementation",
1156
+ "traverseAssociations returns AssociationGraph",
1157
+ "getAssociations returns {from, to} structure",
1158
+ "Existing manager tests still pass"
1159
+ ],
1160
+ "files": [
1161
+ "src/core/manager.ts"
1162
+ ],
1163
+ "fast_checks": null,
1164
+ "dependencies": [
1165
+ "t45",
1166
+ "t46"
1167
+ ],
1168
+ "priority": 28,
1169
+ "lane": "core",
1170
+ "parallel_safe": false,
1171
+ "tranche_safe": false,
1172
+ "done": true
1173
+ },
1174
+ {
1175
+ "id": "t48",
1176
+ "desc": "HTTP + MCP + OpenAPI + exports for associations: POST/GET/DELETE /v1/associations endpoints, POST /v1/associations/traverse, memory_get_associations MCP tool, associations tag in OpenAPI, exports from index.ts.",
1177
+ "acceptance_criteria": [
1178
+ "4 HTTP routes added (POST, GET /:kind/:id, POST /traverse, DELETE /:id)",
1179
+ "memory_get_associations MCP tool with traverse option",
1180
+ "New associations tag in openapi.yaml",
1181
+ "Association types exported from src/index.ts",
1182
+ "Existing server tests still pass"
1183
+ ],
1184
+ "files": [
1185
+ "src/server/http-server.ts",
1186
+ "src/server/mcp-server.ts",
1187
+ "openapi.yaml",
1188
+ "src/index.ts"
1189
+ ],
1190
+ "fast_checks": null,
1191
+ "dependencies": [
1192
+ "t47"
1193
+ ],
1194
+ "priority": 29,
1195
+ "lane": "server",
1196
+ "parallel_safe": false,
1197
+ "tranche_safe": false,
1198
+ "done": true
1199
+ },
1200
+ {
1201
+ "id": "t49",
1202
+ "desc": "Python client for associations: Association and AssociationGraph models, add_association, get_associations, traverse_associations, remove_association methods.",
1203
+ "acceptance_criteria": [
1204
+ "Models added to models.py",
1205
+ "4 methods on sync and async clients",
1206
+ "Methods hit correct HTTP endpoints",
1207
+ "Python lint passes"
1208
+ ],
1209
+ "files": [
1210
+ "clients/python/memory_layer_client/models.py",
1211
+ "clients/python/memory_layer_client/client.py"
1212
+ ],
1213
+ "fast_checks": null,
1214
+ "dependencies": [
1215
+ "t48"
1216
+ ],
1217
+ "priority": 30,
1218
+ "lane": "python",
1219
+ "parallel_safe": true,
1220
+ "tranche_safe": true,
1221
+ "done": true
1222
+ },
1223
+ {
1224
+ "id": "t50",
1225
+ "desc": "Association evals: association_auto_detection, association_traversal_bounds, association_retrieval_boost metrics.",
1226
+ "acceptance_criteria": [
1227
+ "New file evals/memory-quality/associations.mjs",
1228
+ "3 metrics implemented and passing",
1229
+ "Registered in index.mjs, baselines updated",
1230
+ "npm run eval:memory-quality passes"
1231
+ ],
1232
+ "files": [
1233
+ "evals/memory-quality/associations.mjs",
1234
+ "evals/memory-quality/index.mjs",
1235
+ "evals/memory-quality/baseline.json"
1236
+ ],
1237
+ "fast_checks": [
1238
+ "npm run eval:memory-quality"
1239
+ ],
1240
+ "dependencies": [
1241
+ "t47"
1242
+ ],
1243
+ "priority": 30,
1244
+ "lane": "evals",
1245
+ "parallel_safe": true,
1246
+ "tranche_safe": true,
1247
+ "done": true
1248
+ },
1249
+ {
1250
+ "id": "t51",
1251
+ "desc": "Phase 3 verification gate: all tests pass, all metrics green, no regression, platform quality green.",
1252
+ "acceptance_criteria": [
1253
+ "npm run test passes",
1254
+ "npm run eval:memory-quality passes (all metrics through Phase 3)",
1255
+ "npm run eval:memory-quality:delta shows no regression",
1256
+ "npm run eval:platform-quality passes"
1257
+ ],
1258
+ "files": [],
1259
+ "fast_checks": [
1260
+ "npm run test",
1261
+ "npm run eval:memory-quality",
1262
+ "npm run eval:memory-quality:delta",
1263
+ "npm run eval:platform-quality"
1264
+ ],
1265
+ "dependencies": [
1266
+ "t36",
1267
+ "t37",
1268
+ "t38",
1269
+ "t39",
1270
+ "t40",
1271
+ "t48",
1272
+ "t49",
1273
+ "t50"
1274
+ ],
1275
+ "priority": 31,
1276
+ "lane": "verification",
1277
+ "parallel_safe": false,
1278
+ "tranche_safe": false,
1279
+ "done": true
1280
+ },
1281
+ {
1282
+ "id": "t52",
1283
+ "desc": "Snapshot types: SessionSnapshot and SnapshotRuntimeOptions interfaces in src/core/runtime.ts.",
1284
+ "acceptance_criteria": [
1285
+ "SessionSnapshot with snapshotId, bootstrap, context, frozenAt, optional profile",
1286
+ "SnapshotRuntimeOptions extends MemoryRuntimeOptions with snapshotMode boolean",
1287
+ "npm run lint passes"
1288
+ ],
1289
+ "files": [
1290
+ "src/core/runtime.ts"
1291
+ ],
1292
+ "fast_checks": [
1293
+ "npm run lint"
1294
+ ],
1295
+ "dependencies": [
1296
+ "t51"
1297
+ ],
1298
+ "priority": 32,
1299
+ "lane": "core",
1300
+ "parallel_safe": false,
1301
+ "tranche_safe": false,
1302
+ "done": true
1303
+ },
1304
+ {
1305
+ "id": "t53",
1306
+ "desc": "Runtime snapshot implementation: when snapshotMode true, startSession/resumeSession captures frozen snapshot, beforeModelCall returns cached, afterModelCall writes durably. New refreshSnapshot and getSnapshot methods.",
1307
+ "acceptance_criteria": [
1308
+ "createMemoryRuntime accepts SnapshotRuntimeOptions",
1309
+ "startSession/resumeSession captures SessionSnapshot when snapshotMode true",
1310
+ "beforeModelCall returns cached snapshot context (not live)",
1311
+ "afterModelCall still writes turns to durable storage",
1312
+ "refreshSnapshot re-captures and replaces cached snapshot",
1313
+ "getSnapshot returns current snapshot or null",
1314
+ "Default (snapshotMode false) behavior unchanged",
1315
+ "Unit tests cover snapshot stability and live writes"
1316
+ ],
1317
+ "files": [
1318
+ "src/core/runtime.ts",
1319
+ "src/__tests__/runtime.test.ts"
1320
+ ],
1321
+ "fast_checks": null,
1322
+ "dependencies": [
1323
+ "t52"
1324
+ ],
1325
+ "priority": 33,
1326
+ "lane": "core",
1327
+ "parallel_safe": false,
1328
+ "tranche_safe": false,
1329
+ "done": true
1330
+ },
1331
+ {
1332
+ "id": "t54",
1333
+ "desc": "HTTP endpoints for session snapshots: POST /v1/sessions/:sessionId/snapshot, GET /v1/sessions/:sessionId/snapshot, POST /v1/sessions/:sessionId/refresh.",
1334
+ "acceptance_criteria": [
1335
+ "3 routes added for capture, get, refresh",
1336
+ "Returns SessionSnapshot in API envelope",
1337
+ "Existing HTTP tests still pass"
1338
+ ],
1339
+ "files": [
1340
+ "src/server/http-server.ts"
1341
+ ],
1342
+ "fast_checks": null,
1343
+ "dependencies": [
1344
+ "t53"
1345
+ ],
1346
+ "priority": 34,
1347
+ "lane": "server",
1348
+ "parallel_safe": true,
1349
+ "tranche_safe": true,
1350
+ "done": true
1351
+ },
1352
+ {
1353
+ "id": "t55",
1354
+ "desc": "MCP tool for snapshots: memory_snapshot with action param (capture/refresh/status).",
1355
+ "acceptance_criteria": [
1356
+ "memory_snapshot tool added to MCP server",
1357
+ "Accepts action enum: capture, refresh, status",
1358
+ "Existing MCP tests still pass"
1359
+ ],
1360
+ "files": [
1361
+ "src/server/mcp-server.ts"
1362
+ ],
1363
+ "fast_checks": null,
1364
+ "dependencies": [
1365
+ "t53"
1366
+ ],
1367
+ "priority": 34,
1368
+ "lane": "server",
1369
+ "parallel_safe": true,
1370
+ "tranche_safe": true,
1371
+ "done": true
1372
+ },
1373
+ {
1374
+ "id": "t56",
1375
+ "desc": "Framework integration snapshot passthrough: pass snapshotMode option through claude-agent, vercel-ai, middleware integrations.",
1376
+ "acceptance_criteria": [
1377
+ "snapshotMode option accepted and passed through in claude-agent.ts",
1378
+ "snapshotMode option accepted and passed through in vercel-ai.ts",
1379
+ "snapshotMode option accepted and passed through in middleware.ts",
1380
+ "Existing integration tests still pass"
1381
+ ],
1382
+ "files": [
1383
+ "src/integrations/claude-agent.ts",
1384
+ "src/integrations/vercel-ai.ts",
1385
+ "src/integrations/middleware.ts"
1386
+ ],
1387
+ "fast_checks": null,
1388
+ "dependencies": [
1389
+ "t53"
1390
+ ],
1391
+ "priority": 34,
1392
+ "lane": "integrations",
1393
+ "parallel_safe": true,
1394
+ "tranche_safe": true,
1395
+ "done": true
1396
+ },
1397
+ {
1398
+ "id": "t57",
1399
+ "desc": "Export Phase 4 types from src/index.ts: SessionSnapshot, SnapshotRuntimeOptions.",
1400
+ "acceptance_criteria": [
1401
+ "SessionSnapshot and SnapshotRuntimeOptions exported",
1402
+ "npm run lint passes"
1403
+ ],
1404
+ "files": [
1405
+ "src/index.ts"
1406
+ ],
1407
+ "fast_checks": [
1408
+ "npm run lint"
1409
+ ],
1410
+ "dependencies": [
1411
+ "t53"
1412
+ ],
1413
+ "priority": 34,
1414
+ "lane": "contracts",
1415
+ "parallel_safe": true,
1416
+ "tranche_safe": true,
1417
+ "done": true
1418
+ },
1419
+ {
1420
+ "id": "t58",
1421
+ "desc": "Snapshot evals: snapshot_stability, snapshot_live_writes, snapshot_refresh metrics.",
1422
+ "acceptance_criteria": [
1423
+ "New file evals/memory-quality/snapshots.mjs",
1424
+ "snapshot_stability: 10 consecutive beforeModelCall returns identical context",
1425
+ "snapshot_live_writes: turns persist during snapshot mode",
1426
+ "snapshot_refresh: refreshSnapshot picks up new knowledge",
1427
+ "Registered in index.mjs, baselines updated"
1428
+ ],
1429
+ "files": [
1430
+ "evals/memory-quality/snapshots.mjs",
1431
+ "evals/memory-quality/index.mjs",
1432
+ "evals/memory-quality/baseline.json"
1433
+ ],
1434
+ "fast_checks": [
1435
+ "npm run eval:memory-quality"
1436
+ ],
1437
+ "dependencies": [
1438
+ "t53"
1439
+ ],
1440
+ "priority": 34,
1441
+ "lane": "evals",
1442
+ "parallel_safe": true,
1443
+ "tranche_safe": true,
1444
+ "done": true
1445
+ },
1446
+ {
1447
+ "id": "t59",
1448
+ "desc": "Python client for snapshots: capture_snapshot, refresh_snapshot, get_snapshot methods on runtime client.",
1449
+ "acceptance_criteria": [
1450
+ "SessionSnapshot model added to models.py",
1451
+ "3 methods on MemoryRuntimeClient and AsyncMemoryRuntimeClient",
1452
+ "Methods hit correct HTTP endpoints from t54",
1453
+ "Python lint passes"
1454
+ ],
1455
+ "files": [
1456
+ "clients/python/memory_layer_client/models.py",
1457
+ "clients/python/memory_layer_client/client.py"
1458
+ ],
1459
+ "fast_checks": null,
1460
+ "dependencies": [
1461
+ "t54"
1462
+ ],
1463
+ "priority": 35,
1464
+ "lane": "python",
1465
+ "parallel_safe": true,
1466
+ "tranche_safe": true,
1467
+ "done": true
1468
+ },
1469
+ {
1470
+ "id": "t60",
1471
+ "desc": "Phase 4 verification + final release gate: all tests, all evals, all metrics, platform quality, memory quality delta, full release:check.",
1472
+ "acceptance_criteria": [
1473
+ "npm run test passes",
1474
+ "npm run eval:memory-quality passes (~26 metrics all green)",
1475
+ "npm run eval:memory-quality:delta shows no regression from baseline",
1476
+ "npm run eval:platform-quality passes",
1477
+ "npm run release:check passes (full gate)"
1478
+ ],
1479
+ "files": [],
1480
+ "fast_checks": [
1481
+ "npm run release:check"
1482
+ ],
1483
+ "dependencies": [
1484
+ "t54",
1485
+ "t55",
1486
+ "t56",
1487
+ "t57",
1488
+ "t58",
1489
+ "t59"
1490
+ ],
1491
+ "priority": 36,
1492
+ "lane": "verification",
1493
+ "parallel_safe": false,
1494
+ "tranche_safe": false,
1495
+ "done": true
1496
+ }
1497
+ ]
1498
+ }