hippo-memory 1.61.0 → 1.63.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 (377) hide show
  1. package/README.md +37 -53
  2. package/dist/agent-memories/apply.d.ts +3 -1
  3. package/dist/agent-memories/apply.js +23 -1
  4. package/dist/agent-memories/claude-code.d.ts +4 -1
  5. package/dist/agent-memories/claude-code.js +53 -9
  6. package/dist/agent-memories/report.d.ts +1 -0
  7. package/dist/agent-memories/report.js +2 -2
  8. package/dist/agent-memories/sync.d.ts +3 -3
  9. package/dist/agent-memories/sync.js +46 -24
  10. package/dist/agent-memories/types.d.ts +0 -2
  11. package/dist/ambient-store.d.ts +4 -4
  12. package/dist/ambient-store.js +4 -3
  13. package/dist/api/assemble.d.ts +7 -10
  14. package/dist/api/assemble.js +62 -66
  15. package/dist/api/audit.d.ts +2 -2
  16. package/dist/api/audit.js +2 -2
  17. package/dist/api/auth.d.ts +6 -6
  18. package/dist/api/auth.js +5 -7
  19. package/dist/api/context-select.d.ts +50 -0
  20. package/dist/api/context-select.js +342 -0
  21. package/dist/api/context-types.d.ts +12 -17
  22. package/dist/api/context.d.ts +5 -4
  23. package/dist/api/context.js +208 -535
  24. package/dist/api/dormant.js +1 -1
  25. package/dist/api/drill-down.d.ts +4 -4
  26. package/dist/api/drill-down.js +56 -41
  27. package/dist/api/outcome.d.ts +8 -13
  28. package/dist/api/outcome.js +13 -17
  29. package/dist/api/promote.d.ts +5 -8
  30. package/dist/api/promote.js +55 -66
  31. package/dist/api/quarantine.js +3 -2
  32. package/dist/api/recall-types.d.ts +43 -55
  33. package/dist/api/recall.d.ts +3 -3
  34. package/dist/api/recall.js +310 -456
  35. package/dist/api/remember.d.ts +2 -2
  36. package/dist/api/sleep.d.ts +7 -35
  37. package/dist/api/sleep.js +206 -220
  38. package/dist/api/tokens.d.ts +2 -2
  39. package/dist/api/tokens.js +2 -2
  40. package/dist/api/types.d.ts +6 -10
  41. package/dist/api/types.js +2 -4
  42. package/dist/audit-prune.d.ts +4 -6
  43. package/dist/audit-prune.js +3 -5
  44. package/dist/audit.js +11 -33
  45. package/dist/auth.d.ts +8 -9
  46. package/dist/auth.js +5 -7
  47. package/dist/autolearn.d.ts +1 -1
  48. package/dist/autolearn.js +1 -1
  49. package/dist/availability.js +3 -5
  50. package/dist/capture/command.d.ts +5 -4
  51. package/dist/capture/command.js +8 -22
  52. package/dist/capture/compact.d.ts +2 -2
  53. package/dist/capture/compact.js +11 -15
  54. package/dist/capture/extract.js +37 -115
  55. package/dist/capture-error.d.ts +1 -1
  56. package/dist/capture-error.js +1 -1
  57. package/dist/churn-git.d.ts +1 -1
  58. package/dist/churn-git.js +1 -1
  59. package/dist/cli/audit.js +3 -4
  60. package/dist/cli/auth.js +3 -6
  61. package/dist/cli/briefs.js +324 -306
  62. package/dist/cli/context.js +44 -34
  63. package/dist/cli/continuity.js +283 -271
  64. package/dist/cli/curate.d.ts +1 -1
  65. package/dist/cli/curate.js +43 -58
  66. package/dist/cli/dag.js +5 -9
  67. package/dist/cli/decisions.js +334 -345
  68. package/dist/cli/explain.js +68 -61
  69. package/dist/cli/goals.js +1 -1
  70. package/dist/cli/init.js +1 -1
  71. package/dist/cli/maintenance.js +62 -51
  72. package/dist/cli/playbooks.js +391 -379
  73. package/dist/cli/projects.js +11 -6
  74. package/dist/cli/recall.js +30 -44
  75. package/dist/cli/remember.js +118 -87
  76. package/dist/cli/session-hooks.js +106 -115
  77. package/dist/cli/setup.d.ts +1 -1
  78. package/dist/cli/setup.js +267 -250
  79. package/dist/cli/shared.js +3 -3
  80. package/dist/cli/slack.js +1 -1
  81. package/dist/cli/sleep.js +27 -1
  82. package/dist/cli/status.d.ts +4 -4
  83. package/dist/cli/status.js +80 -76
  84. package/dist/cli/transfer.js +88 -107
  85. package/dist/cli/usage.js +9 -6
  86. package/dist/cli.d.ts +1 -1
  87. package/dist/cli.js +4 -9
  88. package/dist/compaction-record.d.ts +2 -2
  89. package/dist/compaction-record.js +89 -68
  90. package/dist/compare.d.ts +11 -16
  91. package/dist/compare.js +11 -16
  92. package/dist/config.d.ts +19 -18
  93. package/dist/config.js +90 -67
  94. package/dist/connectors/github/backfill.d.ts +2 -2
  95. package/dist/connectors/github/backfill.js +8 -15
  96. package/dist/connectors/github/cli-impl.js +3 -8
  97. package/dist/connectors/github/deletion.d.ts +5 -12
  98. package/dist/connectors/github/deletion.js +5 -12
  99. package/dist/connectors/github/dlq.d.ts +6 -9
  100. package/dist/connectors/github/dlq.js +2 -3
  101. package/dist/connectors/github/ingest.d.ts +5 -7
  102. package/dist/connectors/github/ingest.js +8 -12
  103. package/dist/connectors/github/octokit-client.d.ts +3 -5
  104. package/dist/connectors/github/octokit-client.js +5 -6
  105. package/dist/connectors/github/signature.d.ts +9 -39
  106. package/dist/connectors/github/signature.js +9 -39
  107. package/dist/connectors/github/tenant-routing.d.ts +1 -1
  108. package/dist/connectors/github/tenant-routing.js +1 -1
  109. package/dist/connectors/github/transform.js +2 -2
  110. package/dist/connectors/github/types.d.ts +2 -10
  111. package/dist/connectors/github/types.js +1 -3
  112. package/dist/connectors/slack/deletion.d.ts +3 -8
  113. package/dist/connectors/slack/deletion.js +3 -8
  114. package/dist/connectors/slack/dlq.d.ts +1 -1
  115. package/dist/connectors/slack/ingest.d.ts +1 -1
  116. package/dist/connectors/slack/ingest.js +7 -16
  117. package/dist/connectors/slack/signature.d.ts +1 -1
  118. package/dist/connectors/slack/tenant-routing.d.ts +3 -5
  119. package/dist/connectors/slack/tenant-routing.js +3 -5
  120. package/dist/connectors/slack/transform.d.ts +5 -6
  121. package/dist/connectors/slack/transform.js +5 -6
  122. package/dist/connectors/slack/types.d.ts +2 -6
  123. package/dist/connectors/slack/types.js +1 -3
  124. package/dist/connectors/slack/web-client.js +10 -3
  125. package/dist/connectors/slack/workspaces.d.ts +3 -5
  126. package/dist/connectors/slack/workspaces.js +3 -5
  127. package/dist/consolidate/conflicts.js +3 -14
  128. package/dist/consolidate/decay.js +9 -29
  129. package/dist/consolidate/llm-passes.js +4 -5
  130. package/dist/consolidate/merge.js +8 -23
  131. package/dist/consolidate/run.d.ts +1 -8
  132. package/dist/consolidate/run.js +3 -25
  133. package/dist/consolidate/sleep.js +5 -17
  134. package/dist/consolidate/traces.js +9 -21
  135. package/dist/customer-notes.d.ts +5 -7
  136. package/dist/customer-notes.js +82 -76
  137. package/dist/dag.d.ts +10 -21
  138. package/dist/dag.js +189 -203
  139. package/dist/db/continuity.js +2 -2
  140. package/dist/db/migrations/v14.js +1 -1
  141. package/dist/db/migrations/v15.js +1 -2
  142. package/dist/db/migrations/v16.js +3 -4
  143. package/dist/db/migrations/v17.js +2 -3
  144. package/dist/db/migrations/v19.js +1 -1
  145. package/dist/db/migrations/v20.js +1 -1
  146. package/dist/db/migrations/v21.js +2 -6
  147. package/dist/db/migrations/v22.js +2 -4
  148. package/dist/db/migrations/v23.js +1 -1
  149. package/dist/db/migrations/v24.js +4 -6
  150. package/dist/db/migrations/v25.js +2 -3
  151. package/dist/db/migrations/v26.js +3 -3
  152. package/dist/db/migrations/v27.js +2 -10
  153. package/dist/db/migrations/v28.js +5 -8
  154. package/dist/db/migrations/v29.js +3 -4
  155. package/dist/db/migrations/v30.js +2 -2
  156. package/dist/db/migrations/v31.js +1 -1
  157. package/dist/db/migrations/v32.js +1 -1
  158. package/dist/db/migrations/v33.js +3 -3
  159. package/dist/db/migrations/v34.js +1 -1
  160. package/dist/db/migrations/v35.js +3 -4
  161. package/dist/db/migrations/v36.js +3 -4
  162. package/dist/db/migrations/v37.js +5 -5
  163. package/dist/db/migrations/v38.js +7 -8
  164. package/dist/db/migrations/v39.js +1 -1
  165. package/dist/db/migrations/v40.js +4 -16
  166. package/dist/db/migrations/v41.js +3 -4
  167. package/dist/db/migrations/v42.js +3 -4
  168. package/dist/db/migrations/v45.js +1 -1
  169. package/dist/db/migrations/v46.js +1 -1
  170. package/dist/db/migrations/v47.js +1 -1
  171. package/dist/db/migrations/v48.js +1 -1
  172. package/dist/decisions.d.ts +2 -2
  173. package/dist/decisions.js +97 -80
  174. package/dist/dedupe.js +86 -61
  175. package/dist/delivery-recorder.js +154 -135
  176. package/dist/doctor.js +129 -110
  177. package/dist/dormant.js +1 -4
  178. package/dist/embedding-provider.d.ts +4 -8
  179. package/dist/embedding-provider.js +4 -8
  180. package/dist/embeddings.js +55 -47
  181. package/dist/env.d.ts +1 -1
  182. package/dist/env.js +12 -12
  183. package/dist/escape.d.ts +5 -0
  184. package/dist/escape.js +10 -0
  185. package/dist/eval-stats.d.ts +1 -2
  186. package/dist/eval-stats.js +1 -2
  187. package/dist/eval-suite.js +27 -21
  188. package/dist/extract.js +4 -9
  189. package/dist/failure-log.d.ts +3 -3
  190. package/dist/failure-log.js +1 -1
  191. package/dist/forward-claim-detector.d.ts +2 -4
  192. package/dist/forward-claim-detector.js +6 -11
  193. package/dist/goals.d.ts +3 -3
  194. package/dist/goals.js +103 -91
  195. package/dist/graph/read.d.ts +2 -2
  196. package/dist/graph/read.js +5 -6
  197. package/dist/graph/types.d.ts +8 -8
  198. package/dist/graph/write.d.ts +7 -14
  199. package/dist/graph/write.js +16 -23
  200. package/dist/graph-extract.d.ts +7 -8
  201. package/dist/graph-extract.js +62 -72
  202. package/dist/graph-recall.d.ts +2 -2
  203. package/dist/graph-recall.js +55 -49
  204. package/dist/graph-stream.d.ts +5 -6
  205. package/dist/graph-stream.js +66 -57
  206. package/dist/graph-view.d.ts +2 -2
  207. package/dist/graph-view.js +7 -7
  208. package/dist/half-life-migration.d.ts +1 -2
  209. package/dist/half-life-migration.js +2 -3
  210. package/dist/hooks/codex-session.js +1 -1
  211. package/dist/hooks/codex-wrapper.d.ts +1 -1
  212. package/dist/hooks/codex-wrapper.js +3 -2
  213. package/dist/hooks/json-hooks.d.ts +2 -2
  214. package/dist/hooks/json-hooks.js +5 -4
  215. package/dist/hooks/opencode.d.ts +1 -1
  216. package/dist/hooks/opencode.js +5 -4
  217. package/dist/hooks/shared.d.ts +3 -7
  218. package/dist/hooks/shared.js +1 -8
  219. package/dist/http-util.d.ts +2 -3
  220. package/dist/http-util.js +3 -0
  221. package/dist/importers/core.d.ts +2 -9
  222. package/dist/importers/core.js +15 -30
  223. package/dist/importers/sources.js +2 -1
  224. package/dist/importers/vault.js +2 -20
  225. package/dist/incidents.d.ts +1 -1
  226. package/dist/incidents.js +46 -39
  227. package/dist/instruction-detect.d.ts +1 -1
  228. package/dist/instruction-detect.js +1 -1
  229. package/dist/invalidation.d.ts +3 -0
  230. package/dist/invalidation.js +160 -114
  231. package/dist/json.d.ts +5 -0
  232. package/dist/json.js +4 -0
  233. package/dist/judgment.js +1 -2
  234. package/dist/local-embedding.js +1 -1
  235. package/dist/mcp/admin-tools.js +7 -17
  236. package/dist/mcp/format.js +1 -1
  237. package/dist/mcp/framing.js +3 -6
  238. package/dist/mcp/protocol.d.ts +2 -5
  239. package/dist/mcp/protocol.js +1 -3
  240. package/dist/mcp/recall-tools.js +12 -15
  241. package/dist/mcp/request.js +4 -3
  242. package/dist/mcp/session-state.js +2 -3
  243. package/dist/mcp/stdio.js +2 -1
  244. package/dist/mcp/tools.js +9 -6
  245. package/dist/memory-value-weights.d.ts +5 -8
  246. package/dist/memory-value-weights.js +5 -8
  247. package/dist/memory-value.d.ts +13 -13
  248. package/dist/memory-value.js +26 -37
  249. package/dist/memory.d.ts +20 -22
  250. package/dist/memory.js +24 -48
  251. package/dist/multihop.d.ts +1 -1
  252. package/dist/multihop.js +3 -2
  253. package/dist/owner-validation.d.ts +4 -5
  254. package/dist/owner-validation.js +4 -5
  255. package/dist/physics.d.ts +4 -4
  256. package/dist/physics.js +7 -9
  257. package/dist/policies.d.ts +9 -10
  258. package/dist/policies.js +96 -81
  259. package/dist/postinstall.js +3 -6
  260. package/dist/predictions/planning-fallacy.d.ts +9 -14
  261. package/dist/predictions/planning-fallacy.js +10 -16
  262. package/dist/predictions/store.d.ts +15 -23
  263. package/dist/predictions/store.js +36 -33
  264. package/dist/processes.d.ts +2 -7
  265. package/dist/processes.js +88 -72
  266. package/dist/project-briefs.d.ts +2 -3
  267. package/dist/project-briefs.js +141 -118
  268. package/dist/project-identity.d.ts +22 -9
  269. package/dist/project-identity.js +47 -12
  270. package/dist/project-merge.d.ts +28 -5
  271. package/dist/project-merge.js +213 -46
  272. package/dist/project-remote.d.ts +12 -0
  273. package/dist/project-remote.js +138 -0
  274. package/dist/prompt-recall.js +1 -2
  275. package/dist/rate-limit.d.ts +1 -1
  276. package/dist/rate-limit.js +1 -1
  277. package/dist/raw-archive.d.ts +9 -0
  278. package/dist/raw-archive.js +70 -53
  279. package/dist/recall-history.d.ts +19 -20
  280. package/dist/recall-history.js +24 -42
  281. package/dist/recall-pipeline.js +4 -28
  282. package/dist/recall-scope.d.ts +7 -8
  283. package/dist/recall-scope.js +7 -8
  284. package/dist/recall-trace.d.ts +5 -9
  285. package/dist/recall-trace.js +6 -10
  286. package/dist/refine-llm.d.ts +1 -1
  287. package/dist/refine-llm.js +2 -2
  288. package/dist/reject-flow.d.ts +3 -4
  289. package/dist/reject-flow.js +122 -117
  290. package/dist/rejection.d.ts +5 -6
  291. package/dist/rejection.js +7 -15
  292. package/dist/rerankers/clef.d.ts +1 -1
  293. package/dist/rerankers/jev.d.ts +1 -2
  294. package/dist/rerankers/jev.js +4 -5
  295. package/dist/rerankers/llm.d.ts +1 -2
  296. package/dist/rerankers/llm.js +1 -2
  297. package/dist/rerankers/types.d.ts +1 -2
  298. package/dist/rrf.d.ts +2 -2
  299. package/dist/rrf.js +2 -2
  300. package/dist/search/bm25-search.d.ts +1 -1
  301. package/dist/search/bm25-search.js +2 -1
  302. package/dist/search/boosts.js +2 -1
  303. package/dist/search/hybrid.d.ts +1 -1
  304. package/dist/search/hybrid.js +2 -1
  305. package/dist/search/physics-search.d.ts +1 -1
  306. package/dist/search/physics-search.js +2 -1
  307. package/dist/search/types.d.ts +2 -0
  308. package/dist/search/types.js +3 -1
  309. package/dist/secret-detect.d.ts +4 -5
  310. package/dist/secret-detect.js +6 -10
  311. package/dist/server/auth.js +5 -5
  312. package/dist/server/client-ip.js +1 -1
  313. package/dist/server/cursor.js +2 -1
  314. package/dist/server/mcp-http.js +4 -4
  315. package/dist/server/request.d.ts +3 -6
  316. package/dist/server/request.js +6 -7
  317. package/dist/server/routes/admin.js +5 -4
  318. package/dist/server/routes/customer-notes.js +6 -5
  319. package/dist/server/routes/decisions.js +4 -3
  320. package/dist/server/routes/incidents.js +7 -5
  321. package/dist/server/routes/memories.js +7 -7
  322. package/dist/server/routes/policies.js +3 -2
  323. package/dist/server/routes/predictions.js +12 -15
  324. package/dist/server/routes/processes.js +3 -2
  325. package/dist/server/routes/project-briefs.js +8 -7
  326. package/dist/server/routes/recall.js +95 -93
  327. package/dist/server/routes/skills.js +6 -5
  328. package/dist/server/types.d.ts +1 -1
  329. package/dist/server/validation.d.ts +1 -2
  330. package/dist/server/validation.js +7 -14
  331. package/dist/server-detect.js +72 -58
  332. package/dist/server.d.ts +2 -2
  333. package/dist/server.js +131 -117
  334. package/dist/shared.d.ts +26 -17
  335. package/dist/shared.js +102 -104
  336. package/dist/skills.d.ts +3 -3
  337. package/dist/skills.js +88 -72
  338. package/dist/store/audit-event.d.ts +2 -2
  339. package/dist/store/audit-event.js +1 -1
  340. package/dist/store/candidates.d.ts +2 -2
  341. package/dist/store/candidates.js +4 -3
  342. package/dist/store/conflicts.js +30 -22
  343. package/dist/store/delete-and-batch.d.ts +11 -14
  344. package/dist/store/delete-and-batch.js +40 -91
  345. package/dist/store/entry-reads.d.ts +17 -25
  346. package/dist/store/entry-reads.js +59 -40
  347. package/dist/store/entry-row.d.ts +6 -24
  348. package/dist/store/entry-row.js +6 -24
  349. package/dist/store/entry-writes.d.ts +6 -7
  350. package/dist/store/entry-writes.js +13 -11
  351. package/dist/store/handoffs.d.ts +1 -1
  352. package/dist/store/handoffs.js +7 -10
  353. package/dist/store/index-and-stats.d.ts +2 -6
  354. package/dist/store/index-and-stats.js +4 -10
  355. package/dist/store/mirrors.d.ts +6 -19
  356. package/dist/store/mirrors.js +14 -39
  357. package/dist/store/open.js +9 -31
  358. package/dist/store/rows.d.ts +5 -11
  359. package/dist/store/rows.js +6 -11
  360. package/dist/store/search-rows.d.ts +17 -34
  361. package/dist/store/search-rows.js +34 -56
  362. package/dist/store/sessions.d.ts +4 -5
  363. package/dist/store/sessions.js +5 -6
  364. package/dist/store/summaries.d.ts +13 -17
  365. package/dist/store/summaries.js +26 -70
  366. package/dist/support-bundle.js +4 -8
  367. package/dist/tenant.d.ts +1 -5
  368. package/dist/token-ledger.d.ts +1 -1
  369. package/dist/token-ledger.js +3 -5
  370. package/dist/trace.js +1 -3
  371. package/dist/version.d.ts +1 -1
  372. package/dist/version.js +1 -1
  373. package/dist/working-memory.d.ts +1 -1
  374. package/extensions/openclaw-plugin/openclaw.plugin.json +1 -1
  375. package/extensions/openclaw-plugin/package.json +1 -1
  376. package/openclaw.plugin.json +1 -1
  377. package/package.json +1 -1
