squish-memory 1.2.0 → 1.2.1

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 (449) hide show
  1. package/bin/squish-mcp.mjs +40 -42
  2. package/core/scheduler/cron-scheduler.ts +10 -1
  3. package/core/worker.ts +10 -1
  4. package/package.json +119 -119
  5. package/packages/mcp/src/index.ts +99 -36
  6. package/dist/config.d.ts +0 -106
  7. package/dist/config.js +0 -194
  8. package/dist/core/adapters/config/claude-code.d.ts +0 -45
  9. package/dist/core/adapters/config/claude-code.js +0 -113
  10. package/dist/core/adapters/config/cursor.d.ts +0 -26
  11. package/dist/core/adapters/config/cursor.js +0 -74
  12. package/dist/core/adapters/config/opencode.d.ts +0 -23
  13. package/dist/core/adapters/config/opencode.js +0 -73
  14. package/dist/core/adapters/config/windsurf.d.ts +0 -26
  15. package/dist/core/adapters/config/windsurf.js +0 -74
  16. package/dist/core/adapters/index.d.ts +0 -45
  17. package/dist/core/adapters/index.js +0 -84
  18. package/dist/core/adapters/scripts/install-adapter.d.ts +0 -19
  19. package/dist/core/adapters/scripts/install-adapter.js +0 -149
  20. package/dist/core/adapters/timeline.d.ts +0 -23
  21. package/dist/core/adapters/timeline.js +0 -88
  22. package/dist/core/adapters/types.d.ts +0 -137
  23. package/dist/core/adapters/types.js +0 -50
  24. package/dist/core/agent-preferences.d.ts +0 -16
  25. package/dist/core/agent-preferences.js +0 -124
  26. package/dist/core/algorithms/analytics/token-estimator.d.ts +0 -50
  27. package/dist/core/algorithms/analytics/token-estimator.js +0 -154
  28. package/dist/core/algorithms/detection/hash-filters.d.ts +0 -47
  29. package/dist/core/algorithms/detection/hash-filters.js +0 -190
  30. package/dist/core/algorithms/detection/semantic-ranker.d.ts +0 -32
  31. package/dist/core/algorithms/detection/semantic-ranker.js +0 -118
  32. package/dist/core/algorithms/detection/two-stage-detector.d.ts +0 -52
  33. package/dist/core/algorithms/detection/two-stage-detector.js +0 -299
  34. package/dist/core/algorithms/handlers/approve-merge.d.ts +0 -22
  35. package/dist/core/algorithms/handlers/approve-merge.js +0 -179
  36. package/dist/core/algorithms/handlers/detect-duplicates.d.ts +0 -47
  37. package/dist/core/algorithms/handlers/detect-duplicates.js +0 -145
  38. package/dist/core/algorithms/handlers/get-stats.d.ts +0 -39
  39. package/dist/core/algorithms/handlers/get-stats.js +0 -88
  40. package/dist/core/algorithms/handlers/list-proposals.d.ts +0 -45
  41. package/dist/core/algorithms/handlers/list-proposals.js +0 -83
  42. package/dist/core/algorithms/handlers/preview-merge.d.ts +0 -39
  43. package/dist/core/algorithms/handlers/preview-merge.js +0 -93
  44. package/dist/core/algorithms/handlers/reject-merge.d.ts +0 -28
  45. package/dist/core/algorithms/handlers/reject-merge.js +0 -69
  46. package/dist/core/algorithms/handlers/reverse-merge.d.ts +0 -21
  47. package/dist/core/algorithms/handlers/reverse-merge.js +0 -121
  48. package/dist/core/algorithms/index.d.ts +0 -21
  49. package/dist/core/algorithms/index.js +0 -26
  50. package/dist/core/algorithms/operations/cache-maintenance.d.ts +0 -12
  51. package/dist/core/algorithms/operations/cache-maintenance.js +0 -157
  52. package/dist/core/algorithms/safety/safety-checks.d.ts +0 -18
  53. package/dist/core/algorithms/safety/safety-checks.js +0 -179
  54. package/dist/core/algorithms/strategies/merge-strategies.d.ts +0 -50
  55. package/dist/core/algorithms/strategies/merge-strategies.js +0 -288
  56. package/dist/core/algorithms/types.d.ts +0 -125
  57. package/dist/core/algorithms/types.js +0 -5
  58. package/dist/core/algorithms/utils/response-builder.d.ts +0 -28
  59. package/dist/core/algorithms/utils/response-builder.js +0 -37
  60. package/dist/core/associations.d.ts +0 -33
  61. package/dist/core/associations.js +0 -284
  62. package/dist/core/autosave.d.ts +0 -19
  63. package/dist/core/autosave.js +0 -16
  64. package/dist/core/beliefs/decay.d.ts +0 -27
  65. package/dist/core/beliefs/decay.js +0 -217
  66. package/dist/core/beliefs/extractor.d.ts +0 -9
  67. package/dist/core/beliefs/extractor.js +0 -113
  68. package/dist/core/beliefs/store.d.ts +0 -46
  69. package/dist/core/beliefs/store.js +0 -466
  70. package/dist/core/beliefs/types.d.ts +0 -28
  71. package/dist/core/beliefs/types.js +0 -2
  72. package/dist/core/commands/mcp-server.d.ts +0 -2
  73. package/dist/core/commands/mcp-server.js +0 -6
  74. package/dist/core/commands/remember.d.ts +0 -24
  75. package/dist/core/commands/remember.js +0 -144
  76. package/dist/core/compression.d.ts +0 -45
  77. package/dist/core/compression.js +0 -160
  78. package/dist/core/consolidation.d.ts +0 -37
  79. package/dist/core/consolidation.js +0 -248
  80. package/dist/core/context/agent-context.d.ts +0 -106
  81. package/dist/core/context/agent-context.js +0 -274
  82. package/dist/core/context/context-paging.d.ts +0 -80
  83. package/dist/core/context/context-paging.js +0 -328
  84. package/dist/core/context/context-window.d.ts +0 -40
  85. package/dist/core/context/context-window.js +0 -177
  86. package/dist/core/context/context.d.ts +0 -7
  87. package/dist/core/context/context.js +0 -22
  88. package/dist/core/embeddings/embeddings.d.ts +0 -29
  89. package/dist/core/embeddings/embeddings.js +0 -546
  90. package/dist/core/embeddings/google-multimodal.d.ts +0 -14
  91. package/dist/core/embeddings/google-multimodal.js +0 -146
  92. package/dist/core/embeddings/local-embeddings.d.ts +0 -11
  93. package/dist/core/embeddings/local-embeddings.js +0 -11
  94. package/dist/core/embeddings/qmd-client.d.ts +0 -136
  95. package/dist/core/embeddings/qmd-client.js +0 -403
  96. package/dist/core/embeddings/transformers-local.d.ts +0 -64
  97. package/dist/core/embeddings/transformers-local.js +0 -213
  98. package/dist/core/embeddings.d.ts +0 -2
  99. package/dist/core/embeddings.js +0 -3
  100. package/dist/core/error-handling.d.ts +0 -63
  101. package/dist/core/error-handling.js +0 -173
  102. package/dist/core/graph/entity-deduplicator.d.ts +0 -24
  103. package/dist/core/graph/entity-deduplicator.js +0 -183
  104. package/dist/core/graph/graph-builder.d.ts +0 -46
  105. package/dist/core/graph/graph-builder.js +0 -174
  106. package/dist/core/graph/graph-traversal.d.ts +0 -80
  107. package/dist/core/graph/graph-traversal.js +0 -315
  108. package/dist/core/graph/index.d.ts +0 -19
  109. package/dist/core/graph/index.js +0 -13
  110. package/dist/core/graph/llm-entity-extractor.d.ts +0 -49
  111. package/dist/core/graph/llm-entity-extractor.js +0 -313
  112. package/dist/core/graph/multi-hop-retrieval.d.ts +0 -48
  113. package/dist/core/graph/multi-hop-retrieval.js +0 -215
  114. package/dist/core/graph/relationship-extractor.d.ts +0 -48
  115. package/dist/core/graph/relationship-extractor.js +0 -351
  116. package/dist/core/hooks/agent-hooks.d.ts +0 -83
  117. package/dist/core/hooks/agent-hooks.js +0 -521
  118. package/dist/core/hooks/auto-tagger.d.ts +0 -19
  119. package/dist/core/hooks/auto-tagger.js +0 -155
  120. package/dist/core/hooks/capture-filter.d.ts +0 -41
  121. package/dist/core/hooks/capture-filter.js +0 -128
  122. package/dist/core/hot-cache.d.ts +0 -86
  123. package/dist/core/hot-cache.js +0 -285
  124. package/dist/core/index.d.ts +0 -10
  125. package/dist/core/index.js +0 -11
  126. package/dist/core/ingestion/agent-memory.d.ts +0 -22
  127. package/dist/core/ingestion/agent-memory.js +0 -109
  128. package/dist/core/ingestion/core-memory.d.ts +0 -78
  129. package/dist/core/ingestion/core-memory.js +0 -226
  130. package/dist/core/ingestion/learnings.d.ts +0 -57
  131. package/dist/core/ingestion/learnings.js +0 -205
  132. package/dist/core/ingestion/signal-engine.d.ts +0 -41
  133. package/dist/core/ingestion/signal-engine.js +0 -201
  134. package/dist/core/integrations/obsidian-vault.d.ts +0 -31
  135. package/dist/core/integrations/obsidian-vault.js +0 -156
  136. package/dist/core/layers/generator.d.ts +0 -25
  137. package/dist/core/layers/generator.js +0 -76
  138. package/dist/core/lib/db-client.d.ts +0 -114
  139. package/dist/core/lib/db-client.js +0 -130
  140. package/dist/core/lib/parse-embedding.d.ts +0 -9
  141. package/dist/core/lib/parse-embedding.js +0 -58
  142. package/dist/core/lib/schemas.d.ts +0 -132
  143. package/dist/core/lib/schemas.js +0 -87
  144. package/dist/core/lib/types.d.ts +0 -45
  145. package/dist/core/lib/types.js +0 -6
  146. package/dist/core/lib/utils.d.ts +0 -18
  147. package/dist/core/lib/utils.js +0 -145
  148. package/dist/core/lib/validation.d.ts +0 -38
  149. package/dist/core/lib/validation.js +0 -151
  150. package/dist/core/lifecycle.d.ts +0 -25
  151. package/dist/core/lifecycle.js +0 -292
  152. package/dist/core/logger.d.ts +0 -17
  153. package/dist/core/logger.js +0 -46
  154. package/dist/core/mcp/client.d.ts +0 -17
  155. package/dist/core/mcp/client.js +0 -101
  156. package/dist/core/mcp/index.d.ts +0 -6
  157. package/dist/core/mcp/index.js +0 -6
  158. package/dist/core/mcp/server.d.ts +0 -18
  159. package/dist/core/mcp/server.js +0 -157
  160. package/dist/core/mcp/standalone-server.d.ts +0 -13
  161. package/dist/core/mcp/standalone-server.js +0 -46
  162. package/dist/core/mcp/tools.d.ts +0 -7
  163. package/dist/core/mcp/tools.js +0 -278
  164. package/dist/core/mcp/types.d.ts +0 -87
  165. package/dist/core/mcp/types.js +0 -48
  166. package/dist/core/memory/bridge-discovery.d.ts +0 -50
  167. package/dist/core/memory/bridge-discovery.js +0 -291
  168. package/dist/core/memory/categorizer.d.ts +0 -27
  169. package/dist/core/memory/categorizer.js +0 -306
  170. package/dist/core/memory/conflict-detector.d.ts +0 -7
  171. package/dist/core/memory/conflict-detector.js +0 -43
  172. package/dist/core/memory/consolidation.d.ts +0 -42
  173. package/dist/core/memory/consolidation.js +0 -277
  174. package/dist/core/memory/context-collector.d.ts +0 -10
  175. package/dist/core/memory/context-collector.js +0 -56
  176. package/dist/core/memory/contradiction-resolver.d.ts +0 -40
  177. package/dist/core/memory/contradiction-resolver.js +0 -368
  178. package/dist/core/memory/edit-workflow.d.ts +0 -19
  179. package/dist/core/memory/edit-workflow.js +0 -120
  180. package/dist/core/memory/entity-extractor.d.ts +0 -37
  181. package/dist/core/memory/entity-extractor.js +0 -350
  182. package/dist/core/memory/entity-resolver.d.ts +0 -23
  183. package/dist/core/memory/entity-resolver.js +0 -64
  184. package/dist/core/memory/explain.d.ts +0 -18
  185. package/dist/core/memory/explain.js +0 -92
  186. package/dist/core/memory/fact-deriver.d.ts +0 -31
  187. package/dist/core/memory/fact-deriver.js +0 -236
  188. package/dist/core/memory/fact-extractor.d.ts +0 -24
  189. package/dist/core/memory/fact-extractor.js +0 -89
  190. package/dist/core/memory/feedback-tracker.d.ts +0 -12
  191. package/dist/core/memory/feedback-tracker.js +0 -155
  192. package/dist/core/memory/hooks.d.ts +0 -88
  193. package/dist/core/memory/hooks.js +0 -174
  194. package/dist/core/memory/hybrid-retrieval.d.ts +0 -27
  195. package/dist/core/memory/hybrid-retrieval.js +0 -37
  196. package/dist/core/memory/hybrid-scorer.d.ts +0 -40
  197. package/dist/core/memory/hybrid-scorer.js +0 -267
  198. package/dist/core/memory/hybrid-search.d.ts +0 -23
  199. package/dist/core/memory/hybrid-search.js +0 -596
  200. package/dist/core/memory/importance.d.ts +0 -46
  201. package/dist/core/memory/importance.js +0 -241
  202. package/dist/core/memory/index.d.ts +0 -9
  203. package/dist/core/memory/index.js +0 -11
  204. package/dist/core/memory/loader.d.ts +0 -31
  205. package/dist/core/memory/loader.js +0 -141
  206. package/dist/core/memory/markdown/markdown-storage.d.ts +0 -72
  207. package/dist/core/memory/markdown/markdown-storage.js +0 -243
  208. package/dist/core/memory/memories.d.ts +0 -43
  209. package/dist/core/memory/memories.js +0 -452
  210. package/dist/core/memory/memory-lifecycle.d.ts +0 -8
  211. package/dist/core/memory/memory-lifecycle.js +0 -47
  212. package/dist/core/memory/memory-manager.d.ts +0 -15
  213. package/dist/core/memory/memory-manager.js +0 -46
  214. package/dist/core/memory/migrate.d.ts +0 -21
  215. package/dist/core/memory/migrate.js +0 -134
  216. package/dist/core/memory/normalization.d.ts +0 -7
  217. package/dist/core/memory/normalization.js +0 -26
  218. package/dist/core/memory/path-strengthener.d.ts +0 -39
  219. package/dist/core/memory/path-strengthener.js +0 -150
  220. package/dist/core/memory/progressive-disclosure.d.ts +0 -43
  221. package/dist/core/memory/progressive-disclosure.js +0 -280
  222. package/dist/core/memory/query-processor.d.ts +0 -21
  223. package/dist/core/memory/query-processor.js +0 -106
  224. package/dist/core/memory/query-rewriter.d.ts +0 -13
  225. package/dist/core/memory/query-rewriter.js +0 -118
  226. package/dist/core/memory/response-analyzer.d.ts +0 -9
  227. package/dist/core/memory/response-analyzer.js +0 -61
  228. package/dist/core/memory/retrieval-feedback.d.ts +0 -70
  229. package/dist/core/memory/retrieval-feedback.js +0 -213
  230. package/dist/core/memory/serialization.d.ts +0 -10
  231. package/dist/core/memory/serialization.js +0 -84
  232. package/dist/core/memory/stale-cleaner.d.ts +0 -26
  233. package/dist/core/memory/stale-cleaner.js +0 -97
  234. package/dist/core/memory/stats.d.ts +0 -32
  235. package/dist/core/memory/stats.js +0 -143
  236. package/dist/core/memory/telemetry.d.ts +0 -69
  237. package/dist/core/memory/telemetry.js +0 -313
  238. package/dist/core/memory/temporal-facts.d.ts +0 -41
  239. package/dist/core/memory/temporal-facts.js +0 -283
  240. package/dist/core/memory/temporal-parser.d.ts +0 -32
  241. package/dist/core/memory/temporal-parser.js +0 -385
  242. package/dist/core/memory/trigger-detector.d.ts +0 -21
  243. package/dist/core/memory/trigger-detector.js +0 -79
  244. package/dist/core/memory/write-gate.d.ts +0 -54
  245. package/dist/core/memory/write-gate.js +0 -210
  246. package/dist/core/places/index.d.ts +0 -14
  247. package/dist/core/places/index.js +0 -14
  248. package/dist/core/places/memory-places.d.ts +0 -68
  249. package/dist/core/places/memory-places.js +0 -261
  250. package/dist/core/places/places.d.ts +0 -88
  251. package/dist/core/places/places.js +0 -314
  252. package/dist/core/places/rules.d.ts +0 -74
  253. package/dist/core/places/rules.js +0 -240
  254. package/dist/core/places/walking.d.ts +0 -56
  255. package/dist/core/places/walking.js +0 -121
  256. package/dist/core/projects.d.ts +0 -17
  257. package/dist/core/projects.js +0 -116
  258. package/dist/core/redis.d.ts +0 -11
  259. package/dist/core/redis.js +0 -69
  260. package/dist/core/responses.d.ts +0 -96
  261. package/dist/core/responses.js +0 -122
  262. package/dist/core/runtime/trust-report.d.ts +0 -102
  263. package/dist/core/runtime/trust-report.js +0 -107
  264. package/dist/core/runtime/trust-state.d.ts +0 -12
  265. package/dist/core/runtime/trust-state.js +0 -309
  266. package/dist/core/scheduler/cron-scheduler.d.ts +0 -32
  267. package/dist/core/scheduler/cron-scheduler.js +0 -493
  268. package/dist/core/scheduler/heartbeat.d.ts +0 -11
  269. package/dist/core/scheduler/heartbeat.js +0 -73
  270. package/dist/core/scheduler/index.d.ts +0 -8
  271. package/dist/core/scheduler/index.js +0 -8
  272. package/dist/core/scheduler/job-runner.d.ts +0 -11
  273. package/dist/core/scheduler/job-runner.js +0 -164
  274. package/dist/core/search/conversations.d.ts +0 -25
  275. package/dist/core/search/conversations.js +0 -110
  276. package/dist/core/search/entities.d.ts +0 -12
  277. package/dist/core/search/entities.js +0 -31
  278. package/dist/core/search/folder-context.d.ts +0 -25
  279. package/dist/core/search/folder-context.js +0 -119
  280. package/dist/core/search/graph-boost.d.ts +0 -7
  281. package/dist/core/search/graph-boost.js +0 -23
  282. package/dist/core/search/index.d.ts +0 -4
  283. package/dist/core/search/index.js +0 -5
  284. package/dist/core/search/qmd-wrapper.d.ts +0 -36
  285. package/dist/core/search/qmd-wrapper.js +0 -58
  286. package/dist/core/security/encrypt.d.ts +0 -6
  287. package/dist/core/security/encrypt.js +0 -47
  288. package/dist/core/security/governance.d.ts +0 -26
  289. package/dist/core/security/governance.js +0 -79
  290. package/dist/core/security/privacy.d.ts +0 -23
  291. package/dist/core/security/privacy.js +0 -82
  292. package/dist/core/security/secret-detector.d.ts +0 -32
  293. package/dist/core/security/secret-detector.js +0 -88
  294. package/dist/core/session/auto-load.d.ts +0 -6
  295. package/dist/core/session/auto-load.js +0 -144
  296. package/dist/core/session/entity-tracker.d.ts +0 -62
  297. package/dist/core/session/entity-tracker.js +0 -287
  298. package/dist/core/session/index.d.ts +0 -7
  299. package/dist/core/session/index.js +0 -7
  300. package/dist/core/session/reference-resolver.d.ts +0 -26
  301. package/dist/core/session/reference-resolver.js +0 -121
  302. package/dist/core/session/self-iteration-job.d.ts +0 -35
  303. package/dist/core/session/self-iteration-job.js +0 -387
  304. package/dist/core/session/session-hooks.d.ts +0 -18
  305. package/dist/core/session/session-hooks.js +0 -58
  306. package/dist/core/session/types.d.ts +0 -26
  307. package/dist/core/session/types.js +0 -10
  308. package/dist/core/session/working-set.d.ts +0 -50
  309. package/dist/core/session/working-set.js +0 -212
  310. package/dist/core/snapshots/cleanup.d.ts +0 -9
  311. package/dist/core/snapshots/cleanup.js +0 -12
  312. package/dist/core/snapshots/comparison.d.ts +0 -19
  313. package/dist/core/snapshots/comparison.js +0 -43
  314. package/dist/core/snapshots/creation.d.ts +0 -13
  315. package/dist/core/snapshots/creation.js +0 -117
  316. package/dist/core/snapshots/retrieval.d.ts +0 -7
  317. package/dist/core/snapshots/retrieval.js +0 -41
  318. package/dist/core/snapshots/stats.d.ts +0 -11
  319. package/dist/core/snapshots/stats.js +0 -52
  320. package/dist/core/storage/cache.d.ts +0 -13
  321. package/dist/core/storage/cache.js +0 -202
  322. package/dist/core/storage/database.d.ts +0 -12
  323. package/dist/core/storage/database.js +0 -12
  324. package/dist/core/summarization/cleanup.d.ts +0 -9
  325. package/dist/core/summarization/cleanup.js +0 -12
  326. package/dist/core/summarization/queries.d.ts +0 -9
  327. package/dist/core/summarization/queries.js +0 -28
  328. package/dist/core/summarization/stats.d.ts +0 -14
  329. package/dist/core/summarization/stats.js +0 -52
  330. package/dist/core/summarization/strategies.d.ts +0 -24
  331. package/dist/core/summarization/strategies.js +0 -28
  332. package/dist/core/summarization.d.ts +0 -37
  333. package/dist/core/summarization.js +0 -188
  334. package/dist/core/temporal-facts.d.ts +0 -54
  335. package/dist/core/temporal-facts.js +0 -193
  336. package/dist/core/tracing/collector.d.ts +0 -111
  337. package/dist/core/tracing/collector.js +0 -350
  338. package/dist/core/tracing/visualizer.d.ts +0 -32
  339. package/dist/core/tracing/visualizer.js +0 -165
  340. package/dist/core/utils/cleanup-operations.d.ts +0 -13
  341. package/dist/core/utils/cleanup-operations.js +0 -44
  342. package/dist/core/utils/content-extraction.d.ts +0 -19
  343. package/dist/core/utils/content-extraction.js +0 -75
  344. package/dist/core/utils/filter-builder.d.ts +0 -13
  345. package/dist/core/utils/filter-builder.js +0 -44
  346. package/dist/core/utils/history-traversal.d.ts +0 -13
  347. package/dist/core/utils/history-traversal.js +0 -50
  348. package/dist/core/utils/memory-operations.d.ts +0 -17
  349. package/dist/core/utils/memory-operations.js +0 -43
  350. package/dist/core/utils/query-operations.d.ts +0 -18
  351. package/dist/core/utils/query-operations.js +0 -65
  352. package/dist/core/utils/summarization-helpers.d.ts +0 -17
  353. package/dist/core/utils/summarization-helpers.js +0 -33
  354. package/dist/core/utils/temporal-queries.d.ts +0 -13
  355. package/dist/core/utils/temporal-queries.js +0 -27
  356. package/dist/core/utils/vector-operations.d.ts +0 -71
  357. package/dist/core/utils/vector-operations.js +0 -129
  358. package/dist/core/utils/version-management.d.ts +0 -9
  359. package/dist/core/utils/version-management.js +0 -61
  360. package/dist/core/worker.d.ts +0 -82
  361. package/dist/core/worker.js +0 -272
  362. package/dist/db/adapter.d.ts +0 -7
  363. package/dist/db/adapter.js +0 -175
  364. package/dist/db/bootstrap.d.ts +0 -11
  365. package/dist/db/bootstrap.js +0 -1034
  366. package/dist/db/drizzle/schema-sqlite.d.ts +0 -5538
  367. package/dist/db/drizzle/schema-sqlite.js +0 -763
  368. package/dist/db/drizzle/schema.d.ts +0 -4734
  369. package/dist/db/drizzle/schema.js +0 -859
  370. package/dist/db/drizzle.config.d.ts +0 -3
  371. package/dist/db/drizzle.config.js +0 -12
  372. package/dist/db/index.d.ts +0 -7
  373. package/dist/db/index.js +0 -89
  374. package/dist/db/migrations/associations.d.ts +0 -6
  375. package/dist/db/migrations/associations.js +0 -29
  376. package/dist/db/migrations/beliefs.d.ts +0 -10
  377. package/dist/db/migrations/beliefs.js +0 -76
  378. package/dist/db/migrations/core-memory.d.ts +0 -6
  379. package/dist/db/migrations/core-memory.js +0 -29
  380. package/dist/db/migrations/fts.d.ts +0 -6
  381. package/dist/db/migrations/fts.js +0 -52
  382. package/dist/db/migrations/index.d.ts +0 -25
  383. package/dist/db/migrations/index.js +0 -51
  384. package/dist/db/migrations/indexes.d.ts +0 -6
  385. package/dist/db/migrations/indexes.js +0 -30
  386. package/dist/db/migrations/learnings.d.ts +0 -7
  387. package/dist/db/migrations/learnings.js +0 -26
  388. package/dist/db/migrations/maintenance.d.ts +0 -6
  389. package/dist/db/migrations/maintenance.js +0 -61
  390. package/dist/db/migrations/memories.d.ts +0 -7
  391. package/dist/db/migrations/memories.js +0 -16
  392. package/dist/db/migrations/memory-places.d.ts +0 -6
  393. package/dist/db/migrations/memory-places.js +0 -29
  394. package/dist/db/migrations/places.d.ts +0 -6
  395. package/dist/db/migrations/places.js +0 -43
  396. package/dist/db/migrations/projects.d.ts +0 -3
  397. package/dist/db/migrations/projects.js +0 -13
  398. package/dist/db/migrations/tier-conversion.d.ts +0 -7
  399. package/dist/db/migrations/tier-conversion.js +0 -20
  400. package/dist/db/neon.d.ts +0 -8
  401. package/dist/db/neon.js +0 -20
  402. package/dist/db/schema/beliefs.d.ts +0 -9
  403. package/dist/db/schema/beliefs.js +0 -46
  404. package/dist/db/schema/generator.d.ts +0 -38
  405. package/dist/db/schema/generator.js +0 -108
  406. package/dist/db/schema/index.d.ts +0 -39
  407. package/dist/db/schema/index.js +0 -51
  408. package/dist/db/schema/learnings.d.ts +0 -7
  409. package/dist/db/schema/learnings.js +0 -30
  410. package/dist/db/schema/memories.d.ts +0 -7
  411. package/dist/db/schema/memories.js +0 -81
  412. package/dist/db/schema/projects.d.ts +0 -4
  413. package/dist/db/schema/projects.js +0 -31
  414. package/dist/db/schema/tables/context-sessions.d.ts +0 -9
  415. package/dist/db/schema/tables/context-sessions.js +0 -37
  416. package/dist/db/schema/tables/conversations.d.ts +0 -9
  417. package/dist/db/schema/tables/conversations.js +0 -47
  418. package/dist/db/schema/tables/core-memory.d.ts +0 -9
  419. package/dist/db/schema/tables/core-memory.js +0 -41
  420. package/dist/db/schema/tables/entities.d.ts +0 -9
  421. package/dist/db/schema/tables/entities.js +0 -39
  422. package/dist/db/schema/tables/entity-relations.d.ts +0 -9
  423. package/dist/db/schema/tables/entity-relations.js +0 -31
  424. package/dist/db/schema/tables/learnings.d.ts +0 -9
  425. package/dist/db/schema/tables/learnings.js +0 -66
  426. package/dist/db/schema/tables/memories.d.ts +0 -9
  427. package/dist/db/schema/tables/memories.js +0 -161
  428. package/dist/db/schema/tables/memory-associations.d.ts +0 -9
  429. package/dist/db/schema/tables/memory-associations.js +0 -39
  430. package/dist/db/schema/tables/memory-hash-cache.d.ts +0 -9
  431. package/dist/db/schema/tables/memory-hash-cache.js +0 -29
  432. package/dist/db/schema/tables/memory-merge-history.d.ts +0 -9
  433. package/dist/db/schema/tables/memory-merge-history.js +0 -33
  434. package/dist/db/schema/tables/memory-merge-proposals.d.ts +0 -9
  435. package/dist/db/schema/tables/memory-merge-proposals.js +0 -39
  436. package/dist/db/schema/tables/messages.d.ts +0 -9
  437. package/dist/db/schema/tables/messages.js +0 -41
  438. package/dist/db/schema/tables/namespaces.d.ts +0 -9
  439. package/dist/db/schema/tables/namespaces.js +0 -37
  440. package/dist/db/schema/tables/projects.d.ts +0 -9
  441. package/dist/db/schema/tables/projects.js +0 -31
  442. package/dist/db/schema/tables/users.d.ts +0 -9
  443. package/dist/db/schema/tables/users.js +0 -27
  444. package/dist/db/schema.d.ts +0 -3
  445. package/dist/db/schema.js +0 -11
  446. package/dist/db/supabase.d.ts +0 -9
  447. package/dist/db/supabase.js +0 -24
  448. package/dist/packages/mcp/src/index.d.ts +0 -3
  449. package/dist/packages/mcp/src/index.js +0 -733
