agentdb 3.0.0-alpha.1 → 3.0.0-alpha.11

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 (541) hide show
  1. package/README.md +775 -533
  2. package/dist/schemas/frontier-schema.sql +0 -7
  3. package/dist/schemas/schema.sql +0 -7
  4. package/dist/src/backends/GraphBackend.d.ts +8 -8
  5. package/dist/src/backends/GraphBackend.d.ts.map +1 -1
  6. package/dist/src/backends/GraphBackend.js +15 -16
  7. package/dist/src/backends/GraphBackend.js.map +1 -1
  8. package/dist/src/backends/LearningBackend.d.ts +2 -2
  9. package/dist/src/backends/LearningBackend.d.ts.map +1 -1
  10. package/dist/src/backends/LearningBackend.js +10 -11
  11. package/dist/src/backends/LearningBackend.js.map +1 -1
  12. package/dist/src/backends/detector.d.ts +3 -25
  13. package/dist/src/backends/detector.d.ts.map +1 -1
  14. package/dist/src/backends/detector.js +15 -119
  15. package/dist/src/backends/detector.js.map +1 -1
  16. package/dist/src/backends/graph/GraphDatabaseAdapter.d.ts +1 -1
  17. package/dist/src/backends/graph/GraphDatabaseAdapter.d.ts.map +1 -1
  18. package/dist/src/backends/graph/GraphDatabaseAdapter.js +1 -5
  19. package/dist/src/backends/graph/GraphDatabaseAdapter.js.map +1 -1
  20. package/dist/src/backends/hnswlib/HNSWLibBackend.d.ts +2 -2
  21. package/dist/src/backends/hnswlib/HNSWLibBackend.d.ts.map +1 -1
  22. package/dist/src/backends/hnswlib/HNSWLibBackend.js +12 -21
  23. package/dist/src/backends/hnswlib/HNSWLibBackend.js.map +1 -1
  24. package/dist/src/backends/index.cjs +6 -0
  25. package/dist/src/backends/index.d.ts +3 -25
  26. package/dist/src/backends/index.d.ts.map +1 -1
  27. package/dist/src/backends/index.js +1 -23
  28. package/dist/src/backends/index.js.map +1 -1
  29. package/dist/src/backends/ruvector/GuardedVectorBackend.d.ts +93 -0
  30. package/dist/src/backends/ruvector/GuardedVectorBackend.d.ts.map +1 -0
  31. package/dist/src/backends/ruvector/GuardedVectorBackend.js +182 -0
  32. package/dist/src/backends/ruvector/GuardedVectorBackend.js.map +1 -0
  33. package/dist/src/backends/ruvector/RuVectorBackend.d.ts +4 -4
  34. package/dist/src/backends/ruvector/RuVectorBackend.d.ts.map +1 -1
  35. package/dist/src/backends/ruvector/RuVectorBackend.js +2 -2
  36. package/dist/src/backends/ruvector/RuVectorBackend.js.map +1 -1
  37. package/dist/src/backends/ruvector/RuVectorLearning.d.ts.map +1 -1
  38. package/dist/src/backends/ruvector/RuVectorLearning.js +5 -10
  39. package/dist/src/backends/ruvector/RuVectorLearning.js.map +1 -1
  40. package/dist/src/benchmark/BenchmarkSuite.d.ts.map +1 -1
  41. package/dist/src/benchmark/BenchmarkSuite.js +0 -2
  42. package/dist/src/benchmark/BenchmarkSuite.js.map +1 -1
  43. package/dist/src/benchmarks/wasm-vector-benchmark.d.ts +10 -0
  44. package/dist/src/benchmarks/wasm-vector-benchmark.d.ts.map +1 -0
  45. package/dist/src/benchmarks/wasm-vector-benchmark.js +196 -0
  46. package/dist/src/benchmarks/wasm-vector-benchmark.js.map +1 -0
  47. package/dist/src/browser/AdvancedFeatures.d.ts.map +1 -1
  48. package/dist/src/browser/AdvancedFeatures.js +10 -3
  49. package/dist/src/browser/AdvancedFeatures.js.map +1 -1
  50. package/dist/src/browser/AttentionBrowser.d.ts.map +1 -1
  51. package/dist/src/browser/AttentionBrowser.js +13 -5
  52. package/dist/src/browser/AttentionBrowser.js.map +1 -1
  53. package/dist/src/browser/HNSWIndex.d.ts +1 -31
  54. package/dist/src/browser/HNSWIndex.d.ts.map +1 -1
  55. package/dist/src/browser/HNSWIndex.js +18 -136
  56. package/dist/src/browser/HNSWIndex.js.map +1 -1
  57. package/dist/src/browser/ProductQuantization.d.ts.map +1 -1
  58. package/dist/src/browser/ProductQuantization.js +1 -0
  59. package/dist/src/browser/ProductQuantization.js.map +1 -1
  60. package/dist/src/browser/index.d.ts +3 -3
  61. package/dist/src/browser/index.d.ts.map +1 -1
  62. package/dist/src/browser/index.js +1 -2
  63. package/dist/src/browser/index.js.map +1 -1
  64. package/dist/src/cli/agentdb-cli.d.ts +2 -3
  65. package/dist/src/cli/agentdb-cli.d.ts.map +1 -1
  66. package/dist/src/cli/agentdb-cli.js +125 -53
  67. package/dist/src/cli/agentdb-cli.js.map +1 -1
  68. package/dist/src/cli/commands/attention.js +3 -3
  69. package/dist/src/cli/commands/attention.js.map +1 -1
  70. package/dist/src/cli/commands/doctor.d.ts +0 -2
  71. package/dist/src/cli/commands/doctor.d.ts.map +1 -1
  72. package/dist/src/cli/commands/doctor.js +1 -106
  73. package/dist/src/cli/commands/doctor.js.map +1 -1
  74. package/dist/src/cli/commands/hyperbolic.d.ts.map +1 -1
  75. package/dist/src/cli/commands/hyperbolic.js +1 -1
  76. package/dist/src/cli/commands/hyperbolic.js.map +1 -1
  77. package/dist/src/cli/commands/init.d.ts +1 -2
  78. package/dist/src/cli/commands/init.d.ts.map +1 -1
  79. package/dist/src/cli/commands/init.js +7 -30
  80. package/dist/src/cli/commands/init.js.map +1 -1
  81. package/dist/src/cli/commands/install-embeddings.d.ts.map +1 -1
  82. package/dist/src/cli/commands/install-embeddings.js.map +1 -1
  83. package/dist/src/cli/commands/learn.d.ts.map +1 -1
  84. package/dist/src/cli/commands/learn.js +5 -5
  85. package/dist/src/cli/commands/learn.js.map +1 -1
  86. package/dist/src/cli/commands/migrate.d.ts.map +1 -1
  87. package/dist/src/cli/commands/migrate.js +17 -8
  88. package/dist/src/cli/commands/migrate.js.map +1 -1
  89. package/dist/src/cli/commands/simulate-report.js.map +1 -1
  90. package/dist/src/cli/commands/simulate-wizard.js.map +1 -1
  91. package/dist/src/cli/commands/simulate.d.ts +7 -0
  92. package/dist/src/cli/commands/simulate.d.ts.map +1 -0
  93. package/dist/src/cli/commands/simulate.js +100 -0
  94. package/dist/src/cli/commands/simulate.js.map +1 -0
  95. package/dist/src/cli/commands/status.js +1 -5
  96. package/dist/src/cli/commands/status.js.map +1 -1
  97. package/dist/src/cli/lib/attention-config.d.ts +2 -2
  98. package/dist/src/cli/lib/attention-config.d.ts.map +1 -1
  99. package/dist/src/cli/lib/attention-config.js +1 -2
  100. package/dist/src/cli/lib/attention-config.js.map +1 -1
  101. package/dist/src/cli/lib/config-manager.d.ts +110 -0
  102. package/dist/src/cli/lib/config-manager.d.ts.map +1 -0
  103. package/dist/src/cli/lib/config-manager.js +512 -0
  104. package/dist/src/cli/lib/config-manager.js.map +1 -0
  105. package/dist/src/cli/lib/config-validator.d.ts +1 -1
  106. package/dist/src/cli/lib/config-validator.d.ts.map +1 -1
  107. package/dist/src/cli/lib/health-monitor.d.ts +149 -0
  108. package/dist/src/cli/lib/health-monitor.d.ts.map +1 -0
  109. package/dist/src/cli/lib/health-monitor.js +380 -0
  110. package/dist/src/cli/lib/health-monitor.js.map +1 -0
  111. package/dist/src/cli/lib/history-tracker.d.ts +103 -0
  112. package/dist/src/cli/lib/history-tracker.d.ts.map +1 -0
  113. package/dist/src/cli/lib/history-tracker.js +352 -0
  114. package/dist/src/cli/lib/history-tracker.js.map +1 -0
  115. package/dist/src/cli/lib/report-store.d.ts.map +1 -1
  116. package/dist/src/cli/lib/report-store.js +3 -5
  117. package/dist/src/cli/lib/report-store.js.map +1 -1
  118. package/dist/src/cli/lib/simulation-registry.d.ts +1 -1
  119. package/dist/src/cli/lib/simulation-registry.d.ts.map +1 -1
  120. package/dist/src/cli/lib/simulation-registry.js +0 -1
  121. package/dist/src/cli/lib/simulation-registry.js.map +1 -1
  122. package/dist/src/cli/lib/simulation-runner.d.ts +1 -1
  123. package/dist/src/cli/lib/simulation-runner.d.ts.map +1 -1
  124. package/dist/src/cli/lib/simulation-runner.js +1 -4
  125. package/dist/src/cli/lib/simulation-runner.js.map +1 -1
  126. package/dist/src/compatibility/DeprecationWarnings.d.ts.map +1 -1
  127. package/dist/src/compatibility/V1toV2Adapter.d.ts +2 -2
  128. package/dist/src/compatibility/V1toV2Adapter.d.ts.map +1 -1
  129. package/dist/src/compatibility/V1toV2Adapter.js +1 -14
  130. package/dist/src/compatibility/V1toV2Adapter.js.map +1 -1
  131. package/dist/src/compatibility/VersionDetector.d.ts +1 -1
  132. package/dist/src/compatibility/VersionDetector.d.ts.map +1 -1
  133. package/dist/src/compatibility/VersionDetector.js +3 -3
  134. package/dist/src/compatibility/VersionDetector.js.map +1 -1
  135. package/dist/src/compatibility/index.d.ts +3 -0
  136. package/dist/src/compatibility/index.d.ts.map +1 -1
  137. package/dist/src/compatibility/index.js +11 -0
  138. package/dist/src/compatibility/index.js.map +1 -1
  139. package/dist/src/consensus/RaftConsensus.d.ts +220 -0
  140. package/dist/src/consensus/RaftConsensus.d.ts.map +1 -0
  141. package/dist/src/consensus/RaftConsensus.js +762 -0
  142. package/dist/src/consensus/RaftConsensus.js.map +1 -0
  143. package/dist/src/controllers/AttentionService.d.ts +98 -122
  144. package/dist/src/controllers/AttentionService.d.ts.map +1 -1
  145. package/dist/src/controllers/AttentionService.js +463 -238
  146. package/dist/src/controllers/AttentionService.js.map +1 -1
  147. package/dist/src/controllers/CausalMemoryGraph.d.ts +4 -4
  148. package/dist/src/controllers/CausalMemoryGraph.d.ts.map +1 -1
  149. package/dist/src/controllers/CausalMemoryGraph.js +3 -4
  150. package/dist/src/controllers/CausalMemoryGraph.js.map +1 -1
  151. package/dist/src/controllers/CausalRecall.d.ts +3 -2
  152. package/dist/src/controllers/CausalRecall.d.ts.map +1 -1
  153. package/dist/src/controllers/CausalRecall.js +19 -8
  154. package/dist/src/controllers/CausalRecall.js.map +1 -1
  155. package/dist/src/controllers/ContextSynthesizer.d.ts +1 -1
  156. package/dist/src/controllers/ContextSynthesizer.d.ts.map +1 -1
  157. package/dist/src/controllers/EmbeddingService.d.ts.map +1 -1
  158. package/dist/src/controllers/EmbeddingService.js +23 -13
  159. package/dist/src/controllers/EmbeddingService.js.map +1 -1
  160. package/dist/src/controllers/EnhancedEmbeddingService.d.ts.map +1 -1
  161. package/dist/src/controllers/EnhancedEmbeddingService.js +10 -3
  162. package/dist/src/controllers/EnhancedEmbeddingService.js.map +1 -1
  163. package/dist/src/controllers/ExplainableRecall.d.ts +5 -4
  164. package/dist/src/controllers/ExplainableRecall.d.ts.map +1 -1
  165. package/dist/src/controllers/ExplainableRecall.js +12 -20
  166. package/dist/src/controllers/ExplainableRecall.js.map +1 -1
  167. package/dist/src/controllers/HNSWIndex.d.ts +5 -4
  168. package/dist/src/controllers/HNSWIndex.d.ts.map +1 -1
  169. package/dist/src/controllers/HNSWIndex.js +6 -9
  170. package/dist/src/controllers/HNSWIndex.js.map +1 -1
  171. package/dist/src/controllers/HierarchicalMemory.d.ts +197 -0
  172. package/dist/src/controllers/HierarchicalMemory.d.ts.map +1 -0
  173. package/dist/src/controllers/HierarchicalMemory.js +519 -0
  174. package/dist/src/controllers/HierarchicalMemory.js.map +1 -0
  175. package/dist/src/controllers/LearningSystem.d.ts +10 -105
  176. package/dist/src/controllers/LearningSystem.d.ts.map +1 -1
  177. package/dist/src/controllers/LearningSystem.js +22 -33
  178. package/dist/src/controllers/LearningSystem.js.map +1 -1
  179. package/dist/src/controllers/MMRDiversityRanker.d.ts +1 -1
  180. package/dist/src/controllers/MMRDiversityRanker.d.ts.map +1 -1
  181. package/dist/src/controllers/MemoryConsolidation.d.ts +142 -0
  182. package/dist/src/controllers/MemoryConsolidation.d.ts.map +1 -0
  183. package/dist/src/controllers/MemoryConsolidation.js +479 -0
  184. package/dist/src/controllers/MemoryConsolidation.js.map +1 -0
  185. package/dist/src/controllers/MemoryController.d.ts +2 -2
  186. package/dist/src/controllers/MemoryController.d.ts.map +1 -1
  187. package/dist/src/controllers/MemoryController.js +16 -3
  188. package/dist/src/controllers/MemoryController.js.map +1 -1
  189. package/dist/src/controllers/MetadataFilter.d.ts +3 -3
  190. package/dist/src/controllers/MetadataFilter.d.ts.map +1 -1
  191. package/dist/src/controllers/MetadataFilter.js +6 -9
  192. package/dist/src/controllers/MetadataFilter.js.map +1 -1
  193. package/dist/src/controllers/MincutService.d.ts +92 -0
  194. package/dist/src/controllers/MincutService.d.ts.map +1 -0
  195. package/dist/src/controllers/MincutService.js +336 -0
  196. package/dist/src/controllers/MincutService.js.map +1 -0
  197. package/dist/src/controllers/NightlyLearner.d.ts +3 -4
  198. package/dist/src/controllers/NightlyLearner.d.ts.map +1 -1
  199. package/dist/src/controllers/NightlyLearner.js +16 -21
  200. package/dist/src/controllers/NightlyLearner.js.map +1 -1
  201. package/dist/src/controllers/QUICClient.d.ts +7 -10
  202. package/dist/src/controllers/QUICClient.d.ts.map +1 -1
  203. package/dist/src/controllers/QUICClient.js +3 -3
  204. package/dist/src/controllers/QUICClient.js.map +1 -1
  205. package/dist/src/controllers/QUICConnection.d.ts +122 -0
  206. package/dist/src/controllers/QUICConnection.d.ts.map +1 -0
  207. package/dist/src/controllers/QUICConnection.js +329 -0
  208. package/dist/src/controllers/QUICConnection.js.map +1 -0
  209. package/dist/src/controllers/QUICConnectionPool.d.ts +83 -0
  210. package/dist/src/controllers/QUICConnectionPool.d.ts.map +1 -0
  211. package/dist/src/controllers/QUICConnectionPool.js +256 -0
  212. package/dist/src/controllers/QUICConnectionPool.js.map +1 -0
  213. package/dist/src/controllers/QUICServer.d.ts +4 -4
  214. package/dist/src/controllers/QUICServer.d.ts.map +1 -1
  215. package/dist/src/controllers/QUICServer.js +14 -22
  216. package/dist/src/controllers/QUICServer.js.map +1 -1
  217. package/dist/src/controllers/QUICStreamManager.d.ts +114 -0
  218. package/dist/src/controllers/QUICStreamManager.d.ts.map +1 -0
  219. package/dist/src/controllers/QUICStreamManager.js +267 -0
  220. package/dist/src/controllers/QUICStreamManager.js.map +1 -0
  221. package/dist/src/controllers/ReasoningBank.d.ts +2 -9
  222. package/dist/src/controllers/ReasoningBank.d.ts.map +1 -1
  223. package/dist/src/controllers/ReasoningBank.js +18 -25
  224. package/dist/src/controllers/ReasoningBank.js.map +1 -1
  225. package/dist/src/controllers/ReflexionMemory.d.ts +1 -1
  226. package/dist/src/controllers/ReflexionMemory.d.ts.map +1 -1
  227. package/dist/src/controllers/ReflexionMemory.js +30 -25
  228. package/dist/src/controllers/ReflexionMemory.js.map +1 -1
  229. package/dist/src/controllers/SkillLibrary.d.ts +5 -11
  230. package/dist/src/controllers/SkillLibrary.d.ts.map +1 -1
  231. package/dist/src/controllers/SkillLibrary.js +18 -38
  232. package/dist/src/controllers/SkillLibrary.js.map +1 -1
  233. package/dist/src/controllers/SparsificationService.d.ts +151 -0
  234. package/dist/src/controllers/SparsificationService.d.ts.map +1 -0
  235. package/dist/src/controllers/SparsificationService.js +375 -0
  236. package/dist/src/controllers/SparsificationService.js.map +1 -0
  237. package/dist/src/controllers/StreamingEmbeddingService.d.ts +82 -0
  238. package/dist/src/controllers/StreamingEmbeddingService.d.ts.map +1 -0
  239. package/dist/src/controllers/StreamingEmbeddingService.js +243 -0
  240. package/dist/src/controllers/StreamingEmbeddingService.js.map +1 -0
  241. package/dist/src/controllers/SyncCoordinator.d.ts +3 -2
  242. package/dist/src/controllers/SyncCoordinator.d.ts.map +1 -1
  243. package/dist/src/controllers/SyncCoordinator.js +2 -2
  244. package/dist/src/controllers/SyncCoordinator.js.map +1 -1
  245. package/dist/src/controllers/WASMVectorSearch.d.ts +7 -6
  246. package/dist/src/controllers/WASMVectorSearch.d.ts.map +1 -1
  247. package/dist/src/controllers/WASMVectorSearch.js +2 -4
  248. package/dist/src/controllers/WASMVectorSearch.js.map +1 -1
  249. package/dist/src/controllers/attention/AttentionCache.d.ts +38 -0
  250. package/dist/src/controllers/attention/AttentionCache.d.ts.map +1 -0
  251. package/dist/src/controllers/attention/AttentionCache.js +80 -0
  252. package/dist/src/controllers/attention/AttentionCache.js.map +1 -0
  253. package/dist/src/controllers/attention/AttentionConfig.d.ts +127 -0
  254. package/dist/src/controllers/attention/AttentionConfig.d.ts.map +1 -0
  255. package/dist/src/controllers/attention/AttentionConfig.js +124 -0
  256. package/dist/src/controllers/attention/AttentionConfig.js.map +1 -0
  257. package/dist/src/controllers/attention/AttentionCore.d.ts +89 -0
  258. package/dist/src/controllers/attention/AttentionCore.d.ts.map +1 -0
  259. package/dist/src/controllers/attention/AttentionCore.js +289 -0
  260. package/dist/src/controllers/attention/AttentionCore.js.map +1 -0
  261. package/dist/src/controllers/attention/AttentionHelpers.d.ts +55 -0
  262. package/dist/src/controllers/attention/AttentionHelpers.d.ts.map +1 -0
  263. package/dist/src/controllers/attention/AttentionHelpers.js +148 -0
  264. package/dist/src/controllers/attention/AttentionHelpers.js.map +1 -0
  265. package/dist/src/controllers/attention/AttentionMetrics.d.ts +55 -0
  266. package/dist/src/controllers/attention/AttentionMetrics.d.ts.map +1 -0
  267. package/dist/src/controllers/attention/AttentionMetrics.js +72 -0
  268. package/dist/src/controllers/attention/AttentionMetrics.js.map +1 -0
  269. package/dist/src/controllers/attention/AttentionWASM.d.ts +98 -0
  270. package/dist/src/controllers/attention/AttentionWASM.d.ts.map +1 -0
  271. package/dist/src/controllers/attention/AttentionWASM.js +147 -0
  272. package/dist/src/controllers/attention/AttentionWASM.js.map +1 -0
  273. package/dist/src/controllers/attention/CrossAttentionController.d.ts +1 -1
  274. package/dist/src/controllers/attention/CrossAttentionController.d.ts.map +1 -1
  275. package/dist/src/controllers/attention/MultiHeadAttentionController.d.ts +1 -1
  276. package/dist/src/controllers/attention/MultiHeadAttentionController.d.ts.map +1 -1
  277. package/dist/src/controllers/attention/MultiHeadAttentionController.js +5 -8
  278. package/dist/src/controllers/attention/MultiHeadAttentionController.js.map +1 -1
  279. package/dist/src/controllers/attention/SelfAttentionController.d.ts +1 -1
  280. package/dist/src/controllers/attention/SelfAttentionController.d.ts.map +1 -1
  281. package/dist/src/controllers/attention/index.d.ts +9 -0
  282. package/dist/src/controllers/attention/index.d.ts.map +1 -1
  283. package/dist/src/controllers/attention/index.js +8 -0
  284. package/dist/src/controllers/attention/index.js.map +1 -1
  285. package/dist/src/controllers/frontier-index.d.ts +14 -0
  286. package/dist/src/controllers/frontier-index.d.ts.map +1 -0
  287. package/dist/src/controllers/frontier-index.js +10 -0
  288. package/dist/src/controllers/frontier-index.js.map +1 -0
  289. package/dist/src/controllers/index.cjs +6 -0
  290. package/dist/src/controllers/index.d.ts +4 -0
  291. package/dist/src/controllers/index.d.ts.map +1 -1
  292. package/dist/src/controllers/index.js +2 -0
  293. package/dist/src/controllers/index.js.map +1 -1
  294. package/dist/src/core/AgentDB.d.ts +4 -35
  295. package/dist/src/core/AgentDB.d.ts.map +1 -1
  296. package/dist/src/core/AgentDB.js +19 -77
  297. package/dist/src/core/AgentDB.js.map +1 -1
  298. package/dist/src/core/QueryCache.d.ts +1 -1
  299. package/dist/src/core/QueryCache.d.ts.map +1 -1
  300. package/dist/src/core/QueryCache.js +2 -6
  301. package/dist/src/core/QueryCache.js.map +1 -1
  302. package/dist/src/db-test.d.ts +13 -0
  303. package/dist/src/db-test.d.ts.map +1 -0
  304. package/dist/src/db-test.js +55 -0
  305. package/dist/src/db-test.js.map +1 -0
  306. package/dist/src/db-unified.d.ts +76 -0
  307. package/dist/src/db-unified.d.ts.map +1 -0
  308. package/dist/src/db-unified.js +279 -0
  309. package/dist/src/db-unified.js.map +1 -0
  310. package/dist/src/examples/quic-sync-example.d.ts +9 -0
  311. package/dist/src/examples/quic-sync-example.d.ts.map +1 -0
  312. package/dist/src/examples/quic-sync-example.js +169 -0
  313. package/dist/src/examples/quic-sync-example.js.map +1 -0
  314. package/dist/src/examples/wasm-vector-usage.d.ts +12 -0
  315. package/dist/src/examples/wasm-vector-usage.d.ts.map +1 -0
  316. package/dist/src/examples/wasm-vector-usage.js +190 -0
  317. package/dist/src/examples/wasm-vector-usage.js.map +1 -0
  318. package/dist/src/index.cjs +6 -0
  319. package/dist/src/index.d.ts +2 -24
  320. package/dist/src/index.d.ts.map +1 -1
  321. package/dist/src/index.js +4 -9
  322. package/dist/src/index.js.map +1 -1
  323. package/dist/src/mcp/agentdb-mcp-server.js +83 -194
  324. package/dist/src/mcp/agentdb-mcp-server.js.map +1 -1
  325. package/dist/src/mcp/learning-tools-handlers.d.ts +16 -0
  326. package/dist/src/mcp/learning-tools-handlers.d.ts.map +1 -0
  327. package/dist/src/mcp/learning-tools-handlers.js +105 -0
  328. package/dist/src/mcp/learning-tools-handlers.js.map +1 -0
  329. package/dist/src/model/ModelCacheLoader.d.ts +24 -0
  330. package/dist/src/model/ModelCacheLoader.d.ts.map +1 -0
  331. package/dist/src/model/ModelCacheLoader.js +121 -0
  332. package/dist/src/model/ModelCacheLoader.js.map +1 -0
  333. package/dist/src/observability/integration.d.ts +3 -3
  334. package/dist/src/observability/integration.d.ts.map +1 -1
  335. package/dist/src/observability/integration.js +2 -0
  336. package/dist/src/observability/integration.js.map +1 -1
  337. package/dist/src/observability/telemetry.d.ts +3 -3
  338. package/dist/src/observability/telemetry.d.ts.map +1 -1
  339. package/dist/src/observability/telemetry.js +0 -4
  340. package/dist/src/observability/telemetry.js.map +1 -1
  341. package/dist/src/optimizations/BatchOperations.d.ts +6 -6
  342. package/dist/src/optimizations/BatchOperations.d.ts.map +1 -1
  343. package/dist/src/optimizations/BatchOperations.js +2 -3
  344. package/dist/src/optimizations/BatchOperations.js.map +1 -1
  345. package/dist/src/optimizations/Quantization.d.ts +330 -0
  346. package/dist/src/optimizations/Quantization.d.ts.map +1 -0
  347. package/dist/src/optimizations/Quantization.js +793 -0
  348. package/dist/src/optimizations/Quantization.js.map +1 -0
  349. package/dist/src/optimizations/QueryOptimizer.d.ts +4 -4
  350. package/dist/src/optimizations/QueryOptimizer.d.ts.map +1 -1
  351. package/dist/src/optimizations/QueryOptimizer.js +1 -3
  352. package/dist/src/optimizations/QueryOptimizer.js.map +1 -1
  353. package/dist/src/optimizations/RVFOptimizer.d.ts +226 -0
  354. package/dist/src/optimizations/RVFOptimizer.d.ts.map +1 -0
  355. package/dist/src/optimizations/RVFOptimizer.js +541 -0
  356. package/dist/src/optimizations/RVFOptimizer.js.map +1 -0
  357. package/dist/src/optimizations/ToolCache.d.ts +4 -4
  358. package/dist/src/optimizations/ToolCache.d.ts.map +1 -1
  359. package/dist/src/optimizations/ToolCache.js.map +1 -1
  360. package/dist/src/quantization/vector-quantization.d.ts.map +1 -1
  361. package/dist/src/quantization/vector-quantization.js +1 -5
  362. package/dist/src/quantization/vector-quantization.js.map +1 -1
  363. package/dist/src/search/HybridSearch.d.ts +6 -6
  364. package/dist/src/search/HybridSearch.d.ts.map +1 -1
  365. package/dist/src/search/HybridSearch.js.map +1 -1
  366. package/dist/src/security/AttestationLog.d.ts +70 -0
  367. package/dist/src/security/AttestationLog.d.ts.map +1 -0
  368. package/dist/src/security/AttestationLog.js +174 -0
  369. package/dist/src/security/AttestationLog.js.map +1 -0
  370. package/dist/src/security/MutationGuard.d.ts +83 -0
  371. package/dist/src/security/MutationGuard.d.ts.map +1 -0
  372. package/dist/src/security/MutationGuard.js +364 -0
  373. package/dist/src/security/MutationGuard.js.map +1 -0
  374. package/dist/src/security/index.cjs +6 -0
  375. package/dist/src/security/index.d.ts +15 -0
  376. package/dist/src/security/index.d.ts.map +1 -0
  377. package/dist/src/security/index.js +18 -0
  378. package/dist/src/security/index.js.map +1 -0
  379. package/dist/src/security/input-validation.d.ts +12 -12
  380. package/dist/src/security/input-validation.d.ts.map +1 -1
  381. package/dist/src/security/input-validation.js +0 -1
  382. package/dist/src/security/input-validation.js.map +1 -1
  383. package/dist/src/security/limits.d.ts +150 -0
  384. package/dist/src/security/limits.d.ts.map +1 -0
  385. package/dist/src/security/limits.js +288 -0
  386. package/dist/src/security/limits.js.map +1 -0
  387. package/dist/src/security/path-security.d.ts +100 -0
  388. package/dist/src/security/path-security.d.ts.map +1 -0
  389. package/dist/src/security/path-security.js +337 -0
  390. package/dist/src/security/path-security.js.map +1 -0
  391. package/dist/src/security/validation.d.ts +95 -0
  392. package/dist/src/security/validation.d.ts.map +1 -0
  393. package/dist/src/security/validation.js +315 -0
  394. package/dist/src/security/validation.js.map +1 -0
  395. package/dist/src/services/AttentionService.d.ts.map +1 -1
  396. package/dist/src/services/AttentionService.js +2 -4
  397. package/dist/src/services/AttentionService.js.map +1 -1
  398. package/dist/src/services/GNNService.d.ts +173 -0
  399. package/dist/src/services/GNNService.d.ts.map +1 -0
  400. package/dist/src/services/GNNService.js +639 -0
  401. package/dist/src/services/GNNService.js.map +1 -0
  402. package/dist/src/services/GraphTransformerService.d.ts +80 -0
  403. package/dist/src/services/GraphTransformerService.d.ts.map +1 -0
  404. package/dist/src/services/GraphTransformerService.js +369 -0
  405. package/dist/src/services/GraphTransformerService.js.map +1 -0
  406. package/dist/src/services/LLMRouter.d.ts +2 -2
  407. package/dist/src/services/LLMRouter.d.ts.map +1 -1
  408. package/dist/src/services/LLMRouter.js +3 -9
  409. package/dist/src/services/LLMRouter.js.map +1 -1
  410. package/dist/src/services/SemanticRouter.d.ts +83 -0
  411. package/dist/src/services/SemanticRouter.d.ts.map +1 -0
  412. package/dist/src/services/SemanticRouter.js +160 -0
  413. package/dist/src/services/SemanticRouter.js.map +1 -0
  414. package/dist/src/services/SonaTrajectoryService.d.ts +224 -0
  415. package/dist/src/services/SonaTrajectoryService.d.ts.map +1 -0
  416. package/dist/src/services/SonaTrajectoryService.js +539 -0
  417. package/dist/src/services/SonaTrajectoryService.js.map +1 -0
  418. package/dist/src/services/audit-logger.service.d.ts +168 -0
  419. package/dist/src/services/audit-logger.service.d.ts.map +1 -0
  420. package/dist/src/services/audit-logger.service.js +331 -0
  421. package/dist/src/services/audit-logger.service.js.map +1 -0
  422. package/dist/src/services/enhanced-embeddings.d.ts +271 -0
  423. package/dist/src/services/enhanced-embeddings.d.ts.map +1 -0
  424. package/dist/src/services/enhanced-embeddings.js +1035 -0
  425. package/dist/src/services/enhanced-embeddings.js.map +1 -0
  426. package/dist/src/services/federated-learning.d.ts +172 -0
  427. package/dist/src/services/federated-learning.d.ts.map +1 -0
  428. package/dist/src/services/federated-learning.js +342 -0
  429. package/dist/src/services/federated-learning.js.map +1 -0
  430. package/dist/src/simd/simd-vector-ops.d.ts.map +1 -1
  431. package/dist/src/simd/simd-vector-ops.js +0 -2
  432. package/dist/src/simd/simd-vector-ops.js.map +1 -1
  433. package/dist/src/types/attention.d.ts +249 -0
  434. package/dist/src/types/attention.d.ts.map +1 -0
  435. package/dist/src/types/attention.js +43 -0
  436. package/dist/src/types/attention.js.map +1 -0
  437. package/dist/src/types/database.types.d.ts +11 -11
  438. package/dist/src/types/database.types.d.ts.map +1 -1
  439. package/dist/src/types/database.types.js +2 -4
  440. package/dist/src/types/database.types.js.map +1 -1
  441. package/dist/src/types/graph.d.ts +29 -0
  442. package/dist/src/types/graph.d.ts.map +1 -0
  443. package/dist/src/types/graph.js +8 -0
  444. package/dist/src/types/graph.js.map +1 -0
  445. package/dist/src/types/quic.d.ts +518 -0
  446. package/dist/src/types/quic.d.ts.map +1 -0
  447. package/dist/src/types/quic.js +272 -0
  448. package/dist/src/types/quic.js.map +1 -0
  449. package/dist/src/utils/LegacyAttentionAdapter.d.ts +93 -0
  450. package/dist/src/utils/LegacyAttentionAdapter.d.ts.map +1 -0
  451. package/dist/src/utils/LegacyAttentionAdapter.js +241 -0
  452. package/dist/src/utils/LegacyAttentionAdapter.js.map +1 -0
  453. package/dist/src/utils/attention-metrics.d.ts +76 -0
  454. package/dist/src/utils/attention-metrics.d.ts.map +1 -0
  455. package/dist/src/utils/attention-metrics.js +178 -0
  456. package/dist/src/utils/attention-metrics.js.map +1 -0
  457. package/dist/src/utils/vector-math.d.ts +29 -0
  458. package/dist/src/utils/vector-math.d.ts.map +1 -0
  459. package/dist/src/utils/vector-math.js +66 -0
  460. package/dist/src/utils/vector-math.js.map +1 -0
  461. package/dist/src/wasm-loader.d.ts +0 -1
  462. package/dist/src/wasm-loader.d.ts.map +1 -1
  463. package/dist/src/wasm-loader.js +0 -2
  464. package/dist/src/wasm-loader.js.map +1 -1
  465. package/dist/src/wrappers/agentdb-fast.d.ts +3 -3
  466. package/dist/src/wrappers/agentdb-fast.d.ts.map +1 -1
  467. package/dist/src/wrappers/agentdb-fast.js +2 -11
  468. package/dist/src/wrappers/agentdb-fast.js.map +1 -1
  469. package/dist/src/wrappers/attention-fallbacks.d.ts +0 -8
  470. package/dist/src/wrappers/attention-fallbacks.d.ts.map +1 -1
  471. package/dist/src/wrappers/attention-fallbacks.js +3 -6
  472. package/dist/src/wrappers/attention-fallbacks.js.map +1 -1
  473. package/dist/src/wrappers/attention-native.d.ts +111 -0
  474. package/dist/src/wrappers/attention-native.d.ts.map +1 -0
  475. package/dist/src/wrappers/attention-native.js +273 -0
  476. package/dist/src/wrappers/attention-native.js.map +1 -0
  477. package/dist/src/wrappers/embedding-service.d.ts +4 -4
  478. package/dist/src/wrappers/embedding-service.d.ts.map +1 -1
  479. package/dist/src/wrappers/embedding-service.js +1 -7
  480. package/dist/src/wrappers/embedding-service.js.map +1 -1
  481. package/dist/src/wrappers/gnn-wrapper.d.ts.map +1 -1
  482. package/dist/src/wrappers/gnn-wrapper.js +3 -7
  483. package/dist/src/wrappers/gnn-wrapper.js.map +1 -1
  484. package/package.json +21 -6
  485. package/scripts/postinstall.cjs +13 -144
  486. package/dist/src/cli/tests/agentdb-cli.test.d.ts +0 -8
  487. package/dist/src/cli/tests/agentdb-cli.test.d.ts.map +0 -1
  488. package/dist/src/cli/tests/agentdb-cli.test.js +0 -50
  489. package/dist/src/cli/tests/agentdb-cli.test.js.map +0 -1
  490. package/dist/src/cli/tests/attention-cli.test.d.ts +0 -5
  491. package/dist/src/cli/tests/attention-cli.test.d.ts.map +0 -1
  492. package/dist/src/cli/tests/attention-cli.test.js +0 -257
  493. package/dist/src/cli/tests/attention-cli.test.js.map +0 -1
  494. package/dist/src/tests/attention-service.test.d.ts +0 -7
  495. package/dist/src/tests/attention-service.test.d.ts.map +0 -1
  496. package/dist/src/tests/attention-service.test.js +0 -401
  497. package/dist/src/tests/attention-service.test.js.map +0 -1
  498. package/dist/src/tests/integration/compatibility/backwards-compat.integration.test.d.ts +0 -7
  499. package/dist/src/tests/integration/compatibility/backwards-compat.integration.test.d.ts.map +0 -1
  500. package/dist/src/tests/integration/compatibility/backwards-compat.integration.test.js +0 -283
  501. package/dist/src/tests/integration/compatibility/backwards-compat.integration.test.js.map +0 -1
  502. package/dist/src/tests/query-cache.test.d.ts +0 -7
  503. package/dist/src/tests/query-cache.test.d.ts.map +0 -1
  504. package/dist/src/tests/query-cache.test.js +0 -343
  505. package/dist/src/tests/query-cache.test.js.map +0 -1
  506. package/dist/src/tests/ruvector-integration.test.d.ts +0 -14
  507. package/dist/src/tests/ruvector-integration.test.d.ts.map +0 -1
  508. package/dist/src/tests/ruvector-integration.test.js +0 -1156
  509. package/dist/src/tests/ruvector-integration.test.js.map +0 -1
  510. package/dist/src/tests/unit/auth/crypto.utils.test.d.ts +0 -6
  511. package/dist/src/tests/unit/auth/crypto.utils.test.d.ts.map +0 -1
  512. package/dist/src/tests/unit/auth/crypto.utils.test.js +0 -310
  513. package/dist/src/tests/unit/auth/crypto.utils.test.js.map +0 -1
  514. package/dist/src/tests/unit/compatibility/deprecation-warnings.test.d.ts +0 -5
  515. package/dist/src/tests/unit/compatibility/deprecation-warnings.test.d.ts.map +0 -1
  516. package/dist/src/tests/unit/compatibility/deprecation-warnings.test.js +0 -207
  517. package/dist/src/tests/unit/compatibility/deprecation-warnings.test.js.map +0 -1
  518. package/dist/src/tests/unit/compatibility/migration-utils.test.d.ts +0 -5
  519. package/dist/src/tests/unit/compatibility/migration-utils.test.d.ts.map +0 -1
  520. package/dist/src/tests/unit/compatibility/migration-utils.test.js +0 -264
  521. package/dist/src/tests/unit/compatibility/migration-utils.test.js.map +0 -1
  522. package/dist/src/tests/unit/compatibility/v1-adapter.test.d.ts +0 -7
  523. package/dist/src/tests/unit/compatibility/v1-adapter.test.d.ts.map +0 -1
  524. package/dist/src/tests/unit/compatibility/v1-adapter.test.js +0 -228
  525. package/dist/src/tests/unit/compatibility/v1-adapter.test.js.map +0 -1
  526. package/dist/src/tests/unit/compatibility/version-detector.test.d.ts +0 -10
  527. package/dist/src/tests/unit/compatibility/version-detector.test.d.ts.map +0 -1
  528. package/dist/src/tests/unit/compatibility/version-detector.test.js +0 -162
  529. package/dist/src/tests/unit/compatibility/version-detector.test.js.map +0 -1
  530. package/dist/src/tests/vector-quantization.test.d.ts +0 -5
  531. package/dist/src/tests/vector-quantization.test.d.ts.map +0 -1
  532. package/dist/src/tests/vector-quantization.test.js +0 -338
  533. package/dist/src/tests/vector-quantization.test.js.map +0 -1
  534. package/dist/src/tests/wasm-vector-search.test.d.ts +0 -7
  535. package/dist/src/tests/wasm-vector-search.test.d.ts.map +0 -1
  536. package/dist/src/tests/wasm-vector-search.test.js +0 -193
  537. package/dist/src/tests/wasm-vector-search.test.js.map +0 -1
  538. package/dist/src/utils/crypto.utils.d.ts +0 -122
  539. package/dist/src/utils/crypto.utils.d.ts.map +0 -1
  540. package/dist/src/utils/crypto.utils.js +0 -296
  541. package/dist/src/utils/crypto.utils.js.map +0 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # AgentDB v3