@@ -2,14 +2,14 @@ import { tableHasColumn, tableExists } from '../tables.js';
2
2
  export const v26 = {
3
3
  version: 26,
4
4
  up: (db) => {
5
- // v1.12.0 A5 v2 sub-1: add role column to api_keys for the admin/member
5
+ // Add role column to api_keys for the admin/member
6
6
  // distinction that gates /v1/sleep. Additive — existing keys backfill to
7
7
  // 'admin' via DEFAULT (single-tenant operator = admin by definition).
8
- // No min_compatible_binary bump: old binaries (v1.11.x) ignore the
8
+ // No min_compatible_binary bump: old binaries ignore the
9
9
  // column on SELECTs that don't name it; new binaries on old data run
10
10
  // this migration at openHippoDb time before any createApiKey call.
11
11
  //
12
- // v1.12.7 defensive: also guard on tableExists. If a DB landed in the
12
+ // Defensive: also guard on tableExists. If a DB landed in the
13
13
  // partial-v16-state (api_keys table missing despite schema_version >= 16),
14
14
  // running ALTER TABLE here would crash and block all later migrations.
15
15
  // The v27 heal below recreates api_keys with the role column already
@@ -2,16 +2,8 @@ import { tableHasColumn, tableExists } from '../tables.js';
2
2
  export const v27 = {
3
3
  version: 27,
4
4
  up: (db) => {
5
- // v1.12.7 self-heal — re-assert the v16 schema (api_keys + audit_log).
6
- //
7
- // Surfaced 2026-05-24 on Keith's ~/.hippo/hippo.db: schema_version
8
- // recorded as 25 but api_keys and audit_log tables were missing from
9
- // migration v16. Root cause unknown — the migration runner has wrapped
10
- // each migration in BEGIN/COMMIT since the first SQLite commit, so
11
- // atomicity isn't the bug. Possible causes: DROP TABLE post-migration,
12
- // SQL import / restore from a pre-v16 backup over a v16+ schema_version,
13
- // or some edge case the wrapping doesn't catch. Cause may be operator
14
- // action; either way the practical fix is the same.
5
+ // Self-heal: re-assert the v16 schema (api_keys + audit_log) on stores stamped past
6
+ // v16 whose tables are missing anyway (a dropped table or an old-backup restore).
15
7
  //
16
8
  // All CREATE IF NOT EXISTS — zero-cost no-op for users without the
17
9
  // bug, fixes anyone who has it. Includes the role column from the
@@ -2,16 +2,13 @@ import { tableHasColumn } from '../tables.js';
2
2
  export const v28 = {
3
3
  version: 28,
4
4
  up: (db) => {
5
- // E1 of 5-episode DAG live-coupling arc (docs/plans/2026-05-25-dag-e1-schema-v28.md).
6
- // Adds dirty-flag persistence for the existing DAG layer's level-2
7
- // summaries so E2 (child-write propagation) and E3 (sleep-cycle
8
- // rebuild) have somewhere to write + read the staleness signal. Adds
9
- // dag_level_3_built_at as a column (Keith Q5 pick: lets E5 entity-
10
- // profile build path land without a second migration).
5
+ // Dirty-flag persistence for level-2 DAG summaries, so child-write propagation and the
6
+ // sleep-cycle rebuild can write + read the staleness signal. dag_level_3_built_at lands
7
+ // now so the entity-profile build path needs no second migration.
11
8
  //
12
9
  // All columns are additive + DEFAULTed/nullable, so backfill is
13
10
  // automatic for existing rows. No min_compatible_binary bump: old
14
- // binaries (v1.12.x) ignore the columns on SELECTs that don't name
11
+ // binaries ignore the columns on SELECTs that don't name
15
12
  // them; new binaries on old data hit this migration at openHippoDb
16
13
  // time before any DAG path touches summary_dirty.
17
14
  //
@@ -29,7 +26,7 @@ export const v28 = {
29
26
  db.exec(`ALTER TABLE memories ADD COLUMN rebuild_count INTEGER NOT NULL DEFAULT 0`);
30
27
  }
31
28
  if (!tableHasColumn(db, 'memories', 'dag_level_3_built_at')) {
32
- // Reserved for E5: buildEntityProfiles will set this on level-3
29
+ // buildEntityProfiles sets this on level-3
33
30
  // rows when they're created. Always NULL for level 0/1/2 rows.
34
31
  db.exec(`ALTER TABLE memories ADD COLUMN dag_level_3_built_at TEXT`);
35
32
  }
@@ -2,9 +2,8 @@ import { tableExists } from '../tables.js';
2
2
  export const v29 = {
3
3
  version: 29,
4
4
  up: (db) => {
5
- // E2 prediction first-class object (docs/plans/2026-05-26-e2-prediction-object.md).
6
- // Adds a canonical predictions table for J3 reference-class /
7
- // planning-fallacy detector (a follow-up episode). Predictions
5
+ // Prediction first-class object: a predictions table for the reference-class /
6
+ // planning-fallacy detector. Predictions
8
7
  // duplicate claim_text in the table itself so memory deletion
9
8
  // (forget/consolidate/archive) does not lose prediction data; FK
10
9
  // memory_id is NULLABLE with ON DELETE SET NULL.
@@ -16,7 +15,7 @@ export const v29 = {
16
15
  // FK target. Precedent: v14 memories.kind trigger pair at db.ts:298-322.
17
16
  //
18
17
  // CHECK constraint pins closure_state to (open|closed|closed-unknown).
19
- // J3 computes accuracy (clean vs regressed) from (estimate_value,
18
+ // Accuracy (clean vs regressed) is computed from (estimate_value,
20
19
  // actual_value) at query time.
21
20
  if (!tableExists(db, 'predictions')) {
22
21
  db.exec(`
@@ -67,9 +67,9 @@ const TRG_DECISIONS_SUPERSEDE_TENANT_MATCH_UPDATE = `
67
67
  export const v30 = {
68
68
  version: 30,
69
69
  up: (db) => {
70
- // E2 decision first-class object (docs/plans/2026-05-28-e2-decision-object.md).
70
+ // Decision first-class object.
71
71
  // Promotes `hippo decide` from a tagged memory (which decayed on a 90-day
72
- // half-life even while the decision was still in force) to a canonical
72
+ // half-life even while the decision was still in force) to a dedicated
73
73
  // decisions table that is the source of truth. The memory mirror is kept
74
74
  // for recall but is no longer authoritative; memory_id is NULLABLE with
75
75
  // ON DELETE SET NULL so forget/consolidate/archive does not lose a
@@ -2,7 +2,7 @@ import { tableExists } from '../tables.js';
2
2
  export const v31 = {
3
3
  version: 31,
4
4
  up: (db) => {
5
- // E2 incident first-class object (docs/plans/2026-05-29-e2-incident-object.md).
5
+ // Incident first-class object.
6
6
  // Mirrors the v30 decisions block but for an open -> resolved -> closed
7
7
  // lifecycle (NOT supersede): there is no superseded_by self-FK and no
8
8
  // supersede trigger. An incident is a postmortem capsule: a recorded
@@ -71,7 +71,7 @@ const TRG_PROCESSES_SUPERSEDE_TENANT_MATCH_UPDATE = `
71
71
  export const v32 = {
72
72
  version: 32,
73
73
  up: (db) => {
74
- // E2 process first-class object (docs/plans/2026-05-29-e2-process-object.md).
74
+ // Process first-class object.
75
75
  // A process is a "living process map": a named, ordered list of steps that
76
76
  // evolves. Unlike incident (open->resolved->closed, no supersede), process
77
77
  // REUSES the v30 decisions supersede path as its delta mechanism: a process
@@ -75,7 +75,7 @@ const TRG_POLICIES_SUPERSEDE_TENANT_MATCH_UPDATE = `
75
75
  export const v33 = {
76
76
  version: 33,
77
77
  up: (db) => {
78
- // E2 policy first-class object (docs/plans/2026-05-30-e2-policy-object.md).
78
+ // Policy first-class object.
79
79
  // The "bi-temporal-first" object type: a named rule/statement that is in
80
80
  // force over an EFFECTIVE-TIME range (valid_from required, valid_to nullable
81
81
  // = open-ended) and evolves via the v32 processes supersede machinery
@@ -86,10 +86,10 @@ export const v33 = {
86
86
  // axis (the as-of query loadPoliciesAsOf); transaction-time is present via
87
87
  // created_at + the supersede chain's superseded_at (time-travel deferred).
88
88
  //
89
- // All date inputs are normalized to canonical ISO-8601 datetime
89
+ // All date inputs are normalized to standard ISO-8601 datetime
90
90
  // (toISOString) at the store boundary before persist/compare, so the
91
91
  // fixed-width values sort lexically and the half-open [valid_from, valid_to)
92
- // as-of comparison is correct (plan-eng-critic round-1 CRIT fix).
92
+ // as-of comparison is correct.
93
93
  if (!tableExists(db, 'policies')) {
94
94
  db.exec(POLICIES_TABLE);
95
95
  db.exec(IDX_POLICIES_TENANT_STATUS);
@@ -69,7 +69,7 @@ const TRG_SKILLS_SUPERSEDE_TENANT_MATCH_UPDATE = `
69
69
  export const v34 = {
70
70
  version: 34,
71
71
  up: (db) => {
72
- // E2 skill first-class object (docs/plans/2026-05-30-e2-skill-object.md).
72
+ // Skill first-class object.
73
73
  // A skill is a reusable, agent-followable capability: an `instructions` body
74
74
  // + an optional `trigger_text` (when to apply), evolving via the v32
75
75
  // processes supersede machinery (superseded_by self-FK + supersede
@@ -72,8 +72,7 @@ const TRG_PROJECT_BRIEFS_SUPERSEDE_TENANT_MATCH_UPDATE = `
72
72
  export const v35 = {
73
73
  version: 35,
74
74
  up: (db) => {
75
- // E2 project_brief first-class object
76
- // (docs/plans/2026-05-30-e2-project-brief-object.md). A project_brief is the
75
+ // project_brief first-class object. A project_brief is the
77
76
  // living, repo-scoped summary of a repository's state: a `summary` body
78
77
  // scoped to a `repo`, evolving via the v34 skills supersede machinery
79
78
  // (superseded_by self-FK + supersede tenant-match trigger + version +
@@ -82,8 +81,8 @@ export const v35 = {
82
81
  // PLUS `summary` (the brief body). The distinguishing op (refreshBrief, in
83
82
  // src/project-briefs.ts) auto-assembles the summary from the repo's receipts
84
83
  // (memory rows tagged path:<repo>); it needs no schema support beyond `repo`.
85
- // All column names were checked against SQLite reserved words (skill-episode
86
- // lesson re: `trigger`): repo/summary/version/status/etc. are non-reserved.
84
+ // All column names were checked against SQLite reserved words:
85
+ // repo/summary/version/status/etc. are non-reserved.
87
86
  if (!tableExists(db, 'project_briefs')) {
88
87
  db.exec(PROJECT_BRIEFS_TABLE);
89
88
  db.exec(IDX_PROJECT_BRIEFS_TENANT_STATUS);
@@ -72,17 +72,16 @@ const TRG_CUSTOMER_NOTES_SUPERSEDE_TENANT_MATCH_UPDATE = `
72
72
  export const v36 = {
73
73
  version: 36,
74
74
  up: (db) => {
75
- // E2 customer_note first-class object (the LAST E2 object)
76
- // (docs/plans/2026-06-01-e2-customer-note-object.md). A customer_note is a
75
+ // customer_note first-class object. A customer_note is a
77
76
  // discrete note recorded against an account/customer entity, evolving via the
78
77
  // v35 project_briefs supersede machinery (superseded_by self-FK + supersede
79
78
  // tenant-match trigger + version + change_summary). This table = the v35
80
79
  // project_briefs table with repo/summary replaced by `customer` (the
81
80
  // entity-scoping dimension; a free-form account/customer id - the entities
82
- // table is unbuilt E3.1, so a FK is deferred) PLUS `note` (the note body).
81
+ // table is unbuilt, so a FK is deferred) PLUS `note` (the note body).
83
82
  // MANY notes per customer (each its own supersede chain), unlike the
84
83
  // one-summary-per-repo project_brief. All column names checked against SQLite
85
- // reserved words (skill-episode lesson, codebase-audit rule 10): customer/note/
84
+ // reserved words: customer/note/
86
85
  // version/status/etc. are non-reserved.
87
86
  if (!tableExists(db, 'customer_notes')) {
88
87
  db.exec(CUSTOMER_NOTES_TABLE);
@@ -139,7 +139,7 @@ const TRG_GRAPH_QUEUE_CONSOLIDATED_ONLY_UPDATE = `
139
139
  END;
140
140
  END
141
141
  `;
142
- // Reverse guard (codex-review-critic 2026-06-01, P1): the graph-table triggers
142
+ // Reverse guard: the graph-table triggers
143
143
  // only fire on writes to the GRAPH tables. They do NOT fire when an
144
144
  // already-indexed memory is later mutated. So 'UPDATE memories SET kind=raw'
145
145
  // (or a tenant change) on a memory the graph references would silently leave
@@ -162,7 +162,7 @@ const TRG_MEMORIES_GRAPH_REFERENCED_GUARD = `
162
162
  SELECT RAISE(ABORT, 'cannot change the kind or tenant of a memory while the graph references it (E3.3 graph-on-consolidated guard); a graph-referenced memory is immutable in kind/tenant - rebuild/remove the graph rows first, or rebuild them after supersession');
163
163
  END
164
164
  `;
165
- // Reverse guard #2 (codex-review-critic 2026-06-01 retry, P2): an entity that is
165
+ // Second reverse guard: an entity that is
166
166
  // a relation endpoint cannot be moved cross-tenant. The entity UPDATE trigger
167
167
  // validates the entity against its source memory, but an existing relation
168
168
  // pointing at the entity is NOT re-validated, so a raw 'UPDATE entities SET
@@ -181,7 +181,7 @@ const TRG_ENTITIES_NO_TENANT_MOVE_WHEN_REFERENCED = `
181
181
  export const v37 = {
182
182
  version: 37,
183
183
  up: (db) => {
184
- // E3.3 graph-on-consolidated guard (docs/plans/2026-06-01-e3-graph-guard.md).
184
+ // Graph-on-consolidated guard.
185
185
  // The graph layer (entities + relations) sits ON TOP OF consolidated state and
186
186
  // must NEVER index the raw layer. The substrate: entities + relations +
187
187
  // graph_extraction_queue, each FK-ing to memories and guarded so they can only
@@ -192,8 +192,8 @@ export const v37 = {
192
192
  // is a BEFORE INSERT *and* BEFORE UPDATE trigger (the subquery-capable pattern
193
193
  // from the v30 decisions / predictions tenant-match triggers). Both INSERT and
194
194
  // UPDATE are guarded: an INSERT-only guard is bypassable via a raw SQL UPDATE
195
- // that moves a row onto a raw memory (plan-eng-critic 2026-06-01). All column
196
- // names checked vs SQL reserved words (rule 10): rel_type avoids REFERENCES.
195
+ // that moves a row onto a raw memory. All column
196
+ // names checked vs SQL reserved words: rel_type avoids REFERENCES.
197
197
  if (!tableExists(db, 'entities')) {
198
198
  db.exec(ENTITIES_TABLE);
199
199
  db.exec(`CREATE INDEX IF NOT EXISTS idx_entities_tenant ON entities(tenant_id)`);
@@ -38,7 +38,7 @@ const RELATIONS_TABLE = `
38
38
  // - memory path (memory_id NOT NULL): source_kind == the FK'd memory's kind
39
39
  // (raw / lying source_kind ABORT) AND tenant-match.
40
40
  // - object path (memory_id NULL): the (type,id) points at an EXISTING same-tenant
41
- // E2 row whose status is active|superseded (explicit 4-way CASE per table).
41
+ // object row whose status is active|superseded (explicit 4-way CASE per table).
42
42
  const TRG_ENTITIES_CONSOLIDATED_ONLY_INSERT = `
43
43
  CREATE TRIGGER IF NOT EXISTS trg_entities_consolidated_only_insert
44
44
  BEFORE INSERT ON entities
@@ -217,10 +217,9 @@ const TRG_ENTITIES_NO_TENANT_MOVE_WHEN_REFERENCED = `
217
217
  export const v38 = {
218
218
  version: 38,
219
219
  up: (db) => {
220
- // E2-provenance: anchor graph entity/relation provenance to the authoritative E2
221
- // object (decision/policy/customer-note/project-brief) instead of the decaying
222
- // memory mirror (docs/plans/2026-06-03-graph-e2-provenance.md). An in-force E2
223
- // object must STAY in the graph after its mirror memory is forgotten or
220
+ // Object provenance: anchor graph entity/relation provenance to the authoritative
221
+ // first-class object (decision/policy/customer-note/project-brief) instead of the
222
+ // decaying memory mirror. An in-force object must STAY in the graph after its mirror memory is forgotten or
224
223
  // consolidation-pruned. The graph is a PURE DERIVED CACHE (clearGraph + rebuild on
225
224
  // every `graph extract` / `sleep`), so v38 DROPs+recreates entities/relations (no
226
225
  // data copy) and the next extract repopulates. graph_extraction_queue is untouched.
@@ -229,7 +228,7 @@ export const v38 = {
229
228
  // - memory path (memory_id NOT NULL): source_kind must equal the FK'd memory's live
230
229
  // kind and that kind is distilled|superseded (raw still ABORTs) + tenant-match.
231
230
  // - object path (memory_id NULL): source_object_type/id must reference an EXISTING
232
- // same-tenant E2 row whose status is active|superseded (not closed). E2 objects
231
+ // same-tenant object row whose status is active|superseded (not closed). Such objects
233
232
  // are consolidated BY CONSTRUCTION, so the no-raw invariant still holds.
234
233
  // - all-null is rejected.
235
234
  //
@@ -243,9 +242,9 @@ export const v38 = {
243
242
  // by design (the object path is distilled-by-construction; source_kind is only
244
243
  // re-checked when memory_id NOT NULL).
245
244
  // source_object_id is a SOFT (type,id) pointer (no hard FK) the rebuild re-validates,
246
- // so a legitimate E2 hard-delete is never blocked; a `closed` E2 row drops at next
245
+ // so a legitimate object hard-delete is never blocked; a `closed` object row drops at next
247
246
  // extract. SQLite cannot parametrize a table name in a trigger, so the object-path
248
- // validation is an explicit 4-way CASE (one arm per E2 table).
247
+ // validation is an explicit 4-way CASE (one arm per object table).
249
248
  recreateGraphTables(db);
250
249
  createGraphGuards(db);
251
250
  },
@@ -6,7 +6,7 @@ import { tableHasColumn } from '../tables.js';
6
6
  export const v39 = {
7
7
  version: 39,
8
8
  up: (db, ctx) => {
9
- // Memory scope isolation (docs/plans/2026-07-01-memory-scope-isolation.md).
9
+ // Memory scope isolation.
10
10
  // origin_project: '<name>' = owned by that project, '' = user-global,
11
11
  // NULL = legacy/unknown (ambient context treats NULL as deny).
12
12
  if (!tableHasColumn(db, 'memories', 'origin_project')) {
@@ -1,27 +1,15 @@
1
1
  export const v40 = {
2
2
  version: 40,
3
3
  up: (db) => {
4
- // LC1 retrieval-trace persistence (docs/plans/2026-08-02-lc1-recall-trace-persistence.md).
4
+ // Retrieval-trace persistence.
5
5
  // Follows the v18 goal_recall_log style: one parent trace row per
6
6
  // recall, a WITHOUT ROWID child table for the ranked results, and a
7
7
  // separate append-only outcomes table so audit_log pruning can never
8
8
  // erase training data.
9
9
  //
10
- // F6 (deliberate, not an oversight): unlike v39, this migration does
11
- // NOT bump `min_compatible_binary`. A pre-v40 binary opening this DB
12
- // ignores the three new tables and keeps writing `last_retrieval_ids`
13
- // exactly as before — it never touches `last_trace_id` (that key
14
- // simply stays whatever it was). recordTraceOutcome's F4 consumer-
15
- // side validation (recall-trace.ts) makes any resulting staleness
16
- // harmless to linkage: it re-validates the named trace's tenant AND
17
- // intersects credited ids against the trace's OWN result set before
18
- // inserting, so a stale/mismatched trace id from an old-binary write
19
- // gets silently skipped rather than mislinked. That preserves the
20
- // plan's "drop the three tables + last_trace_id restores v39 behavior
21
- // exactly" rollback promise — a min_compatible_binary bump would
22
- // additionally lock old binaries out of the WHOLE store for what is
23
- // purely an observability/training feature, which the rollback
24
- // promise does not require.
10
+ // No min_compatible_binary bump, on purpose: an old binary ignores these tables and
11
+ // recordTraceOutcome re-validates trace ids, so its stale writes are skipped; a bump
12
+ // would lock old binaries out of the whole store for an observability feature.
25
13
  db.exec(`
26
14
  CREATE TABLE IF NOT EXISTS recall_traces (
27
15
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -1,7 +1,7 @@
1
1
  export const v41 = {
2
2
  version: 41,
3
3
  up: (db) => {
4
- // AT1 rejected-value tombstone (docs/plans/2026-08-15-at1-rejected-value-tombstone.md).
4
+ // Rejected-value tombstone.
5
5
  // Additive table, template = v40 above. A human who rejects a fact gets
6
6
  // a durable say: the write-path guard in upsertEntryRow refuses any
7
7
  // write that would re-introduce a value whose normalized digest
@@ -17,11 +17,10 @@ export const v41 = {
17
17
  // No FK on source_memory_id (v40 precedent above: tombstone outlives
18
18
  // the row it was sourced from) — provenance only.
19
19
  //
20
- // Reserved-word check on column names (skill-episode lesson, rule 10):
20
+ // Reserved-word check on column names:
21
21
  // tenant/digest/reason/rejected/source/normalized/chars are non-reserved.
22
22
  //
23
- // No min_compatible_binary bump — a deliberate tradeoff (plan §2,
24
- // flagged to the ship gate). An old binary sharing a synced store
23
+ // No min_compatible_binary bump, a deliberate tradeoff: an old binary sharing a synced store
25
24
  // writes WITHOUT the guard until upgraded; documented in
26
25
  // MEMORY_ENVELOPE.md rather than hard-locking every old binary out of
27
26
  // the store, which is disproportionate for the dominant single-user
@@ -2,9 +2,8 @@ import { tableHasColumn } from '../tables.js';
2
2
  export const v42 = {
3
3
  version: 42,
4
4
  up: (db) => {
5
- // W1 handoff envelope (trajectories/01M2BQTM4AGFVMYY7G2XV5G7WY/plan.md).
6
- // Five nullable columns so the envelope carries evidence and outcome
7
- // and W2/W5 can filter on them without parsing JSON.
5
+ // Handoff envelope: five nullable columns so the envelope carries evidence and
6
+ // outcome and readers can filter on them without parsing JSON.
8
7
  if (!tableHasColumn(db, 'session_handoffs', 'constraints_json')) {
9
8
  db.exec(`ALTER TABLE session_handoffs ADD COLUMN constraints_json TEXT`);
10
9
  }
@@ -13,7 +12,7 @@ export const v42 = {
13
12
  }
14
13
  if (!tableHasColumn(db, 'session_handoffs', 'outcome')) {
15
14
  db.exec(`ALTER TABLE session_handoffs ADD COLUMN outcome TEXT`);
16
- // codex P2: backfill from session_complete so pre-existing handoffs don't
15
+ // Backfill from session_complete so pre-existing handoffs don't
17
16
  // all read as unfinished and get injected by the new 72h ambient fallback.
18
17
  db.exec(`
19
18
  UPDATE session_handoffs SET outcome = (
@@ -1,7 +1,7 @@
1
1
  export const v45 = {
2
2
  version: 45,
3
3
  up: (db) => {
4
- // Token ledger (src/token-ledger.ts, ROADMAP TE0): one row per block of
4
+ // Token ledger (src/token-ledger.ts): one row per block of
5
5
  // memory text hippo hands an agent (hook, CLI, MCP, HTTP). `event` is 'inject'
6
6
  // (sent), 'skip' (unchanged since the session's last inject, not sent), 'reset'
7
7
  // (compaction dropped earlier injections, so the next one must be sent) or
@@ -1,7 +1,7 @@
1
1
  export const v46 = {
2
2
  version: 46,
3
3
  up: (db) => {
4
- // CD13 failure log (src/failure-log.ts): hashes only, since failure text can carry paths and secrets.
4
+ // Failure log (src/failure-log.ts): hashes only, since failure text can carry paths and secrets.
5
5
  // Additive only: no min_compatible_binary bump.
6
6
  db.exec(`
7
7
  CREATE TABLE IF NOT EXISTS failure_log (
@@ -1,7 +1,7 @@
1
1
  export const v47 = {
2
2
  version: 47,
3
3
  up: (db) => {
4
- // Scope grants (src/auth.ts, ROADMAP EI2): a member key reads a
4
+ // Scope grants (src/auth.ts): a member key reads a
5
5
  // restricted scope only by an explicit row here. Additive only: no
6
6
  // min_compatible_binary bump.
7
7
  db.exec(`
@@ -2,7 +2,7 @@ import { MEMORY_QUARANTINE_DDL } from '../continuity.js';
2
2
  export const v48 = {
3
3
  version: 48,
4
4
  up: (db) => {
5
- // Quarantine (src/quarantine.ts, CD5): a poisoned or suspect memory sits here pending
5
+ // Quarantine (src/quarantine.ts): a poisoned or suspect memory sits here pending
6
6
  // admin review instead of being hidden with no record. Additive only: no min_compatible_binary bump.
7
7
  db.exec(MEMORY_QUARANTINE_DDL);
8
8
  },
@@ -1,5 +1,5 @@
1
1
  /**
2
- * E2 decision first-class object (docs/plans/2026-05-28-e2-decision-object.md).
2
+ * Decision first-class object.
3
3
  *
4
4
  * `hippo decide` used to write only a tagged memory (tags ['decision'], source
5
5
  * 'decision') with a 90-day half-life, so an in-force decision decayed out of
@@ -16,7 +16,7 @@
16
16
  * Tenant scoping: every helper requires tenantId. BEFORE INSERT/UPDATE triggers
17
17
  * enforce decisions.tenant_id == the referenced memory's tenant_id, and a
18
18
  * superseded_by same-tenant trigger makes cross-tenant supersession
19
- * unrepresentable. Mirrors the v0.31 predictions pattern (src/predictions.ts).
19
+ * unrepresentable. Mirrors the predictions pattern (src/predictions.ts).
20
20
  *
21
21
  * Dual-write atomicity: `saveDecision` writes the memory + decisions row (and,
22
22
  * when superseding, the old row's UPDATE) inside writeEntry's SAVEPOINT