@@ -1,763 +0,0 @@
1
- import { sqliteTable, text, integer, blob, index } from 'drizzle-orm/sqlite-core';
2
- import { sql } from 'drizzle-orm';
3
- // Core Tables - SQLite compatible version
4
- // ============================================================================
5
- /**
6
- * Users - represents Claude Code users
7
- */
8
- export const users = sqliteTable('users', {
9
- id: text('id').primaryKey().$default(() => crypto.randomUUID()),
10
- externalId: text('external_id').unique(), // Claude user ID if available
11
- name: text('name'),
12
- email: text('email'),
13
- preferences: text('preferences').$type(),
14
- createdAt: integer('created_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
15
- updatedAt: integer('updated_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
16
- });
17
- /**
18
- * Projects - workspaces that memories are scoped to
19
- */
20
- export const projects = sqliteTable('projects', {
21
- id: text('id').primaryKey().$default(() => crypto.randomUUID()),
22
- name: text('name').notNull(),
23
- path: text('path').notNull(),
24
- description: text('description'),
25
- metadata: text('metadata').$type(),
26
- createdAt: integer('created_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
27
- updatedAt: integer('updated_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
28
- }, (table) => [
29
- index('projects_path_idx').on(table.path),
30
- ]);
31
- /**
32
- * Memories - core memory storage
33
- */
34
- export const memories = sqliteTable('memories', {
35
- id: text('id').primaryKey().$default(() => crypto.randomUUID()),
36
- projectId: text('project_id').references(() => projects.id, { onDelete: 'cascade' }),
37
- userId: text('user_id').references(() => users.id, { onDelete: 'set null' }),
38
- // Content
39
- type: text('type').notNull().$type(),
40
- content: text('content').notNull(),
41
- summary: text('summary'),
42
- // Embeddings stored as JSON string (not for semantic search in SQLite)
43
- embeddingJson: text('embedding_json'),
44
- // v0.2.0: Vector embedding for local search
45
- embedding: blob('embedding'),
46
- // Metadata
47
- source: text('source'),
48
- confidence: integer('confidence').default(50), // 0-100 confidence score (default: speculative)
49
- confidenceLevel: text('confidence_level').$type().default('speculative'), // Iteration 3: Confidence flags (default: speculative)
50
- tags: text('tags').$type(),
51
- metadata: text('metadata').$type(),
52
- // v0.2.0: Privacy and relevance
53
- isPrivate: integer('is_private', { mode: 'boolean' }).default(false),
54
- hasSecrets: integer('has_secrets', { mode: 'boolean' }).default(false),
55
- relevanceScore: integer('relevance_score').default(50), // 0-100
56
- // Lifecycle
57
- isActive: integer('is_active', { mode: 'boolean' }).default(true),
58
- expiresAt: integer('expires_at', { mode: 'timestamp' }),
59
- accessCount: integer('access_count').default(0),
60
- lastAccessedAt: integer('last_accessed_at', { mode: 'timestamp' }),
61
- // Merge tracking
62
- isMerged: integer('is_merged', { mode: 'boolean' }).default(false),
63
- mergedIntoId: text('merged_into_id').references(() => memories.id),
64
- mergedAt: integer('merged_at', { mode: 'timestamp' }),
65
- isCanonical: integer('is_canonical', { mode: 'boolean' }).default(false),
66
- mergeSourceIds: text('merge_source_ids').$type(),
67
- isMergeable: integer('is_mergeable', { mode: 'boolean' }).default(true),
68
- mergeVersion: integer('merge_version').default(1),
69
- // v0.4.2: Namespace support
70
- namespaceId: text('namespace_id').references(() => namespaces.id, { onDelete: 'set null' }),
71
- namespacePath: text('namespace_path'),
72
- // v1.1.5: Places support (spatial memory organization)
73
- placeId: text('place_id').references(() => places.id, { onDelete: 'set null' }),
74
- placeSortOrder: integer('place_sort_order'),
75
- // v0.4.3: Layer support
76
- hasL0Abstract: integer('has_l0_abstract', { mode: 'boolean' }).default(false),
77
- hasL1Overview: integer('has_l1_overview', { mode: 'boolean' }).default(false),
78
- lastLayerUpdate: integer('last_layer_update', { mode: 'timestamp' }),
79
- // v0.8.0: Importance Scoring
80
- importanceScore: integer('importance_score').default(50), // 0-100
81
- importanceDecayRate: integer('importance_decay_rate').default(30), // days half-life
82
- lastImportanceRecalc: integer('last_importance_recalc', { mode: 'timestamp' }),
83
- // v0.10.0: Echo/Fizzle Tracking - Retrieval Priority
84
- retrievalPriority: integer('retrieval_priority').default(50), // 0-100, adjusted by feedback
85
- // v1.0.x: Token tracking
86
- tokensEstimate: integer('tokens_estimate').default(0).notNull(),
87
- // v0.8.0: Consolidation tracking
88
- consolidatedInto: text('consolidated_into').references(() => memories.id),
89
- consolidatedAt: integer('consolidated_at', { mode: 'timestamp' }),
90
- isConsolidated: integer('is_consolidated', { mode: 'boolean' }).default(false),
91
- // v0.3.0: Memory Lifecycle Management
92
- sector: text('sector').$type().default('episodic'),
93
- tier: text('tier').$type().default('hot'),
94
- status: text('status').notNull().default('active'),
95
- encrypted_content: text('encrypted_content'),
96
- encryption_nonce: text('encryption_nonce'),
97
- is_encrypted: integer('is_encrypted', { mode: 'boolean' }).default(false),
98
- // v0.5.0: Context Status - Track whether memory is in active context or archived
99
- contextStatus: text('context_status').$type().default('out-of-context'),
100
- // Per-memory decay rate (integer percentage, e.g., 30 = 30% decay per cycle)
101
- decayRate: integer('decay_rate').default(30),
102
- coactivationScore: integer('coactivation_score').default(0),
103
- lastDecayAt: integer('last_decay_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`),
104
- // v0.3.0: Agent-Aware Memory
105
- agentId: text('agent_id'),
106
- agentRole: text('agent_role'),
107
- visibilityScope: text('visibility_scope').$type().default('private'),
108
- // v0.3.0: Memory Governance
109
- isProtected: integer('is_protected', { mode: 'boolean' }).default(false),
110
- isPinned: integer('is_pinned', { mode: 'boolean' }).default(false),
111
- isImmutable: integer('is_immutable', { mode: 'boolean' }).default(false),
112
- writeScope: text('write_scope').$type(),
113
- readScope: text('read_scope').$type(),
114
- // v0.3.0: Provenance
115
- triggeredBy: text('triggered_by'),
116
- captureReason: text('capture_reason'),
117
- lastUsedAt: integer('last_used_at', { mode: 'timestamp' }),
118
- usageCount: integer('usage_count').default(0),
119
- // v0.3.0: Temporal Facts
120
- validFrom: integer('valid_from', { mode: 'timestamp' }),
121
- validTo: integer('valid_to', { mode: 'timestamp' }),
122
- recordedAt: integer('recorded_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(), // When agent learned/stored the fact
123
- supersededBy: text('superseded_by').references(() => memories.id),
124
- version: integer('version').default(1),
125
- createdAt: integer('created_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
126
- updatedAt: integer('updated_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
127
- }, (table) => [
128
- index('memories_project_idx').on(table.projectId),
129
- index('memories_type_idx').on(table.type),
130
- index('memories_created_idx').on(table.createdAt),
131
- index('memories_tags_idx').on(table.tags),
132
- index('memories_relevance_idx').on(table.relevanceScore),
133
- index('memories_private_idx').on(table.isPrivate),
134
- index('memories_merged_idx').on(table.isMerged),
135
- index('memories_canonical_idx').on(table.isCanonical),
136
- index('memories_sector_idx').on(table.sector),
137
- index('memories_tier_idx').on(table.tier),
138
- index('memories_agent_idx').on(table.agentId),
139
- index('memories_visibility_idx').on(table.visibilityScope),
140
- index('memories_protected_idx').on(table.isProtected),
141
- index('memories_pinned_idx').on(table.isPinned),
142
- index('memories_valid_from_idx').on(table.validFrom),
143
- index('memories_valid_to_idx').on(table.validTo),
144
- index('memories_context_status_idx').on(table.contextStatus),
145
- // v0.8.0: Importance scoring indexes
146
- index('memories_importance_idx').on(table.importanceScore),
147
- index('memories_consolidated_idx').on(table.isConsolidated),
148
- index('memories_consolidation_query_idx').on(table.projectId, table.isConsolidated, table.importanceScore),
149
- // v0.5.0: Context status composite index for efficient filtering
150
- index('memories_context_query_idx').on(table.projectId, table.contextStatus, table.tier),
151
- // v0.4.2: Composite indexes for performance optimization
152
- // Duplicate detection query optimization
153
- index('memories_duplicate_detection_idx').on(table.projectId, table.isMerged, table.isMergeable, table.isActive),
154
- // Eviction query optimization
155
- index('memories_eviction_idx').on(table.projectId, table.tier, table.relevanceScore, table.createdAt),
156
- // Decay operations optimization
157
- index('memories_decay_idx').on(table.sector, table.lastDecayAt, table.isProtected),
158
- // Temporal query optimization
159
- index('memories_temporal_idx').on(table.projectId, table.validFrom, table.validTo),
160
- // Agent-aware retrieval optimization
161
- index('memories_agent_visibility_idx').on(table.agentId, table.visibilityScope, table.isActive),
162
- ]);
163
- /**
164
- * Conversations - chat session tracking
165
- */
166
- export const conversations = sqliteTable('conversations', {
167
- id: text('id').primaryKey().$default(() => crypto.randomUUID()),
168
- projectId: text('project_id').references(() => projects.id, { onDelete: 'cascade' }),
169
- userId: text('user_id').references(() => users.id, { onDelete: 'set null' }),
170
- sessionId: text('session_id').notNull(),
171
- title: text('title'),
172
- summary: text('summary'),
173
- messageCount: integer('message_count').default(0),
174
- tokenCount: integer('token_count').default(0),
175
- startedAt: integer('started_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
176
- endedAt: integer('ended_at', { mode: 'timestamp' }),
177
- metadata: text('metadata').$type(),
178
- createdAt: integer('created_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
179
- updatedAt: integer('updated_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
180
- }, (table) => [
181
- index('conversations_project_idx').on(table.projectId),
182
- index('conversations_session_idx').on(table.sessionId),
183
- index('conversations_started_idx').on(table.startedAt),
184
- ]);
185
- /**
186
- * Messages - individual messages in conversations
187
- */
188
- export const messages = sqliteTable('messages', {
189
- id: text('id').primaryKey().$default(() => crypto.randomUUID()),
190
- conversationId: text('conversation_id').notNull().references(() => conversations.id, { onDelete: 'cascade' }),
191
- role: text('role').notNull().$type(),
192
- content: text('content').notNull(),
193
- embeddingJson: text('embedding_json'),
194
- tokenCount: integer('token_count'),
195
- toolCalls: text('tool_calls').$type(),
196
- metadata: text('metadata').$type(),
197
- createdAt: integer('created_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
198
- }, (table) => [
199
- index('messages_conversation_idx').on(table.conversationId),
200
- index('messages_role_idx').on(table.role),
201
- index('messages_created_idx').on(table.createdAt),
202
- ]);
203
- /**
204
- * Learnings - agent learnings: success, failure, fix, insight
205
- */
206
- export const learnings = sqliteTable('learnings', {
207
- id: text('id').primaryKey().$default(() => crypto.randomUUID()),
208
- projectId: text('project_id').references(() => projects.id, { onDelete: 'cascade' }),
209
- conversationId: text('conversation_id').references(() => conversations.id, { onDelete: 'set null' }),
210
- // Learning type: success, failure, fix, insight
211
- type: text('type').notNull().$type(),
212
- action: text('action').notNull(),
213
- target: text('target'),
214
- summary: text('summary').notNull(),
215
- details: text('details').$type(),
216
- // Embeddings
217
- embeddingJson: text('embedding_json'),
218
- embedding: blob('embedding'),
219
- // Optional link to a memory (for bidirectional linking)
220
- memoryId: text('memory_id').references(() => memories.id, { onDelete: 'set null' }),
221
- // Folder-scoped
222
- folderPath: text('folder_path'),
223
- projectPath: text('project_path'),
224
- // Privacy and relevance
225
- isPrivate: integer('is_private', { mode: 'boolean' }).default(false),
226
- hasSecrets: integer('has_secrets', { mode: 'boolean' }).default(false),
227
- relevanceScore: integer('relevance_score').default(50),
228
- category: text('category'),
229
- importance: integer('importance').default(50),
230
- metadata: text('metadata').$type(),
231
- // Migration tracking
232
- isImported: integer('is_imported', { mode: 'boolean' }).default(false),
233
- createdAt: integer('created_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
234
- }, (table) => [
235
- index('learnings_project_idx').on(table.projectId),
236
- index('learnings_type_idx').on(table.type),
237
- index('learnings_action_idx').on(table.action),
238
- index('learnings_created_idx').on(table.createdAt),
239
- index('learnings_folder_idx').on(table.folderPath),
240
- index('learnings_relevance_idx').on(table.relevanceScore),
241
- index('learnings_private_idx').on(table.isPrivate),
242
- index('learnings_memory_idx').on(table.memoryId),
243
- ]);
244
- /**
245
- * Agent Preferences - learned agent preferences from learnings
246
- * Enables agents to evolve and remember preferences over time
247
- */
248
- export const agentPreferences = sqliteTable('agent_preferences', {
249
- id: text('id').primaryKey().$default(() => crypto.randomUUID()),
250
- projectId: text('project_id').references(() => projects.id, { onDelete: 'cascade' }).notNull(),
251
- key: text('key').notNull(), // e.g., "prefer_bun", "prefer_typescript"
252
- value: text('value').notNull(), // e.g., "bun", "true"
253
- sourceMemoryId: text('source_memory_id').references(() => memories.id, { onDelete: 'set null' }),
254
- confidence: text('confidence').default('0.5'), // 0.00 to 1.00
255
- usageCount: integer('usage_count').default(1),
256
- lastUpdated: integer('last_updated', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
257
- createdAt: integer('created_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
258
- }, (table) => [
259
- index('agent_preferences_project_idx').on(table.projectId),
260
- index('agent_preferences_key_idx').on(table.key),
261
- ]);
262
- /**
263
- * Entities - named entities in the codebase
264
- */
265
- export const entities = sqliteTable('entities', {
266
- id: text('id').primaryKey().$default(() => crypto.randomUUID()),
267
- projectId: text('project_id').references(() => projects.id, { onDelete: 'cascade' }),
268
- name: text('name').notNull(),
269
- type: text('type').notNull(),
270
- description: text('description'),
271
- embeddingJson: text('embedding_json'),
272
- properties: text('properties').$type(),
273
- createdAt: integer('created_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
274
- updatedAt: integer('updated_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
275
- }, (table) => [
276
- index('entities_project_idx').on(table.projectId),
277
- index('entities_type_idx').on(table.type),
278
- index('entities_name_idx').on(table.name),
279
- ]);
280
- /**
281
- * Namespaces - Hierarchical folder-like namespaces for memory organization
282
- */
283
- export const namespaces = sqliteTable('namespaces', {
284
- id: text('id').primaryKey().$default(() => crypto.randomUUID()),
285
- projectId: text('project_id').references(() => projects.id, { onDelete: 'cascade' }),
286
- name: text('name').notNull(),
287
- parentId: text('parent_id').references(() => namespaces.id, { onDelete: 'set null' }),
288
- type: text('type'),
289
- description: text('description'),
290
- path: text('path'),
291
- createdAt: integer('created_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
292
- updatedAt: integer('updated_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
293
- }, (table) => [
294
- index('namespaces_project_idx').on(table.projectId),
295
- index('namespaces_parent_idx').on(table.parentId),
296
- ]);
297
- /**
298
- * Places - Spatial memory organization
299
- */
300
- export const places = sqliteTable('places', {
301
- id: text('id').primaryKey().$default(() => crypto.randomUUID()),
302
- projectId: text('project_id').references(() => projects.id, { onDelete: 'cascade' }).notNull(),
303
- name: text('name').notNull(),
304
- placeType: text('place_type').notNull(),
305
- parentId: text('parent_id').references(() => places.id, { onDelete: 'set null' }),
306
- sortOrder: integer('sort_order').default(0),
307
- positionX: integer('position_x').default(0),
308
- positionY: integer('position_y').default(0),
309
- description: text('description'),
310
- purpose: text('purpose'),
311
- memoryCount: integer('memory_count').default(0),
312
- createdAt: integer('created_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
313
- updatedAt: integer('updated_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
314
- }, (table) => [
315
- index('places_project_idx').on(table.projectId),
316
- index('places_type_idx').on(table.placeType),
317
- index('places_parent_idx').on(table.parentId),
318
- index('places_sort_order_idx').on(table.projectId, table.sortOrder),
319
- ]);
320
- /**
321
- * Memory-Place assignments
322
- */
323
- export const memoryPlaces = sqliteTable('memory_places', {
324
- id: text('id').primaryKey().$default(() => crypto.randomUUID()),
325
- memoryId: text('memory_id').references(() => memories.id, { onDelete: 'cascade' }).notNull(),
326
- placeId: text('place_id').references(() => places.id, { onDelete: 'cascade' }).notNull(),
327
- isManual: integer('is_manual').default(0),
328
- ruleId: text('rule_id'),
329
- createdAt: integer('created_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
330
- }, (table) => [
331
- index('memory_places_memory_idx').on(table.memoryId),
332
- index('memory_places_place_idx').on(table.placeId),
333
- ]);
334
- /**
335
- * Place auto-assignment rules
336
- */
337
- export const placeRules = sqliteTable('place_rules', {
338
- id: text('id').primaryKey().$default(() => crypto.randomUUID()),
339
- projectId: text('project_id').references(() => projects.id, { onDelete: 'cascade' }).notNull(),
340
- name: text('name').notNull(),
341
- placeType: text('place_type').notNull(),
342
- matchTool: text('match_tool'),
343
- matchKeyword: text('match_keyword'),
344
- matchTag: text('match_tag'),
345
- matchMemoryType: text('match_memory_type'),
346
- priority: integer('priority').default(0),
347
- enabled: integer('enabled').default(1),
348
- createdAt: integer('created_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
349
- updatedAt: integer('updated_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
350
- }, (table) => [
351
- index('place_rules_project_idx').on(table.projectId),
352
- index('place_rules_type_idx').on(table.placeType),
353
- ]);
354
- /**
355
- * Memory Layers - Tiered L0/L1/L2 summaries for token-efficient retrieval
356
- */
357
- export const memoryLayers = sqliteTable('memory_layers', {
358
- id: text('id').primaryKey().$default(() => crypto.randomUUID()),
359
- memoryId: text('memory_id').references(() => memories.id, { onDelete: 'cascade' }),
360
- layerType: text('layer_type').notNull().$type(),
361
- content: text('content').notNull(),
362
- tokenCount: integer('token_count').default(0),
363
- createdAt: integer('created_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
364
- }, (table) => [
365
- index('memory_layers_memory_idx').on(table.memoryId),
366
- index('memory_layers_type_idx').on(table.layerType),
367
- ]);
368
- // Progressive Disclosure & Context Paging Tables
369
- // ============================================================================
370
- /**
371
- * Lightweight memory indices for progressive disclosure - previews and metadata
372
- * used for quick filtering before loading full memories
373
- */
374
- export const lightweightMemoryIndices = sqliteTable('lightweight_memory_indices', {
375
- id: text('id').primaryKey().$default(() => crypto.randomUUID()),
376
- memoryId: text('memory_id').references(() => memories.id, { onDelete: 'cascade' }),
377
- // Hash for quick comparison
378
- contentHash: text('content_hash').notNull(),
379
- contentPreview: text('content_preview').notNull(),
380
- keyTerms: text('key_terms').$type(),
381
- // Categorization
382
- category: text('category').notNull(),
383
- importanceScore: integer('importance_score').notNull(),
384
- createdAt: integer('created_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
385
- }, (table) => [
386
- index('lightweight_indices_memory_idx').on(table.memoryId),
387
- index('lightweight_indices_category_idx').on(table.category),
388
- index('lightweight_indices_importance_idx').on(table.importanceScore),
389
- ]);
390
- /**
391
- * Context paging sessions for tracking loaded/preloaded memories
392
- * Agent-controlled memory loading system
393
- */
394
- export const contextPagingSessions = sqliteTable('context_paging_sessions', {
395
- id: text('id').primaryKey().$default(() => crypto.randomUUID()),
396
- sessionId: text('session_id').notNull().unique(),
397
- projectId: text('project_id').references(() => projects.id, { onDelete: 'cascade' }),
398
- userId: text('user_id').references(() => users.id, { onDelete: 'set null' }),
399
- // Loaded memories (actively in context)
400
- loadedMemoryIds: text('loaded_memory_ids').$type().default([]),
401
- // Preload candidates (ready to load if needed)
402
- preloadCandidateIds: text('preload_candidate_ids').$type().default([]),
403
- // Token tracking
404
- tokenBudget: integer('token_budget').default(8000).notNull(),
405
- tokensUsed: integer('tokens_used').default(0).notNull(),
406
- loadedMemoriesTokens: integer('loaded_memories_tokens').default(0).notNull(),
407
- // Session metadata
408
- metadata: text('metadata').$type(),
409
- createdAt: integer('created_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
410
- updatedAt: integer('updated_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
411
- }, (table) => [
412
- index('context_paging_session_idx').on(table.sessionId),
413
- index('context_paging_project_idx').on(table.projectId),
414
- index('context_paging_created_idx').on(table.createdAt),
415
- ]);
416
- // Memory Merging Tables
417
- // ============================================================================
418
- /**
419
- * Memory Merge Proposals - tracks suggested merges before user approval
420
- */
421
- export const memoryMergeProposals = sqliteTable('memory_merge_proposals', {
422
- id: text('id').primaryKey().$default(() => crypto.randomUUID()),
423
- projectId: text('project_id').notNull().references(() => projects.id, { onDelete: 'cascade' }),
424
- userId: text('user_id').references(() => users.id, { onDelete: 'set null' }),
425
- sourceMemoryIds: text('source_memory_ids').$type().notNull(),
426
- proposedContent: text('proposed_content').notNull(),
427
- proposedSummary: text('proposed_summary'),
428
- proposedTags: text('proposed_tags').$type(),
429
- proposedMetadata: text('proposed_metadata').$type(),
430
- detectionMethod: text('detection_method').notNull().$type(),
431
- similarityScore: text('similarity_score').notNull(),
432
- confidenceLevel: text('confidence_level').notNull().$type(),
433
- mergeReason: text('merge_reason').notNull(),
434
- conflictWarnings: text('conflict_warnings').$type(),
435
- status: text('status').$type().default('pending').notNull(),
436
- reviewedAt: integer('reviewed_at', { mode: 'timestamp' }),
437
- reviewNotes: text('review_notes'),
438
- createdAt: integer('created_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
439
- expiresAt: integer('expires_at', { mode: 'timestamp' }),
440
- }, (table) => [
441
- index('memory_merge_proposals_project_status_idx').on(table.projectId, table.status),
442
- index('memory_merge_proposals_created_at_idx').on(table.createdAt),
443
- ]);
444
- /**
445
- * Memory Merge History - audit trail of completed merges
446
- */
447
- export const memoryMergeHistory = sqliteTable('memory_merge_history', {
448
- id: text('id').primaryKey().$default(() => crypto.randomUUID()),
449
- projectId: text('project_id').notNull().references(() => projects.id, { onDelete: 'cascade' }),
450
- userId: text('user_id').references(() => users.id, { onDelete: 'set null' }),
451
- proposalId: text('proposal_id').references(() => memoryMergeProposals.id, { onDelete: 'set null' }),
452
- sourceMemoryIds: text('source_memory_ids').$type().notNull(),
453
- canonicalMemoryId: text('canonical_memory_id').notNull().references(() => memories.id, { onDelete: 'cascade' }),
454
- sourceMemoriesSnapshot: text('source_memories_snapshot').$type().notNull(),
455
- mergeStrategy: text('merge_strategy').notNull().$type(),
456
- tokensSaved: integer('tokens_saved'),
457
- isReversed: integer('is_reversed', { mode: 'boolean' }).default(false),
458
- reversedAt: integer('reversed_at', { mode: 'timestamp' }),
459
- reversedBy: text('reversed_by'),
460
- mergedAt: integer('merged_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
461
- });
462
- /**
463
- * Memory Hash Cache - cached hash signatures for efficient duplicate detection
464
- */
465
- export const memoryHashCache = sqliteTable('memory_hash_cache', {
466
- memoryId: text('memory_id').primaryKey().references(() => memories.id, { onDelete: 'cascade' }),
467
- projectId: text('project_id').notNull().references(() => projects.id, { onDelete: 'cascade' }),
468
- simhash: text('simhash'),
469
- minhash: text('minhash').$type(),
470
- contentHash: text('content_hash').notNull(),
471
- lastUpdated: integer('last_updated', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
472
- }, (table) => [
473
- index('memory_hash_cache_project_id_idx').on(table.projectId),
474
- index('memory_hash_cache_simhash_idx').on(table.simhash),
475
- ]);
476
- /**
477
- * Entity Relations - relationships between entities
478
- */
479
- export const entityRelations = sqliteTable('entity_relations', {
480
- id: text('id').primaryKey().$default(() => crypto.randomUUID()),
481
- fromEntityId: text('from_entity_id').notNull().references(() => entities.id, { onDelete: 'cascade' }),
482
- toEntityId: text('to_entity_id').notNull().references(() => entities.id, { onDelete: 'cascade' }),
483
- type: text('type').notNull(),
484
- weight: integer('weight').default(1),
485
- properties: text('properties').$type(),
486
- createdAt: integer('created_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
487
- }, (table) => [
488
- index('relations_from_idx').on(table.fromEntityId),
489
- index('relations_to_idx').on(table.toEntityId),
490
- index('relations_type_idx').on(table.type),
491
- ]);
492
- // v0.3.0: Lifecycle Features - Associations, Summarization, Snapshots
493
- // ============================================================================
494
- /**
495
- * Memory Associations - waypoint graph for co-activation tracking
496
- */
497
- export const memoryAssociations = sqliteTable('memory_associations', {
498
- id: text('id').primaryKey().$default(() => crypto.randomUUID()),
499
- fromMemoryId: text('from_memory_id').notNull().references(() => memories.id, { onDelete: 'cascade' }),
500
- toMemoryId: text('to_memory_id').notNull().references(() => memories.id, { onDelete: 'cascade' }),
501
- associationType: text('association_type').notNull().$type(),
502
- weight: integer('weight').default(1),
503
- coactivationCount: integer('coactivation_count').default(0),
504
- metadata: text('metadata').$type(),
505
- createdAt: integer('created_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
506
- lastCoactivatedAt: integer('last_coactivated_at', { mode: 'timestamp' }),
507
- }, (table) => [
508
- index('memory_associations_from_idx').on(table.fromMemoryId),
509
- index('memory_associations_to_idx').on(table.toMemoryId),
510
- index('memory_associations_type_idx').on(table.associationType),
511
- index('memory_associations_weight_idx').on(table.weight),
512
- // v0.4.2: Composite index for graph traversal optimization
513
- index('memory_associations_graph_traversal_idx').on(table.fromMemoryId, table.toMemoryId, table.weight, table.associationType),
514
- ]);
515
- /**
516
- * Session Summaries - incremental and rolling session summaries
517
- */
518
- export const sessionSummaries = sqliteTable('session_summaries', {
519
- id: text('id').primaryKey().$default(() => crypto.randomUUID()),
520
- conversationId: text('conversation_id').notNull().references(() => conversations.id, { onDelete: 'cascade' }),
521
- projectId: text('project_id').references(() => projects.id, { onDelete: 'cascade' }),
522
- summaryType: text('summary_type').notNull().$type(),
523
- content: text('content').notNull(),
524
- compressedFrom: integer('compressed_from'),
525
- tokensSaved: integer('tokens_saved'),
526
- embedding: blob('embedding'),
527
- createdAt: integer('created_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
528
- }, (table) => [
529
- index('session_summaries_conversation_idx').on(table.conversationId),
530
- index('session_summaries_project_idx').on(table.projectId),
531
- index('session_summaries_type_idx').on(table.summaryType),
532
- index('session_summaries_created_idx').on(table.createdAt),
533
- ]);
534
- /**
535
- * Memory Snapshots - before/after diffs for auditability
536
- */
537
- export const memorySnapshots = sqliteTable('memory_snapshots', {
538
- id: text('id').primaryKey().$default(() => crypto.randomUUID()),
539
- memoryId: text('memory_id').notNull().references(() => memories.id, { onDelete: 'cascade' }),
540
- snapshotType: text('snapshot_type').notNull().$type(),
541
- content: text('content').notNull(),
542
- metadata: text('metadata').$type(),
543
- diff: text('diff').$type(),
544
- createdAt: integer('created_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
545
- }, (table) => [
546
- index('memory_snapshots_memory_idx').on(table.memoryId),
547
- index('memory_snapshots_type_idx').on(table.snapshotType),
548
- index('memory_snapshots_created_idx').on(table.createdAt),
549
- ]);
550
- /**
551
- * Core Memory - Always-in-context memory (Tier 1)
552
- * Small, persistent, always-visible memory block (< 2KB total)
553
- */
554
- export const coreMemory = sqliteTable('core_memory', {
555
- id: text('id').primaryKey().$default(() => crypto.randomUUID()),
556
- projectId: text('project_id').references(() => projects.id, { onDelete: 'cascade' }),
557
- userId: text('user_id').references(() => users.id, { onDelete: 'set null' }),
558
- // Core memory sections
559
- section: text('section').notNull().$type(),
560
- content: text('content').notNull().default(''),
561
- sizeBytes: integer('size_bytes').default(0).notNull(),
562
- tokensEstimate: integer('tokens_estimate').default(0).notNull(),
563
- // Version tracking
564
- version: integer('version').default(1).notNull(),
565
- createdAt: integer('created_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
566
- updatedAt: integer('updated_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
567
- }, (table) => [
568
- index('core_memory_project_idx').on(table.projectId),
569
- index('core_memory_user_idx').on(table.userId),
570
- index('core_memory_section_idx').on(table.section),
571
- ]);
572
- /**
573
- * Context Sessions - Track loaded memories and context window usage
574
- */
575
- export const contextSessions = sqliteTable('context_sessions', {
576
- id: text('id').primaryKey().$default(() => crypto.randomUUID()),
577
- sessionId: text('session_id').notNull().unique(),
578
- projectId: text('project_id').references(() => projects.id, { onDelete: 'cascade' }),
579
- userId: text('user_id').references(() => users.id, { onDelete: 'set null' }),
580
- // Loaded memories (paging system)
581
- loadedMemoryIds: text('loaded_memory_ids').$type().default([]),
582
- // Token tracking
583
- tokenBudget: integer('token_budget').default(8000).notNull(),
584
- tokensUsed: integer('tokens_used').default(0).notNull(),
585
- coreMemoryTokens: integer('core_memory_tokens').default(0).notNull(),
586
- loadedMemoriesTokens: integer('loaded_memories_tokens').default(0).notNull(),
587
- // Session metadata
588
- metadata: text('metadata').$type(),
589
- createdAt: integer('created_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
590
- updatedAt: integer('updated_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
591
- }, (table) => [
592
- index('context_sessions_session_idx').on(table.sessionId),
593
- index('context_sessions_project_idx').on(table.projectId),
594
- index('context_sessions_created_idx').on(table.createdAt),
595
- ]);
596
- // v0.10.0: Echo/Fizzle Tracking & Scheduled Maintenance
597
- // ============================================================================
598
- export const memoryFeedback = sqliteTable('memory_feedback', {
599
- id: text('id').primaryKey().$default(() => crypto.randomUUID()),
600
- memoryId: text('memory_id').notNull().references(() => memories.id, { onDelete: 'cascade' }),
601
- sessionId: text('session_id').notNull(),
602
- conversationId: text('conversation_id').references(() => conversations.id, { onDelete: 'set null' }),
603
- wasInjected: integer('was_injected', { mode: 'boolean' }).default(false),
604
- wasReferenced: integer('was_referenced', { mode: 'boolean' }).default(false),
605
- referenceCount: integer('reference_count').default(0),
606
- retrievalPriorityDelta: integer('retrieval_priority_delta').default(0),
607
- injectedAt: integer('injected_at', { mode: 'timestamp' }),
608
- referencedAt: integer('referenced_at', { mode: 'timestamp' }),
609
- createdAt: integer('created_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
610
- }, (table) => [
611
- index('memory_feedback_memory_idx').on(table.memoryId),
612
- index('memory_feedback_session_idx').on(table.sessionId),
613
- index('memory_feedback_referenced_idx').on(table.wasReferenced),
614
- index('memory_feedback_conversation_idx').on(table.conversationId),
615
- ]);
616
- export const maintenanceJobs = sqliteTable('maintenance_jobs', {
617
- id: text('id').primaryKey().$default(() => crypto.randomUUID()),
618
- jobName: text('job_name').notNull().unique(),
619
- jobType: text('job_type').notNull().$type(),
620
- cronExpression: text('cron_expression'),
621
- enabled: integer('enabled', { mode: 'boolean' }).default(true),
622
- lastRunAt: integer('last_run_at', { mode: 'timestamp' }),
623
- nextRunAt: integer('next_run_at', { mode: 'timestamp' }),
624
- lastRunDuration: integer('last_run_duration'),
625
- lastRunStatus: text('last_run_status').$type(),
626
- lastRunError: text('last_run_error'),
627
- totalRuns: integer('total_runs').default(0),
628
- successCount: integer('success_count').default(0),
629
- failureCount: integer('failure_count').default(0),
630
- jobConfig: text('job_config').$type(),
631
- createdAt: integer('created_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
632
- updatedAt: integer('updated_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
633
- }, (table) => [
634
- index('maintenance_jobs_name_idx').on(table.jobName),
635
- index('maintenance_jobs_next_run_idx').on(table.nextRunAt),
636
- index('maintenance_jobs_type_idx').on(table.jobType),
637
- index('maintenance_jobs_enabled_idx').on(table.enabled),
638
- ]);
639
- export const maintenanceJobHistory = sqliteTable('maintenance_job_history', {
640
- id: text('id').primaryKey().$default(() => crypto.randomUUID()),
641
- jobId: text('job_id').notNull().references(() => maintenanceJobs.id, { onDelete: 'cascade' }),
642
- startedAt: integer('started_at', { mode: 'timestamp' }).notNull(),
643
- completedAt: integer('completed_at', { mode: 'timestamp' }),
644
- duration: integer('duration'),
645
- status: text('status').notNull().$type(),
646
- error: text('error'),
647
- recordsProcessed: integer('records_processed').default(0),
648
- resultSummary: text('result_summary').$type(),
649
- createdAt: integer('created_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
650
- }, (table) => [
651
- index('maintenance_job_history_job_idx').on(table.jobId),
652
- index('maintenance_job_history_started_idx').on(table.startedAt),
653
- index('maintenance_job_history_status_idx').on(table.status),
654
- ]);
655
- // Memory Editing Tables (SQLite)
656
- // ============================================================================
657
- export const memoryEditProposals = sqliteTable('memory_edit_proposals', {
658
- id: text('id').primaryKey().$default(() => crypto.randomUUID()),
659
- projectId: text('project_id').notNull().references(() => projects.id, { onDelete: 'cascade' }),
660
- userId: text('user_id').references(() => users.id, { onDelete: 'set null' }),
661
- memoryId: text('memory_id').notNull().references(() => memories.id, { onDelete: 'cascade' }),
662
- currentContent: text('current_content').notNull(),
663
- proposedContent: text('proposed_content').notNull(),
664
- reason: text('reason').notNull(),
665
- conflictWarnings: text('conflict_warnings').$type(),
666
- status: text('status').$type().default('pending').notNull(),
667
- version: integer('version').default(1).notNull(),
668
- createdAt: integer('created_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
669
- reviewedAt: integer('reviewed_at', { mode: 'timestamp' }),
670
- reviewNotes: text('review_notes'),
671
- }, (table) => [
672
- index('memory_edit_proposals_memory_idx').on(table.memoryId),
673
- index('memory_edit_proposals_status_idx').on(table.status),
674
- index('memory_edit_proposals_created_at_idx').on(table.createdAt),
675
- ]);
676
- // Phase 3: Retrieval Tracing - Search Traces table
677
- // ============================================================================
678
- /**
679
- * Search Traces - Stores retrieval logs for debugging and performance analysis
680
- */
681
- export const searchTraces = sqliteTable('search_traces', {
682
- id: text('id').primaryKey().$default(() => crypto.randomUUID()),
683
- sessionId: text('session_id').notNull(),
684
- query: text('query').notNull(),
685
- timestamp: integer('timestamp', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
686
- // Search pipeline stages (JSONB stored as text for SQLite)
687
- queryRewrite: text('query_rewrite').$type(),
688
- candidateRetrieval: text('candidate_retrieval').$type(),
689
- entityFiltering: text('entity_filtering').$type(),
690
- hybridScoring: text('hybrid_scoring').$type(),
691
- reranking: text('reranking').$type(),
692
- // Final results
693
- resultCount: integer('result_count').default(0),
694
- topResults: text('top_results').$type(),
695
- // Performance metrics
696
- totalDurationMs: integer('total_duration_ms').default(0),
697
- metadata: text('metadata').$type(),
698
- }, (table) => [
699
- index('search_traces_session_idx').on(table.sessionId),
700
- index('search_traces_timestamp_idx').on(table.timestamp),
701
- ]);
702
- // Belief Systems - Derived Beliefs from Memory
703
- // ============================================================================
704
- /**
705
- * Beliefs - Derived semantic beliefs extracted from memories
706
- * Represents inferred decisions, preferences, constraints, failure causes
707
- */
708
- export const beliefs = sqliteTable('beliefs', {
709
- id: text('id').primaryKey().$default(() => crypto.randomUUID()),
710
- projectId: text('project_id').references(() => projects.id, { onDelete: 'cascade' }),
711
- // Belief identification
712
- beliefType: text('belief_type').notNull().$type(),
713
- statement: text('statement').notNull(),
714
- normalizedKey: text('normalized_key').notNull(),
715
- // Confidence and decay
716
- confidence: integer('confidence').default(50), // 0-100
717
- beliefDecayRate: integer('belief_decay_rate').default(30), // days half-life
718
- lastConfirmedAt: integer('last_confirmed_at', { mode: 'timestamp' }),
719
- sourceCount: integer('source_count').default(1),
720
- // Status
721
- status: text('status').$type().default('active'),
722
- // Context and evidence
723
- reason: text('reason'),
724
- context: text('context'),
725
- evidenceSummary: text('evidence_summary'),
726
- // Metadata (stores edges, derivation info)
727
- metadata: text('metadata').$type(),
728
- createdAt: integer('created_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
729
- updatedAt: integer('updated_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
730
- }, (table) => [
731
- index('beliefs_project_idx').on(table.projectId),
732
- index('beliefs_type_idx').on(table.beliefType),
733
- index('beliefs_status_idx').on(table.status),
734
- index('beliefs_confidence_idx').on(table.confidence),
735
- index('beliefs_normalized_key_idx').on(table.normalizedKey),
736
- ]);
737
- /**
738
- * Belief Memory Sources - Links beliefs to source memories
739
- */
740
- export const beliefMemorySources = sqliteTable('belief_memory_sources', {
741
- id: text('id').primaryKey().$default(() => crypto.randomUUID()),
742
- beliefId: text('belief_id').references(() => beliefs.id, { onDelete: 'cascade' }).notNull(),
743
- memoryId: text('memory_id').references(() => memories.id, { onDelete: 'cascade' }).notNull(),
744
- createdAt: integer('created_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
745
- }, (table) => [
746
- index('belief_sources_belief_idx').on(table.beliefId),
747
- index('belief_sources_memory_idx').on(table.memoryId),
748
- ]);
749
- /**
750
- * Belief Edges - Relationships between beliefs
751
- */
752
- export const beliefEdges = sqliteTable('belief_edges', {
753
- id: text('id').primaryKey().$default(() => crypto.randomUUID()),
754
- fromBeliefId: text('from_belief_id').references(() => beliefs.id, { onDelete: 'cascade' }).notNull(),
755
- toBeliefId: text('to_belief_id').references(() => beliefs.id, { onDelete: 'cascade' }).notNull(),
756
- edgeType: text('edge_type').notNull().$type(),
757
- metadata: text('metadata').$type(),
758
- createdAt: integer('created_at', { mode: 'timestamp' }).default(sql `CURRENT_TIMESTAMP`).notNull(),
759
- }, (table) => [
760
- index('belief_edges_from_idx').on(table.fromBeliefId),
761
- index('belief_edges_to_idx').on(table.toBeliefId),
762
- ]);
763
- //# sourceMappingURL=schema-sqlite.js.map