2
2
 
3
- > Intelligent agentic vector database — learns from experience, optimizes itself, runs anywhere
3
+ > Intelligent agentic vector memory — learns from experience, optimizes itself, runs anywhere
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/agentdb.svg?style=flat-square)](https://www.npmjs.com/package/agentdb)
6
6
  [![npm downloads](https://img.shields.io/npm/dm/agentdb.svg?style=flat-square)](https://www.npmjs.com/package/agentdb)
@@ -12,30 +12,34 @@
12
12
 
13
13
  ## What is AgentDB?
14
14
 
15
- **AgentDB is a vector database that gets smarter every time you use it.**
15
+ **AgentDB is a vector memory and database that gets smarter every time you use it.**
16
16
 
17
17
  Most vector databases store and retrieve embeddings. AgentDB does that too — 150x faster — but it also watches which results your AI agent actually used, learns from that feedback, and returns better results next time. Search quality improves by up to **36% automatically**, with zero manual tuning.
18
18
 
19
19
  Everything lives in a **single Cognitive Container** (`.rvf` file) — vectors, indexes, learning state, and a cryptographic audit trail. No external services. No API keys. No monthly bills.
20
20
 
21
21
  > **3 lines to self-learning search:**
22
+ >
22
23
  > ```typescript
23
- > const backend = await SelfLearningRvfBackend.create({ learning: true, storagePath: './my.rvf' });
24
- > const results = await backend.searchAsync(query, 10); // search
25
- > backend.recordFeedback('q1', 0.9); // learn — next search is smarter
24
+ > const backend = await SelfLearningRvfBackend.create({
25
+ > learning: true,
26
+ > storagePath: "./my.rvf",
27
+ > });
28
+ > const results = await backend.searchAsync(query, 10); // search
29
+ > backend.recordFeedback("q1", 0.9); // learn — next search is smarter
26
30
  > ```
27
31
 
28
32
  ### Who is it for?
29
33
 
30
- | If you're building... | AgentDB gives you... |
31
- | --- | --- |
32
- | **A RAG chatbot** | Search that learns which documents actually answer user questions |
33
- | **A code review agent** | Pattern memory that remembers what worked across 1000s of reviews |
34
- | **A research assistant** | Skill library that builds reusable tools from successful strategies |
35
- | **An RL-powered agent** | 9 algorithms from Q-Learning to PPO, with bandit-guided algorithm selection and transfer learning |
36
- | **A Claude Code / MCP tool** | 41 tools that plug in with one command |
37
- | **An offline or edge app** | Full vector DB in the browser via WASM — no server needed |
38
- | **An enterprise platform** | JWT auth, API key rotation, Argon2id hashing, SOC2/GDPR audit logs |
34
+ | If you're building... | AgentDB gives you... |
35
+ | ---------------------------- | ------------------------------------------------------------------------------------------------- |
36
+ | **A RAG chatbot** | Search that learns which documents actually answer user questions |
37
+ | **A code review agent** | Pattern memory that remembers what worked across 1000s of reviews |
38
+ | **A research assistant** | Skill library that builds reusable tools from successful strategies |
39
+ | **An RL-powered agent** | 9 algorithms from Q-Learning to PPO, with bandit-guided algorithm selection and transfer learning |
40
+ | **A Claude Code / MCP tool** | 41 tools that plug in with one command |
41
+ | **An offline or edge app** | Full vector DB in the browser via WASM — no server needed |
42
+ | **An enterprise platform** | JWT auth, API key rotation, Argon2id hashing, SOC2/GDPR audit logs |
39
43
 
40
44
  ---
41
45
 
@@ -43,50 +47,50 @@ Everything lives in a **single Cognitive Container** (`.rvf` file) — vectors,
43
47
 
44
48
  ### Intelligence
45
49
 
46
- | | |
47
- | --- | --- |
48
- | **Self-Learning Search** | Gets 36% better over time — learns from feedback, no manual tuning |
49
- | **Cognitive Memory** | 6 human-inspired patterns: learn from mistakes, build reusable skills, discover what causes what |
50
+ | | |
51
+ | ------------------------- | ---------------------------------------------------------------------------------------------------------------- |
52
+ | **Self-Learning Search** | Gets 36% better over time — learns from feedback, no manual tuning |
53
+ | **Cognitive Memory** | 6 human-inspired patterns: learn from mistakes, build reusable skills, discover what causes what |
50
54
  | **Decision Intelligence** | Thompson Sampling bandit auto-tunes skill selection, pattern ranking, compression tiers, and RL algorithm choice |
51
- | **9 RL Algorithms** | Q-Learning, SARSA, DQN, PPO, Actor-Critic, Policy Gradient, Decision Transformer, MCTS, Model-Based RL |
52
- | **Hybrid Search** | BM25 keyword + vector with Reciprocal Rank Fusion — exact matches + semantic understanding |
53
- | **Graph Intelligence** | Cypher queries, causal reasoning, GNN 8-head attention (+12.4% recall) |
55
+ | **9 RL Algorithms** | Q-Learning, SARSA, DQN, PPO, Actor-Critic, Policy Gradient, Decision Transformer, MCTS, Model-Based RL |
56
+ | **Hybrid Search** | BM25 keyword + vector with Reciprocal Rank Fusion — exact matches + semantic understanding |
57
+ | **Graph Intelligence** | Cypher queries, causal reasoning, GNN 8-head attention (+12.4% recall) |
54
58
 
55
59
  ### Performance
56
60
 
57
- | | |
58
- | --- | --- |
59
- | **150x Faster** | 61us search with Rust+SIMD — 800x faster than Pinecone, 160x faster than Chroma |
60
- | **4 Backends** | Auto-selects best available: RuVector (Rust) > RVF > HNSWLib (C++) > sql.js (WASM) |
61
- | **Runs Anywhere** | Node.js, browsers (WASM), edge functions, fully offline |
62
- | **AgentDBFast** | 50-200x faster programmatic API — skip CLI overhead for production workloads |
61
+ | | |
62
+ | ----------------- | ---------------------------------------------------------------------------------- |
63
+ | **150x Faster** | 61us search with Rust+SIMD — 800x faster than Pinecone, 160x faster than Chroma |
64
+ | **4 Backends** | Auto-selects best available: RuVector (Rust) > RVF > HNSWLib (C++) > sql.js (WASM) |
65
+ | **Runs Anywhere** | Node.js, browsers (WASM), edge functions, fully offline |
66
+ | **AgentDBFast** | 50-200x faster programmatic API — skip CLI overhead for production workloads |
63
67
 
64
68
  ### Storage & Data
65
69
 
66
- | | |
67
- | --- | --- |
68
- | **Cognitive Container (RVF)** | Single `.rvf` file — vectors, index, learning state, SHAKE-256 witness chain |
69
- | **COW Branching** | Instant copy-on-write branches for experiments, with full lineage tracking |
70
- | **Compression** | 5-tier auto-tiering (hot/warm/cool/cold/archive), scalar 8-bit/4-bit, product quantization |
71
- | **Metadata Filtering** | 10 MongoDB-style operators ($eq, $gt, $in, $contains, $exists, etc.) |
70
+ | | |
71
+ | ----------------------------- | ------------------------------------------------------------------------------------------ |
72
+ | **Cognitive Container (RVF)** | Single `.rvf` file — vectors, index, learning state, SHAKE-256 witness chain |
73
+ | **COW Branching** | Instant copy-on-write branches for experiments, with full lineage tracking |
74
+ | **Compression** | 5-tier auto-tiering (hot/warm/cool/cold/archive), scalar 8-bit/4-bit, product quantization |
75
+ | **Metadata Filtering** | 10 MongoDB-style operators ($eq, $gt, $in, $contains, $exists, etc.) |
72
76
 
73
77
  ### Integration & Tools
74
78
 
75
- | | |
76
- | --- | --- |
77
- | **41 MCP Tools** | One command to connect to Claude Code, Cursor, or any MCP-compatible assistant |
78
- | **Chat UI** | `@agentdb/chat` — deploy a self-learning RAG chatbot in one line |
79
- | **LLM Router** | Auto-selects best provider: RuvLLM (local), OpenRouter (200+ models), Gemini, Claude, ONNX |
80
- | **Real-Time Sync** | QUIC transport, multi-instance replication, 4 conflict resolution strategies |
79
+ | | |
80
+ | ------------------ | ------------------------------------------------------------------------------------------ |
81
+ | **41 MCP Tools** | One command to connect to Claude Code, Cursor, or any MCP-compatible assistant |
82
+ | **Chat UI** | `@agentdb/chat` — deploy a self-learning RAG chatbot in one line |
83
+ | **LLM Router** | Auto-selects best provider: RuvLLM (local), OpenRouter (200+ models), Gemini, Claude, ONNX |
84
+ | **Real-Time Sync** | QUIC transport, multi-instance replication, 4 conflict resolution strategies |
81
85
 
82
86
  ### Enterprise & Security
83
87
 
84
- | | |
85
- | --- | --- |
86
- | **Auth & Audit** | JWT tokens, Argon2id hashing, API key rotation, SOC2/GDPR/HIPAA logging |
87
- | **Security** | Input validation, XSS/injection prevention, Cypher sanitization, witness chain verification |
88
- | **Observability** | OpenTelemetry traces, Prometheus metrics, structured logging |
89
- | **Benchmarking** | 5 built-in benchmarks, custom benchmark classes, Markdown/JSON reports |
88
+ | | |
89
+ | ----------------- | ------------------------------------------------------------------------------------------- |
90
+ | **Auth & Audit** | JWT tokens, Argon2id hashing, API key rotation, SOC2/GDPR/HIPAA logging |
91
+ | **Security** | Input validation, XSS/injection prevention, Cypher sanitization, witness chain verification |
92
+ | **Observability** | OpenTelemetry traces, Prometheus metrics, structured logging |
93
+ | **Benchmarking** | 5 built-in benchmarks, custom benchmark classes, Markdown/JSON reports |
90
94
 
91
95
  > **Zero config, zero cost.** `npm install agentdb` and go — fully local, no API keys, no cloud fees.
92
96
 
@@ -97,8 +101,96 @@ npm install agentdb # Latest stable (v2)
97
101
  npm install agentdb@alpha # Latest alpha (v3 — unified .rvf, self-learning, SolverBandit)
98
102
  ```
99
103
 
104
+ **Zero native dependencies.** AgentDB uses sql.js (WASM SQLite) — no Python, no C++ compiler, no `node-gyp`. Works on Windows, macOS, Linux, and CI containers out of the box. `better-sqlite3` is supported as an optional performance upgrade but never required.
105
+
100
106
  ---
101
107
 
108
+ ## 🧠 Agent Memory Intelligence
109
+
110
+ AgentDB v3.0.0-alpha.6 introduces revolutionary **sparse attention** and **graph partitioning** capabilities that enable AI agents to handle massive knowledge graphs with 10-100x performance improvements.
111
+
112
+ ### Memory-Oriented Architecture
113
+
114
+ AgentDB is designed as an **agent memory substrate** - a persistent, intelligent memory layer that agents can query, update, and learn from:
115
+
116
+ **Core Memory Capabilities**:
117
+ - 🎯 **Sparse Attention** - 10-100x speedup for large graphs using PPR, random walk, spectral sparsification
118
+ - 📊 **Graph Partitioning** - 50-80% memory reduction with Stoer-Wagner, Karger, flow-based mincut
119
+ - ⚡ **Fused Attention** - 10-50x faster kernel fusion (exceeded 20-25% target by 40x!)
120
+ - 🔍 **Zero-Copy Indexing** - 90% fewer allocations, 40-50% speedup
121
+ - 🏗️ **Clean Architecture** - 6 focused classes replacing 782-line god object
122
+
123
+ ### Agent Memory Pattern
124
+
125
+ ```typescript
126
+ import { SparsificationService, MincutService, AttentionService } from 'agentdb';
127
+
128
+ // Initialize agent memory layer
129
+ const memory = new AttentionService();
130
+ await memory.initialize();
131
+
132
+ // Sparse attention for agent memory retrieval (10-100x faster)
133
+ const relevantMemories = await memory.sparseAttention(
134
+ agentQuery,
135
+ memoryGraph,
136
+ {
137
+ method: 'ppr', // Personalized PageRank
138
+ topK: 50, // Top 50 most relevant
139
+ sparsificationRatio: 0.1 // Keep 10% of edges
140
+ }
141
+ );
142
+
143
+ // Partitioned attention for distributed agent teams
144
+ const teamMemories = await memory.partitionedAttention(
145
+ teamQuery,
146
+ sharedKnowledge,
147
+ {
148
+ method: 'stoer-wagner', // Optimal partitioning
149
+ maxPartitionSize: 1000 // Max 1000 nodes per partition
150
+ }
151
+ );
152
+
153
+ // Fused attention for rapid memory access (10-50x faster)
154
+ const fastAccess = await memory.fusedAttention(
155
+ query,
156
+ keys,
157
+ values
158
+ );
159
+ ```
160
+
161
+ ### Performance Metrics
162
+
163
+ | Operation | Before | After | Improvement |
164
+ |-----------|--------|-------|-------------|
165
+ | Sparse Attention (N=10K) | 1000ms | 10-100ms | **10-100x** |
166
+ | Memory Reduction | 100% | 20-50% | **50-80% less** |
167
+ | Fused Attention | 1010ms | 21ms | **49x faster** |
168
+ | Allocations | 100% | 10% | **90% fewer** |
169
+
170
+ ### Use Cases
171
+
172
+ **Agent Episodic Memory**:
173
+ ```typescript
174
+ // Store agent experiences as sparse graphs
175
+ await sparsification.sparseByPPR(experienceGraph, {
176
+ alpha: 0.15,
177
+ topK: 100
178
+ });
179
+ ```
180
+
181
+ **Multi-Agent Knowledge Sharing**:
182
+ ```typescript
183
+ // Partition knowledge for team collaboration
184
+ const partitions = await mincut.computeStoerWagner(teamKnowledge);
185
+ ```
186
+
187
+ **Rapid Context Retrieval**:
188
+ ```typescript
189
+ // Fused attention for instant memory access
190
+ const context = await attention.fusedAttention(Q, K, V);
191
+ ```
192
+
193
+ ---
102
194
  ## Comparison
103
195
 
104
196
  > **61 microseconds.** That's 800x faster than Pinecone, 160x faster than Chroma, and the only vector database that learns from your usage and gets better over time.
@@ -107,45 +199,45 @@ npm install agentdb@alpha # Latest alpha (v3 — unified .rvf, self-learning,
107
199
 
108
200
  #### Intelligence
109
201
 
110
- | Feature | AgentDB v3 | Pinecone | Chroma | Weaviate | pgvector |
111
- | --- | --- | --- | --- | --- | --- |
112
- | Self-learning pipeline | SONA + contrastive + federated + bandit | No | No | No | No |
113
- | Reinforcement learning | 9 algorithms (Q-Learning to MCTS) | No | No | No | No |
114
- | Cognitive memory | 6 patterns | No | No | No | No |
115
- | Hybrid search | BM25 + vector (RRF fusion) | No | No | BM25 only | No |
116
- | Graph queries | Cypher | No | No | GraphQL | No |
202
+ | Feature | AgentDB v3 | Pinecone | Chroma | Weaviate | pgvector |
203
+ | ---------------------- | --------------------------------------- | -------- | ------ | --------- | -------- |
204
+ | Self-learning pipeline | SONA + contrastive + federated + bandit | No | No | No | No |
205
+ | Reinforcement learning | 9 algorithms (Q-Learning to MCTS) | No | No | No | No |
206
+ | Cognitive memory | 6 patterns | No | No | No | No |
207
+ | Hybrid search | BM25 + vector (RRF fusion) | No | No | BM25 only | No |
208
+ | Graph queries | Cypher | No | No | GraphQL | No |
117
209
 
118
210
  #### Performance & Deployment
119
211
 
120
- | Feature | AgentDB v3 | Pinecone | Chroma | Weaviate | pgvector |
121
- | --- | --- | --- | --- | --- | --- |
122
- | Search latency | **61us** | ~50ms | ~10ms | ~5ms | ~2ms |
123
- | Runs offline | Full | No | Yes | Yes | Yes |
124
- | Browser (WASM) | Yes | No | No | No | No |
212
+ | Feature | AgentDB v3 | Pinecone | Chroma | Weaviate | pgvector |
213
+ | -------------- | ---------- | -------- | ------ | -------- | -------- |
214
+ | Search latency | **61us** | ~50ms | ~10ms | ~5ms | ~2ms |
215
+ | Runs offline | Full | No | Yes | Yes | Yes |
216
+ | Browser (WASM) | Yes | No | No | No | No |
125
217
 
126
218
  #### Storage
127
219
 
128
- | Feature | AgentDB v3 | Pinecone | Chroma | Weaviate | pgvector |
129
- | --- | --- | --- | --- | --- | --- |
130
- | Cognitive Container | Single `.rvf` file + COW branching | No | No | No | No |
131
- | Monthly cost | **$0** | $70+ | $0 | $0+ | $0+ |
220
+ | Feature | AgentDB v3 | Pinecone | Chroma | Weaviate | pgvector |
221
+ | ------------------- | ---------------------------------- | -------- | ------ | -------- | -------- |
222
+ | Cognitive Container | Single `.rvf` file + COW branching | No | No | No | No |
223
+ | Monthly cost | **$0** | $70+ | $0 | $0+ | $0+ |
132
224
 
133
225
  #### Integration & Security
134
226
 
135
- | Feature | AgentDB v3 | Pinecone | Chroma | Weaviate | pgvector |
136
- | --- | --- | --- | --- | --- | --- |
137
- | MCP integration | 41 tools | No | No | No | No |
138
- | Auth & audit | JWT + Argon2id + compliance logs | No | No | No | No |
139
- | Local-first | Yes | Cloud only | Yes | Self-host | Postgres |
227
+ | Feature | AgentDB v3 | Pinecone | Chroma | Weaviate | pgvector |
228
+ | --------------- | -------------------------------- | ---------- | ------ | --------- | -------- |
229
+ | MCP integration | 41 tools | No | No | No | No |
230
+ | Auth & audit | JWT + Argon2id + compliance logs | No | No | No | No |
231
+ | Local-first | Yes | Cloud only | Yes | Self-host | Postgres |
140
232
 
141
233
  ### Backend Performance
142
234
 
143
- | Backend | Latency | Recall@10 | Native | Best For |
144
- | --- | --- | --- | --- | --- |
145
- | **RuVector** (Rust + SIMD) | 61us | 96.8% | Yes | Production, high throughput |
146
- | **Cognitive Container** (RVF) | ~100us | 96.8% | Yes | Portable, branching, lineage |
147
- | **HNSWLib** (C++) | ~500us | 95%+ | Yes | Compatibility |
148
- | **sql.js** (WASM) | ~5ms | 90%+ | No | Zero-dependency fallback |
235
+ | Backend | Latency | Recall@10 | Native | Best For |
236
+ | ----------------------------- | ------- | --------- | ------ | ---------------------------- |
237
+ | **RuVector** (Rust + SIMD) | 61us | 96.8% | Yes | Production, high throughput |
238
+ | **Cognitive Container** (RVF) | ~100us | 96.8% | Yes | Portable, branching, lineage |
239
+ | **HNSWLib** (C++) | ~500us | 95%+ | Yes | Compatibility |
240
+ | **sql.js** (WASM) | ~5ms | 90%+ | No | Zero-dependency fallback |
149
241
 
150
242
  AgentDB auto-selects the best available: RuVector > Cognitive Container (RVF) > HNSWLib > sql.js
151
243
 
@@ -162,30 +254,30 @@ npm install agentdb
162
254
  The `AgentDB` class is the simplest way to use AgentDB. Everything — vectors, relational data, learning state — lives in a single `.rvf` file:
163
255
 
164
256
  ```typescript
165
- import { AgentDB } from 'agentdb';
257
+ import { AgentDB } from "agentdb";
166
258
 
167
- const db = new AgentDB({ dbPath: './knowledge.rvf' });
259
+ const db = new AgentDB({ dbPath: "./knowledge.rvf" });
168
260
  await db.initialize();
169
261
 
170
262
  // All controllers are ready — reflexion memory, skill library, causal graph
171
- const reflexion = db.getController('reflexion');
172
- const skills = db.getController('skills');
173
- const causal = db.getController('causal');
263
+ const reflexion = db.getController("reflexion");
264
+ const skills = db.getController("skills");
265
+ const causal = db.getController("causal");
174
266
 
175
267
  // Store an episode
176
268
  await reflexion.storeEpisode({
177
- sessionId: 'session-1',
178
- task: 'Fix auth bug',
269
+ sessionId: "session-1",
270
+ task: "Fix auth bug",
179
271
  reward: 0.95,
180
272
  success: true,
181
- critique: 'OAuth2 PKCE was the right approach',
273
+ critique: "OAuth2 PKCE was the right approach",
182
274
  });
183
275
 
184
276
  // Create a reusable skill
185
277
  await skills.createSkill({
186
- name: 'jwt_auth',
187
- description: 'JWT authentication with refresh tokens',
188
- code: 'implementation...',
278
+ name: "jwt_auth",
279
+ description: "JWT authentication with refresh tokens",
280
+ code: "implementation...",
189
281
  successRate: 0.92,
190
282
  });
191
283
 
@@ -196,13 +288,13 @@ await db.close();
196
288
 
197
289
  **Configuration options:**
198
290
 
199
- | Option | Default | Description |
200
- | --- | --- | --- |
201
- | `dbPath` | `':memory:'` | Path to `.rvf` file (or `.db` for legacy mode) |
202
- | `vectorBackend` | `'rvf'` | Backend: `'rvf'` (unified), `'auto'`, `'ruvector'`, `'hnswlib'` |
203
- | `vectorDimension` | `384` | Embedding dimension (384 for MiniLM, 768 for bge-base) |
204
- | `forceWasm` | `false` | Force sql.js WASM even if better-sqlite3 is available |
205
- | `enableAttention` | `false` | Enable GNN attention mechanisms |
291
+ | Option | Default | Description |
292
+ | ----------------- | ------------ | ------------------------------------------------------------------------------------------ |
293
+ | `dbPath` | `':memory:'` | Path to `.rvf` file (or `.db` for legacy mode) |
294
+ | `vectorBackend` | `'rvf'` | Backend: `'rvf'` (unified), `'auto'`, `'ruvector'`, `'hnswlib'` |
295
+ | `vectorDimension` | `384` | Embedding dimension (384 for MiniLM, 768 for bge-base) |
296
+ | `forceWasm` | `false` | Force sql.js WASM backend (sql.js is the default; `better-sqlite3` used only if installed) |
297
+ | `enableAttention` | `false` | Enable GNN attention mechanisms |
206
298
 
207
299
  **Controllers:** `db.getController('reflexion')` (ReflexionMemory), `db.getController('skills')` (SkillLibrary), `db.getController('causal')` (CausalMemoryGraph)
208
300
 
@@ -293,26 +385,26 @@ npx agentdb mcp start --port 8080 # Custom port
293
385
  Most vector databases return the same results no matter how many times you query them. AgentDB closes the loop: after every search, you tell it which results were actually useful. A contrastive trainer (InfoNCE + hard-negative mining) adjusts a lightweight LoRA adapter in under 1 ms, and EWC++ consolidation keeps old knowledge intact. Over 500 feedback cycles, recall jumps from 54% to 90% — automatically.
294
386
 
295
387
  ```typescript
296
- import { SelfLearningRvfBackend } from 'agentdb/backends/rvf/SelfLearningRvfBackend';
388
+ import { SelfLearningRvfBackend } from "agentdb/backends/rvf/SelfLearningRvfBackend";
297
389
 
298
390
  // Create a self-learning Cognitive Container
299
391
  const backend = await SelfLearningRvfBackend.create({
300
392
  dimension: 384,
301
- metric: 'cosine',
302
- storagePath: './knowledge.rvf',
303
- learning: true, // enable the learning pipeline
393
+ metric: "cosine",
394
+ storagePath: "./knowledge.rvf",
395
+ learning: true, // enable the learning pipeline
304
396
  });
305
397
 
306
398
  // Insert documents
307
- await backend.insertAsync('doc-1', embedding, { title: 'Auth Guide' });
308
- await backend.insertAsync('doc-2', embedding2, { title: 'API Reference' });
399
+ await backend.insertAsync("doc-1", embedding, { title: "Auth Guide" });
400
+ await backend.insertAsync("doc-2", embedding2, { title: "API Reference" });
309
401
 
310
402
  // Search — automatically routed through the learning pipeline
311
403
  const results = await backend.searchAsync(queryEmbedding, 10);
312
404
 
313
405
  // Tell AgentDB which results were useful — this drives learning
314
- backend.recordFeedback('query-1', 0.95); // great result
315
- backend.recordFeedback('query-2', 0.2); // poor result
406
+ backend.recordFeedback("query-1", 0.95); // great result
407
+ backend.recordFeedback("query-2", 0.2); // poor result
316
408
 
317
409
  // Run a learning tick — trains the model, updates adapters
318
410
  await backend.tick();
@@ -324,24 +416,24 @@ await backend.tick();
324
416
  Store and retrieve reasoning patterns — your agent remembers what worked:
325
417
 
326
418
  ```typescript
327
- import { createDatabase, ReasoningBank, EmbeddingService } from 'agentdb';
419
+ import { createDatabase, ReasoningBank, EmbeddingService } from "agentdb";
328
420
 
329
- const db = await createDatabase('./agent-memory.db');
330
- const embedder = new EmbeddingService({ model: 'Xenova/all-MiniLM-L6-v2' });
421
+ const db = await createDatabase("./agent-memory.db");
422
+ const embedder = new EmbeddingService({ model: "Xenova/all-MiniLM-L6-v2" });
331
423
  await embedder.initialize();
332
424
 
333
425
  const reasoningBank = new ReasoningBank(db, embedder);
334
426
 
335
427
  // Store what your agent learned
336
428
  await reasoningBank.storePattern({
337
- taskType: 'code_review',
338
- approach: 'Security-first analysis',
429
+ taskType: "code_review",
430
+ approach: "Security-first analysis",
339
431
  successRate: 0.95,
340
432
  });
341
433
 
342
434
  // Find similar successful patterns
343
435
  const patterns = await reasoningBank.searchPatterns({
344
- task: 'security code review',
436
+ task: "security code review",
345
437
  k: 10,
346
438
  });
347
439
  ```
@@ -351,25 +443,25 @@ const patterns = await reasoningBank.searchPatterns({
351
443
  In v3, `AgentDB` stores vectors, relational data, learning state, and metadata in a single `.rvf` file:
352
444
 
353
445
  ```typescript
354
- import { AgentDB } from 'agentdb';
446
+ import { AgentDB } from "agentdb";
355
447
 
356
448
  // Single-file mode is the default — no configuration needed
357
- const db = new AgentDB({ dbPath: './agent.rvf' });
449
+ const db = new AgentDB({ dbPath: "./agent.rvf" });
358
450
  await db.initialize();
359
451
 
360
452
  // Access the underlying database for advanced queries
361
453
  const raw = db.database;
362
- const stats = raw.prepare('SELECT COUNT(*) as c FROM episodes').get();
454
+ const stats = raw.prepare("SELECT COUNT(*) as c FROM episodes").get();
363
455
 
364
456
  // Check mode
365
- console.log(db.isUnifiedMode); // true — everything in one .rvf file
457
+ console.log(db.isUnifiedMode); // true — everything in one .rvf file
366
458
  console.log(db.vectorBackendName); // 'rvf'
367
459
 
368
460
  // Save and reopen — all data persists in agent.rvf
369
461
  await db.save();
370
462
  await db.close();
371
463
 
372
- const db2 = new AgentDB({ dbPath: './agent.rvf' });
464
+ const db2 = new AgentDB({ dbPath: "./agent.rvf" });
373
465
  await db2.initialize(); // All episodes, skills, vectors restored
374
466
  ```
375
467
 
@@ -447,15 +539,15 @@ Or add to `~/.config/claude/claude_desktop_config.json`:
447
539
 
448
540
  ### MCP Tools Overview
449
541
 
450
- | Category | Tools | Examples |
451
- | --- | --- | --- |
452
- | **Core DB** | 6 | init, insert, batch insert, search, delete, stats |
453
- | **Patterns** | 4 | store, search, batch store, statistics |
454
- | **Memory** | 9 | reflexion store/retrieve/batch, skill create/search/batch, causal edges/queries, nightly learner |
455
- | **Learning** | 10 | RL sessions, predictions, feedback, training, transfer learning, explainability |
456
- | **Recall** | 2 | explainable recall with provenance certificates, cache management |
457
- | **Solver** | 4 | solver train, acceptance testing, policy inspection, witness chain audit |
458
- | **Admin** | 6 | diagnostics, migration, pruning, experience recording, reward signals, legacy stats |
542
+ | Category | Tools | Examples |
543
+ | ------------ | ----- | ------------------------------------------------------------------------------------------------ |
544
+ | **Core DB** | 6 | init, insert, batch insert, search, delete, stats |
545
+ | **Patterns** | 4 | store, search, batch store, statistics |
546
+ | **Memory** | 9 | reflexion store/retrieve/batch, skill create/search/batch, causal edges/queries, nightly learner |
547
+ | **Learning** | 10 | RL sessions, predictions, feedback, training, transfer learning, explainability |
548
+ | **Recall** | 2 | explainable recall with provenance certificates, cache management |
549
+ | **Solver** | 4 | solver train, acceptance testing, policy inspection, witness chain audit |
550
+ | **Admin** | 6 | diagnostics, migration, pruning, experience recording, reward signals, legacy stats |
459
551
 
460
552
  All 41 tools support parallel execution markers, batch operations, intelligent caching, and format parameters for token reduction.
461
553
 
@@ -473,15 +565,16 @@ npx @agentdb/chat serve --rvf ./kb.rvf --port 3000
473
565
  Programmatic usage:
474
566
 
475
567
  ```typescript
476
- import { createChatServer } from '@agentdb/chat';
568
+ import { createChatServer } from "@agentdb/chat";
477
569
 
478
- const server = await createChatServer('./kb.rvf', {
570
+ const server = await createChatServer("./kb.rvf", {
479
571
  port: 3000,
480
572
  learning: true,
481
573
  });
482
574
  ```
483
575
 
484
576
  The chat ecosystem includes:
577
+
485
578
  - **Chat Server** — streaming inference with any LLM provider
486
579
  - **Chat Persistence** — conversation history stored in Cognitive Containers
487
580
  - **MCP Bridge** — expose all 37 AgentDB tools through chat
@@ -566,16 +659,19 @@ npx agentdb doctor --fix
566
659
  Configure cross-session federated learning for continuous improvement:
567
660
 
568
661
  ```typescript
569
- import { FederatedLearningCoordinator, EphemeralLearningAgent } from 'agentdb/services/federated-learning';
662
+ import {
663
+ FederatedLearningCoordinator,
664
+ EphemeralLearningAgent,
665
+ } from "agentdb/services/federated-learning";
570
666
 
571
667
  const coordinator = new FederatedLearningCoordinator({
572
- agentId: 'coordinator-1',
668
+ agentId: "coordinator-1",
573
669
  minQuality: 0.7,
574
670
  maxAgents: 100,
575
671
  });
576
672
 
577
673
  const agent = new EphemeralLearningAgent({
578
- agentId: 'session-agent-1',
674
+ agentId: "session-agent-1",
579
675
  qualityFiltering: true,
580
676
  });
581
677
 
@@ -594,34 +690,39 @@ const merged = await coordinator.consolidate();
594
690
  #### Tutorial 1: Build a Learning Code Review Agent
595
691
 
596
692
  ```typescript
597
- import { createDatabase, ReasoningBank, ReflexionMemory, EmbeddingService } from 'agentdb';
598
-
599
- const db = await createDatabase('./code-reviewer.db');
600
- const embedder = new EmbeddingService({ model: 'Xenova/all-MiniLM-L6-v2' });
693
+ import {
694
+ createDatabase,
695
+ ReasoningBank,
696
+ ReflexionMemory,
697
+ EmbeddingService,
698
+ } from "agentdb";
699
+
700
+ const db = await createDatabase("./code-reviewer.db");
701
+ const embedder = new EmbeddingService({ model: "Xenova/all-MiniLM-L6-v2" });
601
702
  await embedder.initialize();
602
703
 
603
704
  const reasoningBank = new ReasoningBank(db, embedder);
604
705
  const reflexion = new ReflexionMemory(db, embedder);
605
706
 
606
707
  await reasoningBank.storePattern({
607
- taskType: 'code_review',
608
- approach: 'Security scan > Type safety > Code quality > Performance',
708
+ taskType: "code_review",
709
+ approach: "Security scan > Type safety > Code quality > Performance",
609
710
  successRate: 0.94,
610
711
  });
611
712
 
612
713
  const result = await performCodeReview(code);
613
714
  await reflexion.storeEpisode({
614
- sessionId: 'review-1',
615
- task: 'Review authentication PR',
715
+ sessionId: "review-1",
716
+ task: "Review authentication PR",
616
717
  reward: result.issuesFound > 0 ? 0.9 : 0.6,
617
718
  success: true,
618
- critique: 'Found SQL injection — security checks work!',
719
+ critique: "Found SQL injection — security checks work!",
619
720
  input: code,
620
721
  output: result.findings,
621
722
  });
622
723
 
623
724
  const pastReviews = await reflexion.retrieveRelevant({
624
- task: 'authentication code review',
725
+ task: "authentication code review",
625
726
  k: 5,
626
727
  onlySuccesses: true,
627
728
  });
@@ -630,23 +731,26 @@ const pastReviews = await reflexion.retrieveRelevant({
630
731
  #### Tutorial 2: RAG with Self-Learning Skills
631
732
 
632
733
  ```typescript
633
- import { createDatabase, SkillLibrary, EmbeddingService } from 'agentdb';
734
+ import { createDatabase, SkillLibrary, EmbeddingService } from "agentdb";
634
735
 
635
- const db = await createDatabase('./rag-system.db');
636
- const embedder = new EmbeddingService({ model: 'Xenova/all-MiniLM-L6-v2' });
736
+ const db = await createDatabase("./rag-system.db");
737
+ const embedder = new EmbeddingService({ model: "Xenova/all-MiniLM-L6-v2" });
637
738
  await embedder.initialize();
638
739
 
639
740
  const skills = new SkillLibrary(db, embedder);
640
741
 
641
742
  await skills.createSkill({
642
- name: 'expand_query',
643
- description: 'Expand user query with domain-specific synonyms',
644
- signature: { inputs: { query: 'string' }, outputs: { expanded: 'string[]' } },
743
+ name: "expand_query",
744
+ description: "Expand user query with domain-specific synonyms",
745
+ signature: { inputs: { query: "string" }, outputs: { expanded: "string[]" } },
645
746
  code: `const map = { 'bug': ['issue', 'defect', 'error'] }; ...`,
646
747
  successRate: 0.92,
647
748
  });
648
749
 
649
- const applicable = await skills.searchSkills({ task: 'find technical documentation', k: 10 });
750
+ const applicable = await skills.searchSkills({
751
+ task: "find technical documentation",
752
+ k: 10,
753
+ });
650
754
  ```
651
755
 
652
756
  #### Tutorial 3: Run Latent Space Simulations
@@ -661,27 +765,34 @@ npx agentdb simulate --wizard
661
765
  #### Tutorial 4: Cognitive Container Branching
662
766
 
663
767
  ```typescript
664
- import { RvfBackend } from 'agentdb/backends/rvf/RvfBackend';
768
+ import { RvfBackend } from "agentdb/backends/rvf/RvfBackend";
665
769
 
666
- const main = new RvfBackend({ dimension: 384, metric: 'cosine', storagePath: './main.rvf' });
770
+ const main = new RvfBackend({
771
+ dimension: 384,
772
+ metric: "cosine",
773
+ storagePath: "./main.rvf",
774
+ });
667
775
  await main.initialize();
668
- await main.insertAsync('doc-1', embedding1, { source: 'production' });
776
+ await main.insertAsync("doc-1", embedding1, { source: "production" });
669
777
  await main.flush();
670
778
 
671
779
  // Branch for experiment (copy-on-write, near-instant)
672
- const experiment = await main.derive('./experiment.rvf');
673
- await experiment.insertAsync('doc-exp-1', experimentEmbedding);
780
+ const experiment = await main.derive("./experiment.rvf");
781
+ await experiment.insertAsync("doc-exp-1", experimentEmbedding);
674
782
  console.log(`Lineage depth: ${await experiment.lineageDepth()}`);
675
783
  ```
676
784
 
677
785
  #### Tutorial 5: Self-Learning RAG Pipeline
678
786
 
679
787
  ```typescript
680
- import { SelfLearningRvfBackend } from 'agentdb/backends/rvf/SelfLearningRvfBackend';
788
+ import { SelfLearningRvfBackend } from "agentdb/backends/rvf/SelfLearningRvfBackend";
681
789
 
682
790
  const backend = await SelfLearningRvfBackend.create({
683
- dimension: 384, metric: 'cosine', storagePath: './rag-vectors.rvf',
684
- learning: true, federated: true,
791
+ dimension: 384,
792
+ metric: "cosine",
793
+ storagePath: "./rag-vectors.rvf",
794
+ learning: true,
795
+ federated: true,
685
796
  });
686
797
 
687
798
  for (const doc of documents) {
@@ -689,7 +800,7 @@ for (const doc of documents) {
689
800
  }
690
801
 
691
802
  const results = await backend.searchAsync(queryEmbedding, 10);
692
- backend.recordFeedback('query-1', 0.95);
803
+ backend.recordFeedback("query-1", 0.95);
693
804
  await backend.tick();
694
805
  ```
695
806
 
@@ -711,10 +822,11 @@ npx @agentdb/chat serve --rvf ./docs.rvf --port 3000
711
822
  #### Batch Operations
712
823
 
713
824
  ```typescript
714
- import { BatchOperations } from 'agentdb/optimizations/BatchOperations';
825
+ import { BatchOperations } from "agentdb/optimizations/BatchOperations";
715
826
 
716
827
  const batchOps = new BatchOperations(db, embedder, {
717
- batchSize: 100, parallelism: 4,
828
+ batchSize: 100,
829
+ parallelism: 4,
718
830
  progressCallback: (done, total) => console.log(`${done}/${total}`),
719
831
  });
720
832
 
@@ -726,21 +838,30 @@ await batchOps.insertPatterns([...patterns]);
726
838
  #### Custom Backend Selection
727
839
 
728
840
  ```typescript
729
- import { createBackend, detectBackends } from 'agentdb/backends/factory';
841
+ import { createBackend, detectBackends } from "agentdb/backends/factory";
730
842
 
731
843
  const detection = await detectBackends();
732
844
  // { ruvector: { available, native, gnn }, rvf: { sdk, node, wasm }, hnswlib: { available } }
733
845
 
734
- const backend = await createBackend({ type: 'rvf', dimension: 384, metric: 'cosine', storagePath: './vectors.rvf' });
846
+ const backend = await createBackend({
847
+ type: "rvf",
848
+ dimension: 384,
849
+ metric: "cosine",
850
+ storagePath: "./vectors.rvf",
851
+ });
735
852
  ```
736
853
 
737
854
  #### Adaptive Index Tuning
738
855
 
739
856
  ```typescript
740
- import { AgentDBSolver } from 'agentdb/backends/rvf/RvfSolver';
857
+ import { AgentDBSolver } from "agentdb/backends/rvf/RvfSolver";
741
858
 
742
859
  const solver = await AgentDBSolver.create();
743
- const trainResult = solver.train({ count: 50, minDifficulty: 1, maxDifficulty: 10 });
860
+ const trainResult = solver.train({
861
+ count: 50,
862
+ minDifficulty: 1,
863
+ maxDifficulty: 10,
864
+ });
744
865
  const policy = solver.policy();
745
866
  // 18 context buckets (3 range x 3 distractor x 2 noise)
746
867
  ```
@@ -748,10 +869,20 @@ const policy = solver.policy();
748
869
  #### Federated Session Manager
749
870
 
750
871
  ```typescript
751
- import { FederatedLearningCoordinator, EphemeralLearningAgent } from 'agentdb/services/federated-learning';
872
+ import {
873
+ FederatedLearningCoordinator,
874
+ EphemeralLearningAgent,
875
+ } from "agentdb/services/federated-learning";
752
876
 
753
- const coordinator = new FederatedLearningCoordinator({ agentId: 'coord-main', minQuality: 0.7, maxAgents: 100 });
754
- const sessionAgent = new EphemeralLearningAgent({ agentId: `session-${Date.now()}`, qualityFiltering: true });
877
+ const coordinator = new FederatedLearningCoordinator({
878
+ agentId: "coord-main",
879
+ minQuality: 0.7,
880
+ maxAgents: 100,
881
+ });
882
+ const sessionAgent = new EphemeralLearningAgent({
883
+ agentId: `session-${Date.now()}`,
884
+ qualityFiltering: true,
885
+ });
755
886
 
756
887
  await sessionAgent.processTask(embedding, 0.9);
757
888
  const state = sessionAgent.exportState();
@@ -762,7 +893,7 @@ const merged = await coordinator.consolidate();
762
893
  #### Context Synthesizer
763
894
 
764
895
  ```typescript
765
- import { ContextSynthesizer } from 'agentdb/controllers/ContextSynthesizer';
896
+ import { ContextSynthesizer } from "agentdb/controllers/ContextSynthesizer";
766
897
 
767
898
  const synthesizer = new ContextSynthesizer();
768
899
  const context = await synthesizer.synthesize(memories);
@@ -772,11 +903,11 @@ const context = await synthesizer.synthesize(memories);
772
903
  #### GNN Learning Backend
773
904
 
774
905
  ```typescript
775
- import { LearningBackend } from 'agentdb/backends/LearningBackend';
906
+ import { LearningBackend } from "agentdb/backends/LearningBackend";
776
907
 
777
908
  const learner = new LearningBackend({ dimension: 384 });
778
909
  const enhanced = learner.enhance(queryEmbedding, neighborEmbeddings, weights);
779
- learner.addSample(embedding, 'positive', 1.0, { source: 'feedback' });
910
+ learner.addSample(embedding, "positive", 1.0, { source: "feedback" });
780
911
  const result = await learner.train(10);
781
912
  // { epochs: 10, finalLoss: 0.023, improvement: 15.2, durationMs: 340 }
782
913
  ```
@@ -815,8 +946,8 @@ The router also selects the adaptive ef-search arm for the query. Four ef-search
815
946
 
816
947
  ```typescript
817
948
  // Router learns intents from usage patterns
818
- router.addIntent('technical_search', embedding); // up to 100 exemplars per intent
819
- router.addIntent('conversational', embedding);
949
+ router.addIntent("technical_search", embedding); // up to 100 exemplars per intent
950
+ router.addIntent("conversational", embedding);
820
951
  const { intent, confidence } = await router.route(queryEmbedding, k);
821
952
 
822
953
  // Router state persists across restarts (debounced 5s save)
@@ -840,7 +971,11 @@ InfoNCE contrastive loss with hard negative mining inspired by NV-Retriever's po
840
971
  ```typescript
841
972
  // ContrastiveTrainer handles hard negative mining automatically
842
973
  const result = trainer.trainBatch([
843
- { anchor: queryEmb, positive: goodResultEmb, negatives: [badResult1, badResult2] },
974
+ {
975
+ anchor: queryEmb,
976
+ positive: goodResultEmb,
977
+ negatives: [badResult1, badResult2],
978
+ },
844
979
  ]);
845
980
  // result: { loss, gradients, batchSize }
846
981
  ```
@@ -875,12 +1010,12 @@ Each learning tick performs these steps in sequence:
875
1010
  ### Full Example
876
1011
 
877
1012
  ```typescript
878
- import { SelfLearningRvfBackend } from 'agentdb/backends/rvf/SelfLearningRvfBackend';
1013
+ import { SelfLearningRvfBackend } from "agentdb/backends/rvf/SelfLearningRvfBackend";
879
1014
 
880
1015
  const backend = await SelfLearningRvfBackend.create({
881
1016
  dimension: 384,
882
- metric: 'cosine',
883
- storagePath: './vectors.rvf',
1017
+ metric: "cosine",
1018
+ storagePath: "./vectors.rvf",
884
1019
  learning: true,
885
1020
  federated: true,
886
1021
  positiveThreshold: 0.7,
@@ -890,20 +1025,22 @@ const backend = await SelfLearningRvfBackend.create({
890
1025
  });
891
1026
 
892
1027
  // Insert vectors
893
- await backend.insertAsync('doc-1', embedding, { source: 'docs' });
1028
+ await backend.insertAsync("doc-1", embedding, { source: "docs" });
894
1029
 
895
1030
  // Search (automatically enhanced by SONA + router)
896
1031
  const results = await backend.searchAsync(queryEmbedding, 10);
897
1032
 
898
1033
  // Record feedback to drive learning
899
- backend.recordFeedback('query-123', 0.9); // high quality result
1034
+ backend.recordFeedback("query-123", 0.9); // high quality result
900
1035
 
901
1036
  // Run a learning tick (contrastive training + LoRA update + EWC consolidation)
902
1037
  await backend.tick();
903
1038
 
904
1039
  // Check learning progress
905
1040
  const stats = backend.getLearningStats();
906
- console.log(`Trajectories: ${stats.trajectoryCount}, LoRA rank: ${stats.loraRank}`);
1041
+ console.log(
1042
+ `Trajectories: ${stats.trajectoryCount}, LoRA rank: ${stats.loraRank}`,
1043
+ );
907
1044
  ```
908
1045
 
909
1046
  </details>
@@ -921,14 +1058,14 @@ Store successful reasoning patterns and retrieve them by semantic similarity. Th
921
1058
 
922
1059
  ```typescript
923
1060
  await reasoningBank.storePattern({
924
- taskType: 'bug_investigation',
925
- approach: 'Check logs > Reproduce > Binary search for root cause',
1061
+ taskType: "bug_investigation",
1062
+ approach: "Check logs > Reproduce > Binary search for root cause",
926
1063
  successRate: 0.92,
927
- tags: ['debugging', 'systematic'],
1064
+ tags: ["debugging", "systematic"],
928
1065
  });
929
1066
 
930
1067
  const patterns = await reasoningBank.searchPatterns({
931
- task: 'debug memory leak',
1068
+ task: "debug memory leak",
932
1069
  k: 10,
933
1070
  threshold: 0.7,
934
1071
  });
@@ -940,19 +1077,19 @@ Store complete task episodes with self-generated critiques, then replay them to
940
1077
 
941
1078
  ```typescript
942
1079
  await reflexion.storeEpisode({
943
- sessionId: 'session-1',
944
- task: 'Fix authentication bug',
1080
+ sessionId: "session-1",
1081
+ task: "Fix authentication bug",
945
1082
  reward: 0.95,
946
1083
  success: true,
947
- critique: 'OAuth2 PKCE flow was more secure than basic flow',
948
- input: 'Users cannot log in',
949
- output: 'Working OAuth2 implementation',
1084
+ critique: "OAuth2 PKCE flow was more secure than basic flow",
1085
+ input: "Users cannot log in",
1086
+ output: "Working OAuth2 implementation",
950
1087
  latencyMs: 1200,
951
1088
  tokensUsed: 500,
952
1089
  });
953
1090
 
954
1091
  const similar = await reflexion.retrieveRelevant({
955
- task: 'authentication issues',
1092
+ task: "authentication issues",
956
1093
  k: 10,
957
1094
  onlySuccesses: true,
958
1095
  });
@@ -964,15 +1101,15 @@ Transform successful patterns into reusable, composable skills that improve over
964
1101
 
965
1102
  ```typescript
966
1103
  await skills.createSkill({
967
- name: 'jwt_authentication',
968
- description: 'Generate and validate JWT tokens',
969
- signature: { inputs: { userId: 'string' }, outputs: { token: 'string' } },
970
- code: 'implementation...',
1104
+ name: "jwt_authentication",
1105
+ description: "Generate and validate JWT tokens",
1106
+ signature: { inputs: { userId: "string" }, outputs: { token: "string" } },
1107
+ code: "implementation...",
971
1108
  successRate: 0.92,
972
1109
  });
973
1110
 
974
1111
  const applicable = await skills.searchSkills({
975
- task: 'user authentication',
1112
+ task: "user authentication",
976
1113
  k: 5,
977
1114
  minSuccessRate: 0.7,
978
1115
  });
@@ -983,19 +1120,19 @@ const applicable = await skills.searchSkills({
983
1120
  Track `p(y|do(x))` using doubly robust estimation. Learn what interventions cause what outcomes.
984
1121
 
985
1122
  ```typescript
986
- import { CausalMemoryGraph } from 'agentdb';
1123
+ import { CausalMemoryGraph } from "agentdb";
987
1124
 
988
1125
  const causalGraph = new CausalMemoryGraph(db);
989
1126
 
990
1127
  const experimentId = causalGraph.createExperiment({
991
- name: 'test_error_handling',
992
- hypothesis: 'Try-catch reduces crash rate',
1128
+ name: "test_error_handling",
1129
+ hypothesis: "Try-catch reduces crash rate",
993
1130
  treatmentId: 123,
994
- treatmentType: 'episode',
1131
+ treatmentType: "episode",
995
1132
  controlId: 124,
996
1133
  startTime: Date.now(),
997
1134
  sampleSize: 0,
998
- status: 'running',
1135
+ status: "running",
999
1136
  });
1000
1137
 
1001
1138
  const { uplift, pValue } = causalGraph.calculateUplift(experimentId);
@@ -1007,11 +1144,11 @@ Every retrieval comes with a cryptographic Merkle proof explaining why specific
1007
1144
 
1008
1145
  ```typescript
1009
1146
  const result = await causalRecall.recall(
1010
- 'query-123',
1011
- 'How to optimize API response time',
1147
+ "query-123",
1148
+ "How to optimize API response time",
1012
1149
  12,
1013
- ['performance'],
1014
- 'internal',
1150
+ ["performance"],
1151
+ "internal",
1015
1152
  );
1016
1153
 
1017
1154
  console.log(`Certificate: ${result.certificate.id}`);
@@ -1066,44 +1203,44 @@ graph TB
1066
1203
 
1067
1204
  ### Key Capabilities
1068
1205
 
1069
- | Feature | Description |
1070
- | --- | --- |
1071
- | **Single-file** | Everything in one Cognitive Container (`.rvf`) — vectors, index, metadata |
1072
- | **Crash-safe** | Append-only log with checksums, safe concurrent access |
1073
- | **COW Branching** | Create copy-on-write branches for experiments (near-instant) |
1074
- | **Lineage Tracking** | `fileId()`, `parentId()`, `lineageDepth()` for file-level provenance |
1075
- | **Progressive Indexing** | 3-layer HNSW quality tiers, index builds incrementally as data arrives |
1076
- | **Witness Chains** | SHAKE-256 cryptographic verification (73 bytes per entry) |
1077
- | **Filter Expressions** | 11 operators for metadata filtering, max 64 depth |
1078
- | **Auto-Compaction** | `compact()` reclaims space, reports segments compacted & bytes reclaimed |
1079
- | **Readonly Mode** | `openReadonly()` for concurrent readers without locks |
1080
- | **Segment Introspection** | `segments()` returns id, type, and payload length per segment |
1081
- | **Kernel Embedding** | Embed unikernel images directly into Cognitive Containers |
1082
- | **eBPF Embedding** | Embed and extract eBPF bytecode for programmable queries |
1206
+ | Feature | Description |
1207
+ | ------------------------- | ------------------------------------------------------------------------- |
1208
+ | **Single-file** | Everything in one Cognitive Container (`.rvf`) — vectors, index, metadata |
1209
+ | **Crash-safe** | Append-only log with checksums, safe concurrent access |
1210
+ | **COW Branching** | Create copy-on-write branches for experiments (near-instant) |
1211
+ | **Lineage Tracking** | `fileId()`, `parentId()`, `lineageDepth()` for file-level provenance |
1212
+ | **Progressive Indexing** | 3-layer HNSW quality tiers, index builds incrementally as data arrives |
1213
+ | **Witness Chains** | SHAKE-256 cryptographic verification (73 bytes per entry) |
1214
+ | **Filter Expressions** | 11 operators for metadata filtering, max 64 depth |
1215
+ | **Auto-Compaction** | `compact()` reclaims space, reports segments compacted & bytes reclaimed |
1216
+ | **Readonly Mode** | `openReadonly()` for concurrent readers without locks |
1217
+ | **Segment Introspection** | `segments()` returns id, type, and payload length per segment |
1218
+ | **Kernel Embedding** | Embed unikernel images directly into Cognitive Containers |
1219
+ | **eBPF Embedding** | Embed and extract eBPF bytecode for programmable queries |
1083
1220
 
1084
1221
  ### Configuration
1085
1222
 
1086
1223
  ```typescript
1087
1224
  const backend = new RvfBackend({
1088
1225
  dimension: 384,
1089
- metric: 'cosine', // 'cosine' | 'l2' | 'dotproduct'
1090
- storagePath: './vectors.rvf',
1091
- rvfBackend: 'auto', // 'auto' | 'node' (N-API) | 'wasm' (browser)
1092
- batchThreshold: 100, // Auto-flush after N sync inserts (1-10,000)
1093
- compression: 'none', // 'none' (fp32) | 'scalar' (int8) | 'product' (PQ)
1094
- hardwareProfile: 0, // 0=Generic | 1=Core | 2=Hot | 3=Full
1095
- enableStats: true, // Track insert/search/flush/compaction timing
1226
+ metric: "cosine", // 'cosine' | 'l2' | 'dotproduct'
1227
+ storagePath: "./vectors.rvf",
1228
+ rvfBackend: "auto", // 'auto' | 'node' (N-API) | 'wasm' (browser)
1229
+ batchThreshold: 100, // Auto-flush after N sync inserts (1-10,000)
1230
+ compression: "none", // 'none' (fp32) | 'scalar' (int8) | 'product' (PQ)
1231
+ hardwareProfile: 0, // 0=Generic | 1=Core | 2=Hot | 3=Full
1232
+ enableStats: true, // Track insert/search/flush/compaction timing
1096
1233
  });
1097
1234
  ```
1098
1235
 
1099
1236
  **Hardware profiles** tune internal parameters for your deployment:
1100
1237
 
1101
- | Profile | Level | Best For |
1102
- | --- | --- | --- |
1103
- | Generic (0) | Conservative defaults | Unknown hardware |
1104
- | Core (1) | Balanced throughput/latency | Developer machines |
1105
- | Hot (2) | Aggressive caching | High-throughput servers |
1106
- | Full (3) | Maximum parallelism | Dedicated vector search |
1238
+ | Profile | Level | Best For |
1239
+ | ----------- | --------------------------- | ----------------------- |
1240
+ | Generic (0) | Conservative defaults | Unknown hardware |
1241
+ | Core (1) | Balanced throughput/latency | Developer machines |
1242
+ | Hot (2) | Aggressive caching | High-throughput servers |
1243
+ | Full (3) | Maximum parallelism | Dedicated vector search |
1107
1244
 
1108
1245
  ### Witness Chains
1109
1246
 
@@ -1121,13 +1258,13 @@ const result = backend.verifyWitnessChain();
1121
1258
  RVF supports 11 filter operators for metadata-filtered search. Filters are serialized to a compact field-ID format with a maximum depth of 64 expressions for security:
1122
1259
 
1123
1260
  ```typescript
1124
- import { FilterBuilder } from 'agentdb/backends/rvf/FilterBuilder';
1261
+ import { FilterBuilder } from "agentdb/backends/rvf/FilterBuilder";
1125
1262
 
1126
1263
  const filter = new FilterBuilder()
1127
- .eq('status', 'active')
1128
- .gt('score', 0.5)
1129
- .range('timestamp', startDate, endDate)
1130
- .in('category', ['research', 'engineering'])
1264
+ .eq("status", "active")
1265
+ .gt("score", 0.5)
1266
+ .range("timestamp", startDate, endDate)
1267
+ .in("category", ["research", "engineering"])
1131
1268
  .build();
1132
1269
 
1133
1270
  const results = await backend.searchAsync(queryVector, 10, { filter });
@@ -1158,12 +1295,12 @@ Cognitive Containers can embed unikernel images and eBPF bytecode directly, enab
1158
1295
  ```typescript
1159
1296
  // Embed a kernel image into the Cognitive Container
1160
1297
  await backend.embedKernel({
1161
- arch: 'x86_64', // 'x86_64' | 'aarch64' | 'riscv64'
1162
- type: 'firecracker', // 'firecracker' | 'qemu' | 'cloud-hypervisor'
1298
+ arch: "x86_64", // 'x86_64' | 'aarch64' | 'riscv64'
1299
+ type: "firecracker", // 'firecracker' | 'qemu' | 'cloud-hypervisor'
1163
1300
  flags: 0,
1164
1301
  image: kernelBuffer,
1165
1302
  apiPort: 8080,
1166
- cmdline: 'console=ttyS0',
1303
+ cmdline: "console=ttyS0",
1167
1304
  });
1168
1305
 
1169
1306
  // Extract it later
@@ -1197,23 +1334,23 @@ npx agentdb rvf detect
1197
1334
  ### Programmatic Usage
1198
1335
 
1199
1336
  ```typescript
1200
- import { RvfBackend } from 'agentdb/backends/rvf/RvfBackend';
1337
+ import { RvfBackend } from "agentdb/backends/rvf/RvfBackend";
1201
1338
 
1202
1339
  const backend = new RvfBackend({
1203
1340
  dimension: 384,
1204
- metric: 'cosine',
1205
- storagePath: './vectors.rvf',
1206
- rvfBackend: 'auto', // 'node' for N-API, 'wasm' for browser
1341
+ metric: "cosine",
1342
+ storagePath: "./vectors.rvf",
1343
+ rvfBackend: "auto", // 'node' for N-API, 'wasm' for browser
1207
1344
  });
1208
1345
  await backend.initialize();
1209
1346
 
1210
1347
  // Async operations (native)
1211
- await backend.insertAsync('vec-1', embedding, { tag: 'example' });
1348
+ await backend.insertAsync("vec-1", embedding, { tag: "example" });
1212
1349
  const results = await backend.searchAsync(queryVector, 10);
1213
1350
  await backend.flush();
1214
1351
 
1215
1352
  // COW branching
1216
- const branch = await backend.derive('./experiment.rvf');
1353
+ const branch = await backend.derive("./experiment.rvf");
1217
1354
  const lineage = await backend.lineageDepth();
1218
1355
  ```
1219
1356
 
@@ -1248,30 +1385,30 @@ The `NativeAccelerator` provides 15 capability groups bridging 11 `@ruvector` pa
1248
1385
 
1249
1386
  ### Capability Groups
1250
1387
 
1251
- | Group | Operations | Package |
1252
- | --- | --- | --- |
1253
- | **Vector Distance & Math** | cosine, dot, L2, hamming, add, mul, scale, normalize | `ruvector` |
1254
- | **Activations** | softmax, relu, gelu, sigmoid, layerNorm | `@ruvector/ruvllm` |
1255
- | **Loss Functions** | InfoNCE (contrastive) | `@ruvector/sona` |
1256
- | **Optimizers** | AdamW step | `@ruvector/sona` |
1257
- | **Quantization** | scalar 8-bit/4-bit, product quantization | `@ruvector/rvf` |
1258
- | **WASM Store** | create, ingest, query, export, close | `@ruvector/rvf-wasm` |
1259
- | **Verification** | witness chain, segment header | `@ruvector/rvf-node` |
1260
- | **Graph Transactions** | begin, commit, rollback | `@ruvector/graph-node` |
1261
- | **Graph Batch Insert** | high-throughput node/edge ingestion | `@ruvector/graph-node` |
1262
- | **Graph Cypher** | pattern matching, path queries | `@ruvector/graph-node` |
1263
- | **Core Batch Insert** | native vector batch ingestion | `ruvector` |
1264
- | **EWC Memory** | penalty calculation, Fisher update | `@ruvector/sona` |
1265
- | **Router** | save/load state persistence | `@ruvector/router` |
1266
- | **SONA** | context addition, flush, base LoRA | `@ruvector/sona` |
1267
- | **Compression** | tensor compress/decompress | `@ruvector/rvf` |
1388
+ | Group | Operations | Package |
1389
+ | -------------------------- | ---------------------------------------------------- | ---------------------- |
1390
+ | **Vector Distance & Math** | cosine, dot, L2, hamming, add, mul, scale, normalize | `ruvector` |
1391
+ | **Activations** | softmax, relu, gelu, sigmoid, layerNorm | `@ruvector/ruvllm` |
1392
+ | **Loss Functions** | InfoNCE (contrastive) | `@ruvector/sona` |
1393
+ | **Optimizers** | AdamW step | `@ruvector/sona` |
1394
+ | **Quantization** | scalar 8-bit/4-bit, product quantization | `@ruvector/rvf` |
1395
+ | **WASM Store** | create, ingest, query, export, close | `@ruvector/rvf-wasm` |
1396
+ | **Verification** | witness chain, segment header | `@ruvector/rvf-node` |
1397
+ | **Graph Transactions** | begin, commit, rollback | `@ruvector/graph-node` |
1398
+ | **Graph Batch Insert** | high-throughput node/edge ingestion | `@ruvector/graph-node` |
1399
+ | **Graph Cypher** | pattern matching, path queries | `@ruvector/graph-node` |
1400
+ | **Core Batch Insert** | native vector batch ingestion | `ruvector` |
1401
+ | **EWC Memory** | penalty calculation, Fisher update | `@ruvector/sona` |
1402
+ | **Router** | save/load state persistence | `@ruvector/router` |
1403
+ | **SONA** | context addition, flush, base LoRA | `@ruvector/sona` |
1404
+ | **Compression** | tensor compress/decompress | `@ruvector/rvf` |
1268
1405
 
1269
1406
  ### Auto-Detection
1270
1407
 
1271
1408
  Each capability group is lazily loaded — only the packages actually installed on the system are loaded, and each load is tried independently so a missing package never blocks others:
1272
1409
 
1273
1410
  ```typescript
1274
- import { NativeAccelerator } from 'agentdb/backends/rvf/NativeAccelerator';
1411
+ import { NativeAccelerator } from "agentdb/backends/rvf/NativeAccelerator";
1275
1412
 
1276
1413
  const accel = new NativeAccelerator();
1277
1414
  const stats = await accel.initialize();
@@ -1303,12 +1440,27 @@ console.log(stats);
1303
1440
  Every SIMD operation has a pure-JS fallback with 4-wide loop unrolling for reasonable performance even without native bindings:
1304
1441
 
1305
1442
  ```typescript
1306
- import { SimdFallbacks } from 'agentdb/backends/rvf/SimdFallbacks';
1443
+ import { SimdFallbacks } from "agentdb/backends/rvf/SimdFallbacks";
1307
1444
 
1308
1445
  // Same API as native, ~10-50x slower but always available
1309
1446
  const similarity = SimdFallbacks.jsCosineSimilarity(vecA, vecB);
1310
- const loss = SimdFallbacks.jsInfoNceLoss(anchor, positive, negatives, temperature);
1311
- const result = SimdFallbacks.jsAdamWStep(params, grads, m, v, lr, beta1, beta2, weightDecay, t);
1447
+ const loss = SimdFallbacks.jsInfoNceLoss(
1448
+ anchor,
1449
+ positive,
1450
+ negatives,
1451
+ temperature,
1452
+ );
1453
+ const result = SimdFallbacks.jsAdamWStep(
1454
+ params,
1455
+ grads,
1456
+ m,
1457
+ v,
1458
+ lr,
1459
+ beta1,
1460
+ beta2,
1461
+ weightDecay,
1462
+ t,
1463
+ );
1312
1464
  ```
1313
1465
 
1314
1466
  ### Additional SIMD Operations
@@ -1316,7 +1468,7 @@ const result = SimdFallbacks.jsAdamWStep(params, grads, m, v, lr, beta1, beta2,
1316
1468
  The `SIMDVectorOps` class provides batch operations and platform-specific detection:
1317
1469
 
1318
1470
  ```typescript
1319
- import { SIMDVectorOps, detectSIMDSupport } from 'agentdb/simd';
1471
+ import { SIMDVectorOps, detectSIMDSupport } from "agentdb/simd";
1320
1472
 
1321
1473
  const simd = new SIMDVectorOps();
1322
1474
  const support = detectSIMDSupport();
@@ -1339,12 +1491,12 @@ AgentDB integrates `@ruvector/graph-node` for a full graph database with Cypher
1339
1491
  Full Neo4j-compatible Cypher syntax including MATCH, RETURN, WHERE, ORDER BY, LIMIT, relationship patterns, and graph traversal:
1340
1492
 
1341
1493
  ```typescript
1342
- import { GraphDatabaseAdapter } from 'agentdb/backends/graph/GraphDatabaseAdapter';
1494
+ import { GraphDatabaseAdapter } from "agentdb/backends/graph/GraphDatabaseAdapter";
1343
1495
 
1344
1496
  const graph = new GraphDatabaseAdapter({
1345
- storagePath: './graph.db',
1497
+ storagePath: "./graph.db",
1346
1498
  dimensions: 384,
1347
- distanceMetric: 'Cosine', // 'Cosine' | 'Euclidean' | 'DotProduct' | 'Manhattan'
1499
+ distanceMetric: "Cosine", // 'Cosine' | 'Euclidean' | 'DotProduct' | 'Manhattan'
1348
1500
  });
1349
1501
  await graph.initialize();
1350
1502
 
@@ -1369,12 +1521,12 @@ Traverse relationships with direction control, depth limits, and label filtering
1369
1521
 
1370
1522
  ```typescript
1371
1523
  const paths = await graph.traverse({
1372
- startNodeId: 'episode-42',
1373
- pattern: '()-[:RELATES_TO]->(:Skill)',
1374
- direction: 'outgoing', // 'outgoing' | 'incoming' | 'both'
1524
+ startNodeId: "episode-42",
1525
+ pattern: "()-[:RELATES_TO]->(:Skill)",
1526
+ direction: "outgoing", // 'outgoing' | 'incoming' | 'both'
1375
1527
  maxDepth: 3,
1376
- relationshipTypes: ['CAUSED', 'RELATES_TO'],
1377
- nodeLabels: ['Episode', 'Skill'],
1528
+ relationshipTypes: ["CAUSED", "RELATES_TO"],
1529
+ nodeLabels: ["Episode", "Skill"],
1378
1530
  });
1379
1531
  ```
1380
1532
 
@@ -1389,9 +1541,9 @@ const results = await graph.vectorSearch(queryEmbedding, 10);
1389
1541
 
1390
1542
  // Nodes support multi-label classification
1391
1543
  await graph.createNode({
1392
- id: 'analysis-1',
1393
- label: ['Episode', 'Analyzed', 'Security'],
1394
- properties: { reward: 0.95, task: 'auth review' },
1544
+ id: "analysis-1",
1545
+ label: ["Episode", "Analyzed", "Security"],
1546
+ properties: { reward: 0.95, task: "auth review" },
1395
1547
  embedding: embeddingVector,
1396
1548
  });
1397
1549
  ```
@@ -1404,8 +1556,13 @@ ACID-guaranteed batch operations with rollback support:
1404
1556
  const txId = await graph.beginTransaction();
1405
1557
  try {
1406
1558
  await graph.batchInsert(
1407
- nodes.map(n => ({ id: n.id, label: n.type, properties: n.data })),
1408
- edges.map(e => ({ from: e.source, to: e.target, label: e.type, properties: e.data })),
1559
+ nodes.map((n) => ({ id: n.id, label: n.type, properties: n.data })),
1560
+ edges.map((e) => ({
1561
+ from: e.source,
1562
+ to: e.target,
1563
+ label: e.type,
1564
+ properties: e.data,
1565
+ })),
1409
1566
  );
1410
1567
  await graph.commitTransaction(txId);
1411
1568
  } catch (err) {
@@ -1417,19 +1574,19 @@ try {
1417
1574
 
1418
1575
  The GNN attention mechanism improves recall by +12.4% with a 3.8ms forward pass and 91% transfer learning retention. Three attention types are available:
1419
1576
 
1420
- | Type | Algorithm | Best For |
1421
- | --- | --- | --- |
1422
- | `gat` | Graph Attention Network | Weighted neighbor aggregation |
1423
- | `gcn` | Graph Convolutional Network | Uniform message passing |
1424
- | `sage` | GraphSAGE | Inductive learning on unseen nodes |
1577
+ | Type | Algorithm | Best For |
1578
+ | ------ | --------------------------- | ---------------------------------- |
1579
+ | `gat` | Graph Attention Network | Weighted neighbor aggregation |
1580
+ | `gcn` | Graph Convolutional Network | Uniform message passing |
1581
+ | `sage` | GraphSAGE | Inductive learning on unseen nodes |
1425
1582
 
1426
1583
  ```typescript
1427
- import { AttentionService } from 'agentdb/controllers/AttentionService';
1584
+ import { AttentionService } from "agentdb/controllers/AttentionService";
1428
1585
 
1429
1586
  const attention = new AttentionService({
1430
1587
  numHeads: 8,
1431
1588
  dimension: 384,
1432
- attentionType: 'gat', // 'gat' | 'gcn' | 'sage'
1589
+ attentionType: "gat", // 'gat' | 'gcn' | 'sage'
1433
1590
  });
1434
1591
  const enhanced = await attention.forward(queryEmbedding, neighborEmbeddings);
1435
1592
  ```
@@ -1439,18 +1596,18 @@ const enhanced = await attention.forward(queryEmbedding, neighborEmbeddings);
1439
1596
  Track interventions with `p(y|do(x))` doubly robust estimation and optional Poincare embeddings for hierarchical relationships:
1440
1597
 
1441
1598
  ```typescript
1442
- import { CausalMemoryGraph } from 'agentdb';
1599
+ import { CausalMemoryGraph } from "agentdb";
1443
1600
 
1444
1601
  const causal = new CausalMemoryGraph(db, graph, embedder, {
1445
1602
  ENABLE_HYPERBOLIC_ATTENTION: true, // Poincaré ball distance for hierarchies
1446
1603
  });
1447
1604
 
1448
1605
  await causal.addCausalEdge({
1449
- fromMemoryId: 'episode-1',
1450
- toMemoryType: 'skill', // 'episode' | 'skill' | 'note' | 'fact'
1451
- uplift: 0.15, // E[y|do(x)] - E[y]
1606
+ fromMemoryId: "episode-1",
1607
+ toMemoryType: "skill", // 'episode' | 'skill' | 'note' | 'fact'
1608
+ uplift: 0.15, // E[y|do(x)] - E[y]
1452
1609
  confidence: 0.92,
1453
- mechanism: 'error-handling improvement',
1610
+ mechanism: "error-handling improvement",
1454
1611
  sampleSize: 50,
1455
1612
  confounderScore: 0.03,
1456
1613
  });
@@ -1470,7 +1627,7 @@ AgentDB runs fully in the browser with WASM-backed vector storage, GNN attention
1470
1627
  The `WasmStoreBridge` provides a full HNSW vector database in the browser by wrapping `@ruvector/rvf-wasm`:
1471
1628
 
1472
1629
  ```typescript
1473
- import { WasmStoreBridge } from 'agentdb/backends/rvf/WasmStoreBridge';
1630
+ import { WasmStoreBridge } from "agentdb/backends/rvf/WasmStoreBridge";
1474
1631
 
1475
1632
  const bridge = new WasmStoreBridge();
1476
1633
  await bridge.initialize();
@@ -1496,7 +1653,7 @@ bridge.wasmStoreClose(handle);
1496
1653
  The `AttentionBrowser` provides three advanced attention types compiled to WASM:
1497
1654
 
1498
1655
  ```typescript
1499
- import { AttentionBrowser } from 'agentdb/browser/AttentionBrowser';
1656
+ import { AttentionBrowser } from "agentdb/browser/AttentionBrowser";
1500
1657
 
1501
1658
  const attention = new AttentionBrowser({ numHeads: 8 });
1502
1659
  // Loading states: 'idle' → 'loading' → 'loaded' | 'error'
@@ -1521,14 +1678,17 @@ const consolidated = await attention.consolidateMemories(memories, {
1521
1678
 
1522
1679
  Memory-efficient vector storage with three PQ compression levels:
1523
1680
 
1524
- | Variant | Compression | Subvectors | Centroids | Best For |
1525
- | --- | --- | --- | --- | --- |
1526
- | **PQ8** | 4x | 8 | 256 | Balanced quality/memory |
1527
- | **PQ16** | 8x | 16 | 256 | Medium datasets |
1528
- | **PQ32** | 16x | 32 | 256 | Maximum compression |
1681
+ | Variant | Compression | Subvectors | Centroids | Best For |
1682
+ | -------- | ----------- | ---------- | --------- | ----------------------- |
1683
+ | **PQ8** | 4x | 8 | 256 | Balanced quality/memory |
1684
+ | **PQ16** | 8x | 16 | 256 | Medium datasets |
1685
+ | **PQ32** | 16x | 32 | 256 | Maximum compression |
1529
1686
 
1530
1687
  ```typescript
1531
- import { createProductQuantizedStore, createScalar8BitStore } from 'agentdb/browser/ProductQuantization';
1688
+ import {
1689
+ createProductQuantizedStore,
1690
+ createScalar8BitStore,
1691
+ } from "agentdb/browser/ProductQuantization";
1532
1692
 
1533
1693
  // Product quantization with asymmetric distance computation (ADC)
1534
1694
  const pq = createProductQuantizedStore(384, {
@@ -1536,7 +1696,7 @@ const pq = createProductQuantizedStore(384, {
1536
1696
  bitsPerCode: 8,
1537
1697
  // Uses K-means++ initialization for codebook training
1538
1698
  });
1539
- pq.add('doc-1', embedding);
1699
+ pq.add("doc-1", embedding);
1540
1700
  const results = pq.search(query, 10);
1541
1701
  ```
1542
1702
 
@@ -1544,25 +1704,25 @@ const results = pq.search(query, 10);
1544
1704
 
1545
1705
  Pre-tuned configurations for common scenarios:
1546
1706
 
1547
- | Preset | Features | Target |
1548
- | --- | --- | --- |
1549
- | `SMALL_DATASET` | GNN only | <1K vectors |
1550
- | `MEDIUM_DATASET` | HNSW + PQ8 | 1K-10K vectors |
1551
- | `LARGE_DATASET` | Aggressive compression + HNSW | 10K-100K vectors |
1552
- | `MEMORY_OPTIMIZED` | PQ32 + SVD (dim 64) | Memory-constrained |
1553
- | `SPEED_OPTIMIZED` | HNSW max quality | Latency-critical |
1554
- | `QUALITY_OPTIMIZED` | No compression, max attention heads | Accuracy-critical |
1707
+ | Preset | Features | Target |
1708
+ | ------------------- | ----------------------------------- | ------------------ |
1709
+ | `SMALL_DATASET` | GNN only | <1K vectors |
1710
+ | `MEDIUM_DATASET` | HNSW + PQ8 | 1K-10K vectors |
1711
+ | `LARGE_DATASET` | Aggressive compression + HNSW | 10K-100K vectors |
1712
+ | `MEMORY_OPTIMIZED` | PQ32 + SVD (dim 64) | Memory-constrained |
1713
+ | `SPEED_OPTIMIZED` | HNSW max quality | Latency-critical |
1714
+ | `QUALITY_OPTIMIZED` | No compression, max attention heads | Accuracy-critical |
1555
1715
 
1556
1716
  ### Maximal Marginal Relevance (MMR)
1557
1717
 
1558
1718
  Diversify search results to avoid returning near-duplicate items:
1559
1719
 
1560
1720
  ```typescript
1561
- import { MMRDiversityRanker } from 'agentdb/controllers/MMRDiversityRanker';
1721
+ import { MMRDiversityRanker } from "agentdb/controllers/MMRDiversityRanker";
1562
1722
 
1563
1723
  const ranker = new MMRDiversityRanker({
1564
- lambda: 0.7, // 0=max diversity, 1=max relevance
1565
- metric: 'cosine', // 'cosine' | 'euclidean' | 'dot'
1724
+ lambda: 0.7, // 0=max diversity, 1=max relevance
1725
+ metric: "cosine", // 'cosine' | 'euclidean' | 'dot'
1566
1726
  });
1567
1727
 
1568
1728
  // Rerank results: MMR = λ × Sim(Di,Q) - (1-λ) × max Sim(Di,Dj)
@@ -1573,12 +1733,12 @@ const score = ranker.diversityScore(diverse); // average pairwise distance
1573
1733
  ### Browser Bundle
1574
1734
 
1575
1735
  ```typescript
1576
- import { AgentDB } from 'agentdb/browser';
1736
+ import { AgentDB } from "agentdb/browser";
1577
1737
 
1578
1738
  const db = new AgentDB({ dimension: 384 });
1579
1739
  await db.initialize();
1580
1740
 
1581
- await db.insert('doc-1', embedding, { title: 'Getting Started' });
1741
+ await db.insert("doc-1", embedding, { title: "Getting Started" });
1582
1742
  const results = await db.search(queryEmbedding, 5);
1583
1743
  ```
1584
1744
 
@@ -1587,11 +1747,11 @@ const results = await db.search(queryEmbedding, 5);
1587
1747
  For zero-dependency environments, AgentDB falls back to `sql.js` (SQLite compiled to WASM) automatically. Non-WASM browsers get pure-JS implementations with 4-wide loop unrolling (~10-50x slower than native SIMD but fully functional):
1588
1748
 
1589
1749
  ```typescript
1590
- import { createDatabase } from 'agentdb';
1591
- import { detectSIMDSupport } from 'agentdb/simd';
1750
+ import { createDatabase } from "agentdb";
1751
+ import { detectSIMDSupport } from "agentdb/simd";
1592
1752
 
1593
1753
  // In browsers, automatically uses sql.js WASM backend
1594
- const db = await createDatabase(':memory:');
1754
+ const db = await createDatabase(":memory:");
1595
1755
 
1596
1756
  const support = detectSIMDSupport();
1597
1757
  // { wasm: true, x64: false, avx2: false, neon: false }
@@ -1606,13 +1766,13 @@ const support = detectSIMDSupport();
1606
1766
 
1607
1767
  ### Core Operations
1608
1768
 
1609
- | Operation | Throughput | Latency |
1610
- | --- | --- | --- |
1611
- | Pattern search | 32.6M ops/sec | <1ms |
1612
- | Pattern storage | 388K ops/sec | ~2.5us |
1613
- | Episode retrieval | 957 ops/sec | ~1ms |
1614
- | Skill search | 694 ops/sec | ~1.4ms |
1615
- | Batch insert | 5,556-7,692 ops/sec | 3-4x faster than sequential |
1769
+ | Operation | Throughput | Latency |
1770
+ | ----------------- | ------------------- | --------------------------- |
1771
+ | Pattern search | 32.6M ops/sec | <1ms |
1772
+ | Pattern storage | 388K ops/sec | ~2.5us |
1773
+ | Episode retrieval | 957 ops/sec | ~1ms |
1774
+ | Skill search | 694 ops/sec | ~1.4ms |
1775
+ | Batch insert | 5,556-7,692 ops/sec | 3-4x faster than sequential |
1616
1776
 
1617
1777
  ### Scaling Behavior
1618
1778
 
@@ -1633,12 +1793,12 @@ Adaptive Learning (10 sessions, 50 episodes each)
1633
1793
 
1634
1794
  ### Latent Space Validation (31 scenarios, 98.2% reproducibility)
1635
1795
 
1636
- | Scenario | Result |
1637
- | --- | --- |
1638
- | HNSW Optimization | 61us p50, 96.8% recall@10, 8.2x vs hnswlib |
1639
- | GNN Attention | +12.4% recall, 3.8ms forward pass, 91% transfer |
1640
- | Self-Healing | 97.9% degradation prevention, <100ms repair |
1641
- | Neural Augmentation | +29.4% improvement, -32% memory, -52% hops |
1796
+ | Scenario | Result |
1797
+ | ------------------- | ----------------------------------------------- |
1798
+ | HNSW Optimization | 61us p50, 96.8% recall@10, 8.2x vs hnswlib |
1799
+ | GNN Attention | +12.4% recall, 3.8ms forward pass, 91% transfer |
1800
+ | Self-Healing | 97.9% degradation prevention, <100ms repair |
1801
+ | Neural Augmentation | +29.4% improvement, -32% memory, -52% hops |
1642
1802
 
1643
1803
  ### Adaptive Solver (Thompson Sampling)
1644
1804
 
@@ -1664,6 +1824,7 @@ const chain = solver.witnessChain();
1664
1824
  ```
1665
1825
 
1666
1826
  Three-loop architecture:
1827
+
1667
1828
  1. **Fast loop** — constraint propagation (~0.1ms)
1668
1829
  2. **Medium loop** — PolicyKernel with Thompson Sampling (~1ms)
1669
1830
  3. **Slow loop** — KnowledgeCompiler for long-term patterns (~10ms)
@@ -1672,29 +1833,37 @@ Three-loop architecture:
1672
1833
 
1673
1834
  The `SolverBandit` is a general-purpose Thompson Sampling bandit that provides explore/exploit decisions for any context-dependent selection problem. It powers adaptive decision-making in 5 AgentDB controllers:
1674
1835
 
1675
- | Controller | What the Bandit Decides | Context Key |
1676
- | --- | --- | --- |
1677
- | **SkillLibrary** | Rerank retrieved skills by task type | `taskType` string |
1678
- | **ReasoningBank** | Rerank matching patterns by task type | query text |
1679
- | **NightlyLearner** | Prioritize experiment candidates | `'experiment'` |
1680
- | **LearningSystem** | Select best RL algorithm (9 options) | task description |
1836
+ | Controller | What the Bandit Decides | Context Key |
1837
+ | ---------------------- | -------------------------------------------------- | ------------------- |
1838
+ | **SkillLibrary** | Rerank retrieved skills by task type | `taskType` string |
1839
+ | **ReasoningBank** | Rerank matching patterns by task type | query text |
1840
+ | **NightlyLearner** | Prioritize experiment candidates | `'experiment'` |
1841
+ | **LearningSystem** | Select best RL algorithm (9 options) | task description |
1681
1842
  | **TemporalCompressor** | Choose compression tier (none/half/pq8/pq4/binary) | `hot`/`warm`/`cold` |
1682
1843
 
1683
1844
  Each controller uses the bandit optionally — when no bandit is provided, behavior is unchanged from v2. When present, the bandit reranks results using Thompson-sampled Beta distributions, and controllers feed outcomes back via `recordReward()`.
1684
1845
 
1685
1846
  ```typescript
1686
- import { SolverBandit } from 'agentdb/backends/rvf/SolverBandit';
1847
+ import { SolverBandit } from "agentdb/backends/rvf/SolverBandit";
1687
1848
 
1688
1849
  const bandit = new SolverBandit();
1689
1850
 
1690
1851
  // Select best arm for a context
1691
- const skill = bandit.selectArm('code_review', ['lint_first', 'test_first', 'security_scan']);
1852
+ const skill = bandit.selectArm("code_review", [
1853
+ "lint_first",
1854
+ "test_first",
1855
+ "security_scan",
1856
+ ]);
1692
1857
 
1693
1858
  // Record outcome
1694
- bandit.recordReward('code_review', skill, 0.85, /* latencyMs */ 120);
1859
+ bandit.recordReward("code_review", skill, 0.85, /* latencyMs */ 120);
1695
1860
 
1696
1861
  // Rerank candidates by learned performance
1697
- const ranked = bandit.rerank('code_review', ['lint_first', 'test_first', 'security_scan']);
1862
+ const ranked = bandit.rerank("code_review", [
1863
+ "lint_first",
1864
+ "test_first",
1865
+ "security_scan",
1866
+ ]);
1698
1867
 
1699
1868
  // Serialize for cross-session persistence
1700
1869
  const state = bandit.serialize(); // JSON-safe
@@ -1706,7 +1875,12 @@ const restored = SolverBandit.deserialize(state);
1706
1875
  **Wire into AgentDB controllers:**
1707
1876
 
1708
1877
  ```typescript
1709
- import { SolverBandit, SkillLibrary, ReasoningBank, LearningSystem } from 'agentdb';
1878
+ import {
1879
+ SolverBandit,
1880
+ SkillLibrary,
1881
+ ReasoningBank,
1882
+ LearningSystem,
1883
+ } from "agentdb";
1710
1884
 
1711
1885
  const bandit = new SolverBandit({ costWeight: 0.01, explorationBonus: 0.1 });
1712
1886
 
@@ -1716,8 +1890,8 @@ const patterns = new ReasoningBank(db, embedder, undefined, bandit);
1716
1890
  const learning = new LearningSystem(db, undefined, bandit);
1717
1891
 
1718
1892
  // Controllers automatically rerank results and accept feedback
1719
- const algorithm = learning.recommendAlgorithm('navigation task');
1720
- learning.recordAlgorithmOutcome('navigation task', algorithm, 0.92, 340);
1893
+ const algorithm = learning.recommendAlgorithm("navigation task");
1894
+ learning.recordAlgorithmOutcome("navigation task", algorithm, 0.92, 340);
1721
1895
  ```
1722
1896
 
1723
1897
  </details>
@@ -1745,13 +1919,13 @@ import {
1745
1919
  validateCypherParams,
1746
1920
  validateLabel,
1747
1921
  validateBatchSize,
1748
- } from 'agentdb/security/validation';
1922
+ } from "agentdb/security/validation";
1749
1923
 
1750
1924
  // Vector validation — prevents NaN/Infinity injection
1751
- validateVector(embedding, 384, 'embedding');
1925
+ validateVector(embedding, 384, "embedding");
1752
1926
 
1753
1927
  // ID validation — prevents path traversal (../, etc.)
1754
- validateVectorId('doc-123', 'id');
1928
+ validateVectorId("doc-123", "id");
1755
1929
 
1756
1930
  // Search bounds — k, threshold, efSearch range checking
1757
1931
  validateSearchOptions({ k: 10, threshold: 0.7 });
@@ -1773,27 +1947,27 @@ import {
1773
1947
  validateTaskString,
1774
1948
  validateNumericRange,
1775
1949
  validateEnum,
1776
- } from 'agentdb/security/input-validation';
1950
+ } from "agentdb/security/input-validation";
1777
1951
 
1778
- const task = validateTaskString(input, 'task'); // XSS pattern detection
1779
- const k = validateNumericRange(kVal, 'k', 1, 100);
1780
- const format = validateEnum(fmt, 'format', ['json', 'concise', 'detailed']);
1952
+ const task = validateTaskString(input, "task"); // XSS pattern detection
1953
+ const k = validateNumericRange(kVal, "k", 1, 100);
1954
+ const format = validateEnum(fmt, "format", ["json", "concise", "detailed"]);
1781
1955
  ```
1782
1956
 
1783
1957
  ### Security Limits
1784
1958
 
1785
- | Parameter | Limit |
1786
- | --- | --- |
1787
- | Max vectors | 10,000,000 |
1788
- | Max dimension | 4,096 |
1789
- | Max batch size | 10,000 |
1790
- | Max k | 10,000 |
1791
- | Max metadata size | 64 KB |
1792
- | Max ID length | 256 chars |
1793
- | Filter expression depth | 64 |
1794
- | ef-search range | 1 - 1,000 |
1795
- | ef-construction range | 4 - 500 |
1796
- | M range | 2 - 64 |
1959
+ | Parameter | Limit |
1960
+ | ----------------------- | ---------- |
1961
+ | Max vectors | 10,000,000 |
1962
+ | Max dimension | 4,096 |
1963
+ | Max batch size | 10,000 |
1964
+ | Max k | 10,000 |
1965
+ | Max metadata size | 64 KB |
1966
+ | Max ID length | 256 chars |
1967
+ | Filter expression depth | 64 |
1968
+ | ef-search range | 1 - 1,000 |
1969
+ | ef-construction range | 4 - 500 |
1970
+ | M range | 2 - 64 |
1797
1971
 
1798
1972
  ### Witness Chain Verification
1799
1973
 
@@ -1802,7 +1976,7 @@ SHAKE-256 cryptographic witness chains provide tamper-evident audit trails:
1802
1976
  ```typescript
1803
1977
  const result = backend.verifyWitnessChain();
1804
1978
  if (!result.valid) {
1805
- console.error('Data integrity compromised!');
1979
+ console.error("Data integrity compromised!");
1806
1980
  }
1807
1981
  ```
1808
1982
 
@@ -1812,11 +1986,11 @@ Every search result can include a Merkle proof explaining why it was selected:
1812
1986
 
1813
1987
  ```typescript
1814
1988
  const { results, certificate } = await causalRecall.recall(
1815
- 'query-id',
1816
- 'optimization strategies',
1989
+ "query-id",
1990
+ "optimization strategies",
1817
1991
  10,
1818
- ['performance'],
1819
- 'internal',
1992
+ ["performance"],
1993
+ "internal",
1820
1994
  );
1821
1995
  console.log(`Certificate ID: ${certificate.id}`);
1822
1996
  console.log(`Completeness: ${certificate.completenessScore}`);
@@ -1836,16 +2010,22 @@ AgentDB supports multiple quantization strategies to reduce memory footprint whi
1836
2010
  8-bit and 4-bit scalar quantization for memory-efficient storage:
1837
2011
 
1838
2012
  ```typescript
1839
- import { createScalar8BitStore, createProductQuantizedStore } from 'agentdb/browser/ProductQuantization';
2013
+ import {
2014
+ createScalar8BitStore,
2015
+ createProductQuantizedStore,
2016
+ } from "agentdb/browser/ProductQuantization";
1840
2017
 
1841
2018
  // 8-bit quantization — 4x memory reduction
1842
2019
  const store8 = createScalar8BitStore(384);
1843
- store8.add('doc-1', embedding);
2020
+ store8.add("doc-1", embedding);
1844
2021
  const results = store8.search(query, 10);
1845
2022
 
1846
2023
  // Product quantization — up to 32x memory reduction
1847
- const storePQ = createProductQuantizedStore(384, { numSubvectors: 48, bitsPerCode: 8 });
1848
- storePQ.add('doc-1', embedding);
2024
+ const storePQ = createProductQuantizedStore(384, {
2025
+ numSubvectors: 48,
2026
+ bitsPerCode: 8,
2027
+ });
2028
+ storePQ.add("doc-1", embedding);
1849
2029
  const results = storePQ.search(query, 10);
1850
2030
  ```
1851
2031
 
@@ -1853,13 +2033,13 @@ const results = storePQ.search(query, 10);
1853
2033
 
1854
2034
  Vectors are automatically compressed based on age and access frequency:
1855
2035
 
1856
- | Tier | Compression | Memory | Quality | Trigger |
1857
- | --- | --- | --- | --- | --- |
1858
- | **Hot** | None | 100% | 100% | Recent / frequently accessed |
1859
- | **Warm** | Half-precision | 50% | ~99% | Moderate age |
1860
- | **Cool** | PQ-8 | ~12% | ~95% | Older data |
1861
- | **Cold** | PQ-4 | ~6% | ~90% | Rarely accessed |
1862
- | **Archive** | Binary | ~3% | ~80% | Archival storage |
2036
+ | Tier | Compression | Memory | Quality | Trigger |
2037
+ | ----------- | -------------- | ------ | ------- | ---------------------------- |
2038
+ | **Hot** | None | 100% | 100% | Recent / frequently accessed |
2039
+ | **Warm** | Half-precision | 50% | ~99% | Moderate age |
2040
+ | **Cool** | PQ-8 | ~12% | ~95% | Older data |
2041
+ | **Cold** | PQ-4 | ~6% | ~90% | Rarely accessed |
2042
+ | **Archive** | Binary | ~3% | ~80% | Archival storage |
1863
2043
 
1864
2044
  ### Matryoshka Dimension Truncation
1865
2045
 
@@ -1903,13 +2083,13 @@ Connect AgentDB to LLM providers, embedding models, and distributed systems with
1903
2083
 
1904
2084
  AgentDB supports multiple embedding models. No API key required — all Xenova models run locally.
1905
2085
 
1906
- | Model | Dimension | Quality | Speed | Best For |
1907
- | --- | --- | --- | --- | --- |
1908
- | **all-MiniLM-L6-v2** (default) | 384 | Good | Fastest | Prototyping |
1909
- | **bge-small-en-v1.5** | 384 | Excellent | Fast | Best 384d quality |
1910
- | **bge-base-en-v1.5** | 768 | Excellent | Moderate | Production |
1911
- | **all-mpnet-base-v2** | 768 | Excellent | Moderate | All-around |
1912
- | **e5-base-v2** | 768 | Excellent | Moderate | Multilingual |
2086
+ | Model | Dimension | Quality | Speed | Best For |
2087
+ | ------------------------------ | --------- | --------- | -------- | ----------------- |
2088
+ | **all-MiniLM-L6-v2** (default) | 384 | Good | Fastest | Prototyping |
2089
+ | **bge-small-en-v1.5** | 384 | Excellent | Fast | Best 384d quality |
2090
+ | **bge-base-en-v1.5** | 768 | Excellent | Moderate | Production |
2091
+ | **all-mpnet-base-v2** | 768 | Excellent | Moderate | All-around |
2092
+ | **e5-base-v2** | 768 | Excellent | Moderate | Multilingual |
1913
2093
 
1914
2094
  ```bash
1915
2095
  # Default (384d, fast)
@@ -1919,12 +2099,49 @@ npx agentdb init
1919
2099
  npx agentdb init --dimension 768 --model "Xenova/bge-base-en-v1.5"
1920
2100
  ```
1921
2101
 
2102
+ ### Offline Embeddings (Bundled Model)
2103
+
2104
+ The default `all-MiniLM-L6-v2` model can be bundled into a `.rvf` file and shipped with the package. This eliminates the ~23MB first-run download and enables fully offline embedding generation.
2105
+
2106
+ **Resolution order** (automatic, no config needed):
2107
+
2108
+ 1. `AGENTDB_MODEL_PATH` env var (user override)
2109
+ 2. Bundled `.rvf` at `dist/models/all-MiniLM-L6-v2.rvf`
2110
+ 3. Existing `@xenova/transformers` cache
2111
+ 4. Network download (fallback)
2112
+
2113
+ ```bash
2114
+ # Build the bundled model .rvf (requires model to be downloaded first)
2115
+ npm run build:model
2116
+
2117
+ # Or specify a custom source directory
2118
+ node scripts/build-model-rvf.mjs --source /path/to/model/files
2119
+ ```
2120
+
2121
+ ```typescript
2122
+ // Programmatic access
2123
+ import { ModelCacheLoader } from "agentdb/model";
2124
+
2125
+ const cached = await ModelCacheLoader.resolve("all-MiniLM-L6-v2");
2126
+ if (cached) {
2127
+ console.log(cached.localPath); // path to extracted model
2128
+ console.log(cached.fromBundle); // true if loaded from .rvf
2129
+ }
2130
+ ```
2131
+
2132
+ Set `AGENTDB_MODEL_PATH` to point to a custom model directory:
2133
+
2134
+ ```bash
2135
+ export AGENTDB_MODEL_PATH=/opt/models
2136
+ # expects: /opt/models/Xenova/all-MiniLM-L6-v2/onnx/model_quantized.onnx
2137
+ ```
2138
+
1922
2139
  ### LLM Router for Multi-Provider Integration
1923
2140
 
1924
2141
  AgentDB can route queries through multiple LLM providers via `@ruvector/ruvllm`:
1925
2142
 
1926
2143
  ```typescript
1927
- import { isRuvLLMInstalled } from 'agentdb/wrappers';
2144
+ import { isRuvLLMInstalled } from "agentdb/wrappers";
1928
2145
 
1929
2146
  if (await isRuvLLMInstalled()) {
1930
2147
  // LLM router available for enrichment and reranking
@@ -2009,34 +2226,38 @@ Multi-database coordination, real-time replication, and production observability
2009
2226
  The `MultiDatabaseCoordinator` enables distributed sync between multiple AgentDB instances with configurable conflict resolution.
2010
2227
 
2011
2228
  ```typescript
2012
- import { MultiDatabaseCoordinator } from 'agentdb/coordination/MultiDatabaseCoordinator';
2229
+ import { MultiDatabaseCoordinator } from "agentdb/coordination/MultiDatabaseCoordinator";
2013
2230
 
2014
2231
  const coordinator = new MultiDatabaseCoordinator({
2015
2232
  replicationFactor: 3,
2016
2233
  syncIntervalMs: 5000,
2017
- conflictResolution: 'merge', // 'last-write-wins' | 'merge' | 'manual'
2234
+ conflictResolution: "merge", // 'last-write-wins' | 'merge' | 'manual'
2018
2235
  autoFailover: true,
2019
2236
  maxRetries: 3,
2020
2237
  });
2021
2238
 
2022
2239
  // Register database instances
2023
2240
  await coordinator.registerInstance({
2024
- id: 'primary',
2025
- url: 'file:///data/primary.rvf',
2026
- role: 'primary',
2241
+ id: "primary",
2242
+ url: "file:///data/primary.rvf",
2243
+ role: "primary",
2027
2244
  });
2028
2245
  await coordinator.registerInstance({
2029
- id: 'replica-1',
2030
- url: 'file:///data/replica-1.rvf',
2031
- role: 'replica',
2246
+ id: "replica-1",
2247
+ url: "file:///data/replica-1.rvf",
2248
+ role: "replica",
2032
2249
  });
2033
2250
 
2034
2251
  // Sync a specific instance
2035
- const result = await coordinator.syncInstance('replica-1');
2252
+ const result = await coordinator.syncInstance("replica-1");
2036
2253
  console.log(`Synced: ${result.recordsSynced}, Conflicts: ${result.conflicts}`);
2037
2254
 
2038
2255
  // Broadcast operations to all instances
2039
- await coordinator.broadcast('insertAsync', ['doc-1', embedding, { source: 'api' }]);
2256
+ await coordinator.broadcast("insertAsync", [
2257
+ "doc-1",
2258
+ embedding,
2259
+ { source: "api" },
2260
+ ]);
2040
2261
 
2041
2262
  // Monitor instance status
2042
2263
  coordinator.onStatusChange((instanceId, status) => {
@@ -2046,11 +2267,11 @@ coordinator.onStatusChange((instanceId, status) => {
2046
2267
 
2047
2268
  ### Conflict Resolution Strategies
2048
2269
 
2049
- | Strategy | Description | Best For |
2050
- | --- | --- | --- |
2051
- | **last-write-wins** | Most recent write wins (LWW) | Simple setups, eventual consistency |
2052
- | **merge** | Quality-based weighted average | Learning systems, federated aggregation |
2053
- | **manual** | Returns conflicts for user resolution | Critical data, compliance requirements |
2270
+ | Strategy | Description | Best For |
2271
+ | ------------------- | ------------------------------------- | --------------------------------------- |
2272
+ | **last-write-wins** | Most recent write wins (LWW) | Simple setups, eventual consistency |
2273
+ | **merge** | Quality-based weighted average | Learning systems, federated aggregation |
2274
+ | **manual** | Returns conflicts for user resolution | Critical data, compliance requirements |
2054
2275
 
2055
2276
  </details>
2056
2277
 
@@ -2066,7 +2287,7 @@ AgentDB supports real-time bidirectional sync between instances using QUIC trans
2066
2287
  QUIC provides multiplexed streams over a single connection with zero head-of-line blocking, connection migration between networks, and 0-RTT session resumption:
2067
2288
 
2068
2289
  ```typescript
2069
- import { QUICServer } from 'agentdb/controllers/QUICServer';
2290
+ import { QUICServer } from "agentdb/controllers/QUICServer";
2070
2291
 
2071
2292
  const server = new QUICServer({
2072
2293
  port: 4433,
@@ -2075,7 +2296,7 @@ const server = new QUICServer({
2075
2296
  requestsPerMin: 1000,
2076
2297
  bytesPerMin: 10_000_000,
2077
2298
  },
2078
- authToken: 'secret', // optional token validation
2299
+ authToken: "secret", // optional token validation
2079
2300
  });
2080
2301
 
2081
2302
  // Stale connections auto-cleaned after 5 minutes idle
@@ -2088,12 +2309,12 @@ const server = new QUICServer({
2088
2309
  High-level bidirectional sync with conflict resolution, progress tracking, and auto-sync:
2089
2310
 
2090
2311
  ```typescript
2091
- import { SyncCoordinator } from 'agentdb/controllers/SyncCoordinator';
2312
+ import { SyncCoordinator } from "agentdb/controllers/SyncCoordinator";
2092
2313
 
2093
2314
  const sync = new SyncCoordinator({
2094
- conflictStrategy: 'latest-wins', // 'local-wins' | 'remote-wins' | 'latest-wins' | 'merge'
2315
+ conflictStrategy: "latest-wins", // 'local-wins' | 'remote-wins' | 'latest-wins' | 'merge'
2095
2316
  batchSize: 100,
2096
- autoSyncInterval: 60000, // Auto-sync every 60 seconds
2317
+ autoSyncInterval: 60000, // Auto-sync every 60 seconds
2097
2318
  });
2098
2319
 
2099
2320
  // Push local changes, pull remote changes, resolve conflicts
@@ -2120,12 +2341,12 @@ await sync.saveSyncState();
2120
2341
 
2121
2342
  ### Conflict Resolution
2122
2343
 
2123
- | Strategy | Behavior |
2124
- | --- | --- |
2125
- | `local-wins` | Local version always kept |
2126
- | `remote-wins` | Remote version always accepted |
2127
- | `latest-wins` | Most recent timestamp wins |
2128
- | `merge` | Quality-weighted merge of both versions |
2344
+ | Strategy | Behavior |
2345
+ | ------------- | --------------------------------------- |
2346
+ | `local-wins` | Local version always kept |
2347
+ | `remote-wins` | Remote version always accepted |
2348
+ | `latest-wins` | Most recent timestamp wins |
2349
+ | `merge` | Quality-weighted merge of both versions |
2129
2350
 
2130
2351
  </details>
2131
2352
 
@@ -2141,11 +2362,11 @@ AgentDB integrates with OpenTelemetry for production monitoring.
2141
2362
  Automatic span creation for search, insert, and sync operations:
2142
2363
 
2143
2364
  ```typescript
2144
- import { initTelemetry } from 'agentdb/observability';
2365
+ import { initTelemetry } from "agentdb/observability";
2145
2366
 
2146
2367
  initTelemetry({
2147
- serviceName: 'my-agent',
2148
- exporterUrl: 'http://localhost:4318', // OTLP HTTP endpoint
2368
+ serviceName: "my-agent",
2369
+ exporterUrl: "http://localhost:4318", // OTLP HTTP endpoint
2149
2370
  });
2150
2371
 
2151
2372
  // All AgentDB operations automatically generate spans:
@@ -2179,25 +2400,25 @@ AgentDB includes a complete reinforcement learning system with 9 algorithms for
2179
2400
 
2180
2401
  ### Available Algorithms
2181
2402
 
2182
- | Algorithm | Type | Best For |
2183
- | --- | --- | --- |
2184
- | **Q-Learning** | Value-based | Simple discrete action spaces |
2185
- | **SARSA** | Value-based | On-policy learning, safer exploration |
2186
- | **Deep Q-Network (DQN)** | Value-based | Complex state spaces with neural function approximation |
2187
- | **Policy Gradient** | Policy-based | Continuous action spaces |
2188
- | **Actor-Critic** | Hybrid | Balances value and policy learning |
2189
- | **PPO** | Policy-based | Stable training with clipped objectives |
2190
- | **Decision Transformer** | Sequence-based | Offline RL from logged trajectories |
2191
- | **Monte Carlo Tree Search** | Planning | Game-like decision trees, look-ahead planning |
2192
- | **Model-Based RL** | Model-based | Sample-efficient learning with world models |
2403
+ | Algorithm | Type | Best For |
2404
+ | --------------------------- | -------------- | ------------------------------------------------------- |
2405
+ | **Q-Learning** | Value-based | Simple discrete action spaces |
2406
+ | **SARSA** | Value-based | On-policy learning, safer exploration |
2407
+ | **Deep Q-Network (DQN)** | Value-based | Complex state spaces with neural function approximation |
2408
+ | **Policy Gradient** | Policy-based | Continuous action spaces |
2409
+ | **Actor-Critic** | Hybrid | Balances value and policy learning |
2410
+ | **PPO** | Policy-based | Stable training with clipped objectives |
2411
+ | **Decision Transformer** | Sequence-based | Offline RL from logged trajectories |
2412
+ | **Monte Carlo Tree Search** | Planning | Game-like decision trees, look-ahead planning |
2413
+ | **Model-Based RL** | Model-based | Sample-efficient learning with world models |
2193
2414
 
2194
2415
  ### Usage
2195
2416
 
2196
2417
  ```typescript
2197
- import { LearningSystem } from 'agentdb';
2418
+ import { LearningSystem } from "agentdb";
2198
2419
 
2199
2420
  const learner = new LearningSystem(db, {
2200
- algorithm: 'ppo', // any of the 9 algorithms
2421
+ algorithm: "ppo", // any of the 9 algorithms
2201
2422
  learningRate: 0.001,
2202
2423
  discountFactor: 0.99,
2203
2424
  explorationRate: 0.1,
@@ -2205,7 +2426,7 @@ const learner = new LearningSystem(db, {
2205
2426
 
2206
2427
  // Start a learning session
2207
2428
  const session = await learner.createSession({
2208
- task: 'optimize_api_responses',
2429
+ task: "optimize_api_responses",
2209
2430
  maxEpisodes: 100,
2210
2431
  });
2211
2432
 
@@ -2226,6 +2447,7 @@ await learner.transfer(sourceSessionId, targetSessionId);
2226
2447
  ### MCP Tools for RL
2227
2448
 
2228
2449
  All 9 algorithms are accessible through MCP tools:
2450
+
2229
2451
  - `agentdb_rl_create_session` — start a new learning session
2230
2452
  - `agentdb_rl_predict` — get next action recommendation
2231
2453
  - `agentdb_rl_record_reward` — record outcome feedback
@@ -2243,30 +2465,30 @@ All 9 algorithms are accessible through MCP tools:
2243
2465
  Combine traditional keyword search (BM25) with vector similarity for retrieval that handles both exact matches and semantic meaning:
2244
2466
 
2245
2467
  ```typescript
2246
- import { createHybridSearch, createKeywordIndex } from 'agentdb';
2468
+ import { createHybridSearch, createKeywordIndex } from "agentdb";
2247
2469
 
2248
2470
  // Create keyword index (BM25)
2249
2471
  const keywordIndex = createKeywordIndex({
2250
- k1: 1.2, // term frequency saturation
2251
- b: 0.75, // document length normalization
2472
+ k1: 1.2, // term frequency saturation
2473
+ b: 0.75, // document length normalization
2252
2474
  avgDocLength: 100,
2253
2475
  });
2254
2476
 
2255
2477
  // Index documents
2256
- keywordIndex.add('doc-1', 'JWT authentication with refresh token rotation');
2257
- keywordIndex.add('doc-2', 'OAuth2 PKCE flow for mobile applications');
2478
+ keywordIndex.add("doc-1", "JWT authentication with refresh token rotation");
2479
+ keywordIndex.add("doc-2", "OAuth2 PKCE flow for mobile applications");
2258
2480
 
2259
2481
  // Create hybrid search (keyword + vector)
2260
2482
  const hybrid = createHybridSearch(keywordIndex, vectorBackend, {
2261
- fusion: 'rrf', // 'rrf' (Reciprocal Rank Fusion) | 'linear' | 'max'
2262
- keywordWeight: 0.3, // 30% keyword, 70% vector
2483
+ fusion: "rrf", // 'rrf' (Reciprocal Rank Fusion) | 'linear' | 'max'
2484
+ keywordWeight: 0.3, // 30% keyword, 70% vector
2263
2485
  vectorWeight: 0.7,
2264
2486
  });
2265
2487
 
2266
2488
  // Search with both keyword and semantic matching
2267
2489
  const results = await hybrid.search({
2268
- text: 'JWT refresh token', // keyword query
2269
- embedding: queryEmbedding, // vector query
2490
+ text: "JWT refresh token", // keyword query
2491
+ embedding: queryEmbedding, // vector query
2270
2492
  k: 10,
2271
2493
  });
2272
2494
  // Results fused from both sources — exact term matches + semantic similarity
@@ -2274,11 +2496,11 @@ const results = await hybrid.search({
2274
2496
 
2275
2497
  ### Fusion Strategies
2276
2498
 
2277
- | Strategy | How it works | Best For |
2278
- | --- | --- | --- |
2279
- | **RRF** (default) | `1/(k + rank)` — rank-based fusion, no score calibration needed | General use |
2280
- | **Linear** | `α × keyword_score + β × vector_score` — weighted score combination | When you know the right balance |
2281
- | **Max** | `max(keyword_score, vector_score)` — takes highest signal | When either source is sufficient |
2499
+ | Strategy | How it works | Best For |
2500
+ | ----------------- | ------------------------------------------------------------------- | -------------------------------- |
2501
+ | **RRF** (default) | `1/(k + rank)` — rank-based fusion, no score calibration needed | General use |
2502
+ | **Linear** | `α × keyword_score + β × vector_score` — weighted score combination | When you know the right balance |
2503
+ | **Max** | `max(keyword_score, vector_score)` — takes highest signal | When either source is sufficient |
2282
2504
 
2283
2505
  > **When to use hybrid search:** When your data contains domain-specific terms (function names, error codes, product IDs) that vector embeddings might miss, but you also want semantic understanding for natural language queries.
2284
2506
 
@@ -2292,26 +2514,26 @@ const results = await hybrid.search({
2292
2514
  AgentDB can route LLM queries to the optimal provider based on your constraints:
2293
2515
 
2294
2516
  ```typescript
2295
- import { LLMRouter } from 'agentdb';
2517
+ import { LLMRouter } from "agentdb";
2296
2518
 
2297
2519
  const router = new LLMRouter({
2298
2520
  providers: {
2299
- ruvllm: { enabled: true }, // Local, SIMD-optimized, free
2300
- openrouter: { apiKey: process.env.OPENROUTER_KEY }, // 200+ models, 99% cost savings
2301
- gemini: { apiKey: process.env.GEMINI_KEY }, // Free tier available
2302
- anthropic: { apiKey: process.env.ANTHROPIC_KEY }, // Claude models
2303
- onnx: { enabled: true }, // Local models via transformers.js
2521
+ ruvllm: { enabled: true }, // Local, SIMD-optimized, free
2522
+ openrouter: { apiKey: process.env.OPENROUTER_KEY }, // 200+ models, 99% cost savings
2523
+ gemini: { apiKey: process.env.GEMINI_KEY }, // Free tier available
2524
+ anthropic: { apiKey: process.env.ANTHROPIC_KEY }, // Claude models
2525
+ onnx: { enabled: true }, // Local models via transformers.js
2304
2526
  },
2305
- strategy: 'auto', // auto-selects based on constraints below
2527
+ strategy: "auto", // auto-selects based on constraints below
2306
2528
  constraints: {
2307
- maxCostPerQuery: 0.001, // max $0.001 per query
2308
- minQuality: 0.8, // minimum quality score
2309
- preferLocal: true, // prefer local models when possible
2310
- requirePrivacy: false, // if true, only uses local providers
2529
+ maxCostPerQuery: 0.001, // max $0.001 per query
2530
+ minQuality: 0.8, // minimum quality score
2531
+ preferLocal: true, // prefer local models when possible
2532
+ requirePrivacy: false, // if true, only uses local providers
2311
2533
  },
2312
2534
  });
2313
2535
 
2314
- const response = await router.generate('Summarize this document...', {
2536
+ const response = await router.generate("Summarize this document...", {
2315
2537
  maxTokens: 500,
2316
2538
  temperature: 0.7,
2317
2539
  });
@@ -2319,17 +2541,17 @@ const response = await router.generate('Summarize this document...', {
2319
2541
 
2320
2542
  ### Provider Comparison
2321
2543
 
2322
- | Provider | Latency | Cost | Privacy | Models |
2323
- | --- | --- | --- | --- | --- |
2324
- | **RuvLLM** | Fastest | Free | Full (local) | SIMD-optimized local models |
2325
- | **ONNX** | Fast | Free | Full (local) | transformers.js models |
2326
- | **OpenRouter** | ~500ms | $0.0001+ | Cloud | 200+ models (GPT-4, Claude, Llama, etc.) |
2327
- | **Gemini** | ~300ms | Free tier | Cloud | Gemini Pro, Flash |
2328
- | **Anthropic** | ~1s | $0.003+ | Cloud | Claude Opus, Sonnet, Haiku |
2544
+ | Provider | Latency | Cost | Privacy | Models |
2545
+ | -------------- | ------- | --------- | ------------ | ---------------------------------------- |
2546
+ | **RuvLLM** | Fastest | Free | Full (local) | SIMD-optimized local models |
2547
+ | **ONNX** | Fast | Free | Full (local) | transformers.js models |
2548
+ | **OpenRouter** | ~500ms | $0.0001+ | Cloud | 200+ models (GPT-4, Claude, Llama, etc.) |
2549
+ | **Gemini** | ~300ms | Free tier | Cloud | Gemini Pro, Flash |
2550
+ | **Anthropic** | ~1s | $0.003+ | Cloud | Claude Opus, Sonnet, Haiku |
2329
2551
 
2330
2552
  ```typescript
2331
2553
  // Check what's available locally
2332
- import { isRuvLLMInstalled } from 'agentdb';
2554
+ import { isRuvLLMInstalled } from "agentdb";
2333
2555
  if (await isRuvLLMInstalled()) {
2334
2556
  // Local inference available — no API keys needed
2335
2557
  }
@@ -2347,18 +2569,18 @@ Enterprise-ready authentication and audit logging for production deployments.
2347
2569
  ### Authentication
2348
2570
 
2349
2571
  ```typescript
2350
- import { AuthService } from 'agentdb/services/auth';
2572
+ import { AuthService } from "agentdb/services/auth";
2351
2573
 
2352
2574
  const auth = new AuthService(db, {
2353
2575
  jwtSecret: process.env.JWT_SECRET,
2354
- accessTokenTTL: '15m',
2355
- refreshTokenTTL: '7d',
2356
- maxLoginAttempts: 5, // account lockout after 5 failures
2357
- lockoutDuration: '30m',
2576
+ accessTokenTTL: "15m",
2577
+ refreshTokenTTL: "7d",
2578
+ maxLoginAttempts: 5, // account lockout after 5 failures
2579
+ lockoutDuration: "30m",
2358
2580
  });
2359
2581
 
2360
2582
  // User registration (Argon2id password hashing)
2361
- const user = await auth.register({ email, password, role: 'user' });
2583
+ const user = await auth.register({ email, password, role: "user" });
2362
2584
 
2363
2585
  // Login — returns access + refresh token pair
2364
2586
  const { accessToken, refreshToken } = await auth.login(email, password);
@@ -2367,19 +2589,22 @@ const { accessToken, refreshToken } = await auth.login(email, password);
2367
2589
  const payload = await auth.verifyAccessToken(accessToken);
2368
2590
 
2369
2591
  // API key management
2370
- const apiKey = await auth.generateApiKey(userId, { name: 'prod-key', scopes: ['read', 'write'] });
2371
- await auth.rotateApiKey(apiKey.id); // automatic rotation
2592
+ const apiKey = await auth.generateApiKey(userId, {
2593
+ name: "prod-key",
2594
+ scopes: ["read", "write"],
2595
+ });
2596
+ await auth.rotateApiKey(apiKey.id); // automatic rotation
2372
2597
  ```
2373
2598
 
2374
2599
  ### Audit Logging
2375
2600
 
2376
2601
  ```typescript
2377
- import { AuditLogger } from 'agentdb/services/audit-logger';
2602
+ import { AuditLogger } from "agentdb/services/audit-logger";
2378
2603
 
2379
2604
  const audit = new AuditLogger({
2380
- retention: '90d', // log retention period
2381
- compliance: ['SOC2', 'GDPR'], // compliance frameworks
2382
- autoRotate: true, // automatic log rotation
2605
+ retention: "90d", // log retention period
2606
+ compliance: ["SOC2", "GDPR"], // compliance frameworks
2607
+ autoRotate: true, // automatic log rotation
2383
2608
  });
2384
2609
 
2385
2610
  // 13 audit event types tracked automatically:
@@ -2393,11 +2618,15 @@ const audit = new AuditLogger({
2393
2618
  ### Security Utilities
2394
2619
 
2395
2620
  ```typescript
2396
- import { hashPassword, verifyPassword, generateApiKey } from 'agentdb/utils/crypto';
2621
+ import {
2622
+ hashPassword,
2623
+ verifyPassword,
2624
+ generateApiKey,
2625
+ } from "agentdb/utils/crypto";
2397
2626
 
2398
- const hash = await hashPassword('user-password'); // Argon2id
2399
- const valid = await verifyPassword('user-password', hash);
2400
- const key = generateApiKey(); // cryptographically random
2627
+ const hash = await hashPassword("user-password"); // Argon2id
2628
+ const valid = await verifyPassword("user-password", hash);
2629
+ const key = generateApiKey(); // cryptographically random
2401
2630
  ```
2402
2631
 
2403
2632
  </details>
@@ -2410,40 +2639,40 @@ const key = generateApiKey(); // cryptographically ran
2410
2639
  Filter search results and database queries using MongoDB-style operators:
2411
2640
 
2412
2641
  ```typescript
2413
- import { MetadataFilter } from 'agentdb';
2642
+ import { MetadataFilter } from "agentdb";
2414
2643
 
2415
2644
  const filter = new MetadataFilter();
2416
2645
 
2417
2646
  // Episodes with reward > 0.8 and specific tags
2418
2647
  const episodes = await filter.filterEpisodes(db, {
2419
2648
  reward: { $gt: 0.8 },
2420
- tags: { $contains: 'security' },
2421
- status: { $in: ['success', 'partial'] },
2649
+ tags: { $contains: "security" },
2650
+ status: { $in: ["success", "partial"] },
2422
2651
  archived: { $exists: false },
2423
2652
  });
2424
2653
 
2425
2654
  // Patterns matching complex criteria
2426
2655
  const patterns = await filter.filterPatterns(db, {
2427
2656
  successRate: { $gte: 0.7, $lte: 1.0 },
2428
- taskType: { $ne: 'deprecated' },
2657
+ taskType: { $ne: "deprecated" },
2429
2658
  createdAt: { $gt: lastWeekTimestamp },
2430
2659
  });
2431
2660
  ```
2432
2661
 
2433
2662
  ### Supported Operators
2434
2663
 
2435
- | Operator | Description | Example |
2436
- | --- | --- | --- |
2437
- | `$eq` | Equal | `{ status: { $eq: 'active' } }` |
2438
- | `$ne` | Not equal | `{ role: { $ne: 'admin' } }` |
2439
- | `$gt` | Greater than | `{ reward: { $gt: 0.5 } }` |
2440
- | `$gte` | Greater than or equal | `{ score: { $gte: 0.8 } }` |
2441
- | `$lt` | Less than | `{ age: { $lt: 90 } }` |
2442
- | `$lte` | Less than or equal | `{ priority: { $lte: 3 } }` |
2443
- | `$in` | In array | `{ type: { $in: ['a', 'b'] } }` |
2444
- | `$nin` | Not in array | `{ status: { $nin: ['deleted'] } }` |
2445
- | `$contains` | Contains substring | `{ tags: { $contains: 'auth' } }` |
2446
- | `$exists` | Field exists | `{ metadata: { $exists: true } }` |
2664
+ | Operator | Description | Example |
2665
+ | ----------- | --------------------- | ----------------------------------- |
2666
+ | `$eq` | Equal | `{ status: { $eq: 'active' } }` |
2667
+ | `$ne` | Not equal | `{ role: { $ne: 'admin' } }` |
2668
+ | `$gt` | Greater than | `{ reward: { $gt: 0.5 } }` |
2669
+ | `$gte` | Greater than or equal | `{ score: { $gte: 0.8 } }` |
2670
+ | `$lt` | Less than | `{ age: { $lt: 90 } }` |
2671
+ | `$lte` | Less than or equal | `{ priority: { $lte: 3 } }` |
2672
+ | `$in` | In array | `{ type: { $in: ['a', 'b'] } }` |
2673
+ | `$nin` | Not in array | `{ status: { $nin: ['deleted'] } }` |
2674
+ | `$contains` | Contains substring | `{ tags: { $contains: 'auth' } }` |
2675
+ | `$exists` | Field exists | `{ metadata: { $exists: true } }` |
2447
2676
 
2448
2677
  </details>
2449
2678
 
@@ -2455,16 +2684,16 @@ const patterns = await filter.filterPatterns(db, {
2455
2684
  The `AgentDBFast` wrapper provides direct programmatic access that's 50-200x faster than going through the CLI:
2456
2685
 
2457
2686
  ```typescript
2458
- import { createFastAgentDB } from 'agentdb/wrappers/agentdb-fast';
2687
+ import { createFastAgentDB } from "agentdb/wrappers/agentdb-fast";
2459
2688
 
2460
2689
  const db = await createFastAgentDB({
2461
- path: './agent-memory.db',
2690
+ path: "./agent-memory.db",
2462
2691
  dimension: 384,
2463
- model: 'Xenova/all-MiniLM-L6-v2',
2692
+ model: "Xenova/all-MiniLM-L6-v2",
2464
2693
  });
2465
2694
 
2466
2695
  // All operations bypass CLI parsing overhead
2467
- await db.insert('doc-1', embedding, metadata);
2696
+ await db.insert("doc-1", embedding, metadata);
2468
2697
  const results = await db.search(queryEmbedding, 10);
2469
2698
  await db.batchInsert(documents);
2470
2699
 
@@ -2477,11 +2706,11 @@ await db.batchInsert(documents);
2477
2706
 
2478
2707
  ### Wrapper Performance vs CLI
2479
2708
 
2480
- | Operation | CLI | AgentDBFast | Speedup |
2481
- | --- | --- | --- | --- |
2482
- | Single insert | ~20ms | ~0.1ms | 200x |
2483
- | Search (k=10) | ~15ms | ~0.08ms | 187x |
2484
- | Batch insert (100) | ~500ms | ~10ms | 50x |
2709
+ | Operation | CLI | AgentDBFast | Speedup |
2710
+ | ------------------ | ------ | ----------- | ------- |
2711
+ | Single insert | ~20ms | ~0.1ms | 200x |
2712
+ | Search (k=10) | ~15ms | ~0.08ms | 187x |
2713
+ | Batch insert (100) | ~500ms | ~10ms | 50x |
2485
2714
 
2486
2715
  ### Attention Wrappers
2487
2716
 
@@ -2494,7 +2723,7 @@ import {
2494
2723
  LinearAttention,
2495
2724
  HyperbolicAttention,
2496
2725
  MoEAttention,
2497
- } from 'agentdb/wrappers';
2726
+ } from "agentdb/wrappers";
2498
2727
 
2499
2728
  // Flash Attention — O(N) memory instead of O(N^2)
2500
2729
  const flash = new FlashAttention({ numHeads: 8 });
@@ -2514,13 +2743,15 @@ import {
2514
2743
  OpenAIEmbeddingService,
2515
2744
  TransformersEmbeddingService,
2516
2745
  MockEmbeddingService,
2517
- } from 'agentdb/wrappers';
2746
+ } from "agentdb/wrappers";
2518
2747
 
2519
2748
  // OpenAI (cloud)
2520
2749
  const openai = new OpenAIEmbeddingService({ apiKey: process.env.OPENAI_KEY });
2521
2750
 
2522
2751
  // Transformers.js (local, free)
2523
- const local = new TransformersEmbeddingService({ model: 'Xenova/all-MiniLM-L6-v2' });
2752
+ const local = new TransformersEmbeddingService({
2753
+ model: "Xenova/all-MiniLM-L6-v2",
2754
+ });
2524
2755
 
2525
2756
  // Mock (testing)
2526
2757
  const mock = new MockEmbeddingService({ dimension: 384 });
@@ -2536,7 +2767,7 @@ const mock = new MockEmbeddingService({ dimension: 384 });
2536
2767
  Run performance benchmarks to validate your deployment:
2537
2768
 
2538
2769
  ```typescript
2539
- import { BenchmarkSuite, runBenchmarks, formatReportAsMarkdown } from 'agentdb';
2770
+ import { BenchmarkSuite, runBenchmarks, formatReportAsMarkdown } from "agentdb";
2540
2771
 
2541
2772
  // Run all built-in benchmarks
2542
2773
  const report = await runBenchmarks({
@@ -2550,25 +2781,31 @@ console.log(formatReportAsMarkdown(report));
2550
2781
 
2551
2782
  ### Built-in Benchmarks
2552
2783
 
2553
- | Benchmark | Measures | Key Metrics |
2554
- | --- | --- | --- |
2555
- | **VectorInsertBenchmark** | Insert throughput | ops/sec, p50/p99 latency |
2556
- | **VectorSearchBenchmark** | Search performance | ops/sec, recall@k, latency distribution |
2557
- | **MemoryUsageBenchmark** | RAM consumption | bytes per vector, total footprint |
2558
- | **ConcurrencyBenchmark** | Parallel performance | throughput under load, contention |
2559
- | **QuantizationBenchmark** | Compression tradeoffs | quality loss vs memory savings |
2784
+ | Benchmark | Measures | Key Metrics |
2785
+ | ------------------------- | --------------------- | --------------------------------------- |
2786
+ | **VectorInsertBenchmark** | Insert throughput | ops/sec, p50/p99 latency |
2787
+ | **VectorSearchBenchmark** | Search performance | ops/sec, recall@k, latency distribution |
2788
+ | **MemoryUsageBenchmark** | RAM consumption | bytes per vector, total footprint |
2789
+ | **ConcurrencyBenchmark** | Parallel performance | throughput under load, contention |
2790
+ | **QuantizationBenchmark** | Compression tradeoffs | quality loss vs memory savings |
2560
2791
 
2561
2792
  ### Custom Benchmarks
2562
2793
 
2563
2794
  ```typescript
2564
- import { Benchmark, BenchmarkSuite } from 'agentdb';
2795
+ import { Benchmark, BenchmarkSuite } from "agentdb";
2565
2796
 
2566
2797
  class MyBenchmark extends Benchmark {
2567
- name = 'my-custom-benchmark';
2798
+ name = "my-custom-benchmark";
2568
2799
 
2569
- async setup() { /* prepare data */ }
2570
- async run() { /* measure this */ }
2571
- async teardown() { /* cleanup */ }
2800
+ async setup() {
2801
+ /* prepare data */
2802
+ }
2803
+ async run() {
2804
+ /* measure this */
2805
+ }
2806
+ async teardown() {
2807
+ /* cleanup */
2808
+ }
2572
2809
  }
2573
2810
 
2574
2811
  const suite = new BenchmarkSuite();
@@ -2576,7 +2813,7 @@ suite.add(new MyBenchmark());
2576
2813
  const report = await suite.run({ iterations: 50 });
2577
2814
 
2578
2815
  // Compare reports across runs
2579
- import { formatComparisonAsMarkdown } from 'agentdb';
2816
+ import { formatComparisonAsMarkdown } from "agentdb";
2580
2817
  console.log(formatComparisonAsMarkdown(reportBefore, reportAfter));
2581
2818
  ```
2582
2819
 
@@ -2613,13 +2850,13 @@ npm run test:ci # CI pipeline: browser tests + build + bundle v
2613
2850
 
2614
2851
  ### What's Tested
2615
2852
 
2616
- | Suite | Coverage | What it validates |
2617
- | --- | --- | --- |
2618
- | **Unit tests** | Core controllers, memory patterns, embedding service, quantization | All 6 cognitive memory patterns, 9 RL algorithms, filter expressions, security validators |
2619
- | **Browser tests** | WASM store, attention mechanisms, product quantization, SIMD fallbacks | Full vector DB in browser, Flash/Hyperbolic/MoE attention, PQ8/PQ16/PQ32 compression |
2620
- | **Integration tests** | End-to-end flows, backend auto-selection, MCP tool execution | Self-learning pipeline, Cognitive Container operations, federated aggregation |
2621
- | **Performance tests** | Latency benchmarks, throughput, scaling behavior | 61us search target, 32.6M ops/sec pattern search, batch insert speedup |
2622
- | **Security tests** | Input validation, injection prevention, witness chain verification | XSS patterns, SQL injection, path traversal, Cypher sanitization, SHAKE-256 |
2853
+ | Suite | Coverage | What it validates |
2854
+ | --------------------- | ---------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
2855
+ | **Unit tests** | Core controllers, memory patterns, embedding service, quantization | All 6 cognitive memory patterns, 9 RL algorithms, filter expressions, security validators |
2856
+ | **Browser tests** | WASM store, attention mechanisms, product quantization, SIMD fallbacks | Full vector DB in browser, Flash/Hyperbolic/MoE attention, PQ8/PQ16/PQ32 compression |
2857
+ | **Integration tests** | End-to-end flows, backend auto-selection, MCP tool execution | Self-learning pipeline, Cognitive Container operations, federated aggregation |
2858
+ | **Performance tests** | Latency benchmarks, throughput, scaling behavior | 61us search target, 32.6M ops/sec pattern search, batch insert speedup |
2859
+ | **Security tests** | Input validation, injection prevention, witness chain verification | XSS patterns, SQL injection, path traversal, Cypher sanitization, SHAKE-256 |
2623
2860
 
2624
2861
  ### Benchmarks
2625
2862
 
@@ -2635,6 +2872,7 @@ npm run benchmark:all # Run everything
2635
2872
  ### CI Pipeline
2636
2873
 
2637
2874
  The CI pipeline runs `test:ci` which executes:
2875
+
2638
2876
  1. **Browser bundle tests** — verifies WASM and JS fallbacks work
2639
2877
  2. **TypeScript build** — full `tsc` compilation
2640
2878
  3. **Bundle verification** — ensures all export paths resolve correctly
@@ -2642,19 +2880,23 @@ The CI pipeline runs `test:ci` which executes:
2642
2880
  ### Writing Custom Tests
2643
2881
 
2644
2882
  ```typescript
2645
- import { describe, it, expect } from 'vitest';
2646
- import { createDatabase, ReasoningBank, EmbeddingService } from 'agentdb';
2883
+ import { describe, it, expect } from "vitest";
2884
+ import { createDatabase, ReasoningBank, EmbeddingService } from "agentdb";
2647
2885
 
2648
- describe('My Agent Memory', () => {
2649
- it('stores and retrieves patterns', async () => {
2650
- const db = await createDatabase(':memory:');
2651
- const embedder = new EmbeddingService({ model: 'Xenova/all-MiniLM-L6-v2' });
2886
+ describe("My Agent Memory", () => {
2887
+ it("stores and retrieves patterns", async () => {
2888
+ const db = await createDatabase(":memory:");
2889
+ const embedder = new EmbeddingService({ model: "Xenova/all-MiniLM-L6-v2" });
2652
2890
  await embedder.initialize();
2653
2891
 
2654
2892
  const bank = new ReasoningBank(db, embedder);
2655
- await bank.storePattern({ taskType: 'test', approach: 'TDD', successRate: 0.95 });
2893
+ await bank.storePattern({
2894
+ taskType: "test",
2895
+ approach: "TDD",
2896
+ successRate: 0.95,
2897
+ });
2656
2898
 
2657
- const results = await bank.searchPatterns({ task: 'testing', k: 5 });
2899
+ const results = await bank.searchPatterns({ task: "testing", k: 5 });
2658
2900
  expect(results.length).toBeGreaterThan(0);
2659
2901
  });
2660
2902
  });
@@ -2666,13 +2908,13 @@ describe('My Agent Memory', () => {
2666
2908
 
2667
2909
  ## Documentation
2668
2910
 
2669
- | Document | Description |
2670
- | --- | --- |
2671
- | [MCP Tool Optimization Guide](docs/guides/) | Comprehensive MCP patterns |
2672
- | [Embedding Models Guide](docs/guides/) | Model selection and benchmarks |
2673
- | [Simulation System](simulation/README.md) | 31 scenarios, interactive wizard |
2674
- | [Security Hardening](docs/guides/) | Input validation and security patterns |
2675
- | [Chat Ecosystem](../agentdb-chat/README.md) | `@agentdb/chat` integration guide |
2911
+ | Document | Description |
2912
+ | ------------------------------------------------------------------------------------ | ------------------------------------------ |
2913
+ | [MCP Tool Optimization Guide](docs/guides/) | Comprehensive MCP patterns |
2914
+ | [Embedding Models Guide](docs/guides/) | Model selection and benchmarks |
2915
+ | [Simulation System](simulation/README.md) | 31 scenarios, interactive wizard |
2916
+ | [Security Hardening](docs/guides/) | Input validation and security patterns |
2917
+ | [Chat Ecosystem](../agentdb-chat/README.md) | `@agentdb/chat` integration guide |
2676
2918
  | [ADR-010: Solver Integration](docs/adrs/ADR-010-rvf-solver-v014-deep-integration.md) | SolverBandit + rvf-solver deep integration |
2677
2919
 
2678
2920
  ---