agentdb 1.6.1 โ 2.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1098 -350
- package/dist/agentdb-advanced.js +2110 -0
- package/dist/agentdb-advanced.min.js +1 -0
- package/dist/agentdb.min.js +4 -4
- package/dist/backends/GraphBackend.d.ts +196 -0
- package/dist/backends/GraphBackend.d.ts.map +1 -0
- package/dist/backends/GraphBackend.js +33 -0
- package/dist/backends/GraphBackend.js.map +1 -0
- package/dist/backends/LearningBackend.d.ts +148 -0
- package/dist/backends/LearningBackend.d.ts.map +1 -0
- package/dist/backends/LearningBackend.js +27 -0
- package/dist/backends/LearningBackend.js.map +1 -0
- package/dist/backends/VectorBackend.d.ts +119 -0
- package/dist/backends/VectorBackend.d.ts.map +1 -0
- package/dist/backends/VectorBackend.js +14 -0
- package/dist/backends/VectorBackend.js.map +1 -0
- package/dist/backends/detector.d.ts +81 -0
- package/dist/backends/detector.d.ts.map +1 -0
- package/dist/backends/detector.js +192 -0
- package/dist/backends/detector.js.map +1 -0
- package/dist/backends/factory.d.ts +50 -0
- package/dist/backends/factory.d.ts.map +1 -0
- package/dist/backends/factory.js +161 -0
- package/dist/backends/factory.js.map +1 -0
- package/dist/backends/graph/GraphDatabaseAdapter.d.ts +139 -0
- package/dist/backends/graph/GraphDatabaseAdapter.d.ts.map +1 -0
- package/dist/backends/graph/GraphDatabaseAdapter.js +194 -0
- package/dist/backends/graph/GraphDatabaseAdapter.js.map +1 -0
- package/dist/backends/hnswlib/HNSWLibBackend.d.ts +92 -0
- package/dist/backends/hnswlib/HNSWLibBackend.d.ts.map +1 -0
- package/dist/backends/hnswlib/HNSWLibBackend.js +316 -0
- package/dist/backends/hnswlib/HNSWLibBackend.js.map +1 -0
- package/dist/backends/hnswlib/index.d.ts +7 -0
- package/dist/backends/hnswlib/index.d.ts.map +1 -0
- package/dist/backends/hnswlib/index.js +7 -0
- package/dist/backends/hnswlib/index.js.map +1 -0
- package/dist/backends/index.d.ts +14 -0
- package/dist/backends/index.d.ts.map +1 -0
- package/dist/backends/index.js +13 -0
- package/dist/backends/index.js.map +1 -0
- package/dist/backends/ruvector/RuVectorBackend.d.ts +75 -0
- package/dist/backends/ruvector/RuVectorBackend.d.ts.map +1 -0
- package/dist/backends/ruvector/RuVectorBackend.js +198 -0
- package/dist/backends/ruvector/RuVectorBackend.js.map +1 -0
- package/dist/backends/ruvector/RuVectorLearning.d.ts +104 -0
- package/dist/backends/ruvector/RuVectorLearning.d.ts.map +1 -0
- package/dist/backends/ruvector/RuVectorLearning.js +177 -0
- package/dist/backends/ruvector/RuVectorLearning.js.map +1 -0
- package/dist/backends/ruvector/index.d.ts +9 -0
- package/dist/backends/ruvector/index.d.ts.map +1 -0
- package/dist/backends/ruvector/index.js +8 -0
- package/dist/backends/ruvector/index.js.map +1 -0
- package/dist/browser/AdvancedFeatures.d.ts +144 -0
- package/dist/browser/AdvancedFeatures.d.ts.map +1 -0
- package/dist/browser/AdvancedFeatures.js +430 -0
- package/dist/browser/AdvancedFeatures.js.map +1 -0
- package/dist/browser/HNSWIndex.d.ts +117 -0
- package/dist/browser/HNSWIndex.d.ts.map +1 -0
- package/dist/browser/HNSWIndex.js +402 -0
- package/dist/browser/HNSWIndex.js.map +1 -0
- package/dist/browser/ProductQuantization.d.ts +107 -0
- package/dist/browser/ProductQuantization.d.ts.map +1 -0
- package/dist/browser/ProductQuantization.js +337 -0
- package/dist/browser/ProductQuantization.js.map +1 -0
- package/dist/browser/browser/AdvancedFeatures.d.ts +144 -0
- package/dist/browser/browser/AdvancedFeatures.d.ts.map +1 -0
- package/dist/browser/browser/AdvancedFeatures.js +427 -0
- package/dist/browser/browser/HNSWIndex.d.ts +117 -0
- package/dist/browser/browser/HNSWIndex.d.ts.map +1 -0
- package/dist/browser/browser/HNSWIndex.js +402 -0
- package/dist/browser/browser/ProductQuantization.d.ts +107 -0
- package/dist/browser/browser/ProductQuantization.d.ts.map +1 -0
- package/dist/browser/browser/ProductQuantization.js +348 -0
- package/dist/browser/browser/index.d.ts +223 -0
- package/dist/browser/browser/index.d.ts.map +1 -0
- package/dist/browser/browser/index.js +233 -0
- package/dist/browser/index.d.ts +223 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +225 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/cli/agentdb-cli.d.ts.map +1 -1
- package/dist/cli/agentdb-cli.js +130 -8
- package/dist/cli/agentdb-cli.js.map +1 -1
- package/dist/cli/agentdb.db +0 -0
- package/dist/cli/commands/init.d.ts +12 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +115 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/install-embeddings.d.ts +10 -0
- package/dist/cli/commands/install-embeddings.d.ts.map +1 -0
- package/dist/cli/commands/install-embeddings.js +68 -0
- package/dist/cli/commands/install-embeddings.js.map +1 -0
- package/dist/cli/commands/migrate.d.ts +15 -0
- package/dist/cli/commands/migrate.d.ts.map +1 -0
- package/dist/cli/commands/migrate.js +425 -0
- package/dist/cli/commands/migrate.js.map +1 -0
- package/dist/cli/commands/status.d.ts +10 -0
- package/dist/cli/commands/status.d.ts.map +1 -0
- package/dist/cli/commands/status.js +129 -0
- package/dist/cli/commands/status.js.map +1 -0
- package/dist/controllers/CausalRecall.d.ts +3 -1
- package/dist/controllers/CausalRecall.d.ts.map +1 -1
- package/dist/controllers/CausalRecall.js +35 -4
- package/dist/controllers/CausalRecall.js.map +1 -1
- package/dist/controllers/ExplainableRecall.d.ts +24 -0
- package/dist/controllers/ExplainableRecall.d.ts.map +1 -1
- package/dist/controllers/ExplainableRecall.js +102 -5
- package/dist/controllers/ExplainableRecall.js.map +1 -1
- package/dist/controllers/NightlyLearner.d.ts.map +1 -1
- package/dist/controllers/NightlyLearner.js +7 -4
- package/dist/controllers/NightlyLearner.js.map +1 -1
- package/dist/controllers/ReasoningBank.d.ts +101 -2
- package/dist/controllers/ReasoningBank.d.ts.map +1 -1
- package/dist/controllers/ReasoningBank.js +196 -4
- package/dist/controllers/ReasoningBank.js.map +1 -1
- package/dist/controllers/ReflexionMemory.d.ts +41 -1
- package/dist/controllers/ReflexionMemory.d.ts.map +1 -1
- package/dist/controllers/ReflexionMemory.js +282 -5
- package/dist/controllers/ReflexionMemory.js.map +1 -1
- package/dist/controllers/SkillLibrary.d.ts +27 -9
- package/dist/controllers/SkillLibrary.d.ts.map +1 -1
- package/dist/controllers/SkillLibrary.js +136 -47
- package/dist/controllers/SkillLibrary.js.map +1 -1
- package/dist/db-fallback.d.ts.map +1 -1
- package/dist/db-fallback.js +100 -29
- package/dist/db-fallback.js.map +1 -1
- package/dist/db-test.d.ts +13 -0
- package/dist/db-test.d.ts.map +1 -0
- package/dist/db-test.js +55 -0
- package/dist/db-test.js.map +1 -0
- package/dist/db-unified.d.ts +76 -0
- package/dist/db-unified.d.ts.map +1 -0
- package/dist/db-unified.js +278 -0
- package/dist/db-unified.js.map +1 -0
- package/dist/malp/core/ccc.d.ts +99 -0
- package/dist/malp/core/ccc.d.ts.map +1 -0
- package/dist/malp/core/ccc.js +181 -0
- package/dist/malp/core/ccc.js.map +1 -0
- package/dist/malp/core/index.d.ts +9 -0
- package/dist/malp/core/index.d.ts.map +1 -0
- package/dist/malp/core/index.js +9 -0
- package/dist/malp/core/index.js.map +1 -0
- package/dist/malp/core/linalg.d.ts +101 -0
- package/dist/malp/core/linalg.d.ts.map +1 -0
- package/dist/malp/core/linalg.js +278 -0
- package/dist/malp/core/linalg.js.map +1 -0
- package/dist/malp/core/optimizer.d.ts +68 -0
- package/dist/malp/core/optimizer.d.ts.map +1 -0
- package/dist/malp/core/optimizer.js +160 -0
- package/dist/malp/core/optimizer.js.map +1 -0
- package/dist/malp/index.d.ts +33 -0
- package/dist/malp/index.d.ts.map +1 -0
- package/dist/malp/index.js +37 -0
- package/dist/malp/index.js.map +1 -0
- package/dist/malp/metrics/agreement.d.ts +106 -0
- package/dist/malp/metrics/agreement.d.ts.map +1 -0
- package/dist/malp/metrics/agreement.js +199 -0
- package/dist/malp/metrics/agreement.js.map +1 -0
- package/dist/malp/metrics/comparison.d.ts +93 -0
- package/dist/malp/metrics/comparison.d.ts.map +1 -0
- package/dist/malp/metrics/comparison.js +256 -0
- package/dist/malp/metrics/comparison.js.map +1 -0
- package/dist/malp/metrics/index.d.ts +8 -0
- package/dist/malp/metrics/index.d.ts.map +1 -0
- package/dist/malp/metrics/index.js +8 -0
- package/dist/malp/metrics/index.js.map +1 -0
- package/dist/malp/metrics/performance.d.ts +61 -0
- package/dist/malp/metrics/performance.d.ts.map +1 -0
- package/dist/malp/metrics/performance.js +190 -0
- package/dist/malp/metrics/performance.js.map +1 -0
- package/dist/malp/models/index.d.ts +7 -0
- package/dist/malp/models/index.d.ts.map +1 -0
- package/dist/malp/models/index.js +7 -0
- package/dist/malp/models/index.js.map +1 -0
- package/dist/malp/models/malp.d.ts +116 -0
- package/dist/malp/models/malp.d.ts.map +1 -0
- package/dist/malp/models/malp.js +206 -0
- package/dist/malp/models/malp.js.map +1 -0
- package/dist/malp/models/regressor.d.ts +80 -0
- package/dist/malp/models/regressor.d.ts.map +1 -0
- package/dist/malp/models/regressor.js +229 -0
- package/dist/malp/models/regressor.js.map +1 -0
- package/dist/malp/reasoningbank_validator.d.ts +187 -0
- package/dist/malp/reasoningbank_validator.d.ts.map +1 -0
- package/dist/malp/reasoningbank_validator.js +246 -0
- package/dist/malp/reasoningbank_validator.js.map +1 -0
- package/dist/malp/wasm_bindings.d.ts +344 -0
- package/dist/malp/wasm_bindings.d.ts.map +1 -0
- package/dist/malp/wasm_bindings.js +9 -0
- package/dist/malp/wasm_bindings.js.map +1 -0
- package/dist/mcp/agentdb-mcp-server.js +512 -33
- package/dist/mcp/agentdb-mcp-server.js.map +1 -1
- package/dist/optimizations/BatchOperations.d.ts +42 -0
- package/dist/optimizations/BatchOperations.d.ts.map +1 -1
- package/dist/optimizations/BatchOperations.js +181 -0
- package/dist/optimizations/BatchOperations.js.map +1 -1
- package/dist/optimizations/ToolCache.d.ts +137 -0
- package/dist/optimizations/ToolCache.d.ts.map +1 -0
- package/dist/optimizations/ToolCache.js +281 -0
- package/dist/optimizations/ToolCache.js.map +1 -0
- package/dist/security/input-validation.d.ts +24 -0
- package/dist/security/input-validation.d.ts.map +1 -1
- package/dist/security/input-validation.js +106 -0
- package/dist/security/input-validation.js.map +1 -1
- package/dist/security/limits.d.ts +150 -0
- package/dist/security/limits.d.ts.map +1 -0
- package/dist/security/limits.js +288 -0
- package/dist/security/limits.js.map +1 -0
- package/dist/security/path-security.d.ts +100 -0
- package/dist/security/path-security.d.ts.map +1 -0
- package/dist/security/path-security.js +337 -0
- package/dist/security/path-security.js.map +1 -0
- package/dist/security/validation.d.ts +95 -0
- package/dist/security/validation.d.ts.map +1 -0
- package/dist/security/validation.js +315 -0
- package/dist/security/validation.js.map +1 -0
- package/dist/simulation/cli.d.ts +9 -0
- package/dist/simulation/cli.d.ts.map +1 -0
- package/dist/simulation/cli.js +68 -0
- package/dist/simulation/cli.js.map +1 -0
- package/dist/simulation/runner.d.ts +21 -0
- package/dist/simulation/runner.d.ts.map +1 -0
- package/dist/simulation/runner.js +241 -0
- package/dist/simulation/runner.js.map +1 -0
- package/dist/simulation/scenarios/aidefence-integration.d.ts +24 -0
- package/dist/simulation/scenarios/aidefence-integration.d.ts.map +1 -0
- package/dist/simulation/scenarios/aidefence-integration.js +124 -0
- package/dist/simulation/scenarios/aidefence-integration.js.map +1 -0
- package/dist/simulation/scenarios/bmssp-integration.d.ts +23 -0
- package/dist/simulation/scenarios/bmssp-integration.d.ts.map +1 -0
- package/dist/simulation/scenarios/bmssp-integration.js +104 -0
- package/dist/simulation/scenarios/bmssp-integration.js.map +1 -0
- package/dist/simulation/scenarios/causal-reasoning.d.ts +16 -0
- package/dist/simulation/scenarios/causal-reasoning.d.ts.map +1 -0
- package/dist/simulation/scenarios/causal-reasoning.js +108 -0
- package/dist/simulation/scenarios/causal-reasoning.js.map +1 -0
- package/dist/simulation/scenarios/consciousness-explorer.d.ts +25 -0
- package/dist/simulation/scenarios/consciousness-explorer.d.ts.map +1 -0
- package/dist/simulation/scenarios/consciousness-explorer.js +108 -0
- package/dist/simulation/scenarios/consciousness-explorer.js.map +1 -0
- package/dist/simulation/scenarios/domain-examples/e-commerce-recommendations.d.ts +135 -0
- package/dist/simulation/scenarios/domain-examples/e-commerce-recommendations.d.ts.map +1 -0
- package/dist/simulation/scenarios/domain-examples/e-commerce-recommendations.js +158 -0
- package/dist/simulation/scenarios/domain-examples/e-commerce-recommendations.js.map +1 -0
- package/dist/simulation/scenarios/domain-examples/index.d.ts +14 -0
- package/dist/simulation/scenarios/domain-examples/index.d.ts.map +1 -0
- package/dist/simulation/scenarios/domain-examples/index.js +14 -0
- package/dist/simulation/scenarios/domain-examples/index.js.map +1 -0
- package/dist/simulation/scenarios/domain-examples/iot-sensor-networks.d.ts +178 -0
- package/dist/simulation/scenarios/domain-examples/iot-sensor-networks.d.ts.map +1 -0
- package/dist/simulation/scenarios/domain-examples/iot-sensor-networks.js +218 -0
- package/dist/simulation/scenarios/domain-examples/iot-sensor-networks.js.map +1 -0
- package/dist/simulation/scenarios/domain-examples/medical-imaging.d.ts +122 -0
- package/dist/simulation/scenarios/domain-examples/medical-imaging.d.ts.map +1 -0
- package/dist/simulation/scenarios/domain-examples/medical-imaging.js +129 -0
- package/dist/simulation/scenarios/domain-examples/medical-imaging.js.map +1 -0
- package/dist/simulation/scenarios/domain-examples/robotics-navigation.d.ts +166 -0
- package/dist/simulation/scenarios/domain-examples/robotics-navigation.d.ts.map +1 -0
- package/dist/simulation/scenarios/domain-examples/robotics-navigation.js +161 -0
- package/dist/simulation/scenarios/domain-examples/robotics-navigation.js.map +1 -0
- package/dist/simulation/scenarios/domain-examples/scientific-research.d.ts +151 -0
- package/dist/simulation/scenarios/domain-examples/scientific-research.d.ts.map +1 -0
- package/dist/simulation/scenarios/domain-examples/scientific-research.js +187 -0
- package/dist/simulation/scenarios/domain-examples/scientific-research.js.map +1 -0
- package/dist/simulation/scenarios/domain-examples/trading-systems.d.ts +102 -0
- package/dist/simulation/scenarios/domain-examples/trading-systems.d.ts.map +1 -0
- package/dist/simulation/scenarios/domain-examples/trading-systems.js +100 -0
- package/dist/simulation/scenarios/domain-examples/trading-systems.js.map +1 -0
- package/dist/simulation/scenarios/goalie-integration.d.ts +24 -0
- package/dist/simulation/scenarios/goalie-integration.d.ts.map +1 -0
- package/dist/simulation/scenarios/goalie-integration.js +121 -0
- package/dist/simulation/scenarios/goalie-integration.js.map +1 -0
- package/dist/simulation/scenarios/graph-traversal.d.ts +17 -0
- package/dist/simulation/scenarios/graph-traversal.d.ts.map +1 -0
- package/dist/simulation/scenarios/graph-traversal.js +101 -0
- package/dist/simulation/scenarios/graph-traversal.js.map +1 -0
- package/dist/simulation/scenarios/latent-space/attention-analysis.d.ts +45 -0
- package/dist/simulation/scenarios/latent-space/attention-analysis.d.ts.map +1 -0
- package/dist/simulation/scenarios/latent-space/attention-analysis.js +435 -0
- package/dist/simulation/scenarios/latent-space/attention-analysis.js.map +1 -0
- package/dist/simulation/scenarios/latent-space/clustering-analysis.d.ts +55 -0
- package/dist/simulation/scenarios/latent-space/clustering-analysis.d.ts.map +1 -0
- package/dist/simulation/scenarios/latent-space/clustering-analysis.js +606 -0
- package/dist/simulation/scenarios/latent-space/clustering-analysis.js.map +1 -0
- package/dist/simulation/scenarios/latent-space/hnsw-exploration.d.ts +74 -0
- package/dist/simulation/scenarios/latent-space/hnsw-exploration.d.ts.map +1 -0
- package/dist/simulation/scenarios/latent-space/hnsw-exploration.js +391 -0
- package/dist/simulation/scenarios/latent-space/hnsw-exploration.js.map +1 -0
- package/dist/simulation/scenarios/latent-space/hypergraph-exploration.d.ts +51 -0
- package/dist/simulation/scenarios/latent-space/hypergraph-exploration.d.ts.map +1 -0
- package/dist/simulation/scenarios/latent-space/hypergraph-exploration.js +536 -0
- package/dist/simulation/scenarios/latent-space/hypergraph-exploration.js.map +1 -0
- package/dist/simulation/scenarios/latent-space/index.d.ts +35 -0
- package/dist/simulation/scenarios/latent-space/index.d.ts.map +1 -0
- package/dist/simulation/scenarios/latent-space/index.js +35 -0
- package/dist/simulation/scenarios/latent-space/index.js.map +1 -0
- package/dist/simulation/scenarios/latent-space/neural-augmentation.d.ts +52 -0
- package/dist/simulation/scenarios/latent-space/neural-augmentation.d.ts.map +1 -0
- package/dist/simulation/scenarios/latent-space/neural-augmentation.js +472 -0
- package/dist/simulation/scenarios/latent-space/neural-augmentation.js.map +1 -0
- package/dist/simulation/scenarios/latent-space/quantum-hybrid.d.ts +53 -0
- package/dist/simulation/scenarios/latent-space/quantum-hybrid.d.ts.map +1 -0
- package/dist/simulation/scenarios/latent-space/quantum-hybrid.js +391 -0
- package/dist/simulation/scenarios/latent-space/quantum-hybrid.js.map +1 -0
- package/dist/simulation/scenarios/latent-space/self-organizing-hnsw.d.ts +52 -0
- package/dist/simulation/scenarios/latent-space/self-organizing-hnsw.d.ts.map +1 -0
- package/dist/simulation/scenarios/latent-space/self-organizing-hnsw.js +514 -0
- package/dist/simulation/scenarios/latent-space/self-organizing-hnsw.js.map +1 -0
- package/dist/simulation/scenarios/latent-space/traversal-optimization.d.ts +53 -0
- package/dist/simulation/scenarios/latent-space/traversal-optimization.d.ts.map +1 -0
- package/dist/simulation/scenarios/latent-space/traversal-optimization.js +595 -0
- package/dist/simulation/scenarios/latent-space/traversal-optimization.js.map +1 -0
- package/dist/simulation/scenarios/lean-agentic-swarm.d.ts +18 -0
- package/dist/simulation/scenarios/lean-agentic-swarm.d.ts.map +1 -0
- package/dist/simulation/scenarios/lean-agentic-swarm.js +132 -0
- package/dist/simulation/scenarios/lean-agentic-swarm.js.map +1 -0
- package/dist/simulation/scenarios/multi-agent-swarm.d.ts +17 -0
- package/dist/simulation/scenarios/multi-agent-swarm.d.ts.map +1 -0
- package/dist/simulation/scenarios/multi-agent-swarm.js +111 -0
- package/dist/simulation/scenarios/multi-agent-swarm.js.map +1 -0
- package/dist/simulation/scenarios/psycho-symbolic-reasoner.d.ts +23 -0
- package/dist/simulation/scenarios/psycho-symbolic-reasoner.d.ts.map +1 -0
- package/dist/simulation/scenarios/psycho-symbolic-reasoner.js +98 -0
- package/dist/simulation/scenarios/psycho-symbolic-reasoner.js.map +1 -0
- package/dist/simulation/scenarios/reflexion-learning.d.ts +16 -0
- package/dist/simulation/scenarios/reflexion-learning.d.ts.map +1 -0
- package/dist/simulation/scenarios/reflexion-learning.js +98 -0
- package/dist/simulation/scenarios/reflexion-learning.js.map +1 -0
- package/dist/simulation/scenarios/research-swarm.d.ts +24 -0
- package/dist/simulation/scenarios/research-swarm.d.ts.map +1 -0
- package/dist/simulation/scenarios/research-swarm.js +146 -0
- package/dist/simulation/scenarios/research-swarm.js.map +1 -0
- package/dist/simulation/scenarios/skill-evolution.d.ts +16 -0
- package/dist/simulation/scenarios/skill-evolution.d.ts.map +1 -0
- package/dist/simulation/scenarios/skill-evolution.js +109 -0
- package/dist/simulation/scenarios/skill-evolution.js.map +1 -0
- package/dist/simulation/scenarios/stock-market-emergence.d.ts +33 -0
- package/dist/simulation/scenarios/stock-market-emergence.d.ts.map +1 -0
- package/dist/simulation/scenarios/stock-market-emergence.js +246 -0
- package/dist/simulation/scenarios/stock-market-emergence.js.map +1 -0
- package/dist/simulation/scenarios/strange-loops.d.ts +18 -0
- package/dist/simulation/scenarios/strange-loops.d.ts.map +1 -0
- package/dist/simulation/scenarios/strange-loops.js +133 -0
- package/dist/simulation/scenarios/strange-loops.js.map +1 -0
- package/dist/simulation/scenarios/sublinear-solver.d.ts +22 -0
- package/dist/simulation/scenarios/sublinear-solver.d.ts.map +1 -0
- package/dist/simulation/scenarios/sublinear-solver.js +82 -0
- package/dist/simulation/scenarios/sublinear-solver.js.map +1 -0
- package/dist/simulation/scenarios/temporal-lead-solver.d.ts +23 -0
- package/dist/simulation/scenarios/temporal-lead-solver.d.ts.map +1 -0
- package/dist/simulation/scenarios/temporal-lead-solver.js +90 -0
- package/dist/simulation/scenarios/temporal-lead-solver.js.map +1 -0
- package/dist/simulation/scenarios/voting-system-consensus.d.ts +27 -0
- package/dist/simulation/scenarios/voting-system-consensus.d.ts.map +1 -0
- package/dist/simulation/scenarios/voting-system-consensus.js +175 -0
- package/dist/simulation/scenarios/voting-system-consensus.js.map +1 -0
- package/dist/simulation/types.d.ts +162 -0
- package/dist/simulation/types.d.ts.map +1 -0
- package/dist/simulation/types.js +5 -0
- package/dist/simulation/types.js.map +1 -0
- package/dist/simulation/utils/PerformanceOptimizer.d.ts +115 -0
- package/dist/simulation/utils/PerformanceOptimizer.d.ts.map +1 -0
- package/dist/simulation/utils/PerformanceOptimizer.js +223 -0
- package/dist/simulation/utils/PerformanceOptimizer.js.map +1 -0
- package/dist/src/backends/GraphBackend.d.ts +196 -0
- package/dist/src/backends/GraphBackend.d.ts.map +1 -0
- package/dist/src/backends/GraphBackend.js +33 -0
- package/dist/src/backends/GraphBackend.js.map +1 -0
- package/dist/src/backends/LearningBackend.d.ts +148 -0
- package/dist/src/backends/LearningBackend.d.ts.map +1 -0
- package/dist/src/backends/LearningBackend.js +27 -0
- package/dist/src/backends/LearningBackend.js.map +1 -0
- package/dist/src/backends/VectorBackend.d.ts +119 -0
- package/dist/src/backends/VectorBackend.d.ts.map +1 -0
- package/dist/src/backends/VectorBackend.js +14 -0
- package/dist/src/backends/VectorBackend.js.map +1 -0
- package/dist/src/backends/detector.d.ts +81 -0
- package/dist/src/backends/detector.d.ts.map +1 -0
- package/dist/src/backends/detector.js +192 -0
- package/dist/src/backends/detector.js.map +1 -0
- package/dist/src/backends/factory.d.ts +50 -0
- package/dist/src/backends/factory.d.ts.map +1 -0
- package/dist/src/backends/factory.js +161 -0
- package/dist/src/backends/factory.js.map +1 -0
- package/dist/src/backends/graph/GraphDatabaseAdapter.d.ts +151 -0
- package/dist/src/backends/graph/GraphDatabaseAdapter.d.ts.map +1 -0
- package/dist/src/backends/graph/GraphDatabaseAdapter.js +224 -0
- package/dist/src/backends/graph/GraphDatabaseAdapter.js.map +1 -0
- package/dist/src/backends/hnswlib/HNSWLibBackend.d.ts +92 -0
- package/dist/src/backends/hnswlib/HNSWLibBackend.d.ts.map +1 -0
- package/dist/src/backends/hnswlib/HNSWLibBackend.js +316 -0
- package/dist/src/backends/hnswlib/HNSWLibBackend.js.map +1 -0
- package/dist/src/backends/hnswlib/index.d.ts +7 -0
- package/dist/src/backends/hnswlib/index.d.ts.map +1 -0
- package/dist/src/backends/hnswlib/index.js +7 -0
- package/dist/src/backends/hnswlib/index.js.map +1 -0
- package/dist/src/backends/index.d.ts +14 -0
- package/dist/src/backends/index.d.ts.map +1 -0
- package/dist/src/backends/index.js +13 -0
- package/dist/src/backends/index.js.map +1 -0
- package/dist/src/backends/ruvector/RuVectorBackend.d.ts +75 -0
- package/dist/src/backends/ruvector/RuVectorBackend.d.ts.map +1 -0
- package/dist/src/backends/ruvector/RuVectorBackend.js +198 -0
- package/dist/src/backends/ruvector/RuVectorBackend.js.map +1 -0
- package/dist/src/backends/ruvector/RuVectorLearning.d.ts +104 -0
- package/dist/src/backends/ruvector/RuVectorLearning.d.ts.map +1 -0
- package/dist/src/backends/ruvector/RuVectorLearning.js +177 -0
- package/dist/src/backends/ruvector/RuVectorLearning.js.map +1 -0
- package/dist/src/backends/ruvector/index.d.ts +9 -0
- package/dist/src/backends/ruvector/index.d.ts.map +1 -0
- package/dist/src/backends/ruvector/index.js +8 -0
- package/dist/src/backends/ruvector/index.js.map +1 -0
- package/dist/src/benchmarks/wasm-vector-benchmark.d.ts +10 -0
- package/dist/src/benchmarks/wasm-vector-benchmark.d.ts.map +1 -0
- package/dist/src/benchmarks/wasm-vector-benchmark.js +196 -0
- package/dist/src/benchmarks/wasm-vector-benchmark.js.map +1 -0
- package/dist/src/browser/AdvancedFeatures.d.ts +144 -0
- package/dist/src/browser/AdvancedFeatures.d.ts.map +1 -0
- package/dist/src/browser/AdvancedFeatures.js +430 -0
- package/dist/src/browser/AdvancedFeatures.js.map +1 -0
- package/dist/src/browser/HNSWIndex.d.ts +117 -0
- package/dist/src/browser/HNSWIndex.d.ts.map +1 -0
- package/dist/src/browser/HNSWIndex.js +402 -0
- package/dist/src/browser/HNSWIndex.js.map +1 -0
- package/dist/src/browser/ProductQuantization.d.ts +107 -0
- package/dist/src/browser/ProductQuantization.d.ts.map +1 -0
- package/dist/src/browser/ProductQuantization.js +337 -0
- package/dist/src/browser/ProductQuantization.js.map +1 -0
- package/dist/src/browser/index.d.ts +223 -0
- package/dist/src/browser/index.d.ts.map +1 -0
- package/dist/src/browser/index.js +225 -0
- package/dist/src/browser/index.js.map +1 -0
- package/dist/src/cli/agentdb-cli.d.ts +154 -0
- package/dist/src/cli/agentdb-cli.d.ts.map +1 -0
- package/dist/src/cli/agentdb-cli.js +2273 -0
- package/dist/src/cli/agentdb-cli.js.map +1 -0
- package/dist/src/cli/commands/init.d.ts +12 -0
- package/dist/src/cli/commands/init.d.ts.map +1 -0
- package/dist/src/cli/commands/init.js +115 -0
- package/dist/src/cli/commands/init.js.map +1 -0
- package/dist/src/cli/commands/install-embeddings.d.ts +10 -0
- package/dist/src/cli/commands/install-embeddings.d.ts.map +1 -0
- package/dist/src/cli/commands/install-embeddings.js +68 -0
- package/dist/src/cli/commands/install-embeddings.js.map +1 -0
- package/dist/src/cli/commands/migrate.d.ts +15 -0
- package/dist/src/cli/commands/migrate.d.ts.map +1 -0
- package/dist/src/cli/commands/migrate.js +425 -0
- package/dist/src/cli/commands/migrate.js.map +1 -0
- package/dist/src/cli/commands/simulate-custom.d.ts +26 -0
- package/dist/src/cli/commands/simulate-custom.d.ts.map +1 -0
- package/dist/src/cli/commands/simulate-custom.js +207 -0
- package/dist/src/cli/commands/simulate-custom.js.map +1 -0
- package/dist/src/cli/commands/simulate-report.d.ts +15 -0
- package/dist/src/cli/commands/simulate-report.d.ts.map +1 -0
- package/dist/src/cli/commands/simulate-report.js +136 -0
- package/dist/src/cli/commands/simulate-report.js.map +1 -0
- package/dist/src/cli/commands/simulate-wizard.d.ts +6 -0
- package/dist/src/cli/commands/simulate-wizard.d.ts.map +1 -0
- package/dist/src/cli/commands/simulate-wizard.js +352 -0
- package/dist/src/cli/commands/simulate-wizard.js.map +1 -0
- package/dist/src/cli/commands/simulate.d.ts +7 -0
- package/dist/src/cli/commands/simulate.d.ts.map +1 -0
- package/dist/src/cli/commands/simulate.js +100 -0
- package/dist/src/cli/commands/simulate.js.map +1 -0
- package/dist/src/cli/commands/status.d.ts +10 -0
- package/dist/src/cli/commands/status.d.ts.map +1 -0
- package/dist/src/cli/commands/status.js +129 -0
- package/dist/src/cli/commands/status.js.map +1 -0
- package/dist/src/cli/lib/config-manager.d.ts +110 -0
- package/dist/src/cli/lib/config-manager.d.ts.map +1 -0
- package/dist/src/cli/lib/config-manager.js +512 -0
- package/dist/src/cli/lib/config-manager.js.map +1 -0
- package/dist/src/cli/lib/config-validator.d.ts +43 -0
- package/dist/src/cli/lib/config-validator.d.ts.map +1 -0
- package/dist/src/cli/lib/config-validator.js +217 -0
- package/dist/src/cli/lib/config-validator.js.map +1 -0
- package/dist/src/cli/lib/health-monitor.d.ts +149 -0
- package/dist/src/cli/lib/health-monitor.d.ts.map +1 -0
- package/dist/src/cli/lib/health-monitor.js +380 -0
- package/dist/src/cli/lib/health-monitor.js.map +1 -0
- package/dist/src/cli/lib/help-formatter.d.ts +38 -0
- package/dist/src/cli/lib/help-formatter.d.ts.map +1 -0
- package/dist/src/cli/lib/help-formatter.js +357 -0
- package/dist/src/cli/lib/help-formatter.js.map +1 -0
- package/dist/src/cli/lib/history-tracker.d.ts +103 -0
- package/dist/src/cli/lib/history-tracker.d.ts.map +1 -0
- package/dist/src/cli/lib/history-tracker.js +346 -0
- package/dist/src/cli/lib/history-tracker.js.map +1 -0
- package/dist/src/cli/lib/report-generator.d.ts +24 -0
- package/dist/src/cli/lib/report-generator.d.ts.map +1 -0
- package/dist/src/cli/lib/report-generator.js +417 -0
- package/dist/src/cli/lib/report-generator.js.map +1 -0
- package/dist/src/cli/lib/report-store.d.ts +116 -0
- package/dist/src/cli/lib/report-store.d.ts.map +1 -0
- package/dist/src/cli/lib/report-store.js +464 -0
- package/dist/src/cli/lib/report-store.js.map +1 -0
- package/dist/src/cli/lib/simulation-registry.d.ts +165 -0
- package/dist/src/cli/lib/simulation-registry.d.ts.map +1 -0
- package/dist/src/cli/lib/simulation-registry.js +332 -0
- package/dist/src/cli/lib/simulation-registry.js.map +1 -0
- package/dist/src/cli/lib/simulation-runner.d.ts +90 -0
- package/dist/src/cli/lib/simulation-runner.d.ts.map +1 -0
- package/dist/src/cli/lib/simulation-runner.js +211 -0
- package/dist/src/cli/lib/simulation-runner.js.map +1 -0
- package/dist/src/controllers/CausalMemoryGraph.d.ts +127 -0
- package/dist/src/controllers/CausalMemoryGraph.d.ts.map +1 -0
- package/dist/src/controllers/CausalMemoryGraph.js +354 -0
- package/dist/src/controllers/CausalMemoryGraph.js.map +1 -0
- package/dist/src/controllers/CausalRecall.d.ts +139 -0
- package/dist/src/controllers/CausalRecall.d.ts.map +1 -0
- package/dist/src/controllers/CausalRecall.js +356 -0
- package/dist/src/controllers/CausalRecall.js.map +1 -0
- package/dist/src/controllers/ContextSynthesizer.d.ts +65 -0
- package/dist/src/controllers/ContextSynthesizer.d.ts.map +1 -0
- package/dist/src/controllers/ContextSynthesizer.js +208 -0
- package/dist/src/controllers/ContextSynthesizer.js.map +1 -0
- package/dist/src/controllers/EmbeddingService.d.ts +37 -0
- package/dist/src/controllers/EmbeddingService.d.ts.map +1 -0
- package/dist/src/controllers/EmbeddingService.js +136 -0
- package/dist/src/controllers/EmbeddingService.js.map +1 -0
- package/dist/src/controllers/EnhancedEmbeddingService.d.ts +50 -0
- package/dist/src/controllers/EnhancedEmbeddingService.d.ts.map +1 -0
- package/dist/src/controllers/EnhancedEmbeddingService.js +119 -0
- package/dist/src/controllers/EnhancedEmbeddingService.js.map +1 -0
- package/dist/src/controllers/ExplainableRecall.d.ts +163 -0
- package/dist/src/controllers/ExplainableRecall.d.ts.map +1 -0
- package/dist/src/controllers/ExplainableRecall.js +485 -0
- package/dist/src/controllers/ExplainableRecall.js.map +1 -0
- package/dist/src/controllers/HNSWIndex.d.ts +128 -0
- package/dist/src/controllers/HNSWIndex.d.ts.map +1 -0
- package/dist/src/controllers/HNSWIndex.js +361 -0
- package/dist/src/controllers/HNSWIndex.js.map +1 -0
- package/dist/src/controllers/LearningSystem.d.ts +195 -0
- package/dist/src/controllers/LearningSystem.d.ts.map +1 -0
- package/dist/src/controllers/LearningSystem.js +929 -0
- package/dist/src/controllers/LearningSystem.js.map +1 -0
- package/dist/src/controllers/MMRDiversityRanker.d.ts +50 -0
- package/dist/src/controllers/MMRDiversityRanker.d.ts.map +1 -0
- package/dist/src/controllers/MMRDiversityRanker.js +130 -0
- package/dist/src/controllers/MMRDiversityRanker.js.map +1 -0
- package/dist/src/controllers/MetadataFilter.d.ts +70 -0
- package/dist/src/controllers/MetadataFilter.d.ts.map +1 -0
- package/dist/src/controllers/MetadataFilter.js +243 -0
- package/dist/src/controllers/MetadataFilter.js.map +1 -0
- package/dist/src/controllers/NightlyLearner.d.ts +114 -0
- package/dist/src/controllers/NightlyLearner.d.ts.map +1 -0
- package/dist/src/controllers/NightlyLearner.js +394 -0
- package/dist/src/controllers/NightlyLearner.js.map +1 -0
- package/dist/src/controllers/QUICClient.d.ts +109 -0
- package/dist/src/controllers/QUICClient.d.ts.map +1 -0
- package/dist/src/controllers/QUICClient.js +299 -0
- package/dist/src/controllers/QUICClient.js.map +1 -0
- package/dist/src/controllers/QUICServer.d.ts +121 -0
- package/dist/src/controllers/QUICServer.d.ts.map +1 -0
- package/dist/src/controllers/QUICServer.js +383 -0
- package/dist/src/controllers/QUICServer.js.map +1 -0
- package/dist/src/controllers/ReasoningBank.d.ts +196 -0
- package/dist/src/controllers/ReasoningBank.d.ts.map +1 -0
- package/dist/src/controllers/ReasoningBank.js +494 -0
- package/dist/src/controllers/ReasoningBank.js.map +1 -0
- package/dist/src/controllers/ReflexionMemory.d.ts +125 -0
- package/dist/src/controllers/ReflexionMemory.d.ts.map +1 -0
- package/dist/src/controllers/ReflexionMemory.js +654 -0
- package/dist/src/controllers/ReflexionMemory.js.map +1 -0
- package/dist/src/controllers/SkillLibrary.d.ts +150 -0
- package/dist/src/controllers/SkillLibrary.d.ts.map +1 -0
- package/dist/src/controllers/SkillLibrary.js +608 -0
- package/dist/src/controllers/SkillLibrary.js.map +1 -0
- package/dist/src/controllers/SyncCoordinator.d.ts +120 -0
- package/dist/src/controllers/SyncCoordinator.d.ts.map +1 -0
- package/dist/src/controllers/SyncCoordinator.js +441 -0
- package/dist/src/controllers/SyncCoordinator.js.map +1 -0
- package/dist/src/controllers/WASMVectorSearch.d.ts +89 -0
- package/dist/src/controllers/WASMVectorSearch.d.ts.map +1 -0
- package/dist/src/controllers/WASMVectorSearch.js +234 -0
- package/dist/src/controllers/WASMVectorSearch.js.map +1 -0
- package/dist/src/controllers/frontier-index.d.ts +14 -0
- package/dist/src/controllers/frontier-index.d.ts.map +1 -0
- package/dist/src/controllers/frontier-index.js +10 -0
- package/dist/src/controllers/frontier-index.js.map +1 -0
- package/dist/src/controllers/index.d.ts +30 -0
- package/dist/src/controllers/index.d.ts.map +1 -0
- package/dist/src/controllers/index.js +18 -0
- package/dist/src/controllers/index.js.map +1 -0
- package/dist/src/db-fallback.d.ts +26 -0
- package/dist/src/db-fallback.d.ts.map +1 -0
- package/dist/src/db-fallback.js +264 -0
- package/dist/src/db-fallback.js.map +1 -0
- package/dist/src/db-test.d.ts +13 -0
- package/dist/src/db-test.d.ts.map +1 -0
- package/dist/src/db-test.js +55 -0
- package/dist/src/db-test.js.map +1 -0
- package/dist/src/db-unified.d.ts +76 -0
- package/dist/src/db-unified.d.ts.map +1 -0
- package/dist/src/db-unified.js +279 -0
- package/dist/src/db-unified.js.map +1 -0
- package/dist/src/examples/quic-sync-example.d.ts +9 -0
- package/dist/src/examples/quic-sync-example.d.ts.map +1 -0
- package/dist/src/examples/quic-sync-example.js +169 -0
- package/dist/src/examples/quic-sync-example.js.map +1 -0
- package/dist/src/examples/wasm-vector-usage.d.ts +12 -0
- package/dist/src/examples/wasm-vector-usage.d.ts.map +1 -0
- package/dist/src/examples/wasm-vector-usage.js +190 -0
- package/dist/src/examples/wasm-vector-usage.js.map +1 -0
- package/dist/src/index.d.ts +28 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +35 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/mcp/agentdb-mcp-server.d.ts +8 -0
- package/dist/src/mcp/agentdb-mcp-server.d.ts.map +1 -0
- package/dist/src/mcp/agentdb-mcp-server.js +2116 -0
- package/dist/src/mcp/agentdb-mcp-server.js.map +1 -0
- package/dist/src/mcp/learning-tools-handlers.d.ts +16 -0
- package/dist/src/mcp/learning-tools-handlers.d.ts.map +1 -0
- package/dist/src/mcp/learning-tools-handlers.js +105 -0
- package/dist/src/mcp/learning-tools-handlers.js.map +1 -0
- package/dist/src/optimizations/BatchOperations.d.ts +109 -0
- package/dist/src/optimizations/BatchOperations.d.ts.map +1 -0
- package/dist/src/optimizations/BatchOperations.js +407 -0
- package/dist/src/optimizations/BatchOperations.js.map +1 -0
- package/dist/src/optimizations/QueryOptimizer.d.ts +83 -0
- package/dist/src/optimizations/QueryOptimizer.d.ts.map +1 -0
- package/dist/src/optimizations/QueryOptimizer.js +228 -0
- package/dist/src/optimizations/QueryOptimizer.js.map +1 -0
- package/dist/src/optimizations/ToolCache.d.ts +137 -0
- package/dist/src/optimizations/ToolCache.d.ts.map +1 -0
- package/dist/src/optimizations/ToolCache.js +281 -0
- package/dist/src/optimizations/ToolCache.js.map +1 -0
- package/dist/src/optimizations/index.d.ts +10 -0
- package/dist/src/optimizations/index.d.ts.map +1 -0
- package/dist/src/optimizations/index.js +8 -0
- package/dist/src/optimizations/index.js.map +1 -0
- package/dist/src/security/input-validation.d.ts +109 -0
- package/dist/src/security/input-validation.d.ts.map +1 -0
- package/dist/src/security/input-validation.js +398 -0
- package/dist/src/security/input-validation.js.map +1 -0
- package/dist/src/security/limits.d.ts +150 -0
- package/dist/src/security/limits.d.ts.map +1 -0
- package/dist/src/security/limits.js +288 -0
- package/dist/src/security/limits.js.map +1 -0
- package/dist/src/security/path-security.d.ts +100 -0
- package/dist/src/security/path-security.d.ts.map +1 -0
- package/dist/src/security/path-security.js +337 -0
- package/dist/src/security/path-security.js.map +1 -0
- package/dist/src/security/validation.d.ts +95 -0
- package/dist/src/security/validation.d.ts.map +1 -0
- package/dist/src/security/validation.js +315 -0
- package/dist/src/security/validation.js.map +1 -0
- package/dist/src/services/LLMRouter.d.ts +84 -0
- package/dist/src/services/LLMRouter.d.ts.map +1 -0
- package/dist/src/services/LLMRouter.js +329 -0
- package/dist/src/services/LLMRouter.js.map +1 -0
- package/dist/src/types/quic.d.ts +518 -0
- package/dist/src/types/quic.d.ts.map +1 -0
- package/dist/src/types/quic.js +272 -0
- package/dist/src/types/quic.js.map +1 -0
- package/dist/src/utils/NodeIdMapper.d.ts +38 -0
- package/dist/src/utils/NodeIdMapper.d.ts.map +1 -0
- package/dist/src/utils/NodeIdMapper.js +57 -0
- package/dist/src/utils/NodeIdMapper.js.map +1 -0
- package/package.json +12 -2
- package/scripts/README.md +314 -0
- package/src/backends/GraphBackend.ts +290 -0
- package/src/backends/LearningBackend.ts +210 -0
- package/src/backends/README.md +389 -0
- package/src/backends/VectorBackend.ts +145 -0
- package/src/backends/detector.ts +283 -0
- package/src/backends/factory.ts +193 -0
- package/src/backends/graph/GraphDatabaseAdapter.ts +334 -0
- package/src/backends/hnswlib/HNSWLibBackend.ts +413 -0
- package/src/backends/hnswlib/index.ts +7 -0
- package/src/backends/index.ts +32 -0
- package/src/backends/ruvector/RuVectorBackend.ts +232 -0
- package/src/backends/ruvector/RuVectorLearning.ts +242 -0
- package/src/backends/ruvector/index.ts +9 -0
- package/src/backends/ruvector/types.d.ts +64 -0
- package/src/browser/AdvancedFeatures.ts +565 -0
- package/src/browser/HNSWIndex.ts +494 -0
- package/src/browser/ProductQuantization.ts +419 -0
- package/src/browser/index.ts +301 -0
- package/src/cli/agentdb-cli.ts +131 -8
- package/src/cli/commands/init.ts +148 -0
- package/src/cli/commands/install-embeddings.ts +81 -0
- package/src/cli/commands/migrate.ts +545 -0
- package/src/cli/commands/simulate-custom.ts +232 -0
- package/src/cli/commands/simulate-report.ts +171 -0
- package/src/cli/commands/simulate-wizard.ts +379 -0
- package/src/cli/commands/simulate.ts +115 -0
- package/src/cli/commands/status.ts +156 -0
- package/src/cli/lib/config-manager.ts +627 -0
- package/src/cli/lib/config-validator.ts +261 -0
- package/src/cli/lib/health-monitor.ts +513 -0
- package/src/cli/lib/help-formatter.ts +406 -0
- package/src/cli/lib/history-tracker.ts +497 -0
- package/src/cli/lib/report-generator.ts +455 -0
- package/src/cli/lib/report-store.ts +582 -0
- package/src/cli/lib/simulation-registry.ts +502 -0
- package/src/cli/lib/simulation-runner.ts +291 -0
- package/src/cli/tests/agentdb-cli.test.ts +58 -0
- package/src/controllers/CausalMemoryGraph.ts +42 -2
- package/src/controllers/CausalRecall.ts +41 -4
- package/src/controllers/ExplainableRecall.ts +123 -5
- package/src/controllers/NightlyLearner.ts +8 -4
- package/src/controllers/ReasoningBank.ts +268 -5
- package/src/controllers/ReflexionMemory.ts +531 -6
- package/src/controllers/SkillLibrary.ts +234 -60
- package/src/db-fallback.ts +103 -35
- package/src/db-test.ts +59 -0
- package/src/db-unified.ts +327 -0
- package/src/mcp/agentdb-mcp-server.ts +544 -38
- package/src/optimizations/BatchOperations.ts +270 -0
- package/src/optimizations/ToolCache.ts +355 -0
- package/src/security/input-validation.ts +166 -0
- package/src/security/limits.ts +375 -0
- package/src/security/path-security.ts +436 -0
- package/src/security/validation.ts +556 -0
- package/src/services/LLMRouter.ts +406 -0
- package/src/types/xenova-transformers.d.ts +26 -0
- package/src/utils/NodeIdMapper.ts +64 -0
package/README.md
CHANGED
|
@@ -1,516 +1,1264 @@
|
|
|
1
|
-
# AgentDB
|
|
1
|
+
# AgentDB v2.0
|
|
2
2
|
|
|
3
|
-
> **
|
|
3
|
+
> **Intelligent vector database for AI agents โ learns from experience, optimizes itself, runs anywhere**
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/agentdb)
|
|
6
6
|
[](https://www.npmjs.com/package/agentdb)
|
|
7
7
|
[](LICENSE)
|
|
8
8
|
[](https://www.typescriptlang.org/)
|
|
9
|
-
[](
|
|
10
|
-
[](tests/)
|
|
10
|
+
[](docs/MCP_TOOL_OPTIMIZATION_GUIDE.md)
|
|
11
|
+
[](docs/DEEP-REVIEW-V2-LATENT-SPACE.md)
|
|
12
|
+
[](simulation/README.md)
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
AgentDB is the first vector database built specifically for autonomous AI agents. Unlike traditional databases that just store vectors, AgentDB **learns from every interaction**, **heals itself automatically**, and **gets smarter over time** โ all while being **150x faster** than cloud alternatives and running **anywhere** (Node.js, browsers, edge functions, even offline).
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
**What makes it special?** It combines six cognitive memory patterns (how humans learn), latent space simulations (empirically validated optimizations), and Graph Neural Networks (self-improving search) into a single, zero-config package that just works.
|
|
15
17
|
|
|
16
|
-
|
|
18
|
+
**Perfect for:** LangChain agents, AutoGPT, Claude Code tools, custom AI assistants, RAG systems, or any application where AI needs to remember, learn, and improve.
|
|
17
19
|
|
|
18
|
-
|
|
19
|
-
- โก **Instant startup** โ Memory ready in milliseconds (optimized sql.js WASM)
|
|
20
|
-
- ๐ชถ **Minimal footprint** โ Lightweight embedded database with zero config
|
|
21
|
-
- ๐ **Universal runtime** โ Node.js, browser, edge, MCP โ runs anywhere
|
|
22
|
-
- ๐ **Coordination ready** โ Architecture designed for distributed agent synchronization
|
|
20
|
+
---
|
|
23
21
|
|
|
24
|
-
|
|
25
|
-
- ๐ **Reflexion Memory** โ Learn from experience with self-critique and episodic replay
|
|
26
|
-
- ๐ **Skill Library** โ Auto-consolidate successful patterns into reusable skills
|
|
27
|
-
- ๐ **Causal Memory** โ Track `p(y|do(x))` not just `p(y|x)` โ intervention-based causality
|
|
28
|
-
- ๐ **Explainable Recall** โ Provenance certificates with cryptographic Merkle proofs
|
|
29
|
-
- ๐ฏ **Causal Recall** โ Utility-based reranking: `U = ฮฑยทsimilarity + ฮฒยทuplift โ ฮณยทlatency`
|
|
30
|
-
- ๐ **Nightly Learner** โ Automated causal discovery with doubly robust learning
|
|
22
|
+
> **๐ข v2.0 Alpha Available!** Early adopters can test the new features with `npm install agentdb@alpha`. Production users should continue using `npm install agentdb@latest` for the stable version. See [Publishing Guide](docs/PUBLISHING_GUIDE.md) for details.
|
|
31
23
|
|
|
32
|
-
**Integration:**
|
|
33
|
-
- ๐ง **ReasoningBank** โ Pattern matching, experience curation, memory optimization
|
|
34
|
-
- ๐ค **29 MCP Tools** โ Zero-code setup for Claude Code, Cursor, and coding assistants (v1.3.0)
|
|
35
|
-
- **5 Core Vector DB Tools**: init, insert, batch, search, delete
|
|
36
|
-
- **5 Core AgentDB Tools** (NEW v1.3.0): database stats, pattern store/search, cache management
|
|
37
|
-
- **9 Frontier Memory Tools**: reflexion, skills, causal memory, explainable recall
|
|
38
|
-
- **10 Learning System Tools** (NEW v1.3.0): full RL pipeline with 9 algorithms
|
|
39
|
-
- ๐ **10 RL Plugins** โ Decision Transformer, Q-Learning, Federated Learning, and more
|
|
40
24
|
|
|
41
|
-
|
|
25
|
+
## โก Key Features
|
|
42
26
|
|
|
43
|
-
|
|
27
|
+
- **๐ง Six Cognitive Memory Patterns** โ Reflexion (self-critique), Skills (reusable code), Causal Memory (interventions), Explainable Recall (Merkle proofs), Utility Ranking, Nightly Learner
|
|
28
|
+
- **๐ 150x Faster Vector Search** โ RuVector Rust backend with SIMD (61ฮผs p50 latency, 8.2x faster than hnswlib)
|
|
29
|
+
- **๐ฎ 25 Latent Space Simulations** โ Empirically validated HNSW, GNN attention, self-healing, beam search (98.2% reproducibility)
|
|
30
|
+
- **๐ 97.9% Self-Healing** โ Automatic degradation prevention using Model Predictive Control (30-day validation)
|
|
31
|
+
- **๐งฌ Graph Neural Networks** โ 8-head attention for adaptive query improvement (+12.4% recall, 3.8ms forward pass)
|
|
32
|
+
- **๐ Runs Anywhere** โ Node.js, browsers, edge functions, MCP tools โ works offline with graceful degradation
|
|
33
|
+
- **โ๏ธ Zero Configuration** โ `npm install agentdb` and go โ auto-selects optimal backend (RuVector โ HNSWLib โ better-sqlite3 โ sql.js)
|
|
34
|
+
- **๐ค 32 MCP Tools + 59 CLI Commands** โ Full Claude Code integration, interactive simulation wizard, batch operations
|
|
35
|
+
- **๐พ Super-Linear Scaling** โ Performance improves with data size (4,536 patterns/sec @ 5k items)
|
|
36
|
+
- **๐ฐ $0 Cost** โ Fully local, no API keys, no cloud fees (vs $70+/mo for Pinecone)
|
|
44
37
|
|
|
45
|
-
##
|
|
38
|
+
## ๐ Quick Start
|
|
46
39
|
|
|
47
|
-
|
|
40
|
+
Get started in 60 seconds:
|
|
48
41
|
|
|
49
|
-
|
|
42
|
+
```bash
|
|
43
|
+
# Install Alpha (v2.0 with all new features - for early adopters)
|
|
44
|
+
npm install agentdb@alpha
|
|
50
45
|
|
|
51
|
-
|
|
46
|
+
# Or install Stable (current production version)
|
|
47
|
+
npm install agentdb@latest
|
|
52
48
|
|
|
53
|
-
|
|
49
|
+
# Use in your code
|
|
50
|
+
import { createDatabase, ReasoningBank, EmbeddingService } from 'agentdb';
|
|
54
51
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
- **Analytics**: `learning_metrics`, `learning_explain`
|
|
59
|
-
- **Advanced Features**: `learning_transfer`, `experience_record`, `reward_signal`
|
|
52
|
+
const db = await createDatabase('./agent-memory.db');
|
|
53
|
+
const embedder = new EmbeddingService({ model: 'Xenova/all-MiniLM-L6-v2' });
|
|
54
|
+
await embedder.initialize();
|
|
60
55
|
|
|
61
|
-
|
|
56
|
+
const reasoningBank = new ReasoningBank(db, embedder);
|
|
62
57
|
|
|
63
|
-
|
|
64
|
-
{
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
58
|
+
// Store what your agent learned
|
|
59
|
+
await reasoningBank.storePattern({
|
|
60
|
+
taskType: 'code_review',
|
|
61
|
+
approach: 'Security-first analysis',
|
|
62
|
+
successRate: 0.95
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
// Find similar successful patterns later (32.6M ops/sec!)
|
|
66
|
+
const patterns = await reasoningBank.searchPatterns({
|
|
67
|
+
task: 'security code review',
|
|
68
|
+
k: 10
|
|
69
|
+
});
|
|
76
70
|
```
|
|
77
71
|
|
|
78
|
-
|
|
72
|
+
**For Claude Code / MCP Integration** (zero-code setup):
|
|
73
|
+
```bash
|
|
74
|
+
# Alpha version (v2.0 features)
|
|
75
|
+
claude mcp add agentdb npx agentdb@alpha mcp start
|
|
79
76
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
- `agentdb_pattern_search` - Search patterns with filters and similarity
|
|
84
|
-
- `agentdb_pattern_stats` - Pattern analytics and top task types
|
|
85
|
-
- `agentdb_clear_cache` - Cache management for optimal performance
|
|
77
|
+
# Or stable version
|
|
78
|
+
claude mcp add agentdb npx agentdb@latest mcp start
|
|
79
|
+
```
|
|
86
80
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
"approach": "Security-first analysis followed by code quality",
|
|
93
|
-
"successRate": 0.95
|
|
94
|
-
}
|
|
95
|
-
}
|
|
81
|
+
**Run latent space simulations** (validate 8.2x speedup):
|
|
82
|
+
```bash
|
|
83
|
+
agentdb simulate hnsw --iterations 3 # HNSW optimization
|
|
84
|
+
agentdb simulate attention --iterations 3 # GNN attention (8-head)
|
|
85
|
+
agentdb simulate --wizard # Interactive configuration
|
|
96
86
|
```
|
|
97
87
|
|
|
98
|
-
|
|
88
|
+
See [๐ Complete Tutorial](#-tutorial) below for step-by-step examples.
|
|
99
89
|
|
|
100
|
-
|
|
90
|
+
---
|
|
101
91
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
92
|
+
|
|
93
|
+
## ๐ What's New in v2.0
|
|
94
|
+
|
|
95
|
+
AgentDB v2.0 represents a fundamental shift from traditional vector databases to **intelligent, self-optimizing cognitive systems**. Through empirically validated latent space simulations (98.2% reproducibility across 24 iterations), we've discovered and implemented optimal configurations that make AgentDB not just faster, but **genuinely intelligent** โ learning from experience, healing itself automatically, and improving over time without human intervention.
|
|
96
|
+
|
|
97
|
+
**Performance Breakthroughs:**
|
|
98
|
+
- 150x faster vector search (RuVector Rust backend, 61ฮผs p50 latency)
|
|
99
|
+
- 8.2x faster than hnswlib (empirically validated through latent space simulations)
|
|
100
|
+
- 173x faster migration (v1.x โ v2.0, 48ms vs 8.3s for 10K vectors)
|
|
101
|
+
- Super-linear scaling (performance improves with data size)
|
|
102
|
+
|
|
103
|
+
**Intelligence & Learning:**
|
|
104
|
+
- Graph Neural Networks with 8-head attention (+12.4% recall improvement)
|
|
105
|
+
- 97.9% self-healing (MPC adaptation, 30-day validation)
|
|
106
|
+
- ReasoningBank pattern matching (36% adaptive learning improvement)
|
|
107
|
+
- Neural augmentation pipeline (+29.4% total improvement)
|
|
108
|
+
|
|
109
|
+
**Developer Experience:**
|
|
110
|
+
- 25 latent space simulations (98.2% reproducibility across 24 iterations)
|
|
111
|
+
- 32 MCP tools + 59 CLI commands (including interactive wizard)
|
|
112
|
+
- Batch operations (3-4x faster bulk inserts)
|
|
113
|
+
- Zero regressions (100% backward compatibility)
|
|
114
|
+
|
|
115
|
+
### ๐ฌ Performance Highlights
|
|
116
|
+
|
|
117
|
+
**Why this matters:** Unlike synthetic benchmarks that test artificial workloads, these are **real-world performance metrics** from production-representative scenarios. Every number below was validated through multiple iterations and represents actual performance your agents will experience โ not theoretical maximums.
|
|
118
|
+
|
|
119
|
+
**Core Operations:**
|
|
120
|
+
- Pattern search: **32.6M ops/sec** (ultra-fast with caching)
|
|
121
|
+
- Pattern storage: **388K ops/sec** (excellent)
|
|
122
|
+
- Batch operations: **3-4x faster** (5,556-7,692 ops/sec)
|
|
123
|
+
- Super-linear scaling: **4,536 patterns/sec** @ 5k items
|
|
124
|
+
|
|
125
|
+
**Latent Space Validation** (25 scenarios, 98.2% reproducibility):
|
|
126
|
+
|
|
127
|
+
*These simulations empirically validate every optimization in AgentDB v2.0. Instead of guessing optimal configurations, we systematically explored the latent space of possible designs, running 24 iterations per scenario to discover what actually works best. The results aren't just faster โ they're **provably optimal** for real-world agent workloads.*
|
|
128
|
+
- **HNSW**: 61ฮผs p50 latency, 96.8% recall@10, 8.2x faster than hnswlib
|
|
129
|
+
- **GNN Attention**: +12.4% recall, 3.8ms forward pass, 91% transferability
|
|
130
|
+
- **Self-Healing**: 97.9% degradation prevention, <100ms automatic repair
|
|
131
|
+
- **Neural Augmentation**: +29.4% total improvement, -32% memory, -52% hops
|
|
132
|
+
|
|
133
|
+
See [OPTIMIZATION-REPORT.md](OPTIMIZATION-REPORT.md) for detailed benchmarks and [simulation/README.md](simulation/README.md) for all 25 simulation scenarios.
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## ๐ Tutorial
|
|
138
|
+
|
|
139
|
+
**Learn by doing:** These examples show real-world use cases where AgentDB's cognitive memory patterns make agents genuinely intelligent. Each example is production-ready code you can adapt for your own applications.
|
|
140
|
+
|
|
141
|
+
### Example 1: Build a Learning Code Review Agent
|
|
142
|
+
|
|
143
|
+
```typescript
|
|
144
|
+
import { createDatabase, ReasoningBank, ReflexionMemory, EmbeddingService } from 'agentdb';
|
|
145
|
+
|
|
146
|
+
// Setup
|
|
147
|
+
const db = await createDatabase('./code-reviewer.db');
|
|
148
|
+
const embedder = new EmbeddingService({ model: 'Xenova/all-MiniLM-L6-v2' });
|
|
149
|
+
await embedder.initialize();
|
|
150
|
+
|
|
151
|
+
const reasoningBank = new ReasoningBank(db, embedder);
|
|
152
|
+
const reflexion = new ReflexionMemory(db, embedder);
|
|
153
|
+
|
|
154
|
+
// 1. Store successful review patterns
|
|
155
|
+
await reasoningBank.storePattern({
|
|
156
|
+
taskType: 'code_review',
|
|
157
|
+
approach: 'Security scan โ Type safety โ Code quality โ Performance',
|
|
158
|
+
successRate: 0.94,
|
|
159
|
+
tags: ['security', 'typescript']
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
// 2. Review code and learn from it
|
|
163
|
+
const reviewResult = await performCodeReview(codeToReview);
|
|
164
|
+
|
|
165
|
+
await reflexion.storeEpisode({
|
|
166
|
+
sessionId: 'review-session-1',
|
|
167
|
+
task: 'Review authentication PR',
|
|
168
|
+
reward: reviewResult.issuesFound > 0 ? 0.9 : 0.6,
|
|
169
|
+
success: true,
|
|
170
|
+
critique: 'Found SQL injection vulnerability - security checks work!',
|
|
171
|
+
input: codeToReview,
|
|
172
|
+
output: reviewResult.findings,
|
|
173
|
+
latencyMs: reviewResult.timeMs,
|
|
174
|
+
tokensUsed: reviewResult.tokensUsed
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
// 3. Next time, find similar successful reviews (32.6M ops/sec!)
|
|
178
|
+
const similarReviews = await reflexion.retrieveRelevant({
|
|
179
|
+
task: 'authentication code review',
|
|
180
|
+
k: 5,
|
|
181
|
+
onlySuccesses: true
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
console.log(`Found ${similarReviews.length} successful reviews to learn from`);
|
|
185
|
+
console.log(`Best approach: ${similarReviews[0].critique}`);
|
|
111
186
|
```
|
|
112
187
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
188
|
+
### Example 2: RAG System with Self-Learning
|
|
189
|
+
|
|
190
|
+
```typescript
|
|
191
|
+
import { createDatabase, ReasoningBank, SkillLibrary, EmbeddingService } from 'agentdb';
|
|
192
|
+
|
|
193
|
+
const db = await createDatabase('./rag-system.db');
|
|
194
|
+
const embedder = new EmbeddingService({ model: 'Xenova/all-MiniLM-L6-v2' });
|
|
195
|
+
await embedder.initialize();
|
|
196
|
+
|
|
197
|
+
const reasoningBank = new ReasoningBank(db, embedder);
|
|
198
|
+
const skills = new SkillLibrary(db, embedder);
|
|
199
|
+
|
|
200
|
+
// Store document retrieval patterns
|
|
201
|
+
await reasoningBank.storePattern({
|
|
202
|
+
taskType: 'document_retrieval',
|
|
203
|
+
approach: 'Expand query with synonyms โ Semantic search โ Re-rank by relevance',
|
|
204
|
+
successRate: 0.88,
|
|
205
|
+
tags: ['rag', 'retrieval']
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
// Create reusable query expansion skill
|
|
209
|
+
await skills.createSkill({
|
|
210
|
+
name: 'expand_query',
|
|
211
|
+
description: 'Expand user query with domain-specific synonyms',
|
|
212
|
+
signature: { inputs: { query: 'string' }, outputs: { expanded: 'string[]' } },
|
|
213
|
+
code: `
|
|
214
|
+
const synonymMap = { 'bug': ['issue', 'defect', 'error'], ... };
|
|
215
|
+
return query.split(' ').flatMap(word => synonymMap[word] || [word]);
|
|
216
|
+
`,
|
|
217
|
+
successRate: 0.92
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
// Search for retrieval patterns (learns which work best)
|
|
221
|
+
const patterns = await reasoningBank.searchPatterns({
|
|
222
|
+
task: 'find technical documentation',
|
|
223
|
+
k: 10
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
// Apply best pattern
|
|
227
|
+
const bestPattern = patterns[0];
|
|
228
|
+
console.log(`Using approach: ${bestPattern.approach}`);
|
|
123
229
|
```
|
|
124
230
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
231
|
+
### Example 3: Run Latent Space Simulations
|
|
232
|
+
|
|
233
|
+
Validate AgentDB's optimizations through empirical simulations:
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
# Test HNSW graph optimization (validates 8.2x speedup)
|
|
237
|
+
agentdb simulate hnsw --iterations 3
|
|
238
|
+
# Output: โ
61ฮผs p50 latency, 96.8% recall@10, M=32 optimal
|
|
239
|
+
|
|
240
|
+
# Test 8-head GNN attention mechanism
|
|
241
|
+
agentdb simulate attention --iterations 3
|
|
242
|
+
# Output: โ
+12.4% recall improvement, 3.8ms forward pass
|
|
243
|
+
|
|
244
|
+
# Test 30-day self-healing with MPC adaptation
|
|
245
|
+
agentdb simulate self-organizing --days 30
|
|
246
|
+
# Output: โ
97.9% degradation prevention, <100ms healing
|
|
247
|
+
|
|
248
|
+
# Interactive wizard for custom simulations
|
|
249
|
+
agentdb simulate --wizard
|
|
250
|
+
# Guides you through 6-step configuration with 25+ components
|
|
137
251
|
```
|
|
138
252
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
253
|
+
See [simulation/README.md](simulation/README.md) for 25 available scenarios and complete documentation.
|
|
254
|
+
|
|
255
|
+
### Example 4: MCP Integration (Claude Code)
|
|
256
|
+
|
|
257
|
+
Zero-code integration with AI coding assistants:
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
# One-command setup
|
|
261
|
+
claude mcp add agentdb npx agentdb@latest mcp start
|
|
262
|
+
|
|
263
|
+
# Now Claude Code can:
|
|
264
|
+
# - Store reasoning patterns automatically
|
|
265
|
+
# - Search 32.6M patterns/sec for relevant approaches
|
|
266
|
+
# - Learn from successful task completions
|
|
267
|
+
# - Build reusable skills over time
|
|
268
|
+
# - Run latent space simulations
|
|
150
269
|
```
|
|
151
270
|
|
|
152
|
-
|
|
271
|
+
**Manual setup** (add to `~/.config/claude/claude_desktop_config.json`):
|
|
153
272
|
```json
|
|
154
273
|
{
|
|
155
|
-
"
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
"
|
|
159
|
-
"
|
|
274
|
+
"mcpServers": {
|
|
275
|
+
"agentdb": {
|
|
276
|
+
"command": "npx",
|
|
277
|
+
"args": ["agentdb@latest", "mcp", "start"],
|
|
278
|
+
"env": { "AGENTDB_PATH": "./agentdb.db" }
|
|
160
279
|
}
|
|
161
280
|
}
|
|
162
281
|
}
|
|
163
282
|
```
|
|
164
283
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
284
|
+
### Advanced Usage
|
|
285
|
+
|
|
286
|
+
```typescript
|
|
287
|
+
import {
|
|
288
|
+
createDatabase,
|
|
289
|
+
ReasoningBank,
|
|
290
|
+
ReflexionMemory,
|
|
291
|
+
SkillLibrary,
|
|
292
|
+
EmbeddingService,
|
|
293
|
+
BatchOperations
|
|
294
|
+
} from 'agentdb';
|
|
295
|
+
|
|
296
|
+
// Initialize database
|
|
297
|
+
const db = await createDatabase('./agent-memory.db');
|
|
298
|
+
|
|
299
|
+
// Initialize embedding service
|
|
300
|
+
const embedder = new EmbeddingService({
|
|
301
|
+
model: 'Xenova/all-MiniLM-L6-v2',
|
|
302
|
+
dimension: 384,
|
|
303
|
+
provider: 'transformers'
|
|
304
|
+
});
|
|
305
|
+
await embedder.initialize();
|
|
306
|
+
|
|
307
|
+
// ReasoningBank - Pattern learning and adaptive memory
|
|
308
|
+
const reasoningBank = new ReasoningBank(db, embedder);
|
|
309
|
+
|
|
310
|
+
// Store reasoning pattern (388K ops/sec)
|
|
311
|
+
const patternId = await reasoningBank.storePattern({
|
|
312
|
+
taskType: 'code_review',
|
|
313
|
+
approach: 'Security-first analysis followed by code quality checks',
|
|
314
|
+
successRate: 0.95,
|
|
315
|
+
tags: ['security', 'code-quality'],
|
|
316
|
+
metadata: { language: 'typescript' }
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
// Search patterns (32.6M ops/sec - ultra-fast)
|
|
320
|
+
const patterns = await reasoningBank.searchPatterns({
|
|
321
|
+
task: 'security code review',
|
|
322
|
+
k: 10,
|
|
323
|
+
threshold: 0.7,
|
|
324
|
+
filters: { taskType: 'code_review' }
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
// Reflexion Memory - Learn from experience
|
|
328
|
+
const reflexion = new ReflexionMemory(db, embedder);
|
|
329
|
+
|
|
330
|
+
// Store episode with self-critique
|
|
331
|
+
const episodeId = await reflexion.storeEpisode({
|
|
332
|
+
sessionId: 'session-1',
|
|
333
|
+
task: 'Implement OAuth2 authentication',
|
|
334
|
+
reward: 0.95,
|
|
335
|
+
success: true,
|
|
336
|
+
critique: 'PKCE flow provided better security than basic flow',
|
|
337
|
+
input: 'Authentication requirements',
|
|
338
|
+
output: 'Working OAuth2 implementation',
|
|
339
|
+
latencyMs: 1200,
|
|
340
|
+
tokensUsed: 500
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
// Retrieve similar episodes (957 ops/sec)
|
|
344
|
+
const episodes = await reflexion.retrieveRelevant({
|
|
345
|
+
task: 'authentication implementation',
|
|
346
|
+
k: 5,
|
|
347
|
+
onlySuccesses: true
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
// Skill Library - Lifelong learning
|
|
351
|
+
const skills = new SkillLibrary(db, embedder);
|
|
352
|
+
|
|
353
|
+
// Create reusable skill
|
|
354
|
+
const skillId = await skills.createSkill({
|
|
355
|
+
name: 'jwt_authentication',
|
|
356
|
+
description: 'Generate and validate JWT tokens',
|
|
357
|
+
signature: { inputs: { userId: 'string' }, outputs: { token: 'string' } },
|
|
358
|
+
code: 'implementation code here...',
|
|
359
|
+
successRate: 0.92,
|
|
360
|
+
uses: 0,
|
|
361
|
+
avgReward: 0.0,
|
|
362
|
+
avgLatencyMs: 0.0
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
// Search for applicable skills (694 ops/sec)
|
|
366
|
+
const applicableSkills = await skills.searchSkills({
|
|
367
|
+
task: 'user authentication',
|
|
368
|
+
k: 10,
|
|
369
|
+
minSuccessRate: 0.7
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
// Batch Operations - 3-4x faster (NEW v2.0)
|
|
373
|
+
const batchOps = new BatchOperations(db, embedder, {
|
|
374
|
+
batchSize: 100,
|
|
375
|
+
parallelism: 4
|
|
376
|
+
});
|
|
377
|
+
|
|
378
|
+
// Batch create skills (1,539 โ 5,556 ops/sec - 3.6x faster)
|
|
379
|
+
const skillIds = await batchOps.insertSkills([
|
|
380
|
+
{ name: 'skill-1', description: 'First skill', successRate: 0.8 },
|
|
381
|
+
{ name: 'skill-2', description: 'Second skill', successRate: 0.9 },
|
|
382
|
+
// ... up to 100 skills
|
|
383
|
+
]);
|
|
384
|
+
|
|
385
|
+
// Batch store episodes (2,273 โ 7,692 ops/sec - 3.4x faster)
|
|
386
|
+
const episodeIds = await batchOps.insertEpisodes([
|
|
387
|
+
{ sessionId: 'session-1', task: 'debug-1', reward: 0.85, success: true },
|
|
388
|
+
{ sessionId: 'session-2', task: 'optimize-1', reward: 0.90, success: true },
|
|
389
|
+
// ... up to 100 episodes
|
|
390
|
+
]);
|
|
391
|
+
|
|
392
|
+
// Prune old data (NEW v2.0)
|
|
393
|
+
const pruneResults = await batchOps.pruneData({
|
|
394
|
+
maxAge: 90, // Keep data from last 90 days
|
|
395
|
+
minReward: 0.3, // Keep episodes with reward >= 0.3
|
|
396
|
+
minSuccessRate: 0.5, // Keep skills/patterns with >= 50% success
|
|
397
|
+
maxRecords: 100000, // Max 100k records per table
|
|
398
|
+
dryRun: false // Actually delete (use true to preview)
|
|
399
|
+
});
|
|
400
|
+
|
|
401
|
+
console.log(`Pruned ${pruneResults.episodesPruned} episodes`);
|
|
402
|
+
console.log(`Saved ${pruneResults.spaceSaved} bytes`);
|
|
403
|
+
```
|
|
168
404
|
|
|
169
405
|
---
|
|
170
406
|
|
|
171
|
-
## ๐ง Frontier Memory Features
|
|
407
|
+
## ๐ง Frontier Memory Features
|
|
408
|
+
|
|
409
|
+
### 1. ๐ ReasoningBank โ Pattern Learning & Adaptive Memory
|
|
410
|
+
|
|
411
|
+
**The cognitive layer that makes agents smarter over time**
|
|
412
|
+
|
|
413
|
+
Store successful reasoning patterns and retrieve them using semantic similarity. ReasoningBank learns which approaches work best for different types of tasks.
|
|
414
|
+
|
|
415
|
+
```typescript
|
|
416
|
+
// Store a pattern
|
|
417
|
+
await reasoningBank.storePattern({
|
|
418
|
+
taskType: 'bug_investigation',
|
|
419
|
+
approach: 'Check logs โ Reproduce issue โ Binary search for root cause',
|
|
420
|
+
successRate: 0.92,
|
|
421
|
+
tags: ['debugging', 'systematic'],
|
|
422
|
+
metadata: { avgTimeMs: 3000 }
|
|
423
|
+
});
|
|
424
|
+
|
|
425
|
+
// Search patterns (32.6M ops/sec - ultra-fast)
|
|
426
|
+
const patterns = await reasoningBank.searchPatterns({
|
|
427
|
+
task: 'debug memory leak',
|
|
428
|
+
k: 10,
|
|
429
|
+
threshold: 0.7,
|
|
430
|
+
filters: { taskType: 'bug_investigation' }
|
|
431
|
+
});
|
|
432
|
+
|
|
433
|
+
// Get pattern statistics
|
|
434
|
+
const stats = reasoningBank.getPatternStats();
|
|
435
|
+
console.log(`Total patterns: ${stats.totalPatterns}`);
|
|
436
|
+
console.log(`Avg success rate: ${stats.avgSuccessRate}`);
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
**Performance:**
|
|
440
|
+
- Pattern storage: 388K ops/sec
|
|
441
|
+
- Pattern search: 32.6M ops/sec (ultra-fast with caching)
|
|
442
|
+
- Super-linear scaling: 4,536 patterns/sec @ 5k items
|
|
443
|
+
|
|
444
|
+
**Use Cases:**
|
|
445
|
+
- Learn debugging strategies that work
|
|
446
|
+
- Discover code patterns that prevent bugs
|
|
447
|
+
- Build institutional knowledge automatically
|
|
172
448
|
|
|
173
|
-
|
|
449
|
+
### 2. ๐ Reflexion Memory โ Learn from Experience
|
|
174
450
|
|
|
175
|
-
|
|
176
|
-
**Learn from experience with self-critique**
|
|
451
|
+
**Episodic replay with self-critique for continuous improvement**
|
|
177
452
|
|
|
178
|
-
Store complete task episodes with self-generated critiques, then replay them to improve future performance.
|
|
453
|
+
Store complete task episodes with self-generated critiques, then replay them to improve future performance. Based on the Reflexion paper (Shinn et al., 2023).
|
|
454
|
+
|
|
455
|
+
```typescript
|
|
456
|
+
// Store episode with self-critique
|
|
457
|
+
const episodeId = await reflexion.storeEpisode({
|
|
458
|
+
sessionId: 'debug-session-1',
|
|
459
|
+
task: 'Fix authentication bug',
|
|
460
|
+
reward: 0.95,
|
|
461
|
+
success: true,
|
|
462
|
+
critique: 'OAuth2 PKCE flow was more secure than basic flow. Should always check token expiration.',
|
|
463
|
+
input: 'Users can\'t log in',
|
|
464
|
+
output: 'Working OAuth2 implementation with refresh tokens',
|
|
465
|
+
latencyMs: 1200,
|
|
466
|
+
tokensUsed: 500
|
|
467
|
+
});
|
|
468
|
+
|
|
469
|
+
// Retrieve similar episodes (957 ops/sec)
|
|
470
|
+
const similar = await reflexion.retrieveRelevant({
|
|
471
|
+
task: 'authentication issues',
|
|
472
|
+
k: 10,
|
|
473
|
+
onlySuccesses: true, // Learn from what worked
|
|
474
|
+
minReward: 0.7
|
|
475
|
+
});
|
|
476
|
+
|
|
477
|
+
// Get task-specific statistics
|
|
478
|
+
const stats = await reflexion.getTaskStats('debug-session-1');
|
|
479
|
+
console.log(`Success rate: ${stats.successRate}`);
|
|
480
|
+
console.log(`Avg reward: ${stats.avgReward}`);
|
|
481
|
+
```
|
|
179
482
|
|
|
483
|
+
**Benefits:**
|
|
484
|
+
- Learn from successes and failures
|
|
485
|
+
- Build expertise over time
|
|
486
|
+
- Avoid repeating mistakes
|
|
487
|
+
- Self-improvement through critique
|
|
488
|
+
|
|
489
|
+
**CLI:**
|
|
180
490
|
```bash
|
|
181
|
-
# Store episode
|
|
491
|
+
# Store episode
|
|
182
492
|
agentdb reflexion store "session-1" "fix_auth_bug" 0.95 true \
|
|
183
|
-
"OAuth2
|
|
493
|
+
"OAuth2 PKCE worked perfectly" "login failing" "fixed tokens" 1200 500
|
|
184
494
|
|
|
185
|
-
# Retrieve similar
|
|
495
|
+
# Retrieve similar
|
|
186
496
|
agentdb reflexion retrieve "authentication issues" 10 0.8
|
|
187
497
|
|
|
188
498
|
# Get critique summary
|
|
189
499
|
agentdb reflexion critique "fix_auth_bug" 10 0.5
|
|
190
|
-
|
|
191
|
-
# Prune old episodes
|
|
192
|
-
agentdb reflexion prune 90 0.5
|
|
193
500
|
```
|
|
194
501
|
|
|
195
|
-
|
|
502
|
+
### 3. ๐ Skill Library โ Lifelong Learning
|
|
503
|
+
|
|
504
|
+
**Transform successful patterns into reusable, composable skills**
|
|
196
505
|
|
|
197
|
-
|
|
198
|
-
|
|
506
|
+
Automatically consolidate repeated successful task executions into parameterized skills that can be composed and reused.
|
|
507
|
+
|
|
508
|
+
```typescript
|
|
509
|
+
// Create skill manually
|
|
510
|
+
const skillId = await skills.createSkill({
|
|
511
|
+
name: 'jwt_authentication',
|
|
512
|
+
description: 'Generate and validate JWT tokens with refresh flow',
|
|
513
|
+
signature: {
|
|
514
|
+
inputs: { userId: 'string', permissions: 'array' },
|
|
515
|
+
outputs: { accessToken: 'string', refreshToken: 'string' }
|
|
516
|
+
},
|
|
517
|
+
code: 'implementation code...',
|
|
518
|
+
successRate: 0.92
|
|
519
|
+
});
|
|
520
|
+
|
|
521
|
+
// Search for applicable skills (694 ops/sec)
|
|
522
|
+
const applicable = await skills.searchSkills({
|
|
523
|
+
task: 'user authentication with tokens',
|
|
524
|
+
k: 5,
|
|
525
|
+
minSuccessRate: 0.7
|
|
526
|
+
});
|
|
527
|
+
|
|
528
|
+
// Auto-consolidate from successful episodes
|
|
529
|
+
const consolidated = await skills.consolidateFromEpisodes({
|
|
530
|
+
minAttempts: 3, // Need 3+ successful executions
|
|
531
|
+
minSuccessRate: 0.7, // With 70%+ success rate
|
|
532
|
+
lookbackDays: 7 // In the last 7 days
|
|
533
|
+
});
|
|
534
|
+
|
|
535
|
+
// Update skill after use
|
|
536
|
+
await skills.updateSkillStats(skillId, {
|
|
537
|
+
uses: 1,
|
|
538
|
+
successRate: 0.95,
|
|
539
|
+
success: true,
|
|
540
|
+
latencyMs: 1200
|
|
541
|
+
});
|
|
542
|
+
```
|
|
199
543
|
|
|
200
|
-
|
|
544
|
+
**Features:**
|
|
545
|
+
- Automatic skill extraction from episodes
|
|
546
|
+
- Semantic search for skill discovery
|
|
547
|
+
- Usage tracking and success rate monitoring
|
|
548
|
+
- Skill composition and chaining
|
|
201
549
|
|
|
550
|
+
**CLI:**
|
|
202
551
|
```bash
|
|
203
|
-
# Create
|
|
552
|
+
# Create skill
|
|
204
553
|
agentdb skill create "jwt_auth" "Generate JWT tokens" \
|
|
205
|
-
'{"inputs": {"user": "object"}}' "
|
|
554
|
+
'{"inputs": {"user": "object"}}' "code..." 1
|
|
206
555
|
|
|
207
|
-
# Search
|
|
556
|
+
# Search skills
|
|
208
557
|
agentdb skill search "authentication" 5 0.5
|
|
209
558
|
|
|
210
|
-
# Auto-consolidate from
|
|
559
|
+
# Auto-consolidate from episodes
|
|
211
560
|
agentdb skill consolidate 3 0.7 7
|
|
212
561
|
|
|
213
|
-
# Update skill
|
|
562
|
+
# Update skill stats
|
|
214
563
|
agentdb skill update 1 1 0.95 true 1200
|
|
564
|
+
```
|
|
565
|
+
|
|
566
|
+
### 4. ๐ Causal Memory Graph โ Intervention-Based Causality
|
|
215
567
|
|
|
216
|
-
|
|
217
|
-
|
|
568
|
+
**Learn what interventions cause what outcomes, not just correlations**
|
|
569
|
+
|
|
570
|
+
Track `p(y|do(x))` using doubly robust estimation and instrumental variables. Understand which actions lead to which results.
|
|
571
|
+
|
|
572
|
+
```typescript
|
|
573
|
+
import { CausalMemoryGraph } from 'agentdb/controllers/CausalMemoryGraph';
|
|
574
|
+
|
|
575
|
+
const causalGraph = new CausalMemoryGraph(db);
|
|
576
|
+
|
|
577
|
+
// Create causal experiment (A/B test)
|
|
578
|
+
const experimentId = causalGraph.createExperiment({
|
|
579
|
+
name: 'test_error_handling_approach',
|
|
580
|
+
hypothesis: 'Try-catch reduces crash rate',
|
|
581
|
+
treatmentId: 123, // Episode ID with error handling
|
|
582
|
+
treatmentType: 'episode',
|
|
583
|
+
controlId: 124, // Episode ID without
|
|
584
|
+
startTime: Date.now(),
|
|
585
|
+
sampleSize: 0,
|
|
586
|
+
status: 'running'
|
|
587
|
+
});
|
|
588
|
+
|
|
589
|
+
// Record observations
|
|
590
|
+
causalGraph.recordObservation({
|
|
591
|
+
experimentId,
|
|
592
|
+
episodeId: 123,
|
|
593
|
+
isTreatment: true,
|
|
594
|
+
outcomeValue: 0.95, // Success rate
|
|
595
|
+
outcomeType: 'success'
|
|
596
|
+
});
|
|
597
|
+
|
|
598
|
+
// Calculate causal uplift
|
|
599
|
+
const { uplift, pValue, confidenceInterval } =
|
|
600
|
+
causalGraph.calculateUplift(experimentId);
|
|
601
|
+
|
|
602
|
+
console.log(`Causal uplift: ${uplift}`);
|
|
603
|
+
console.log(`p-value: ${pValue}`);
|
|
604
|
+
console.log(`95% CI: [${confidenceInterval[0]}, ${confidenceInterval[1]}]`);
|
|
605
|
+
|
|
606
|
+
// Add causal edge
|
|
607
|
+
const edgeId = causalGraph.addCausalEdge({
|
|
608
|
+
fromMemoryId: 123,
|
|
609
|
+
fromMemoryType: 'episode',
|
|
610
|
+
toMemoryId: 125,
|
|
611
|
+
toMemoryType: 'episode',
|
|
612
|
+
similarity: 0.85,
|
|
613
|
+
uplift: 0.15, // 15% improvement
|
|
614
|
+
confidence: 0.95,
|
|
615
|
+
sampleSize: 50
|
|
616
|
+
});
|
|
617
|
+
|
|
618
|
+
// Query causal effects
|
|
619
|
+
const effects = causalGraph.queryCausalEffects({
|
|
620
|
+
interventionMemoryId: 123,
|
|
621
|
+
interventionMemoryType: 'episode',
|
|
622
|
+
minConfidence: 0.8,
|
|
623
|
+
minUplift: 0.1
|
|
624
|
+
});
|
|
218
625
|
```
|
|
219
626
|
|
|
220
|
-
**
|
|
627
|
+
**Use Cases:**
|
|
628
|
+
- Discover which debugging strategies fix bugs
|
|
629
|
+
- Learn what code patterns improve performance
|
|
630
|
+
- Understand what approaches lead to success
|
|
631
|
+
- A/B test different agent strategies
|
|
632
|
+
|
|
633
|
+
### 5. ๐ Explainable Recall โ Provenance Certificates
|
|
634
|
+
|
|
635
|
+
**Every retrieval comes with a cryptographic proof explaining why**
|
|
636
|
+
|
|
637
|
+
Understand exactly why memories were selected with Merkle proof certificates that verify completeness and relevance.
|
|
638
|
+
|
|
639
|
+
```typescript
|
|
640
|
+
import { CausalRecall } from 'agentdb/controllers/CausalRecall';
|
|
641
|
+
|
|
642
|
+
const causalRecall = new CausalRecall(db, embedder, vectorBackend, {
|
|
643
|
+
alpha: 0.7, // Similarity weight
|
|
644
|
+
beta: 0.2, // Causal uplift weight
|
|
645
|
+
gamma: 0.1 // Latency penalty
|
|
646
|
+
});
|
|
647
|
+
|
|
648
|
+
// Retrieve with certificate
|
|
649
|
+
const result = await causalRecall.recall(
|
|
650
|
+
'query-123',
|
|
651
|
+
'How to optimize API response time',
|
|
652
|
+
12, // k results
|
|
653
|
+
['performance', 'optimization'], // requirements
|
|
654
|
+
'internal' // access level
|
|
655
|
+
);
|
|
656
|
+
|
|
657
|
+
console.log(`Retrieved ${result.candidates.length} results`);
|
|
658
|
+
console.log(`Certificate ID: ${result.certificate.id}`);
|
|
659
|
+
console.log(`Completeness: ${result.certificate.completenessScore}`);
|
|
660
|
+
console.log(`Redundancy: ${result.certificate.redundancyRatio}`);
|
|
661
|
+
|
|
662
|
+
// Certificate includes:
|
|
663
|
+
// - Query ID and text
|
|
664
|
+
// - Retrieved chunk IDs with relevance scores
|
|
665
|
+
// - Completeness score (% requirements met)
|
|
666
|
+
// - Redundancy ratio (duplicate coverage)
|
|
667
|
+
// - Merkle root hash (cryptographic proof)
|
|
668
|
+
// - Access level and timestamp
|
|
669
|
+
```
|
|
221
670
|
|
|
222
|
-
|
|
223
|
-
|
|
671
|
+
**Benefits:**
|
|
672
|
+
- Understand why specific memories were selected
|
|
673
|
+
- Verify retrieval completeness
|
|
674
|
+
- Debug agent decision-making
|
|
675
|
+
- Build trust through transparency
|
|
676
|
+
- Audit trail for compliance
|
|
224
677
|
|
|
225
|
-
|
|
678
|
+
### 6. ๐ฏ Causal Recall โ Utility-Based Reranking
|
|
226
679
|
|
|
680
|
+
**Retrieve what actually works, not just what's similar**
|
|
681
|
+
|
|
682
|
+
Standard vector search returns similar memories. Causal Recall reranks by actual utility:
|
|
683
|
+
|
|
684
|
+
**Formula:** `U = ฮฑยทsimilarity + ฮฒยทuplift โ ฮณยทlatency`
|
|
685
|
+
|
|
686
|
+
- **ฮฑยทsimilarity**: Semantic relevance (how related is this memory?)
|
|
687
|
+
- **ฮฒยทuplift**: Causal impact (did this approach actually help?)
|
|
688
|
+
- **ฮณยทlatency**: Performance cost (how long did this take?)
|
|
689
|
+
|
|
690
|
+
```typescript
|
|
691
|
+
// Utility-based retrieval (built into causalRecall.recall)
|
|
692
|
+
const result = await causalRecall.recall(
|
|
693
|
+
'query-456',
|
|
694
|
+
'Optimize database query performance',
|
|
695
|
+
10,
|
|
696
|
+
undefined,
|
|
697
|
+
'internal'
|
|
698
|
+
);
|
|
699
|
+
|
|
700
|
+
// Results ranked by utility, not just similarity
|
|
701
|
+
result.candidates.forEach((candidate, i) => {
|
|
702
|
+
console.log(`${i + 1}. Utility: ${candidate.utilityScore.toFixed(3)}`);
|
|
703
|
+
console.log(` Similarity: ${candidate.similarity.toFixed(3)}`);
|
|
704
|
+
console.log(` Uplift: ${candidate.uplift?.toFixed(3) || 'N/A'}`);
|
|
705
|
+
console.log(` Latency: ${candidate.latencyMs}ms`);
|
|
706
|
+
});
|
|
707
|
+
```
|
|
708
|
+
|
|
709
|
+
**Why It Matters:**
|
|
710
|
+
- Retrieves what works, not just what's similar
|
|
711
|
+
- Balances relevance with effectiveness
|
|
712
|
+
- Accounts for performance costs
|
|
713
|
+
- Learns from causal relationships
|
|
714
|
+
|
|
715
|
+
### 7. ๐ Nightly Learner โ Automated Pattern Discovery
|
|
716
|
+
|
|
717
|
+
**Background process that discovers patterns while you sleep**
|
|
718
|
+
|
|
719
|
+
Runs automated causal discovery on episode history, finding patterns you didn't explicitly program.
|
|
720
|
+
|
|
721
|
+
```typescript
|
|
722
|
+
import { NightlyLearner } from 'agentdb/controllers/NightlyLearner';
|
|
723
|
+
|
|
724
|
+
const learner = new NightlyLearner(db, embedder);
|
|
725
|
+
|
|
726
|
+
// Discover patterns (dry-run first to preview)
|
|
727
|
+
const discovered = await learner.discover({
|
|
728
|
+
minAttempts: 3, // Need 3+ attempts to detect pattern
|
|
729
|
+
minSuccessRate: 0.6, // With 60%+ success rate
|
|
730
|
+
minConfidence: 0.7, // 70% statistical confidence
|
|
731
|
+
dryRun: true // Preview without saving
|
|
732
|
+
});
|
|
733
|
+
|
|
734
|
+
console.log(`Would create ${discovered.length} causal edges`);
|
|
735
|
+
|
|
736
|
+
// Run for real (creates edges + consolidates skills)
|
|
737
|
+
const created = await learner.discover({
|
|
738
|
+
minAttempts: 3,
|
|
739
|
+
minSuccessRate: 0.6,
|
|
740
|
+
minConfidence: 0.7,
|
|
741
|
+
dryRun: false // Actually create
|
|
742
|
+
});
|
|
743
|
+
|
|
744
|
+
console.log(`Created ${created.length} causal edges`);
|
|
745
|
+
|
|
746
|
+
// Prune low-quality edges
|
|
747
|
+
const pruned = await learner.pruneEdges({
|
|
748
|
+
minConfidence: 0.5,
|
|
749
|
+
minUplift: 0.05,
|
|
750
|
+
maxAgeDays: 90
|
|
751
|
+
});
|
|
752
|
+
|
|
753
|
+
console.log(`Pruned ${pruned} low-quality edges`);
|
|
754
|
+
```
|
|
755
|
+
|
|
756
|
+
**Features:**
|
|
757
|
+
- Asynchronous execution (runs in background)
|
|
758
|
+
- Discovers causal edges automatically
|
|
759
|
+
- Auto-consolidates successful patterns into skills
|
|
760
|
+
- Prunes low-quality patterns
|
|
761
|
+
- Doubly robust estimation for causal inference
|
|
762
|
+
|
|
763
|
+
**CLI:**
|
|
227
764
|
```bash
|
|
228
|
-
#
|
|
765
|
+
# Discover patterns (dry-run)
|
|
229
766
|
agentdb learner run 3 0.6 0.7 true
|
|
230
767
|
|
|
231
|
-
#
|
|
768
|
+
# Create patterns for real
|
|
232
769
|
agentdb learner run 3 0.6 0.7 false
|
|
233
770
|
|
|
234
|
-
# Prune low-quality
|
|
771
|
+
# Prune low-quality edges
|
|
235
772
|
agentdb learner prune 0.5 0.05 90
|
|
236
773
|
```
|
|
237
774
|
|
|
238
|
-
|
|
775
|
+
---
|
|
239
776
|
|
|
240
|
-
|
|
241
|
-
**Provenance tracking with cryptographic Merkle proofs**
|
|
777
|
+
## โก Performance Optimizations (v2.0)
|
|
242
778
|
|
|
243
|
-
|
|
779
|
+
### Batch Operations โ 3-4x Faster
|
|
244
780
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
781
|
+
**Process multiple items efficiently with parallel embeddings and SQL transactions**
|
|
782
|
+
|
|
783
|
+
```typescript
|
|
784
|
+
import { BatchOperations } from 'agentdb/optimizations/BatchOperations';
|
|
785
|
+
|
|
786
|
+
const batchOps = new BatchOperations(db, embedder, {
|
|
787
|
+
batchSize: 100, // Process 100 items per batch
|
|
788
|
+
parallelism: 4, // 4 concurrent embedding generations
|
|
789
|
+
progressCallback: (completed, total) => {
|
|
790
|
+
console.log(`Progress: ${completed}/${total}`);
|
|
791
|
+
}
|
|
792
|
+
});
|
|
793
|
+
|
|
794
|
+
// Batch create skills (304 โ 900 ops/sec = 3x faster)
|
|
795
|
+
const skillIds = await batchOps.insertSkills([
|
|
796
|
+
{ name: 'skill-1', description: 'First skill', successRate: 0.8 },
|
|
797
|
+
{ name: 'skill-2', description: 'Second skill', successRate: 0.9 },
|
|
798
|
+
// ... 50 more skills
|
|
799
|
+
]);
|
|
800
|
+
|
|
801
|
+
// Batch store patterns (4x faster than sequential)
|
|
802
|
+
const patternIds = await batchOps.insertPatterns([
|
|
803
|
+
{ taskType: 'debugging', approach: 'Binary search', successRate: 0.85 },
|
|
804
|
+
{ taskType: 'optimization', approach: 'Profile first', successRate: 0.90 },
|
|
805
|
+
// ... 500 patterns
|
|
806
|
+
]);
|
|
807
|
+
|
|
808
|
+
// Batch store episodes (152 โ 500 ops/sec = 3.3x faster)
|
|
809
|
+
const episodeCount = await batchOps.insertEpisodes([
|
|
810
|
+
{ sessionId: 's1', task: 'Task 1', reward: 0.9, success: true },
|
|
811
|
+
{ sessionId: 's1', task: 'Task 2', reward: 0.85, success: true },
|
|
812
|
+
// ... 200 episodes
|
|
813
|
+
]);
|
|
248
814
|
```
|
|
249
815
|
|
|
250
|
-
**
|
|
816
|
+
**Performance:**
|
|
817
|
+
- Skills: 304 โ 900 ops/sec (3x faster)
|
|
818
|
+
- Patterns: 4x faster than sequential
|
|
819
|
+
- Episodes: 152 โ 500 ops/sec (3.3x faster)
|
|
820
|
+
- Parallel embedding generation
|
|
821
|
+
- SQL transaction optimization
|
|
251
822
|
|
|
252
|
-
###
|
|
253
|
-
**Smart retrieval combining similarity, causality, and latency**
|
|
823
|
+
### Intelligent Caching โ 8.8x Faster Stats
|
|
254
824
|
|
|
255
|
-
|
|
825
|
+
**TTL-based caching with LRU eviction for frequently accessed data**
|
|
256
826
|
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
agentdb recall with-certificate "optimize response time" 5 0.7 0.2 0.1
|
|
260
|
-
# ^ ฮฑ ฮฒ ฮณ
|
|
261
|
-
```
|
|
827
|
+
```typescript
|
|
828
|
+
import { ToolCache, MCPToolCaches } from 'agentdb/optimizations/ToolCache';
|
|
262
829
|
|
|
263
|
-
|
|
830
|
+
// Specialized caches for different tool types
|
|
831
|
+
const mcpCaches = new MCPToolCaches();
|
|
832
|
+
// - stats: 60s TTL (agentdb_stats, db_stats)
|
|
833
|
+
// - patterns: 30s TTL (pattern/skill searches)
|
|
834
|
+
// - searches: 15s TTL (episode retrieval)
|
|
835
|
+
// - metrics: 120s TTL (expensive computations)
|
|
264
836
|
|
|
265
|
-
|
|
266
|
-
|
|
837
|
+
// Custom cache
|
|
838
|
+
const customCache = new ToolCache<any>(1000, 60000);
|
|
267
839
|
|
|
268
|
-
|
|
840
|
+
// Set cache entry
|
|
841
|
+
customCache.set('stats:detailed', statsResult, 60000);
|
|
269
842
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
agentdb learner run 3 0.6 0.7 true
|
|
843
|
+
// Get cached value (returns null if expired)
|
|
844
|
+
const cached = customCache.get('stats:detailed');
|
|
273
845
|
|
|
274
|
-
|
|
275
|
-
|
|
846
|
+
// Pattern-based clearing
|
|
847
|
+
customCache.clear('stats:*'); // Clear all stats caches
|
|
848
|
+
|
|
849
|
+
// Get cache statistics
|
|
850
|
+
const stats = customCache.getStats();
|
|
851
|
+
console.log(`Hit rate: ${(stats.hitRate * 100).toFixed(1)}%`);
|
|
852
|
+
console.log(`Size: ${stats.size}/${stats.maxSize}`);
|
|
276
853
|
```
|
|
277
854
|
|
|
278
|
-
**
|
|
855
|
+
**Performance Impact:**
|
|
856
|
+
- agentdb_stats: 176ms โ ~20ms (8.8x faster)
|
|
857
|
+
- pattern_stats: Similar improvement
|
|
858
|
+
- learning_metrics: 120s TTL for expensive computations
|
|
859
|
+
- Hit rates: 80%+ for frequently accessed data
|
|
279
860
|
|
|
280
|
-
###
|
|
861
|
+
### Data Pruning โ Maintain Database Hygiene
|
|
281
862
|
|
|
863
|
+
**Intelligent cleanup preserving causal relationships**
|
|
864
|
+
|
|
865
|
+
```typescript
|
|
866
|
+
// Prune old/low-quality data
|
|
867
|
+
const results = await batchOps.pruneData({
|
|
868
|
+
maxAge: 90, // Keep data from last 90 days
|
|
869
|
+
minReward: 0.3, // Keep episodes with reward >= 0.3
|
|
870
|
+
minSuccessRate: 0.5, // Keep skills/patterns with >= 50% success
|
|
871
|
+
maxRecords: 100000, // Max 100k records per table
|
|
872
|
+
dryRun: false // Actually delete (use true to preview)
|
|
873
|
+
});
|
|
874
|
+
|
|
875
|
+
console.log(`Pruned ${results.episodesPruned} episodes`);
|
|
876
|
+
console.log(`Pruned ${results.skillsPruned} skills`);
|
|
877
|
+
console.log(`Pruned ${results.patternsPruned} patterns`);
|
|
878
|
+
console.log(`Saved ${results.spaceSaved} bytes`);
|
|
879
|
+
```
|
|
880
|
+
|
|
881
|
+
**Features:**
|
|
882
|
+
- Age-based pruning (default: 90 days)
|
|
883
|
+
- Quality-based pruning (min reward/success rate)
|
|
884
|
+
- Max records enforcement (keeps best performing)
|
|
885
|
+
- Preserves causal relationships (won't delete referenced episodes)
|
|
886
|
+
- Dry-run mode for preview
|
|
887
|
+
- Space reclamation via VACUUM
|
|
888
|
+
|
|
889
|
+
**CLI:**
|
|
282
890
|
```bash
|
|
283
|
-
#
|
|
284
|
-
agentdb
|
|
891
|
+
# Preview what would be deleted
|
|
892
|
+
agentdb prune --max-age 90 --min-reward 0.3 --dry-run
|
|
285
893
|
|
|
286
|
-
#
|
|
287
|
-
agentdb --
|
|
288
|
-
agentdb reflexion --help
|
|
289
|
-
agentdb skill --help
|
|
290
|
-
agentdb learner --help
|
|
894
|
+
# Actually prune
|
|
895
|
+
agentdb prune --max-age 90 --min-reward 0.3 --min-success-rate 0.5 --max-records 100000
|
|
291
896
|
```
|
|
292
897
|
|
|
898
|
+
### Enhanced Validation โ Security & Developer Experience
|
|
899
|
+
|
|
900
|
+
**6 new validators with XSS/injection detection**
|
|
901
|
+
|
|
902
|
+
```typescript
|
|
903
|
+
import {
|
|
904
|
+
validateTaskString,
|
|
905
|
+
validateNumericRange,
|
|
906
|
+
validateArrayLength,
|
|
907
|
+
validateObject,
|
|
908
|
+
validateBoolean,
|
|
909
|
+
validateEnum,
|
|
910
|
+
ValidationError
|
|
911
|
+
} from 'agentdb/security/input-validation';
|
|
912
|
+
|
|
913
|
+
try {
|
|
914
|
+
// String validation (length + XSS detection)
|
|
915
|
+
const task = validateTaskString(userInput, 'task');
|
|
916
|
+
|
|
917
|
+
// Numeric range validation
|
|
918
|
+
const k = validateNumericRange(kValue, 'k', 1, 100);
|
|
919
|
+
|
|
920
|
+
// Array length validation
|
|
921
|
+
const items = validateArrayLength(array, 'items', 1, 100);
|
|
922
|
+
|
|
923
|
+
// Enum validation
|
|
924
|
+
const format = validateEnum(formatValue, 'format', ['concise', 'detailed', 'json']);
|
|
925
|
+
|
|
926
|
+
} catch (error) {
|
|
927
|
+
if (error instanceof ValidationError) {
|
|
928
|
+
console.error(`Validation error: ${error.message}`);
|
|
929
|
+
console.error(`Code: ${error.code}`);
|
|
930
|
+
console.error(`Field: ${error.field}`);
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
```
|
|
934
|
+
|
|
935
|
+
**Security Features:**
|
|
936
|
+
- XSS detection (`<script>`, `javascript:`, `onclick=`)
|
|
937
|
+
- Injection detection (null bytes, malicious patterns)
|
|
938
|
+
- Length limits (10k characters max)
|
|
939
|
+
- Type validation with TypeScript types
|
|
940
|
+
- Safe error messages (no sensitive data leakage)
|
|
941
|
+
|
|
293
942
|
---
|
|
294
943
|
|
|
295
|
-
##
|
|
944
|
+
## ๐ค MCP Tools (29 Total)
|
|
296
945
|
|
|
297
|
-
|
|
946
|
+
AgentDB provides 29 optimized MCP tools for zero-code integration with Claude Code, Cursor, and other AI coding assistants.
|
|
298
947
|
|
|
299
|
-
|
|
948
|
+
### Core Vector DB Tools (5)
|
|
300
949
|
|
|
301
|
-
|
|
950
|
+
**Basic vector database operations:**
|
|
302
951
|
|
|
303
|
-
|
|
304
|
-
|
|
952
|
+
| Tool | Description | Performance |
|
|
953
|
+
|------|-------------|-------------|
|
|
954
|
+
| `agentdb_init` | Initialize database with schema | One-time setup |
|
|
955
|
+
| `agentdb_insert` | Insert single vector | Standard |
|
|
956
|
+
| `agentdb_insert_batch` | Batch insert (recommended) | 141x faster |
|
|
957
|
+
| `agentdb_search` | Semantic k-NN search | Optimized |
|
|
958
|
+
| `agentdb_delete` | Delete vectors by ID/filters | Standard |
|
|
305
959
|
|
|
306
|
-
|
|
960
|
+
### Core AgentDB Tools (5 - NEW v2.0)
|
|
307
961
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
| Capability | AgentDB v1.1.0 | Typical Systems |
|
|
311
|
-
|------------|----------------|-----------------|
|
|
312
|
-
| **Startup Time** | โก Milliseconds (sql.js WASM) | ๐ Seconds โ minutes |
|
|
313
|
-
| **Footprint** | ๐ชถ Lightweight embedded database | ๐พ 10โ100ร larger servers |
|
|
314
|
-
| **Search Speed** | ๐ Optimized vector similarity | ๐ข Network latency overhead |
|
|
315
|
-
| **Memory Model** | ๐ง 6 frontier patterns + ReasoningBank | โ Vector search only |
|
|
316
|
-
| **Episodic Memory** | โ
Reflexion with self-critique | โ Not available |
|
|
317
|
-
| **Skill Learning** | โ
Auto-consolidation from episodes | โ Manual extraction |
|
|
318
|
-
| **Causal Reasoning** | โ
`p(y\|do(x))` with doubly robust | โ Correlation only |
|
|
319
|
-
| **Explainability** | โ
Merkle-proof certificates | โ Black box retrieval |
|
|
320
|
-
| **Utility Ranking** | โ
`ฮฑยทsim + ฮฒยทuplift โ ฮณยทlatency` | โ Similarity only |
|
|
321
|
-
| **Auto Discovery** | โ
Nightly Learner (background) | โ Manual pattern finding |
|
|
322
|
-
| **Learning Layer** | ๐ง 10 RL algorithms + plugins | โ External ML stack |
|
|
323
|
-
| **Runtime Scope** | ๐ Node ยท Browser ยท Edge ยท MCP | โ Server-only |
|
|
324
|
-
| **Coordination** | ๐ Frontier memory patterns | โ External services |
|
|
325
|
-
| **Setup** | โ๏ธ Zero config ยท `npm install agentdb` | ๐ข Complex deployment |
|
|
326
|
-
| **CLI Tools** | โ
17 commands (reflexion, skill, learner) | โ Programmatic only |
|
|
962
|
+
**Advanced database management:**
|
|
327
963
|
|
|
328
|
-
|
|
964
|
+
| Tool | Description | Performance |
|
|
965
|
+
|------|-------------|-------------|
|
|
966
|
+
| `agentdb_stats` | Comprehensive database statistics | 8.8x faster (cached) |
|
|
967
|
+
| `agentdb_pattern_store` | Store reasoning patterns | 388K ops/sec |
|
|
968
|
+
| `agentdb_pattern_search` | Search patterns semantically | 32.6M ops/sec |
|
|
969
|
+
| `agentdb_pattern_stats` | Pattern analytics | Cached |
|
|
970
|
+
| `agentdb_clear_cache` | Cache management | Instant |
|
|
971
|
+
|
|
972
|
+
### Frontier Memory Tools (9)
|
|
973
|
+
|
|
974
|
+
**Cognitive capabilities:**
|
|
975
|
+
|
|
976
|
+
| Tool | Description | Use Case |
|
|
977
|
+
|------|-------------|----------|
|
|
978
|
+
| `reflexion_store` | Store episode with self-critique | Learn from experience |
|
|
979
|
+
| `reflexion_retrieve` | Retrieve similar episodes | Episodic replay |
|
|
980
|
+
| `skill_create` | Create reusable skill | Lifelong learning |
|
|
981
|
+
| `skill_search` | Search for applicable skills | Skill discovery |
|
|
982
|
+
| `causal_add_edge` | Add causal relationship | Track causality |
|
|
983
|
+
| `causal_query` | Query causal effects | Understand interventions |
|
|
984
|
+
| `recall_with_certificate` | Utility-based retrieval | Explainable AI |
|
|
985
|
+
| `learner_discover` | Automated pattern discovery | Background learning |
|
|
986
|
+
| `db_stats` | Database statistics | Monitoring |
|
|
329
987
|
|
|
330
|
-
###
|
|
988
|
+
### Learning System Tools (10 - NEW v1.3.0)
|
|
331
989
|
|
|
332
|
-
|
|
333
|
-
* Persist experiences without remote dependencies
|
|
334
|
-
* **Learn cause-and-effect, not just correlations**
|
|
335
|
-
* **Explain every retrieval with cryptographic proofs**
|
|
336
|
-
* **Self-improve through reflexion and critique**
|
|
337
|
-
* Sync distributed cognition in real time
|
|
338
|
-
* Deploy anywhere: Node, browser, edge, MCP
|
|
339
|
-
* Scale from one agent to thousands without re-architecture
|
|
990
|
+
**Reinforcement learning pipeline:**
|
|
340
991
|
|
|
341
|
-
|
|
342
|
-
|
|
992
|
+
| Tool | Description | Algorithms |
|
|
993
|
+
|------|-------------|-----------|
|
|
994
|
+
| `learning_start_session` | Start RL session | 9 algorithms |
|
|
995
|
+
| `learning_end_session` | End session & save policy | All |
|
|
996
|
+
| `learning_predict` | Get AI recommendations | All |
|
|
997
|
+
| `learning_feedback` | Submit action feedback | All |
|
|
998
|
+
| `learning_train` | Batch policy training | All |
|
|
999
|
+
| `learning_metrics` | Performance analytics | All |
|
|
1000
|
+
| `learning_transfer` | Transfer learning | All |
|
|
1001
|
+
| `learning_explain` | Explainable AI | All |
|
|
1002
|
+
| `experience_record` | Record tool execution | All |
|
|
1003
|
+
| `reward_signal` | Calculate rewards | All |
|
|
1004
|
+
|
|
1005
|
+
**Supported RL Algorithms:**
|
|
1006
|
+
Q-Learning, SARSA, DQN, Policy Gradient, Actor-Critic, PPO, Decision Transformer, MCTS, Model-Based
|
|
1007
|
+
|
|
1008
|
+
### MCP Tool Optimization Guide
|
|
1009
|
+
|
|
1010
|
+
For comprehensive MCP tool optimization patterns, see:
|
|
1011
|
+
- [MCP Tool Optimization Guide](docs/MCP_TOOL_OPTIMIZATION_GUIDE.md) - 28KB guide with examples
|
|
1012
|
+
- [MCP Optimization Summary](MCP-OPTIMIZATION-SUMMARY.md) - Executive summary
|
|
1013
|
+
|
|
1014
|
+
**Key Optimizations:**
|
|
1015
|
+
- ๐ Parallel execution markers for 3x speedup
|
|
1016
|
+
- ๐ฆ Batch operations (3-4x faster)
|
|
1017
|
+
- ๐พ Intelligent caching (8.8x faster stats)
|
|
1018
|
+
- ๐ Format parameter (60% token reduction)
|
|
1019
|
+
- โ
Enhanced validation (security + DX)
|
|
343
1020
|
|
|
344
1021
|
---
|
|
345
1022
|
|
|
346
|
-
##
|
|
1023
|
+
## ๐ Benchmarks & Performance
|
|
347
1024
|
|
|
348
|
-
###
|
|
1025
|
+
### ReasoningBank Performance
|
|
349
1026
|
|
|
350
|
-
```bash
|
|
351
|
-
npm install agentdb
|
|
352
1027
|
```
|
|
1028
|
+
Pattern Storage Scalability
|
|
1029
|
+
Small (500): 1,475 patterns/sec, 2MB memory
|
|
1030
|
+
Medium (2,000): 3,818 patterns/sec, 0MB memory
|
|
1031
|
+
Large (5,000): 4,536 patterns/sec, 4MB memory
|
|
1032
|
+
|
|
1033
|
+
โจ Super-linear scaling (throughput increases with data size)
|
|
353
1034
|
|
|
354
|
-
|
|
1035
|
+
Pattern Similarity Detection
|
|
1036
|
+
Threshold 0.5: 12.0 matches, 22.74ms avg search time
|
|
1037
|
+
Threshold 0.7: 10.2 matches, 22.62ms avg search time
|
|
355
1038
|
|
|
356
|
-
|
|
1039
|
+
Optimal threshold: 0.5 (best balance)
|
|
357
1040
|
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
1041
|
+
Query Optimization
|
|
1042
|
+
Simple: 69.31ms
|
|
1043
|
+
Filtered: 15.76ms (4.4x faster)
|
|
1044
|
+
High threshold: 69.09ms
|
|
1045
|
+
Large k=100: 93.03ms
|
|
1046
|
+
```
|
|
363
1047
|
|
|
364
|
-
|
|
365
|
-
db.run('INSERT INTO vectors (text, metadata) VALUES (?, ?)',
|
|
366
|
-
['Hello world', JSON.stringify({type: 'greeting'})]);
|
|
1048
|
+
### Self-Learning Performance
|
|
367
1049
|
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
1050
|
+
```
|
|
1051
|
+
Adaptive Learning (10 sessions, 50 episodes each)
|
|
1052
|
+
Initial success rate: 54%
|
|
1053
|
+
Final success rate: 90%
|
|
1054
|
+
Improvement: 36%
|
|
1055
|
+
Avg session duration: 170ms
|
|
1056
|
+
|
|
1057
|
+
Skill Evolution (3 skills, 5 versions each)
|
|
1058
|
+
Initial avg success: 0.60
|
|
1059
|
+
Final avg success: 0.85
|
|
1060
|
+
Improvement: 25%
|
|
1061
|
+
|
|
1062
|
+
Causal Episode Linking
|
|
1063
|
+
5 episodes linked: 22ms
|
|
1064
|
+
Chain depth: 5 steps
|
|
1065
|
+
Causal relationship: Sequential debugging process
|
|
371
1066
|
```
|
|
372
1067
|
|
|
373
|
-
|
|
374
|
-
- All v1.0.7 API methods work in v1.3.3
|
|
375
|
-
- Same `Database` class interface
|
|
376
|
-
- Uses sql.js WASM (included in bundle)
|
|
377
|
-
- No breaking changes from v1.0.7
|
|
1068
|
+
### MCP Tools Performance
|
|
378
1069
|
|
|
379
|
-
|
|
380
|
-
-
|
|
381
|
-
|
|
382
|
-
- Learning systems (9 RL algorithms)
|
|
383
|
-
- Install: `npm install agentdb@1.3.3`
|
|
1070
|
+
```
|
|
1071
|
+
Ultra-Fast (>1M ops/sec)
|
|
1072
|
+
pattern_search: 32.6M ops/sec
|
|
384
1073
|
|
|
385
|
-
|
|
1074
|
+
Excellent (>100K ops/sec)
|
|
1075
|
+
pattern_store: 388K ops/sec
|
|
386
1076
|
|
|
387
|
-
|
|
1077
|
+
Very Good (>500 ops/sec)
|
|
1078
|
+
episode_retrieve: 957 ops/sec
|
|
1079
|
+
skill_search: 694 ops/sec
|
|
388
1080
|
|
|
389
|
-
|
|
390
|
-
|
|
1081
|
+
Good (>100 ops/sec)
|
|
1082
|
+
skill_create: 304 ops/sec โ 900 ops/sec (with batch)
|
|
1083
|
+
|
|
1084
|
+
Optimization Targets
|
|
1085
|
+
episode_store: 152 ops/sec โ 500 ops/sec (with batch)
|
|
391
1086
|
```
|
|
392
1087
|
|
|
393
|
-
|
|
1088
|
+
### Memory Efficiency
|
|
394
1089
|
|
|
395
|
-
|
|
1090
|
+
```
|
|
1091
|
+
5,000 patterns: 4MB memory (0.8KB per pattern)
|
|
1092
|
+
Consistent low latency: 0.22-0.68ms per pattern
|
|
1093
|
+
Super-linear scaling: performance improves with data size
|
|
1094
|
+
```
|
|
396
1095
|
|
|
397
|
-
|
|
1096
|
+
See [OPTIMIZATION-REPORT.md](OPTIMIZATION-REPORT.md) for comprehensive benchmarks.
|
|
398
1097
|
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
1098
|
+
---
|
|
1099
|
+
|
|
1100
|
+
## ๐๏ธ Architecture
|
|
1101
|
+
|
|
1102
|
+
### Multi-Backend System
|
|
1103
|
+
|
|
1104
|
+
```
|
|
1105
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
1106
|
+
โ AgentDB v2.0 Core โ
|
|
1107
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
|
|
1108
|
+
โ Frontier Memory: โ
|
|
1109
|
+
โ โข ReasoningBank โข Reflexion Memory โ
|
|
1110
|
+
โ โข Skill Library โข Causal Memory Graph โ
|
|
1111
|
+
โ โข Causal Recall โข Nightly Learner โ
|
|
1112
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
|
|
1113
|
+
โ Optimizations: โ
|
|
1114
|
+
โ โข BatchOperations โข ToolCache (LRU + TTL) โ
|
|
1115
|
+
โ โข Enhanced Validation โ
|
|
1116
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
|
|
1117
|
+
โ Backend Auto-Selection (fastest โ most compatible): โ
|
|
1118
|
+
โ RuVector โ HNSWLib โ better-sqlite3 โ sql.js (WASM) โ
|
|
1119
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
1120
|
+
โ โ โ
|
|
1121
|
+
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ
|
|
1122
|
+
โ RuVector โ โ HNSWLib โ โ SQLite โ
|
|
1123
|
+
โ Rust + SIMD โ โ C++ HNSW โ โ better-sql3 โ
|
|
1124
|
+
โ 150x faster โ โ 100x faster โ โ Native Node โ
|
|
1125
|
+
โ (optional) โ โ (optional) โ โ (optional) โ
|
|
1126
|
+
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ
|
|
1127
|
+
โ
|
|
1128
|
+
โโโโโโโโโโโโโโโโ
|
|
1129
|
+
โ sql.js WASM โ
|
|
1130
|
+
โ Default โ
|
|
1131
|
+
โ Zero deps โ
|
|
1132
|
+
โโโโโโโโโโโโโโโโ
|
|
408
1133
|
```
|
|
409
1134
|
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
- `learning_train` - Train policy with batch learning
|
|
443
|
-
- `learning_metrics` - Get performance metrics and trends
|
|
444
|
-
- `learning_transfer` - Transfer knowledge between tasks
|
|
445
|
-
- `learning_explain` - Explainable AI recommendations
|
|
446
|
-
- `experience_record` - Record tool execution experience
|
|
447
|
-
- `reward_signal` - Calculate reward signals for learning
|
|
448
|
-
|
|
449
|
-
[๐ Full MCP Tools Guide](docs/MCP_TOOLS.md) | [๐ Migration Guide v1.3.0](MIGRATION_v1.3.0.md)
|
|
450
|
-
|
|
451
|
-
### CLI Usage
|
|
1135
|
+
### Data Flow
|
|
1136
|
+
|
|
1137
|
+
```
|
|
1138
|
+
User Input
|
|
1139
|
+
โ
|
|
1140
|
+
Input Validation (XSS/injection detection)
|
|
1141
|
+
โ
|
|
1142
|
+
ToolCache Check (LRU + TTL)
|
|
1143
|
+
โโโ Cache Hit โ Return cached result (8.8x faster)
|
|
1144
|
+
โโโ Cache Miss โ Continue
|
|
1145
|
+
โ
|
|
1146
|
+
Embedding Service
|
|
1147
|
+
(Transformers.js or mock)
|
|
1148
|
+
โ
|
|
1149
|
+
Vector Backend
|
|
1150
|
+
(Auto-selected: RuVector โ HNSWLib โ SQLite)
|
|
1151
|
+
โ
|
|
1152
|
+
Frontier Memory Layer
|
|
1153
|
+
(ReasoningBank, Reflexion, Skills, Causal)
|
|
1154
|
+
โ
|
|
1155
|
+
Result + Provenance Certificate
|
|
1156
|
+
โ
|
|
1157
|
+
Cache Result (with TTL)
|
|
1158
|
+
โ
|
|
1159
|
+
Return to User
|
|
1160
|
+
```
|
|
1161
|
+
|
|
1162
|
+
---
|
|
1163
|
+
|
|
1164
|
+
## ๐งช Testing
|
|
1165
|
+
|
|
1166
|
+
AgentDB v2 includes comprehensive test coverage:
|
|
452
1167
|
|
|
453
1168
|
```bash
|
|
454
|
-
#
|
|
455
|
-
|
|
1169
|
+
# Run all tests
|
|
1170
|
+
npm test
|
|
1171
|
+
|
|
1172
|
+
# Run specific test suites
|
|
1173
|
+
npm run test:unit # Unit tests
|
|
1174
|
+
npm run test:integration # Integration tests
|
|
1175
|
+
npm run test:performance # Performance benchmarks
|
|
1176
|
+
npm run test:security # Security validation
|
|
1177
|
+
|
|
1178
|
+
# Docker validation (full CI/CD)
|
|
1179
|
+
npm run docker:build # 9-stage Docker build
|
|
1180
|
+
npm run docker:test # Run tests in container
|
|
1181
|
+
```
|
|
456
1182
|
|
|
457
|
-
|
|
1183
|
+
**Test Coverage:**
|
|
1184
|
+
- โ
Core vector operations
|
|
1185
|
+
- โ
Frontier memory features
|
|
1186
|
+
- โ
Batch operations
|
|
1187
|
+
- โ
Caching mechanisms
|
|
1188
|
+
- โ
Input validation
|
|
1189
|
+
- โ
MCP tool handlers
|
|
1190
|
+
- โ
Security (XSS, injection)
|
|
1191
|
+
- โ
Performance benchmarks
|
|
1192
|
+
- โ
Backwards compatibility
|
|
458
1193
|
|
|
459
|
-
|
|
460
|
-
agentdb reflexion store "session-1" "implement_auth" 0.95 true "Used OAuth2" "requirements" "working code" 1200 500
|
|
1194
|
+
---
|
|
461
1195
|
|
|
462
|
-
|
|
463
|
-
agentdb reflexion retrieve "authentication" 10 0.8
|
|
1196
|
+
## ๐ Documentation
|
|
464
1197
|
|
|
465
|
-
|
|
466
|
-
|
|
1198
|
+
**Core Documentation:**
|
|
1199
|
+
- [MCP Tool Optimization Guide](docs/MCP_TOOL_OPTIMIZATION_GUIDE.md) - Comprehensive optimization patterns (28KB)
|
|
1200
|
+
- [Deep Review v2.0 - Latent Space](docs/DEEP-REVIEW-V2-LATENT-SPACE.md) - Complete validation report (59 CLI commands, 32 MCP tools, zero regressions)
|
|
1201
|
+
- [MCP Tools Reference](docs/MCP_TOOLS.md) - All 32 tools documented
|
|
1202
|
+
- [Optimization Report](OPTIMIZATION-REPORT.md) - v2.0 performance benchmarks
|
|
1203
|
+
- [Optimization Summary](MCP-OPTIMIZATION-SUMMARY.md) - Executive summary
|
|
1204
|
+
- [Migration Guide v1.3.0](MIGRATION_v1.3.0.md) - Upgrade from v1.2.2
|
|
467
1205
|
|
|
468
|
-
|
|
469
|
-
|
|
1206
|
+
**Simulation Documentation:**
|
|
1207
|
+
- [Simulation System](simulation/README.md) - Complete simulation framework (25 scenarios, 848 lines)
|
|
1208
|
+
- [Wizard Guide](simulation/docs/guides/WIZARD-GUIDE.md) - Interactive CLI configuration
|
|
1209
|
+
- [Documentation Index](simulation/docs/DOCUMENTATION-INDEX.md) - 60+ guides organized by category
|
|
470
1210
|
|
|
471
|
-
|
|
472
|
-
agentdb skill search "authentication" 5 0.5
|
|
1211
|
+
---
|
|
473
1212
|
|
|
474
|
-
|
|
475
|
-
agentdb skill consolidate 3 0.7 7
|
|
1213
|
+
## ๐ค Contributing
|
|
476
1214
|
|
|
477
|
-
|
|
478
|
-
agentdb recall with-certificate "successful API optimization" 5 0.7 0.2 0.1
|
|
1215
|
+
We welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
479
1216
|
|
|
480
|
-
|
|
481
|
-
|
|
1217
|
+
**Areas of Interest:**
|
|
1218
|
+
- Additional RL algorithms
|
|
1219
|
+
- Performance optimizations
|
|
1220
|
+
- New backend integrations
|
|
1221
|
+
- Documentation improvements
|
|
1222
|
+
- Test coverage expansion
|
|
482
1223
|
|
|
483
|
-
|
|
484
|
-
agentdb db stats
|
|
1224
|
+
---
|
|
485
1225
|
|
|
486
|
-
|
|
487
|
-
agentdb list-templates
|
|
1226
|
+
## ๐ License
|
|
488
1227
|
|
|
489
|
-
|
|
490
|
-
agentdb create-plugin
|
|
1228
|
+
MIT OR Apache-2.0
|
|
491
1229
|
|
|
492
|
-
|
|
493
|
-
agentdb --help
|
|
494
|
-
```
|
|
1230
|
+
See [LICENSE-MIT](LICENSE-MIT) and [LICENSE-APACHE](LICENSE-APACHE) for details.
|
|
495
1231
|
|
|
496
|
-
|
|
1232
|
+
---
|
|
497
1233
|
|
|
498
|
-
|
|
499
|
-
import { createVectorDB } from 'agentdb';
|
|
1234
|
+
## ๐ Acknowledgments
|
|
500
1235
|
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
1236
|
+
AgentDB v2 builds on research from:
|
|
1237
|
+
- **RuVector** - Native Rust vector database with SIMD optimization (150x faster, 8.2x vs hnswlib)
|
|
1238
|
+
- **Latent Space Research** - Empirical validation of optimal HNSW configurations, GNN attention, self-healing MPC
|
|
1239
|
+
- **Reflexion** (Shinn et al., 2023) - Self-critique and episodic replay
|
|
1240
|
+
- **Causal Inference** (Pearl, Judea) - Intervention-based causality
|
|
1241
|
+
- **Decision Transformer** (Chen et al., 2021) - Offline RL
|
|
1242
|
+
- **HNSW** (Malkov & Yashunin, 2018) - Approximate nearest neighbor search
|
|
1243
|
+
- **Graph Neural Networks** - 8-head attention mechanism for navigation (+12.4% recall)
|
|
1244
|
+
- **Anthropic** - Advanced tool use patterns and MCP protocol
|
|
505
1245
|
|
|
506
1246
|
---
|
|
507
1247
|
|
|
508
|
-
|
|
1248
|
+
## ๐ Project Status
|
|
509
1249
|
|
|
510
|
-
**Version:**
|
|
511
|
-
**Status:**
|
|
512
|
-
**MCP Tools:**
|
|
513
|
-
**
|
|
514
|
-
**
|
|
1250
|
+
**Version:** 2.0.0-alpha.1
|
|
1251
|
+
**Status:** ๐งช Alpha Testing (Early Adopters)
|
|
1252
|
+
**MCP Tools:** 32 (optimized with latent space research)
|
|
1253
|
+
**CLI Commands:** 59 (including simulation suite)
|
|
1254
|
+
**Simulations:** 25 scenarios (98.2% reproducibility)
|
|
1255
|
+
**Tests:** โ
Passing (comprehensive coverage, zero regressions)
|
|
1256
|
+
**Performance:** 150x faster (RuVector), 8.2x faster than hnswlib, 173x faster migration
|
|
1257
|
+
**Self-Healing:** 97.9% degradation prevention (30-day validation)
|
|
1258
|
+
**Last Updated:** 2025-11-30
|
|
1259
|
+
|
|
1260
|
+
[Get Started](#-quick-start-60-seconds) | [Documentation](./docs/) | [GitHub](https://github.com/ruvnet/agentic-flow/tree/main/packages/agentdb) | [npm](https://www.npmjs.com/package/agentdb)
|
|
1261
|
+
|
|
1262
|
+
---
|
|
515
1263
|
|
|
516
|
-
|
|
1264
|
+
**Built with โค๏ธ for the agentic era**
|