@sparkleideas/agentic-flow 2.0.2-alpha-patch.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 +2026 -0
- package/agentic-flow/.claude/agents/MIGRATION_SUMMARY.md +222 -0
- package/agentic-flow/.claude/agents/README.md +89 -0
- package/agentic-flow/.claude/agents/analysis/analyze-code-quality.md +180 -0
- package/agentic-flow/.claude/agents/analysis/code-analyzer.md +209 -0
- package/agentic-flow/.claude/agents/architecture/arch-system-design.md +156 -0
- package/agentic-flow/.claude/agents/base-template-generator.md +268 -0
- package/agentic-flow/.claude/agents/consensus/README.md +253 -0
- package/agentic-flow/.claude/agents/consensus/byzantine-coordinator.md +63 -0
- package/agentic-flow/.claude/agents/consensus/crdt-synchronizer.md +997 -0
- package/agentic-flow/.claude/agents/consensus/gossip-coordinator.md +63 -0
- package/agentic-flow/.claude/agents/consensus/performance-benchmarker.md +851 -0
- package/agentic-flow/.claude/agents/consensus/quorum-manager.md +823 -0
- package/agentic-flow/.claude/agents/consensus/raft-manager.md +63 -0
- package/agentic-flow/.claude/agents/consensus/security-manager.md +622 -0
- package/agentic-flow/.claude/agents/core/coder.md +416 -0
- package/agentic-flow/.claude/agents/core/planner.md +337 -0
- package/agentic-flow/.claude/agents/core/researcher.md +331 -0
- package/agentic-flow/.claude/agents/core/reviewer.md +483 -0
- package/agentic-flow/.claude/agents/core/tester.md +476 -0
- package/agentic-flow/.claude/agents/custom/test-long-runner.md +44 -0
- package/agentic-flow/.claude/agents/data/data-ml-model.md +444 -0
- package/agentic-flow/.claude/agents/development/dev-backend-api.md +345 -0
- package/agentic-flow/.claude/agents/devops/ops-cicd-github.md +164 -0
- package/agentic-flow/.claude/agents/documentation/docs-api-openapi.md +354 -0
- package/agentic-flow/.claude/agents/flow-nexus/app-store.md +88 -0
- package/agentic-flow/.claude/agents/flow-nexus/authentication.md +69 -0
- package/agentic-flow/.claude/agents/flow-nexus/challenges.md +81 -0
- package/agentic-flow/.claude/agents/flow-nexus/neural-network.md +88 -0
- package/agentic-flow/.claude/agents/flow-nexus/payments.md +83 -0
- package/agentic-flow/.claude/agents/flow-nexus/sandbox.md +76 -0
- package/agentic-flow/.claude/agents/flow-nexus/swarm.md +76 -0
- package/agentic-flow/.claude/agents/flow-nexus/user-tools.md +96 -0
- package/agentic-flow/.claude/agents/flow-nexus/workflow.md +84 -0
- package/agentic-flow/.claude/agents/github/code-review-swarm.md +377 -0
- package/agentic-flow/.claude/agents/github/github-modes.md +173 -0
- package/agentic-flow/.claude/agents/github/issue-tracker.md +576 -0
- package/agentic-flow/.claude/agents/github/multi-repo-swarm.md +553 -0
- package/agentic-flow/.claude/agents/github/pr-manager.md +438 -0
- package/agentic-flow/.claude/agents/github/project-board-sync.md +509 -0
- package/agentic-flow/.claude/agents/github/release-manager.md +605 -0
- package/agentic-flow/.claude/agents/github/release-swarm.md +583 -0
- package/agentic-flow/.claude/agents/github/repo-architect.md +398 -0
- package/agentic-flow/.claude/agents/github/swarm-issue.md +573 -0
- package/agentic-flow/.claude/agents/github/swarm-pr.md +428 -0
- package/agentic-flow/.claude/agents/github/sync-coordinator.md +452 -0
- package/agentic-flow/.claude/agents/github/workflow-automation.md +903 -0
- package/agentic-flow/.claude/agents/goal/agent.md +816 -0
- package/agentic-flow/.claude/agents/goal/goal-planner.md +73 -0
- package/agentic-flow/.claude/agents/optimization/README.md +250 -0
- package/agentic-flow/.claude/agents/optimization/benchmark-suite.md +665 -0
- package/agentic-flow/.claude/agents/optimization/load-balancer.md +431 -0
- package/agentic-flow/.claude/agents/optimization/performance-monitor.md +672 -0
- package/agentic-flow/.claude/agents/optimization/resource-allocator.md +674 -0
- package/agentic-flow/.claude/agents/optimization/topology-optimizer.md +808 -0
- package/agentic-flow/.claude/agents/payments/agentic-payments.md +126 -0
- package/agentic-flow/.claude/agents/sona/sona-learning-optimizer.md +496 -0
- package/agentic-flow/.claude/agents/sparc/architecture.md +699 -0
- package/agentic-flow/.claude/agents/sparc/pseudocode.md +520 -0
- package/agentic-flow/.claude/agents/sparc/refinement.md +802 -0
- package/agentic-flow/.claude/agents/sparc/specification.md +478 -0
- package/agentic-flow/.claude/agents/specialized/spec-mobile-react-native.md +226 -0
- package/agentic-flow/.claude/agents/sublinear/consensus-coordinator.md +338 -0
- package/agentic-flow/.claude/agents/sublinear/matrix-optimizer.md +185 -0
- package/agentic-flow/.claude/agents/sublinear/pagerank-analyzer.md +299 -0
- package/agentic-flow/.claude/agents/sublinear/performance-optimizer.md +368 -0
- package/agentic-flow/.claude/agents/sublinear/trading-predictor.md +246 -0
- package/agentic-flow/.claude/agents/swarm/README.md +190 -0
- package/agentic-flow/.claude/agents/swarm/adaptive-coordinator.md +1127 -0
- package/agentic-flow/.claude/agents/swarm/hierarchical-coordinator.md +710 -0
- package/agentic-flow/.claude/agents/swarm/mesh-coordinator.md +963 -0
- package/agentic-flow/.claude/agents/templates/automation-smart-agent.md +205 -0
- package/agentic-flow/.claude/agents/templates/coordinator-swarm-init.md +90 -0
- package/agentic-flow/.claude/agents/templates/github-pr-manager.md +177 -0
- package/agentic-flow/.claude/agents/templates/implementer-sparc-coder.md +259 -0
- package/agentic-flow/.claude/agents/templates/memory-coordinator.md +187 -0
- package/agentic-flow/.claude/agents/templates/migration-plan.md +746 -0
- package/agentic-flow/.claude/agents/templates/orchestrator-task.md +139 -0
- package/agentic-flow/.claude/agents/templates/performance-analyzer.md +199 -0
- package/agentic-flow/.claude/agents/templates/sparc-coordinator.md +514 -0
- package/agentic-flow/.claude/agents/testing/production-validator.md +395 -0
- package/agentic-flow/.claude/agents/testing/tdd-london-swarm.md +244 -0
- package/agentic-flow/.claude/answer.md +1 -0
- package/agentic-flow/.claude/commands/agents/README.md +10 -0
- package/agentic-flow/.claude/commands/agents/agent-capabilities.md +21 -0
- package/agentic-flow/.claude/commands/agents/agent-coordination.md +28 -0
- package/agentic-flow/.claude/commands/agents/agent-spawning.md +28 -0
- package/agentic-flow/.claude/commands/agents/agent-types.md +26 -0
- package/agentic-flow/.claude/commands/analysis/COMMAND_COMPLIANCE_REPORT.md +54 -0
- package/agentic-flow/.claude/commands/analysis/README.md +9 -0
- package/agentic-flow/.claude/commands/analysis/bottleneck-detect.md +162 -0
- package/agentic-flow/.claude/commands/analysis/performance-bottlenecks.md +59 -0
- package/agentic-flow/.claude/commands/analysis/performance-report.md +25 -0
- package/agentic-flow/.claude/commands/analysis/token-efficiency.md +45 -0
- package/agentic-flow/.claude/commands/analysis/token-usage.md +25 -0
- package/agentic-flow/.claude/commands/automation/README.md +9 -0
- package/agentic-flow/.claude/commands/automation/auto-agent.md +122 -0
- package/agentic-flow/.claude/commands/automation/self-healing.md +106 -0
- package/agentic-flow/.claude/commands/automation/session-memory.md +90 -0
- package/agentic-flow/.claude/commands/automation/smart-agents.md +73 -0
- package/agentic-flow/.claude/commands/automation/smart-spawn.md +25 -0
- package/agentic-flow/.claude/commands/automation/workflow-select.md +25 -0
- package/agentic-flow/.claude/commands/claude-flow-help.md +103 -0
- package/agentic-flow/.claude/commands/claude-flow-memory.md +107 -0
- package/agentic-flow/.claude/commands/claude-flow-swarm.md +205 -0
- package/agentic-flow/.claude/commands/flow-nexus/app-store.md +124 -0
- package/agentic-flow/.claude/commands/flow-nexus/challenges.md +120 -0
- package/agentic-flow/.claude/commands/flow-nexus/login-registration.md +65 -0
- package/agentic-flow/.claude/commands/flow-nexus/neural-network.md +134 -0
- package/agentic-flow/.claude/commands/flow-nexus/payments.md +116 -0
- package/agentic-flow/.claude/commands/flow-nexus/sandbox.md +83 -0
- package/agentic-flow/.claude/commands/flow-nexus/swarm.md +87 -0
- package/agentic-flow/.claude/commands/flow-nexus/user-tools.md +152 -0
- package/agentic-flow/.claude/commands/flow-nexus/workflow.md +115 -0
- package/agentic-flow/.claude/commands/github/README.md +11 -0
- package/agentic-flow/.claude/commands/github/code-review-swarm.md +514 -0
- package/agentic-flow/.claude/commands/github/code-review.md +25 -0
- package/agentic-flow/.claude/commands/github/github-modes.md +147 -0
- package/agentic-flow/.claude/commands/github/github-swarm.md +121 -0
- package/agentic-flow/.claude/commands/github/issue-tracker.md +292 -0
- package/agentic-flow/.claude/commands/github/issue-triage.md +25 -0
- package/agentic-flow/.claude/commands/github/multi-repo-swarm.md +519 -0
- package/agentic-flow/.claude/commands/github/pr-enhance.md +26 -0
- package/agentic-flow/.claude/commands/github/pr-manager.md +170 -0
- package/agentic-flow/.claude/commands/github/project-board-sync.md +471 -0
- package/agentic-flow/.claude/commands/github/release-manager.md +338 -0
- package/agentic-flow/.claude/commands/github/release-swarm.md +544 -0
- package/agentic-flow/.claude/commands/github/repo-analyze.md +25 -0
- package/agentic-flow/.claude/commands/github/repo-architect.md +367 -0
- package/agentic-flow/.claude/commands/github/swarm-issue.md +482 -0
- package/agentic-flow/.claude/commands/github/swarm-pr.md +285 -0
- package/agentic-flow/.claude/commands/github/sync-coordinator.md +301 -0
- package/agentic-flow/.claude/commands/github/workflow-automation.md +442 -0
- package/agentic-flow/.claude/commands/hive-mind/README.md +17 -0
- package/agentic-flow/.claude/commands/hive-mind/hive-mind-consensus.md +8 -0
- package/agentic-flow/.claude/commands/hive-mind/hive-mind-init.md +18 -0
- package/agentic-flow/.claude/commands/hive-mind/hive-mind-memory.md +8 -0
- package/agentic-flow/.claude/commands/hive-mind/hive-mind-metrics.md +8 -0
- package/agentic-flow/.claude/commands/hive-mind/hive-mind-resume.md +8 -0
- package/agentic-flow/.claude/commands/hive-mind/hive-mind-sessions.md +8 -0
- package/agentic-flow/.claude/commands/hive-mind/hive-mind-spawn.md +21 -0
- package/agentic-flow/.claude/commands/hive-mind/hive-mind-status.md +8 -0
- package/agentic-flow/.claude/commands/hive-mind/hive-mind-stop.md +8 -0
- package/agentic-flow/.claude/commands/hive-mind/hive-mind-wizard.md +8 -0
- package/agentic-flow/.claude/commands/hive-mind/hive-mind.md +27 -0
- package/agentic-flow/.claude/commands/hooks/README.md +11 -0
- package/agentic-flow/.claude/commands/hooks/overview.md +58 -0
- package/agentic-flow/.claude/commands/hooks/post-edit.md +117 -0
- package/agentic-flow/.claude/commands/hooks/post-task.md +112 -0
- package/agentic-flow/.claude/commands/hooks/pre-edit.md +113 -0
- package/agentic-flow/.claude/commands/hooks/pre-task.md +111 -0
- package/agentic-flow/.claude/commands/hooks/session-end.md +118 -0
- package/agentic-flow/.claude/commands/hooks/setup.md +103 -0
- package/agentic-flow/.claude/commands/monitoring/README.md +9 -0
- package/agentic-flow/.claude/commands/monitoring/agent-metrics.md +25 -0
- package/agentic-flow/.claude/commands/monitoring/agents.md +44 -0
- package/agentic-flow/.claude/commands/monitoring/real-time-view.md +25 -0
- package/agentic-flow/.claude/commands/monitoring/status.md +46 -0
- package/agentic-flow/.claude/commands/monitoring/swarm-monitor.md +25 -0
- package/agentic-flow/.claude/commands/optimization/README.md +9 -0
- package/agentic-flow/.claude/commands/optimization/auto-topology.md +62 -0
- package/agentic-flow/.claude/commands/optimization/cache-manage.md +25 -0
- package/agentic-flow/.claude/commands/optimization/parallel-execute.md +25 -0
- package/agentic-flow/.claude/commands/optimization/parallel-execution.md +50 -0
- package/agentic-flow/.claude/commands/optimization/topology-optimize.md +25 -0
- package/agentic-flow/.claude/commands/pair/README.md +261 -0
- package/agentic-flow/.claude/commands/pair/commands.md +546 -0
- package/agentic-flow/.claude/commands/pair/config.md +510 -0
- package/agentic-flow/.claude/commands/pair/examples.md +512 -0
- package/agentic-flow/.claude/commands/pair/modes.md +348 -0
- package/agentic-flow/.claude/commands/pair/session.md +407 -0
- package/agentic-flow/.claude/commands/pair/start.md +209 -0
- package/agentic-flow/.claude/commands/sparc/analyzer.md +52 -0
- package/agentic-flow/.claude/commands/sparc/architect.md +53 -0
- package/agentic-flow/.claude/commands/sparc/ask.md +97 -0
- package/agentic-flow/.claude/commands/sparc/batch-executor.md +54 -0
- package/agentic-flow/.claude/commands/sparc/code.md +89 -0
- package/agentic-flow/.claude/commands/sparc/coder.md +54 -0
- package/agentic-flow/.claude/commands/sparc/debug.md +83 -0
- package/agentic-flow/.claude/commands/sparc/debugger.md +54 -0
- package/agentic-flow/.claude/commands/sparc/designer.md +53 -0
- package/agentic-flow/.claude/commands/sparc/devops.md +109 -0
- package/agentic-flow/.claude/commands/sparc/docs-writer.md +80 -0
- package/agentic-flow/.claude/commands/sparc/documenter.md +54 -0
- package/agentic-flow/.claude/commands/sparc/innovator.md +54 -0
- package/agentic-flow/.claude/commands/sparc/integration.md +83 -0
- package/agentic-flow/.claude/commands/sparc/mcp.md +117 -0
- package/agentic-flow/.claude/commands/sparc/memory-manager.md +54 -0
- package/agentic-flow/.claude/commands/sparc/optimizer.md +54 -0
- package/agentic-flow/.claude/commands/sparc/orchestrator.md +132 -0
- package/agentic-flow/.claude/commands/sparc/post-deployment-monitoring-mode.md +83 -0
- package/agentic-flow/.claude/commands/sparc/refinement-optimization-mode.md +83 -0
- package/agentic-flow/.claude/commands/sparc/researcher.md +54 -0
- package/agentic-flow/.claude/commands/sparc/reviewer.md +54 -0
- package/agentic-flow/.claude/commands/sparc/security-review.md +80 -0
- package/agentic-flow/.claude/commands/sparc/sparc-modes.md +174 -0
- package/agentic-flow/.claude/commands/sparc/sparc.md +111 -0
- package/agentic-flow/.claude/commands/sparc/spec-pseudocode.md +80 -0
- package/agentic-flow/.claude/commands/sparc/supabase-admin.md +348 -0
- package/agentic-flow/.claude/commands/sparc/swarm-coordinator.md +54 -0
- package/agentic-flow/.claude/commands/sparc/tdd.md +54 -0
- package/agentic-flow/.claude/commands/sparc/tester.md +54 -0
- package/agentic-flow/.claude/commands/sparc/tutorial.md +79 -0
- package/agentic-flow/.claude/commands/sparc/workflow-manager.md +54 -0
- package/agentic-flow/.claude/commands/sparc.md +166 -0
- package/agentic-flow/.claude/commands/stream-chain/pipeline.md +121 -0
- package/agentic-flow/.claude/commands/stream-chain/run.md +70 -0
- package/agentic-flow/.claude/commands/swarm/README.md +15 -0
- package/agentic-flow/.claude/commands/swarm/analysis.md +95 -0
- package/agentic-flow/.claude/commands/swarm/development.md +96 -0
- package/agentic-flow/.claude/commands/swarm/examples.md +168 -0
- package/agentic-flow/.claude/commands/swarm/maintenance.md +102 -0
- package/agentic-flow/.claude/commands/swarm/optimization.md +117 -0
- package/agentic-flow/.claude/commands/swarm/research.md +136 -0
- package/agentic-flow/.claude/commands/swarm/swarm-analysis.md +8 -0
- package/agentic-flow/.claude/commands/swarm/swarm-background.md +8 -0
- package/agentic-flow/.claude/commands/swarm/swarm-init.md +19 -0
- package/agentic-flow/.claude/commands/swarm/swarm-modes.md +8 -0
- package/agentic-flow/.claude/commands/swarm/swarm-monitor.md +8 -0
- package/agentic-flow/.claude/commands/swarm/swarm-spawn.md +19 -0
- package/agentic-flow/.claude/commands/swarm/swarm-status.md +8 -0
- package/agentic-flow/.claude/commands/swarm/swarm-strategies.md +8 -0
- package/agentic-flow/.claude/commands/swarm/swarm.md +27 -0
- package/agentic-flow/.claude/commands/swarm/testing.md +131 -0
- package/agentic-flow/.claude/commands/training/README.md +9 -0
- package/agentic-flow/.claude/commands/training/model-update.md +25 -0
- package/agentic-flow/.claude/commands/training/neural-patterns.md +74 -0
- package/agentic-flow/.claude/commands/training/neural-train.md +25 -0
- package/agentic-flow/.claude/commands/training/pattern-learn.md +25 -0
- package/agentic-flow/.claude/commands/training/specialization.md +63 -0
- package/agentic-flow/.claude/commands/truth/start.md +143 -0
- package/agentic-flow/.claude/commands/verify/check.md +50 -0
- package/agentic-flow/.claude/commands/verify/start.md +128 -0
- package/agentic-flow/.claude/commands/workflows/README.md +9 -0
- package/agentic-flow/.claude/commands/workflows/development.md +78 -0
- package/agentic-flow/.claude/commands/workflows/research.md +63 -0
- package/agentic-flow/.claude/commands/workflows/workflow-create.md +25 -0
- package/agentic-flow/.claude/commands/workflows/workflow-execute.md +25 -0
- package/agentic-flow/.claude/commands/workflows/workflow-export.md +25 -0
- package/agentic-flow/.claude/helpers/checkpoint-manager.sh +251 -0
- package/agentic-flow/.claude/helpers/github-safe.js +106 -0
- package/agentic-flow/.claude/helpers/github-setup.sh +28 -0
- package/agentic-flow/.claude/helpers/quick-start.sh +19 -0
- package/agentic-flow/.claude/helpers/setup-mcp.sh +18 -0
- package/agentic-flow/.claude/helpers/standard-checkpoint-hooks.sh +179 -0
- package/agentic-flow/.claude/mcp.json +13 -0
- package/agentic-flow/.claude/openrouter-models-research.md +411 -0
- package/agentic-flow/.claude/openrouter-quick-reference.md +113 -0
- package/agentic-flow/.claude/settings-backup.json +130 -0
- package/agentic-flow/.claude/settings-optimized.json +116 -0
- package/agentic-flow/.claude/settings-simple.json +78 -0
- package/agentic-flow/.claude/settings.json +238 -0
- package/agentic-flow/.claude/settings.local.json +14 -0
- package/agentic-flow/.claude/skills/agentic-flow-quickstart/skill.md +69 -0
- package/agentic-flow/.claude/skills/hooks-automation/skill.md +155 -0
- package/agentic-flow/.claude/skills/memory-patterns/skill.md +110 -0
- package/agentic-flow/.claude/skills/sparc-methodology/skill.md +137 -0
- package/agentic-flow/.claude/skills/swarm-coordination/skill.md +94 -0
- package/agentic-flow/.claude/skills/worker-benchmarks/skill.md +135 -0
- package/agentic-flow/.claude/skills/worker-integration/skill.md +154 -0
- package/agentic-flow/.claude/statusline.mjs +109 -0
- package/agentic-flow/.claude/statusline.sh +71 -0
- package/agentic-flow/CHANGELOG.md +68 -0
- package/agentic-flow/README.md +2047 -0
- package/agentic-flow/dist/reasoningbank/config/reasoningbank.yaml +145 -0
- package/agentic-flow/dist/reasoningbank/prompts/distill-failure.json +111 -0
- package/agentic-flow/dist/reasoningbank/prompts/distill-success.json +74 -0
- package/agentic-flow/dist/reasoningbank/prompts/judge.json +101 -0
- package/agentic-flow/dist/reasoningbank/prompts/matts-aggregate.json +119 -0
- package/agentic-flow/docs/CLAUDE.md +352 -0
- package/agentic-flow/docs/DOCKER-VERIFICATION.md +207 -0
- package/agentic-flow/docs/IMPROVEMENT_ROADMAP.md +184 -0
- package/agentic-flow/docs/ISSUE-55-VALIDATION.md +171 -0
- package/agentic-flow/docs/LICENSE +21 -0
- package/agentic-flow/docs/NPX_AGENTDB_SETUP.md +175 -0
- package/agentic-flow/docs/OPTIMIZATIONS.md +460 -0
- package/agentic-flow/docs/PUBLISH_GUIDE.md +438 -0
- package/agentic-flow/docs/README.md +217 -0
- package/agentic-flow/docs/RELEASE-v1.10.0-COMPLETE.md +382 -0
- package/agentic-flow/docs/architecture/EXECUTIVE_SUMMARY.md +310 -0
- package/agentic-flow/docs/architecture/FEDERATION-DATA-LIFECYCLE.md +520 -0
- package/agentic-flow/docs/architecture/IMPROVEMENT_PLAN.md +11 -0
- package/agentic-flow/docs/architecture/INTEGRATION-STATUS.md +290 -0
- package/agentic-flow/docs/architecture/MULTI_MODEL_ROUTER_PLAN.md +620 -0
- package/agentic-flow/docs/architecture/PACKAGE_STRUCTURE.md +199 -0
- package/agentic-flow/docs/architecture/QUIC-IMPLEMENTATION-SUMMARY.md +490 -0
- package/agentic-flow/docs/architecture/QUIC-SWARM-INTEGRATION.md +593 -0
- package/agentic-flow/docs/architecture/QUICK_WINS.md +333 -0
- package/agentic-flow/docs/architecture/README.md +15 -0
- package/agentic-flow/docs/architecture/RESEARCH_SUMMARY.md +652 -0
- package/agentic-flow/docs/archive/.agentdb-instructions.md +66 -0
- package/agentic-flow/docs/archive/AGENT-BOOSTER-STATUS.md +292 -0
- package/agentic-flow/docs/archive/CHANGELOG-v1.3.0.md +120 -0
- package/agentic-flow/docs/archive/COMPLETION_REPORT_v1.7.1.md +335 -0
- package/agentic-flow/docs/archive/IMPLEMENTATION_SUMMARY_v1.7.1.md +241 -0
- package/agentic-flow/docs/archive/SUPABASE-INTEGRATION-COMPLETE.md +357 -0
- package/agentic-flow/docs/archive/TESTING_QUICK_START.md +223 -0
- package/agentic-flow/docs/archive/TOOL-EMULATION-INTEGRATION-ISSUE.md +669 -0
- package/agentic-flow/docs/archive/VALIDATION_v1.7.1.md +234 -0
- package/agentic-flow/docs/archived/COMPLETE_VALIDATION_SUMMARY.md +405 -0
- package/agentic-flow/docs/archived/DOCKER_MCP_VALIDATION.md +358 -0
- package/agentic-flow/docs/archived/DOCKER_OPENROUTER_VALIDATION.md +443 -0
- package/agentic-flow/docs/archived/FASTMCP_COMPLETE.md +428 -0
- package/agentic-flow/docs/archived/FASTMCP_INTEGRATION_STATUS.md +288 -0
- package/agentic-flow/docs/archived/FINAL_SDK_VALIDATION.md +328 -0
- package/agentic-flow/docs/archived/FINAL_SYSTEM_VALIDATION.md +458 -0
- package/agentic-flow/docs/archived/FINAL_VALIDATION_SUMMARY.md +409 -0
- package/agentic-flow/docs/archived/FIXES-APPLIED-STATUS.md +331 -0
- package/agentic-flow/docs/archived/FLOW-NEXUS-COMPLETE.md +269 -0
- package/agentic-flow/docs/archived/HOTFIX_1.1.7.md +133 -0
- package/agentic-flow/docs/archived/INTEGRATION_CONFIRMED.md +351 -0
- package/agentic-flow/docs/archived/MCP_CLI_TOOLS_VALIDATION.md +266 -0
- package/agentic-flow/docs/archived/MCP_INTEGRATION_SUCCESS.md +305 -0
- package/agentic-flow/docs/archived/MCP_PROXY_VALIDATION.md +185 -0
- package/agentic-flow/docs/archived/MODEL_VALIDATION_REPORT.md +386 -0
- package/agentic-flow/docs/archived/ONNX_ENV_VARS.md +564 -0
- package/agentic-flow/docs/archived/ONNX_FINAL_REPORT.md +312 -0
- package/agentic-flow/docs/archived/ONNX_IMPLEMENTATION_COMPLETE.md +215 -0
- package/agentic-flow/docs/archived/ONNX_IMPLEMENTATION_SUMMARY.md +197 -0
- package/agentic-flow/docs/archived/ONNX_INTEGRATION.md +422 -0
- package/agentic-flow/docs/archived/ONNX_OPTIMIZATION_SUMMARY.md +374 -0
- package/agentic-flow/docs/archived/ONNX_PHI4_RESEARCH.md +220 -0
- package/agentic-flow/docs/archived/ONNX_RUNTIME_INTEGRATION_PLAN.md +866 -0
- package/agentic-flow/docs/archived/ONNX_SUCCESS_REPORT.md +271 -0
- package/agentic-flow/docs/archived/ONNX_VS_CLAUDE_QUALITY.md +442 -0
- package/agentic-flow/docs/archived/OPENROUTER-FIX-VALIDATION.md +333 -0
- package/agentic-flow/docs/archived/OPENROUTER-SUCCESS-REPORT.md +520 -0
- package/agentic-flow/docs/archived/OPENROUTER_ISSUES_AND_FIXES.md +277 -0
- package/agentic-flow/docs/archived/OPENROUTER_PROXY_COMPLETE.md +494 -0
- package/agentic-flow/docs/archived/OPENROUTER_VALIDATION_COMPLETE.md +382 -0
- package/agentic-flow/docs/archived/OPTIMIZATION_SUMMARY.md +181 -0
- package/agentic-flow/docs/archived/PACKAGE-COMPLETE.md +138 -0
- package/agentic-flow/docs/archived/PHI4_HYPEROPTIMIZATION_PLAN.md +2488 -0
- package/agentic-flow/docs/archived/PROVIDER_INSTRUCTION_OPTIMIZATION.md +139 -0
- package/agentic-flow/docs/archived/PROXY_VALIDATION.md +239 -0
- package/agentic-flow/docs/archived/README.md +20 -0
- package/agentic-flow/docs/archived/README_SDK_VALIDATION.md +356 -0
- package/agentic-flow/docs/archived/README_V1.1.11.md +280 -0
- package/agentic-flow/docs/archived/RELEASE-NOTES-v1.1.13.md +392 -0
- package/agentic-flow/docs/archived/RELEASE-SUMMARY-v1.1.14-beta.1.md +336 -0
- package/agentic-flow/docs/archived/RESEARCH_COMPLETE.txt +335 -0
- package/agentic-flow/docs/archived/ROUTER_VALIDATION.md +311 -0
- package/agentic-flow/docs/archived/SDK-SETUP-COMPLETE.md +252 -0
- package/agentic-flow/docs/archived/SDK_INTEGRATION_COMPLETE.md +336 -0
- package/agentic-flow/docs/archived/TOOL_INSTRUCTION_ENHANCEMENT.md +200 -0
- package/agentic-flow/docs/archived/V1.1.10_VALIDATION.md +194 -0
- package/agentic-flow/docs/archived/V1.1.11_COMPLETE_VALIDATION.md +308 -0
- package/agentic-flow/docs/archived/V1.1.11_MCP_PROXY_FIX.md +374 -0
- package/agentic-flow/docs/archived/V1.1.14-BETA-READY.md +418 -0
- package/agentic-flow/docs/archived/VALIDATION-RESULTS.md +279 -0
- package/agentic-flow/docs/archived/VALIDATION_COMPLETE.md +178 -0
- package/agentic-flow/docs/archived/VALIDATION_SUMMARY.md +224 -0
- package/agentic-flow/docs/archived/claude-flow-integration.md +463 -0
- package/agentic-flow/docs/archived/docker-cli-validation.md +289 -0
- package/agentic-flow/docs/archived/docker-memory-coordination-status.md +261 -0
- package/agentic-flow/docs/archived/mcp-validation-summary.md +264 -0
- package/agentic-flow/docs/archived/quick-wins-validation.md +377 -0
- package/agentic-flow/docs/benchmarks/optimization-guide.md +531 -0
- package/agentic-flow/docs/benchmarks/quic-results.md +494 -0
- package/agentic-flow/docs/docker-tests/TEST-V1.7.8.Dockerfile +13 -0
- package/agentic-flow/docs/docker-tests/TEST-V1.7.9-NODE20.Dockerfile +13 -0
- package/agentic-flow/docs/docker-tests/TEST-V1.7.9.Dockerfile +14 -0
- package/agentic-flow/docs/embeddings/EMBEDDING_GEOMETRY.md +935 -0
- package/agentic-flow/docs/federation/AGENT-DEBUG-STREAMING.md +403 -0
- package/agentic-flow/docs/federation/DEBUG-STREAMING-COMPLETE.md +432 -0
- package/agentic-flow/docs/federation/DEBUG-STREAMING.md +537 -0
- package/agentic-flow/docs/federation/DEPLOYMENT-VALIDATION-SUCCESS.md +394 -0
- package/agentic-flow/docs/federation/DOCKER-FEDERATION-DEEP-REVIEW.md +478 -0
- package/agentic-flow/docs/guides/ADDING-MCP-SERVERS-CLI.md +515 -0
- package/agentic-flow/docs/guides/ADDING-MCP-SERVERS.md +642 -0
- package/agentic-flow/docs/guides/AGENT-BOOSTER.md +435 -0
- package/agentic-flow/docs/guides/ALTERNATIVE_LLM_MODELS.md +524 -0
- package/agentic-flow/docs/guides/CLAUDE-CODE-INTEGRATION.md +403 -0
- package/agentic-flow/docs/guides/DEPLOYMENT.md +906 -0
- package/agentic-flow/docs/guides/DOCKER_AGENT_USAGE.md +352 -0
- package/agentic-flow/docs/guides/IMPLEMENTATION_EXAMPLES.md +960 -0
- package/agentic-flow/docs/guides/MCP-TOOLS.md +1166 -0
- package/agentic-flow/docs/guides/MODEL-ID-MAPPING.md +193 -0
- package/agentic-flow/docs/guides/MULTI-MODEL-ROUTER.md +702 -0
- package/agentic-flow/docs/guides/NPM-PUBLISH.md +218 -0
- package/agentic-flow/docs/guides/ONNX-PROXY-IMPLEMENTATION.md +254 -0
- package/agentic-flow/docs/guides/ONNX_CLI_USAGE.md +344 -0
- package/agentic-flow/docs/guides/ONNX_OPTIMIZATION_GUIDE.md +665 -0
- package/agentic-flow/docs/guides/OPENROUTER_DEPLOYMENT.md +495 -0
- package/agentic-flow/docs/guides/PROXY-ARCHITECTURE-AND-EXTENSION.md +708 -0
- package/agentic-flow/docs/guides/QUIC-SWARM-QUICKSTART.md +543 -0
- package/agentic-flow/docs/guides/QUICK-START-v1.7.1.md +399 -0
- package/agentic-flow/docs/guides/README.md +17 -0
- package/agentic-flow/docs/guides/REASONINGBANK.md +721 -0
- package/agentic-flow/docs/guides/STANDALONE_PROXY_GUIDE.md +437 -0
- package/agentic-flow/docs/guides/agent-sdk.md +234 -0
- package/agentic-flow/docs/integration-docs/AGENT-BOOSTER-INTEGRATION.md +379 -0
- package/agentic-flow/docs/integration-docs/CLAUDE-FLOW-INTEGRATION-ANALYSIS.md +653 -0
- package/agentic-flow/docs/integration-docs/CLI-INTEGRATION-COMPLETE.md +283 -0
- package/agentic-flow/docs/integration-docs/IMPLEMENTATION_SUMMARY.md +369 -0
- package/agentic-flow/docs/integration-docs/INTEGRATION-COMPLETE.md +291 -0
- package/agentic-flow/docs/integration-docs/INTEGRATION-QUICK-SUMMARY.md +249 -0
- package/agentic-flow/docs/integration-docs/INTEGRATION-STATUS-CORRECTED.md +488 -0
- package/agentic-flow/docs/integration-docs/INTEGRATION_COMPLETE_SUMMARY.md +780 -0
- package/agentic-flow/docs/integration-docs/QUIC-WASM-INTEGRATION.md +537 -0
- package/agentic-flow/docs/integration-docs/README.md +61 -0
- package/agentic-flow/docs/integration-docs/WASM_ESM_FIX.md +180 -0
- package/agentic-flow/docs/integration-docs/WASM_INTEGRATION_COMPLETE.md +344 -0
- package/agentic-flow/docs/integrations/CLAUDE_AGENTS_INTEGRATION.md +356 -0
- package/agentic-flow/docs/integrations/CLAUDE_FLOW_INTEGRATION.md +535 -0
- package/agentic-flow/docs/integrations/FASTMCP_CLI_INTEGRATION.md +503 -0
- package/agentic-flow/docs/integrations/FLOW-NEXUS-INTEGRATION.md +319 -0
- package/agentic-flow/docs/integrations/README.md +18 -0
- package/agentic-flow/docs/integrations/fastmcp-implementation-plan.md +2516 -0
- package/agentic-flow/docs/integrations/fastmcp-poc-integration.md +198 -0
- package/agentic-flow/docs/issues/ISSUE-SUPABASE-INTEGRATION.md +536 -0
- package/agentic-flow/docs/issues/ISSUE-xenova-transformers-dependency.md +380 -0
- package/agentic-flow/docs/mcp-validation/IMPLEMENTATION-SUMMARY.md +493 -0
- package/agentic-flow/docs/mcp-validation/MCP-CLI-VALIDATION-REPORT.md +322 -0
- package/agentic-flow/docs/mcp-validation/README.md +43 -0
- package/agentic-flow/docs/mcp-validation/strange-loops-test.md +63 -0
- package/agentic-flow/docs/plans/QUIC/BUILD_INSTRUCTIONS.md +220 -0
- package/agentic-flow/docs/plans/QUIC/IMPLEMENTATION_STATUS.md +234 -0
- package/agentic-flow/docs/plans/QUIC/QUIC-INTEGRATION-SUMMARY.md +545 -0
- package/agentic-flow/docs/plans/QUIC/QUIC-INTEGRATION.md +502 -0
- package/agentic-flow/docs/plans/QUIC/QUIC-README.md +226 -0
- package/agentic-flow/docs/plans/QUIC/QUIC_IMPLEMENTATION_SUMMARY.md +607 -0
- package/agentic-flow/docs/plans/QUIC/README-CONDENSED.md +447 -0
- package/agentic-flow/docs/plans/QUIC/quic-research.md +1415 -0
- package/agentic-flow/docs/plans/QUIC/quic-tutorial.md +485 -0
- package/agentic-flow/docs/plans/agent-booster/00-INDEX.md +230 -0
- package/agentic-flow/docs/plans/agent-booster/00-OVERVIEW.md +454 -0
- package/agentic-flow/docs/plans/agent-booster/01-ARCHITECTURE.md +699 -0
- package/agentic-flow/docs/plans/agent-booster/02-INTEGRATION.md +771 -0
- package/agentic-flow/docs/plans/agent-booster/03-BENCHMARKS.md +616 -0
- package/agentic-flow/docs/plans/agent-booster/04-NPM-SDK.md +673 -0
- package/agentic-flow/docs/plans/agent-booster/GITHUB-ISSUE.md +523 -0
- package/agentic-flow/docs/plans/agent-booster/README.md +576 -0
- package/agentic-flow/docs/plans/agent-booster-cli-integration.md +317 -0
- package/agentic-flow/docs/plans/requesty/00-overview.md +176 -0
- package/agentic-flow/docs/plans/requesty/01-api-research.md +573 -0
- package/agentic-flow/docs/plans/requesty/02-architecture.md +1076 -0
- package/agentic-flow/docs/plans/requesty/03-implementation-phases.md +1129 -0
- package/agentic-flow/docs/plans/requesty/04-testing-strategy.md +905 -0
- package/agentic-flow/docs/plans/requesty/05-migration-guide.md +576 -0
- package/agentic-flow/docs/plans/requesty/README.md +290 -0
- package/agentic-flow/docs/providers/LANDING-PAGE-PROVIDER-CONTENT.md +204 -0
- package/agentic-flow/docs/providers/PROVIDER-FALLBACK-GUIDE.md +619 -0
- package/agentic-flow/docs/providers/PROVIDER-FALLBACK-SUMMARY.md +418 -0
- package/agentic-flow/docs/quantum-goap/DEPENDENCY_GRAPH.mermaid +133 -0
- package/agentic-flow/docs/quantum-goap/EXECUTION_SUMMARY.md +199 -0
- package/agentic-flow/docs/quantum-goap/GOAP_IMPLEMENTATION_PLAN.md +2406 -0
- package/agentic-flow/docs/quantum-goap/QUICK_START.md +301 -0
- package/agentic-flow/docs/quantum-research/QUANTUM_RESEARCH_LITERATURE_REVIEW.md +2071 -0
- package/agentic-flow/docs/quantum-research/README.md +94 -0
- package/agentic-flow/docs/quic/FINAL-VALIDATION.md +336 -0
- package/agentic-flow/docs/quic/IMPLEMENTATION-COMPLETE-SUMMARY.md +349 -0
- package/agentic-flow/docs/quic/PERFORMANCE-VALIDATION.md +282 -0
- package/agentic-flow/docs/quic/QUIC-STATUS-OLD.md +513 -0
- package/agentic-flow/docs/quic/QUIC-STATUS.md +451 -0
- package/agentic-flow/docs/quic/QUIC-VALIDATION-REPORT.md +370 -0
- package/agentic-flow/docs/quic/QUIC_FINAL_STATUS.md +399 -0
- package/agentic-flow/docs/quic/README_QUIC_PHASE1.md +117 -0
- package/agentic-flow/docs/quic/WASM-INTEGRATION-COMPLETE.md +382 -0
- package/agentic-flow/docs/reasoningbank/MEMORY_VALIDATION_REPORT.md +417 -0
- package/agentic-flow/docs/reasoningbank/README.md +43 -0
- package/agentic-flow/docs/reasoningbank/REASONING-AGENTS.md +482 -0
- package/agentic-flow/docs/reasoningbank/REASONINGBANK-BENCHMARK-RESULTS.md +166 -0
- package/agentic-flow/docs/reasoningbank/REASONINGBANK-BENCHMARK.md +396 -0
- package/agentic-flow/docs/reasoningbank/REASONINGBANK-CLI-INTEGRATION.md +455 -0
- package/agentic-flow/docs/reasoningbank/REASONINGBANK-DEMO.md +419 -0
- package/agentic-flow/docs/reasoningbank/REASONINGBANK-VALIDATION.md +532 -0
- package/agentic-flow/docs/reasoningbank/REASONINGBANK_ARCHITECTURE.md +663 -0
- package/agentic-flow/docs/reasoningbank/REASONINGBANK_BACKENDS.md +375 -0
- package/agentic-flow/docs/reasoningbank/REASONINGBANK_FIXES.md +455 -0
- package/agentic-flow/docs/reasoningbank/REASONINGBANK_IMPLEMENTATION_STATUS.md +478 -0
- package/agentic-flow/docs/reasoningbank/REASONINGBANK_INTEGRATION_PLAN.md +1059 -0
- package/agentic-flow/docs/reasoningbank/REASONINGBANK_INVESTIGATION.md +380 -0
- package/agentic-flow/docs/releases/GITHUB-ISSUE-ADDENDUM-v1.4.6.md +1529 -0
- package/agentic-flow/docs/releases/GITHUB-ISSUE-REASONINGBANK-BENCHMARK.md +643 -0
- package/agentic-flow/docs/releases/GITHUB-ISSUE-v1.4.6.md +1453 -0
- package/agentic-flow/docs/releases/GITHUB-ISSUE-v1.5.0.md +468 -0
- package/agentic-flow/docs/releases/HOTFIX-v1.2.1.md +315 -0
- package/agentic-flow/docs/releases/NPM-PUBLISH-GUIDE-v1.2.0.md +440 -0
- package/agentic-flow/docs/releases/PUBLISH-COMPLETE-v1.2.0.md +308 -0
- package/agentic-flow/docs/releases/PUBLISH_CHECKLIST_v1.10.0.md +396 -0
- package/agentic-flow/docs/releases/PUBLISH_SUMMARY_v1.7.1.md +198 -0
- package/agentic-flow/docs/releases/README.md +18 -0
- package/agentic-flow/docs/releases/RELEASE-v1.2.0.md +339 -0
- package/agentic-flow/docs/releases/RELEASE-v1.8.13.md +426 -0
- package/agentic-flow/docs/releases/RELEASE_NOTES_v1.10.0.md +464 -0
- package/agentic-flow/docs/releases/RELEASE_NOTES_v1.7.0.md +297 -0
- package/agentic-flow/docs/releases/RELEASE_v1.7.1.md +327 -0
- package/agentic-flow/docs/releases/v1.4.6-reasoningbank-release.md +541 -0
- package/agentic-flow/docs/releases/v1.4.7-bugfix.md +212 -0
- package/agentic-flow/docs/releases/v1.5.14-QUIC-TRANSPORT.md +201 -0
- package/agentic-flow/docs/reports/QUIC_PHASE1_COMPLETE.md +409 -0
- package/agentic-flow/docs/reports/QUIC_PHASE1_COMPLETION.md +323 -0
- package/agentic-flow/docs/reviews/quic-implementation-review.md +1076 -0
- package/agentic-flow/docs/router/README.md +552 -0
- package/agentic-flow/docs/router/ROUTER_CONFIG_REFERENCE.md +577 -0
- package/agentic-flow/docs/router/ROUTER_USER_GUIDE.md +865 -0
- package/agentic-flow/docs/router/TOP20_MODELS_MATRIX.md +80 -0
- package/agentic-flow/docs/supabase/IMPLEMENTATION-SUMMARY.md +498 -0
- package/agentic-flow/docs/supabase/INDEX.md +358 -0
- package/agentic-flow/docs/supabase/QUICKSTART.md +365 -0
- package/agentic-flow/docs/supabase/README.md +318 -0
- package/agentic-flow/docs/supabase/SUPABASE-REALTIME-FEDERATION.md +575 -0
- package/agentic-flow/docs/supabase/TEST-REPORT.md +446 -0
- package/agentic-flow/docs/supabase/migrations/001_create_federation_tables.sql +339 -0
- package/agentic-flow/docs/testing/AGENT-SYSTEM-VALIDATION.md +517 -0
- package/agentic-flow/docs/testing/AGENTDB_TESTING.md +411 -0
- package/agentic-flow/docs/testing/FINAL-TESTING-SUMMARY.md +362 -0
- package/agentic-flow/docs/testing/README.md +46 -0
- package/agentic-flow/docs/testing/REGRESSION-TEST-RESULTS.md +269 -0
- package/agentic-flow/docs/testing/STREAMING-AND-MCP-VALIDATION.md +517 -0
- package/agentic-flow/docs/validation-reports/BENCHMARK_AND_OPTIMIZATION_REPORT.md +470 -0
- package/agentic-flow/docs/validation-reports/DOCKER_VALIDATION_RESULTS.md +391 -0
- package/agentic-flow/docs/validation-reports/NO_REGRESSIONS_CONFIRMED.md +384 -0
- package/agentic-flow/docs/validation-reports/NPM-PACKAGE-ANALYSIS-FINAL.md +543 -0
- package/agentic-flow/docs/validation-reports/README.md +43 -0
- package/agentic-flow/docs/validation-reports/V2.7.0-ALPHA.10_FINAL_VALIDATION.md +817 -0
- package/agentic-flow/docs/validation-reports/V2.7.0-ALPHA.9_VALIDATION.md +546 -0
- package/agentic-flow/docs/validation-reports/v1.6.0-QUIC-CLI-VALIDATION.md +558 -0
- package/agentic-flow/docs/validation-reports/v1.6.1-NPM-PUBLISH-VALIDATION.md +532 -0
- package/agentic-flow/docs/version-releases/PUBLICATION_REPORT_v1.5.11.md +421 -0
- package/agentic-flow/docs/version-releases/README.md +82 -0
- package/agentic-flow/docs/version-releases/v1.5.9-DOCKER-VERIFICATION.md +263 -0
- package/agentic-flow/docs/version-releases/v1.5.9-RELEASE-SUMMARY.md +222 -0
- package/agentic-flow/scripts/build.sh +30 -0
- package/agentic-flow/scripts/claude +31 -0
- package/agentic-flow/scripts/claude-code +56 -0
- package/agentic-flow/scripts/claude-flow +81 -0
- package/agentic-flow/scripts/claude-flow.bat +18 -0
- package/agentic-flow/scripts/claude-flow.ps1 +24 -0
- package/agentic-flow/scripts/postinstall.js +139 -0
- package/agentic-flow/scripts/run-validation.sh +165 -0
- package/agentic-flow/scripts/test-agentdb.sh +153 -0
- package/agentic-flow/scripts/test-all-commands.sh +46 -0
- package/agentic-flow/scripts/test-claude-flow-sdk.sh +46 -0
- package/agentic-flow/scripts/test-fastmcp-docker.sh +132 -0
- package/agentic-flow/scripts/test-fastmcp-poc.sh +26 -0
- package/agentic-flow/scripts/test-functionality.sh +50 -0
- package/agentic-flow/scripts/test-onnx-docker.sh +176 -0
- package/agentic-flow/scripts/test-router-docker.sh +105 -0
- package/agentic-flow/scripts/validate-mcp-cli-tools.sh +104 -0
- package/agentic-flow/scripts/validate-providers.sh +50 -0
- package/agentic-flow/wasm/quic/README.md +75 -0
- package/agentic-flow/wasm/quic/agentic_flow_quic.js +779 -0
- package/agentic-flow/wasm/quic/agentic_flow_quic_bg.wasm +0 -0
- package/agentic-flow/wasm/quic/package.json +20 -0
- package/agentic-flow/wasm/reasoningbank/package.json +34 -0
- package/agentic-flow/wasm/reasoningbank/reasoningbank_wasm.js +5 -0
- package/agentic-flow/wasm/reasoningbank/reasoningbank_wasm_bg.js +555 -0
- package/agentic-flow/wasm/reasoningbank/reasoningbank_wasm_bg.wasm +0 -0
- package/docs/CHANGELOG.md +272 -0
- package/docs/LICENSE +21 -0
- package/docs/README.md +127 -0
- package/package.json +279 -0
- package/packages/agentic-jujutsu/.cargo/config.toml +14 -0
- package/packages/agentic-jujutsu/BUILD.md +292 -0
- package/packages/agentic-jujutsu/CHANGELOG.md +143 -0
- package/packages/agentic-jujutsu/CHANGELOG_v2.2.0.md +203 -0
- package/packages/agentic-jujutsu/CRATE_README.md +269 -0
- package/packages/agentic-jujutsu/Dockerfile +8 -0
- package/packages/agentic-jujutsu/Dockerfile.test +81 -0
- package/packages/agentic-jujutsu/FUNCTIONALITY_VERIFICATION.md +377 -0
- package/packages/agentic-jujutsu/LICENSE +21 -0
- package/packages/agentic-jujutsu/NAPI_CI_CD_FILES.txt +162 -0
- package/packages/agentic-jujutsu/QUANTUM_INTEGRATION_SUMMARY.txt +67 -0
- package/packages/agentic-jujutsu/README.md +2248 -0
- package/packages/agentic-jujutsu/README_QUANTUM_INTEGRATION.md +195 -0
- package/packages/agentic-jujutsu/agentic-jujutsu-2.0.0.tgz +0 -0
- package/packages/agentic-jujutsu/agentic-jujutsu-2.0.1.tgz +0 -0
- package/packages/agentic-jujutsu/agentic-jujutsu-2.0.2.tgz +0 -0
- package/packages/agentic-jujutsu/agentic-jujutsu-2.0.3.tgz +0 -0
- package/packages/agentic-jujutsu/agentic-jujutsu.linux-x64-gnu.node +0 -0
- package/packages/agentic-jujutsu/benchmarks/README.md +403 -0
- package/packages/agentic-jujutsu/benchmarks/docker/.env.example +24 -0
- package/packages/agentic-jujutsu/benchmarks/docker/Dockerfile.git +55 -0
- package/packages/agentic-jujutsu/benchmarks/docker/Dockerfile.jujutsu +67 -0
- package/packages/agentic-jujutsu/benchmarks/docker/Dockerfile.swarm-coordinator +45 -0
- package/packages/agentic-jujutsu/benchmarks/docker/config/prometheus.yml +20 -0
- package/packages/agentic-jujutsu/benchmarks/docker/docker-compose.yml +152 -0
- package/packages/agentic-jujutsu/benchmarks/docker/scripts/collect-metrics.sh +143 -0
- package/packages/agentic-jujutsu/benchmarks/docker/scripts/generate-reports.sh +150 -0
- package/packages/agentic-jujutsu/benchmarks/docker/scripts/run-benchmarks.sh +80 -0
- package/packages/agentic-jujutsu/benchmarks/docker/scripts/setup-repos.sh +88 -0
- package/packages/agentic-jujutsu/bin/cli.js +286 -0
- package/packages/agentic-jujutsu/bin/mcp-server.js +20 -0
- package/packages/agentic-jujutsu/build.rs +134 -0
- package/packages/agentic-jujutsu/check-methods.js +26 -0
- package/packages/agentic-jujutsu/helpers/encryption.js +234 -0
- package/packages/agentic-jujutsu/index.d.ts +853 -0
- package/packages/agentic-jujutsu/index.js +321 -0
- package/packages/agentic-jujutsu/package-lock.json +1163 -0
- package/packages/agentic-jujutsu/package.json +108 -0
- package/packages/agentic-jujutsu/pkg/bundler/LICENSE +21 -0
- package/packages/agentic-jujutsu/pkg/bundler/README.md +361 -0
- package/packages/agentic-jujutsu/pkg/bundler/agentic_jujutsu.d.ts +554 -0
- package/packages/agentic-jujutsu/pkg/bundler/agentic_jujutsu.js +5 -0
- package/packages/agentic-jujutsu/pkg/bundler/agentic_jujutsu_bg.js +1821 -0
- package/packages/agentic-jujutsu/pkg/bundler/agentic_jujutsu_bg.wasm +0 -0
- package/packages/agentic-jujutsu/pkg/bundler/agentic_jujutsu_bg.wasm.d.ts +113 -0
- package/packages/agentic-jujutsu/pkg/bundler/package.json +34 -0
- package/packages/agentic-jujutsu/pkg/deno/LICENSE +21 -0
- package/packages/agentic-jujutsu/pkg/deno/README.md +361 -0
- package/packages/agentic-jujutsu/pkg/deno/agentic_jujutsu.d.ts +554 -0
- package/packages/agentic-jujutsu/pkg/deno/agentic_jujutsu.js +1802 -0
- package/packages/agentic-jujutsu/pkg/deno/agentic_jujutsu_bg.wasm +0 -0
- package/packages/agentic-jujutsu/pkg/deno/agentic_jujutsu_bg.wasm.d.ts +113 -0
- package/packages/agentic-jujutsu/pkg/node/LICENSE +21 -0
- package/packages/agentic-jujutsu/pkg/node/README.md +361 -0
- package/packages/agentic-jujutsu/pkg/node/agentic_jujutsu.d.ts +554 -0
- package/packages/agentic-jujutsu/pkg/node/agentic_jujutsu.js +1830 -0
- package/packages/agentic-jujutsu/pkg/node/agentic_jujutsu_bg.wasm +0 -0
- package/packages/agentic-jujutsu/pkg/node/agentic_jujutsu_bg.wasm.d.ts +113 -0
- package/packages/agentic-jujutsu/pkg/node/package.json +28 -0
- package/packages/agentic-jujutsu/pkg/web/LICENSE +21 -0
- package/packages/agentic-jujutsu/pkg/web/README.md +361 -0
- package/packages/agentic-jujutsu/pkg/web/agentic_jujutsu.d.ts +691 -0
- package/packages/agentic-jujutsu/pkg/web/agentic_jujutsu.js +1913 -0
- package/packages/agentic-jujutsu/pkg/web/agentic_jujutsu_bg.wasm +0 -0
- package/packages/agentic-jujutsu/pkg/web/agentic_jujutsu_bg.wasm.d.ts +113 -0
- package/packages/agentic-jujutsu/pkg/web/package.json +32 -0
- package/packages/agentic-jujutsu/quantum-bridge.d.ts +115 -0
- package/packages/agentic-jujutsu/scripts/agentic-flow-integration.js +178 -0
- package/packages/agentic-jujutsu/scripts/analyze-size.sh +23 -0
- package/packages/agentic-jujutsu/scripts/coverage.sh +57 -0
- package/packages/agentic-jujutsu/scripts/docker-test.sh +56 -0
- package/packages/agentic-jujutsu/scripts/final-validation.sh +85 -0
- package/packages/agentic-jujutsu/scripts/install-jj.js +197 -0
- package/packages/agentic-jujutsu/scripts/mcp-server.js +98 -0
- package/packages/agentic-jujutsu/scripts/test-all.sh +68 -0
- package/packages/agentic-jujutsu/scripts/verify-build.sh +32 -0
- package/packages/agentic-jujutsu/scripts/verify-napi-config.sh +122 -0
- package/packages/agentic-jujutsu/scripts/wasm-pack-build.sh +76 -0
- package/packages/agentic-jujutsu/test-agentdb-cli.js +119 -0
- package/packages/agentic-jujutsu/test-agentdb.js +105 -0
- package/packages/agentic-jujutsu/test-failures.js +53 -0
- package/packages/agentic-jujutsu/test-napi.js +40 -0
- package/packages/agentic-jujutsu/test-quick.js +61 -0
- package/packages/agentic-jujutsu/test-repo/test-file.txt +1 -0
- package/packages/agentic-jujutsu/typescript/hooks-integration.ts +370 -0
- package/packages/agentic-jujutsu/typescript/index.d.ts +415 -0
- package/reasoningbank/README.md +217 -0
|
@@ -0,0 +1,1529 @@
|
|
|
1
|
+
# 🚀 ReasoningBank v1.4.6 - Additional Technical Details & Advanced Topics
|
|
2
|
+
|
|
3
|
+
This addendum provides deeper technical insights, architectural patterns, and advanced use cases for ReasoningBank.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 🏗️ Architecture Deep Dive
|
|
8
|
+
|
|
9
|
+
### System Architecture Diagram
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
13
|
+
│ APPLICATION LAYER │
|
|
14
|
+
│ ┌───────────┐ ┌───────────┐ ┌───────────┐ ┌──────────────┐│
|
|
15
|
+
│ │ CLI Tools │ │ SDK API │ │ Hooks │ │ MCP Server ││
|
|
16
|
+
│ └─────┬─────┘ └─────┬─────┘ └─────┬─────┘ └──────┬───────┘│
|
|
17
|
+
└────────┼──────────────┼──────────────┼────────────────┼────────┘
|
|
18
|
+
│ │ │ │
|
|
19
|
+
└──────────────┴──────────────┴────────────────┘
|
|
20
|
+
│
|
|
21
|
+
┌─────────────────────────────┼─────────────────────────────────┐
|
|
22
|
+
│ REASONINGBANK CORE │
|
|
23
|
+
│ ┌──────────────────────────┴────────────────────────────┐ │
|
|
24
|
+
│ │ Memory Engine │ │
|
|
25
|
+
│ │ ┌────────────┐ ┌─────────────┐ ┌──────────────┐ │ │
|
|
26
|
+
│ │ │ Retrieve │→ │ Judge │→ │ Distill │ │ │
|
|
27
|
+
│ │ │ (4-factor) │ │ (LLM/Heur.) │ │ (Strategies) │ │ │
|
|
28
|
+
│ │ └────────────┘ └─────────────┘ └──────────────┘ │ │
|
|
29
|
+
│ │ ↑ ↓ │ │
|
|
30
|
+
│ │ ┌────────────────────────────────────────────────┐ │ │
|
|
31
|
+
│ │ │ Consolidate (Periodic) │ │ │
|
|
32
|
+
│ │ │ - Deduplicate - Contradict - Prune │ │ │
|
|
33
|
+
│ │ └────────────────────────────────────────────────┘ │ │
|
|
34
|
+
│ └───────────────────────────────────────────────────────┘ │
|
|
35
|
+
│ │ │
|
|
36
|
+
│ ┌──────────────────────────┴────────────────────────────┐ │
|
|
37
|
+
│ │ Utilities Layer │ │
|
|
38
|
+
│ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ │
|
|
39
|
+
│ │ │Embeddings│ │PII Scrub │ │ MMR │ │ │
|
|
40
|
+
│ │ │(OpenAI/ │ │(9 types) │ │(Diversity)│ │ │
|
|
41
|
+
│ │ │Claude) │ │ │ │ │ │ │
|
|
42
|
+
│ │ └──────────┘ └──────────┘ └──────────┘ │ │
|
|
43
|
+
│ └───────────────────────────────────────────────────────┘ │
|
|
44
|
+
└─────────────────────────────┬───────────────────────────────┘
|
|
45
|
+
│
|
|
46
|
+
┌─────────────────────────────┴───────────────────────────────┐
|
|
47
|
+
│ PERSISTENCE LAYER │
|
|
48
|
+
│ ┌──────────────────────────────────────────────────────┐ │
|
|
49
|
+
│ │ SQLite Database (WAL) │ │
|
|
50
|
+
│ │ ┌───────────────────┐ ┌───────────────────┐ │ │
|
|
51
|
+
│ │ │reasoning_memory │ │task_trajectory │ │ │
|
|
52
|
+
│ │ │- Strategies │ │- Execution logs │ │ │
|
|
53
|
+
│ │ │- Confidence │ │- Verdicts │ │ │
|
|
54
|
+
│ │ │- Usage tracking │ │- Timestamps │ │ │
|
|
55
|
+
│ │ └───────────────────┘ └───────────────────┘ │ │
|
|
56
|
+
│ │ ┌───────────────────┐ ┌───────────────────┐ │ │
|
|
57
|
+
│ │ │pattern_embeddings │ │matts_runs │ │ │
|
|
58
|
+
│ │ │- Semantic vectors │ │- Scaling results │ │ │
|
|
59
|
+
│ │ │- 1024 dimensions │ │- Consensus data │ │ │
|
|
60
|
+
│ │ └───────────────────┘ └───────────────────┘ │ │
|
|
61
|
+
│ └──────────────────────────────────────────────────────┘ │
|
|
62
|
+
└───────────────────────────────────────────────────────────────┘
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Memory Lifecycle State Machine
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
┌────────────────────────────────────────────────────────────┐
|
|
69
|
+
│ MEMORY LIFECYCLE │
|
|
70
|
+
└────────────────────────────────────────────────────────────┘
|
|
71
|
+
|
|
72
|
+
[NEW TASK]
|
|
73
|
+
↓
|
|
74
|
+
┌─────────────────┐
|
|
75
|
+
│ State: READY │ confidence = 0.0
|
|
76
|
+
└────────┬────────┘ usage_count = 0
|
|
77
|
+
│
|
|
78
|
+
↓ (Task execution starts)
|
|
79
|
+
┌──────────────────┐
|
|
80
|
+
│ State: EXECUTING │ Capture trajectory
|
|
81
|
+
└────────┬─────────┘ Track all actions
|
|
82
|
+
│
|
|
83
|
+
↓ (Task completes)
|
|
84
|
+
┌──────────────────┐
|
|
85
|
+
│ State: JUDGING │ LLM evaluates outcome
|
|
86
|
+
└────────┬─────────┘ → Success or Failure
|
|
87
|
+
│
|
|
88
|
+
┌────┴────┐
|
|
89
|
+
↓ ↓
|
|
90
|
+
┌─────────┐ ┌─────────┐
|
|
91
|
+
│SUCCESS │ │FAILURE │
|
|
92
|
+
└────┬────┘ └────┬────┘
|
|
93
|
+
│ │
|
|
94
|
+
↓ ↓
|
|
95
|
+
┌────────────────────────┐
|
|
96
|
+
│ State: DISTILLING │ Extract patterns
|
|
97
|
+
│ - Success → Strategies │ Initial confidence:
|
|
98
|
+
│ - Failure → Guardrails │ 0.5 (neutral)
|
|
99
|
+
└──────────┬─────────────┘
|
|
100
|
+
│
|
|
101
|
+
↓
|
|
102
|
+
┌──────────────────────┐
|
|
103
|
+
│ State: STORED │ confidence = 0.5
|
|
104
|
+
│ (reasoning_memory) │ usage_count = 0
|
|
105
|
+
└──────────┬───────────┘ created_at = NOW
|
|
106
|
+
│
|
|
107
|
+
↓ (Future task retrieves this memory)
|
|
108
|
+
┌──────────────────────┐
|
|
109
|
+
│ State: RETRIEVED │ usage_count++
|
|
110
|
+
│ (being used) │ last_used_at = NOW
|
|
111
|
+
└──────────┬───────────┘
|
|
112
|
+
│
|
|
113
|
+
↓ (Task succeeds with this memory)
|
|
114
|
+
┌──────────────────────┐
|
|
115
|
+
│ State: REINFORCED │ confidence += 0.05
|
|
116
|
+
│ (successful usage) │ (max 0.95)
|
|
117
|
+
└──────────┬───────────┘
|
|
118
|
+
│
|
|
119
|
+
↓ (Every 20 new memories)
|
|
120
|
+
┌──────────────────────┐
|
|
121
|
+
│State: CONSOLIDATING │ Check for:
|
|
122
|
+
│ (maintenance) │ - Duplicates (merge)
|
|
123
|
+
└──────────┬───────────┘ - Contradictions (flag)
|
|
124
|
+
│ - Old/unused (prune)
|
|
125
|
+
┌────┴────┐
|
|
126
|
+
↓ ↓
|
|
127
|
+
┌──────────┐ ┌──────────┐
|
|
128
|
+
│ ACTIVE │ │ PRUNED │
|
|
129
|
+
│(kept) │ │(deleted) │
|
|
130
|
+
└──────────┘ └──────────┘
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Embedding Generation Flow
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
┌─────────────────────────────────────────────────────┐
|
|
137
|
+
│ EMBEDDING GENERATION PIPELINE │
|
|
138
|
+
└─────────────────────────────────────────────────────┘
|
|
139
|
+
|
|
140
|
+
Input: Text (query or memory content)
|
|
141
|
+
│
|
|
142
|
+
├─→ Check Cache
|
|
143
|
+
│ └─→ Cache Hit? → Return cached embedding (0ms)
|
|
144
|
+
│
|
|
145
|
+
└─→ Cache Miss
|
|
146
|
+
↓
|
|
147
|
+
┌────────────────────────┐
|
|
148
|
+
│ Choose Provider │
|
|
149
|
+
│ 1. Claude (API) │
|
|
150
|
+
│ 2. OpenAI (API) │
|
|
151
|
+
│ 3. Hash (Fallback) │
|
|
152
|
+
└───────────┬────────────┘
|
|
153
|
+
│
|
|
154
|
+
┌────────┴─────────┐
|
|
155
|
+
↓ ↓
|
|
156
|
+
┌─────────────┐ ┌──────────────┐ ┌─────────────┐
|
|
157
|
+
│Claude Embed │ │OpenAI Embed │ │Hash Fallback│
|
|
158
|
+
│(Workaround) │ │(text-embed-3)│ │(Deterministic)
|
|
159
|
+
│- Call API │ │- Call API │ │- Simple hash│
|
|
160
|
+
│- Extract │ │- Get vector │ │- Sin/cos │
|
|
161
|
+
│ hidden │ │- 1024 dims │ │ transform │
|
|
162
|
+
│ state │ │ │ │- Normalize │
|
|
163
|
+
└──────┬──────┘ └──────┬───────┘ └──────┬──────┘
|
|
164
|
+
│ │ │
|
|
165
|
+
└─────────────────┴──────────────────┘
|
|
166
|
+
│
|
|
167
|
+
↓
|
|
168
|
+
┌─────────────────┐
|
|
169
|
+
│ Normalize │
|
|
170
|
+
│ magnitude = 1 │
|
|
171
|
+
└────────┬────────┘
|
|
172
|
+
│
|
|
173
|
+
↓
|
|
174
|
+
┌─────────────────┐
|
|
175
|
+
│ Float32Array │
|
|
176
|
+
│ [1024 floats] │
|
|
177
|
+
└────────┬────────┘
|
|
178
|
+
│
|
|
179
|
+
↓
|
|
180
|
+
┌─────────────────┐
|
|
181
|
+
│ Store in Cache │
|
|
182
|
+
│ TTL: 3600s │
|
|
183
|
+
└────────┬────────┘
|
|
184
|
+
│
|
|
185
|
+
↓
|
|
186
|
+
┌─────────────────┐
|
|
187
|
+
│ Serialize to │
|
|
188
|
+
│ BLOB for DB │
|
|
189
|
+
└─────────────────┘
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## 🧮 Mathematical Foundations
|
|
195
|
+
|
|
196
|
+
### Cosine Similarity Derivation
|
|
197
|
+
|
|
198
|
+
The cosine similarity measures the angle between two vectors:
|
|
199
|
+
|
|
200
|
+
```
|
|
201
|
+
Given vectors A and B:
|
|
202
|
+
|
|
203
|
+
cos(θ) = (A · B) / (||A|| × ||B||)
|
|
204
|
+
|
|
205
|
+
Where:
|
|
206
|
+
- A · B = dot product = Σ(A[i] × B[i])
|
|
207
|
+
- ||A|| = magnitude of A = sqrt(Σ(A[i]²))
|
|
208
|
+
- ||B|| = magnitude of B = sqrt(Σ(B[i]²))
|
|
209
|
+
|
|
210
|
+
Properties:
|
|
211
|
+
- Result range: [-1, 1]
|
|
212
|
+
- 1.0 = identical direction (perfect match)
|
|
213
|
+
- 0.0 = orthogonal (unrelated)
|
|
214
|
+
- -1.0 = opposite direction (contradictory)
|
|
215
|
+
|
|
216
|
+
Example:
|
|
217
|
+
A = [0.5, 0.3, 0.2]
|
|
218
|
+
B = [0.4, 0.4, 0.2]
|
|
219
|
+
|
|
220
|
+
A · B = (0.5×0.4) + (0.3×0.4) + (0.2×0.2) = 0.36
|
|
221
|
+
||A|| = sqrt(0.5² + 0.3² + 0.2²) = sqrt(0.38) = 0.616
|
|
222
|
+
||B|| = sqrt(0.4² + 0.4² + 0.2²) = sqrt(0.36) = 0.6
|
|
223
|
+
|
|
224
|
+
cos(θ) = 0.36 / (0.616 × 0.6) = 0.36 / 0.37 = 0.973
|
|
225
|
+
|
|
226
|
+
Interpretation: 0.973 = 97.3% similar → Very high match!
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### Exponential Decay (Recency Factor)
|
|
230
|
+
|
|
231
|
+
Recency uses exponential decay with configurable half-life:
|
|
232
|
+
|
|
233
|
+
```
|
|
234
|
+
recency = exp(-age_days / half_life)
|
|
235
|
+
|
|
236
|
+
Where:
|
|
237
|
+
- age_days = (current_date - created_at) in days
|
|
238
|
+
- half_life = 30 days (default)
|
|
239
|
+
|
|
240
|
+
Example timeline:
|
|
241
|
+
age = 0 days → recency = exp(0) = 1.0 (100%)
|
|
242
|
+
age = 15 days → recency = exp(-0.5) = 0.606 (61%)
|
|
243
|
+
age = 30 days → recency = exp(-1) = 0.368 (37%)
|
|
244
|
+
age = 60 days → recency = exp(-2) = 0.135 (14%)
|
|
245
|
+
age = 90 days → recency = exp(-3) = 0.050 (5%)
|
|
246
|
+
|
|
247
|
+
Graph:
|
|
248
|
+
1.0 │ •
|
|
249
|
+
│ •
|
|
250
|
+
│ •
|
|
251
|
+
0.5 │ •••
|
|
252
|
+
│ ••••
|
|
253
|
+
│ ••••••
|
|
254
|
+
0.0 │____________________••••••••••••••••
|
|
255
|
+
0 15 30 45 60 75 90 days
|
|
256
|
+
|
|
257
|
+
Interpretation:
|
|
258
|
+
- Recent memories (0-15 days) retain 60%+ weight
|
|
259
|
+
- Month-old memories drop to 37%
|
|
260
|
+
- 3-month-old memories nearly irrelevant (5%)
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### Reliability Score Calculation
|
|
264
|
+
|
|
265
|
+
Reliability combines confidence with usage validation:
|
|
266
|
+
|
|
267
|
+
```
|
|
268
|
+
reliability = min(confidence × sqrt(usage_count / 10), 1.0)
|
|
269
|
+
|
|
270
|
+
Components:
|
|
271
|
+
1. confidence: Base trustworthiness (0.0-1.0)
|
|
272
|
+
2. usage_count: Times successfully retrieved
|
|
273
|
+
3. Scaling factor: sqrt(usage_count / 10)
|
|
274
|
+
|
|
275
|
+
Why sqrt? Diminishing returns - 100 uses isn't 10x better than 10 uses
|
|
276
|
+
|
|
277
|
+
Examples:
|
|
278
|
+
Memory A: confidence=0.8, usage=0
|
|
279
|
+
→ reliability = min(0.8 × sqrt(0), 1.0) = 0.0
|
|
280
|
+
(Never used = unproven)
|
|
281
|
+
|
|
282
|
+
Memory B: confidence=0.8, usage=10
|
|
283
|
+
→ reliability = min(0.8 × sqrt(10/10), 1.0) = 0.8
|
|
284
|
+
(10 uses validates the confidence)
|
|
285
|
+
|
|
286
|
+
Memory C: confidence=0.8, usage=100
|
|
287
|
+
→ reliability = min(0.8 × sqrt(100/10), 1.0) = min(2.53, 1.0) = 1.0
|
|
288
|
+
(Capped at perfect reliability)
|
|
289
|
+
|
|
290
|
+
Memory D: confidence=0.5, usage=40
|
|
291
|
+
→ reliability = min(0.5 × sqrt(40/10), 1.0) = min(0.5 × 2.0, 1.0) = 1.0
|
|
292
|
+
(High usage can overcome low initial confidence)
|
|
293
|
+
|
|
294
|
+
Graph of scaling factor:
|
|
295
|
+
sqrt(usage/10)
|
|
296
|
+
3.0 │ •
|
|
297
|
+
│ •••
|
|
298
|
+
2.0 │ •••
|
|
299
|
+
│ •••
|
|
300
|
+
1.0 │ •••
|
|
301
|
+
│ •••
|
|
302
|
+
0.0 │•••___________________________________
|
|
303
|
+
0 10 25 50 75 100 usage_count
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
### Complete Scoring Formula Breakdown
|
|
307
|
+
|
|
308
|
+
```python
|
|
309
|
+
# Step-by-step example with real values
|
|
310
|
+
query = "Login to admin panel with CSRF protection"
|
|
311
|
+
memory = {
|
|
312
|
+
"title": "CSRF token extraction strategy",
|
|
313
|
+
"created_at": "2025-01-05", # 15 days ago
|
|
314
|
+
"confidence": 0.75,
|
|
315
|
+
"usage_count": 18
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
# 1. Semantic similarity (computed via embeddings)
|
|
319
|
+
query_embedding = embed(query) # [0.23, -0.41, 0.52, ...]
|
|
320
|
+
memory_embedding = embed(memory.content) # [0.19, -0.38, 0.48, ...]
|
|
321
|
+
similarity = cosine_similarity(query_embedding, memory_embedding)
|
|
322
|
+
= 0.87 # High match!
|
|
323
|
+
|
|
324
|
+
# 2. Recency (exponential decay)
|
|
325
|
+
age_days = (2025-01-20 - 2025-01-05) = 15 days
|
|
326
|
+
recency = exp(-15 / 30) = exp(-0.5) = 0.606
|
|
327
|
+
|
|
328
|
+
# 3. Reliability (confidence × usage validation)
|
|
329
|
+
reliability = min(0.75 × sqrt(18/10), 1.0)
|
|
330
|
+
= min(0.75 × 1.34, 1.0)
|
|
331
|
+
= min(1.005, 1.0)
|
|
332
|
+
= 1.0 # Capped at perfect
|
|
333
|
+
|
|
334
|
+
# 4. Diversity penalty (applied during MMR)
|
|
335
|
+
# Assume 1 memory already selected with similarity 0.65
|
|
336
|
+
diversity_penalty = 0.65
|
|
337
|
+
|
|
338
|
+
# Final score calculation
|
|
339
|
+
alpha = 0.65 # Similarity weight
|
|
340
|
+
beta = 0.15 # Recency weight
|
|
341
|
+
gamma = 0.20 # Reliability weight
|
|
342
|
+
delta = 0.10 # Diversity weight
|
|
343
|
+
|
|
344
|
+
base_score = (alpha × similarity) + (beta × recency) + (gamma × reliability)
|
|
345
|
+
= (0.65 × 0.87) + (0.15 × 0.606) + (0.20 × 1.0)
|
|
346
|
+
= 0.566 + 0.091 + 0.200
|
|
347
|
+
= 0.857
|
|
348
|
+
|
|
349
|
+
# MMR-adjusted score (diversity penalty)
|
|
350
|
+
final_score = base_score - (delta × diversity_penalty)
|
|
351
|
+
= 0.857 - (0.10 × 0.65)
|
|
352
|
+
= 0.857 - 0.065
|
|
353
|
+
= 0.792
|
|
354
|
+
|
|
355
|
+
# Interpretation: 0.792 = 79.2% → Strong candidate for retrieval!
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
---
|
|
359
|
+
|
|
360
|
+
## 🔬 Advanced Algorithms
|
|
361
|
+
|
|
362
|
+
### MMR (Maximal Marginal Relevance) Detailed
|
|
363
|
+
|
|
364
|
+
MMR iteratively selects documents that balance relevance and diversity:
|
|
365
|
+
|
|
366
|
+
```python
|
|
367
|
+
def mmr_detailed(candidates, query_embedding, k, lambda_param=0.9):
|
|
368
|
+
"""
|
|
369
|
+
MMR: Maximal Marginal Relevance
|
|
370
|
+
|
|
371
|
+
Goal: Select k items that are:
|
|
372
|
+
1. Relevant to query (high base score)
|
|
373
|
+
2. Diverse from each other (low inter-similarity)
|
|
374
|
+
|
|
375
|
+
Lambda parameter trades off relevance vs diversity:
|
|
376
|
+
- λ = 1.0: Pure relevance (ignores diversity)
|
|
377
|
+
- λ = 0.5: Balance
|
|
378
|
+
- λ = 0.0: Pure diversity (ignores relevance)
|
|
379
|
+
"""
|
|
380
|
+
selected = []
|
|
381
|
+
remaining = sorted(candidates, key=lambda x: x.score, reverse=True)
|
|
382
|
+
|
|
383
|
+
# First item: Just pick highest-scoring
|
|
384
|
+
if remaining:
|
|
385
|
+
selected.append(remaining.pop(0))
|
|
386
|
+
|
|
387
|
+
# Subsequent items: Balance relevance and diversity
|
|
388
|
+
while len(selected) < k and remaining:
|
|
389
|
+
best_idx = -1
|
|
390
|
+
best_mmr_score = -float('inf')
|
|
391
|
+
|
|
392
|
+
for i, candidate in enumerate(remaining):
|
|
393
|
+
# Relevance component (from 4-factor scoring)
|
|
394
|
+
relevance = candidate.score
|
|
395
|
+
|
|
396
|
+
# Diversity component (similarity to already-selected)
|
|
397
|
+
max_similarity = 0.0
|
|
398
|
+
for selected_item in selected:
|
|
399
|
+
sim = cosine_similarity(
|
|
400
|
+
candidate.embedding,
|
|
401
|
+
selected_item.embedding
|
|
402
|
+
)
|
|
403
|
+
max_similarity = max(max_similarity, sim)
|
|
404
|
+
|
|
405
|
+
# MMR score: Trade off relevance vs diversity
|
|
406
|
+
mmr_score = lambda_param * relevance - (1 - lambda_param) * max_similarity
|
|
407
|
+
|
|
408
|
+
if mmr_score > best_mmr_score:
|
|
409
|
+
best_mmr_score = mmr_score
|
|
410
|
+
best_idx = i
|
|
411
|
+
|
|
412
|
+
# Add best candidate and remove from consideration
|
|
413
|
+
selected.append(remaining.pop(best_idx))
|
|
414
|
+
|
|
415
|
+
return selected
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
# Example execution trace:
|
|
419
|
+
candidates = [
|
|
420
|
+
{"id": 1, "score": 0.92, "embedding": [0.5, 0.3, ...]}, # CSRF extraction
|
|
421
|
+
{"id": 2, "score": 0.88, "embedding": [0.48, 0.31, ...]}, # CSRF validation
|
|
422
|
+
{"id": 3, "score": 0.75, "embedding": [0.1, -0.8, ...]}, # Rate limiting
|
|
423
|
+
{"id": 4, "score": 0.71, "embedding": [0.49, 0.29, ...]}, # CSRF storage
|
|
424
|
+
]
|
|
425
|
+
|
|
426
|
+
# Iteration 1: Select highest score
|
|
427
|
+
selected = [candidate_1] # score=0.92, "CSRF extraction"
|
|
428
|
+
|
|
429
|
+
# Iteration 2: Balance relevance and diversity
|
|
430
|
+
For candidate_2:
|
|
431
|
+
relevance = 0.88
|
|
432
|
+
similarity_to_1 = cosine_similarity(C2, C1) = 0.95 # Very similar!
|
|
433
|
+
mmr_score = 0.9 × 0.88 - 0.1 × 0.95 = 0.792 - 0.095 = 0.697
|
|
434
|
+
|
|
435
|
+
For candidate_3:
|
|
436
|
+
relevance = 0.75
|
|
437
|
+
similarity_to_1 = cosine_similarity(C3, C1) = 0.12 # Very different!
|
|
438
|
+
mmr_score = 0.9 × 0.75 - 0.1 × 0.12 = 0.675 - 0.012 = 0.663
|
|
439
|
+
|
|
440
|
+
For candidate_4:
|
|
441
|
+
relevance = 0.71
|
|
442
|
+
similarity_to_1 = cosine_similarity(C4, C1) = 0.92 # Very similar!
|
|
443
|
+
mmr_score = 0.9 × 0.71 - 0.1 × 0.92 = 0.639 - 0.092 = 0.547
|
|
444
|
+
|
|
445
|
+
Best MMR score: candidate_2 (0.697)
|
|
446
|
+
selected = [candidate_1, candidate_2]
|
|
447
|
+
|
|
448
|
+
# Iteration 3:
|
|
449
|
+
For candidate_3:
|
|
450
|
+
relevance = 0.75
|
|
451
|
+
max_similarity = max(
|
|
452
|
+
cosine_similarity(C3, C1) = 0.12,
|
|
453
|
+
cosine_similarity(C3, C2) = 0.15
|
|
454
|
+
) = 0.15
|
|
455
|
+
mmr_score = 0.9 × 0.75 - 0.1 × 0.15 = 0.675 - 0.015 = 0.660
|
|
456
|
+
|
|
457
|
+
For candidate_4:
|
|
458
|
+
relevance = 0.71
|
|
459
|
+
max_similarity = max(
|
|
460
|
+
cosine_similarity(C4, C1) = 0.92,
|
|
461
|
+
cosine_similarity(C4, C2) = 0.89
|
|
462
|
+
) = 0.92 # Still very similar to both!
|
|
463
|
+
mmr_score = 0.9 × 0.71 - 0.1 × 0.92 = 0.639 - 0.092 = 0.547
|
|
464
|
+
|
|
465
|
+
Best MMR score: candidate_3 (0.660)
|
|
466
|
+
selected = [candidate_1, candidate_2, candidate_3]
|
|
467
|
+
|
|
468
|
+
Final selection:
|
|
469
|
+
1. CSRF extraction (0.92 base, diverse topic)
|
|
470
|
+
2. CSRF validation (0.88 base, adds validation aspect)
|
|
471
|
+
3. Rate limiting (0.75 base, but VERY diverse topic)
|
|
472
|
+
|
|
473
|
+
Note: candidate_4 excluded despite decent base score (0.71)
|
|
474
|
+
because it's too similar to already-selected items.
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
### Consolidation Algorithms Deep Dive
|
|
478
|
+
|
|
479
|
+
#### Deduplication with Hierarchical Clustering
|
|
480
|
+
|
|
481
|
+
```python
|
|
482
|
+
def deduplicate_advanced(memories, similarity_threshold=0.95):
|
|
483
|
+
"""
|
|
484
|
+
Advanced deduplication using hierarchical clustering
|
|
485
|
+
|
|
486
|
+
Strategy:
|
|
487
|
+
1. Build similarity matrix (O(n²))
|
|
488
|
+
2. Form clusters using single-linkage
|
|
489
|
+
3. Merge clusters within threshold
|
|
490
|
+
4. Keep highest-confidence representative from each cluster
|
|
491
|
+
"""
|
|
492
|
+
# Build similarity matrix
|
|
493
|
+
n = len(memories)
|
|
494
|
+
similarity_matrix = [[0.0] * n for _ in range(n)]
|
|
495
|
+
|
|
496
|
+
for i in range(n):
|
|
497
|
+
for j in range(i+1, n):
|
|
498
|
+
sim = cosine_similarity(
|
|
499
|
+
memories[i].embedding,
|
|
500
|
+
memories[j].embedding
|
|
501
|
+
)
|
|
502
|
+
similarity_matrix[i][j] = sim
|
|
503
|
+
similarity_matrix[j][i] = sim # Symmetric
|
|
504
|
+
|
|
505
|
+
# Hierarchical clustering
|
|
506
|
+
clusters = [[mem] for mem in memories] # Start with singleton clusters
|
|
507
|
+
|
|
508
|
+
while True:
|
|
509
|
+
# Find most similar pair of clusters
|
|
510
|
+
max_sim = 0.0
|
|
511
|
+
merge_i, merge_j = -1, -1
|
|
512
|
+
|
|
513
|
+
for i in range(len(clusters)):
|
|
514
|
+
for j in range(i+1, len(clusters)):
|
|
515
|
+
# Single-linkage: max similarity between any pair
|
|
516
|
+
cluster_sim = max(
|
|
517
|
+
similarity_matrix[m1.id][m2.id]
|
|
518
|
+
for m1 in clusters[i]
|
|
519
|
+
for m2 in clusters[j]
|
|
520
|
+
)
|
|
521
|
+
|
|
522
|
+
if cluster_sim > max_sim:
|
|
523
|
+
max_sim = cluster_sim
|
|
524
|
+
merge_i, merge_j = i, j
|
|
525
|
+
|
|
526
|
+
# Stop if no clusters meet threshold
|
|
527
|
+
if max_sim < similarity_threshold:
|
|
528
|
+
break
|
|
529
|
+
|
|
530
|
+
# Merge most similar clusters
|
|
531
|
+
clusters[merge_i].extend(clusters[merge_j])
|
|
532
|
+
clusters.pop(merge_j)
|
|
533
|
+
|
|
534
|
+
# Keep best memory from each cluster
|
|
535
|
+
representatives = []
|
|
536
|
+
duplicates_removed = 0
|
|
537
|
+
|
|
538
|
+
for cluster in clusters:
|
|
539
|
+
if len(cluster) == 1:
|
|
540
|
+
representatives.append(cluster[0])
|
|
541
|
+
else:
|
|
542
|
+
# Sort by confidence × usage_count
|
|
543
|
+
cluster.sort(
|
|
544
|
+
key=lambda m: m.confidence * sqrt(m.usage_count),
|
|
545
|
+
reverse=True
|
|
546
|
+
)
|
|
547
|
+
|
|
548
|
+
# Keep highest-quality, merge usage counts
|
|
549
|
+
representative = cluster[0]
|
|
550
|
+
for duplicate in cluster[1:]:
|
|
551
|
+
representative.usage_count += duplicate.usage_count
|
|
552
|
+
representative.confidence = max(
|
|
553
|
+
representative.confidence,
|
|
554
|
+
duplicate.confidence
|
|
555
|
+
)
|
|
556
|
+
delete_memory(duplicate.id)
|
|
557
|
+
duplicates_removed += 1
|
|
558
|
+
|
|
559
|
+
representatives.append(representative)
|
|
560
|
+
|
|
561
|
+
return representatives, duplicates_removed
|
|
562
|
+
|
|
563
|
+
|
|
564
|
+
# Example execution:
|
|
565
|
+
memories = [
|
|
566
|
+
{"id": "M1", "title": "Extract CSRF token from form", "confidence": 0.8, "usage": 15},
|
|
567
|
+
{"id": "M2", "title": "Parse CSRF token from HTML", "confidence": 0.7, "usage": 8},
|
|
568
|
+
{"id": "M3", "title": "Include CSRF token in POST", "confidence": 0.75, "usage": 12},
|
|
569
|
+
{"id": "M4", "title": "Rate limit with exponential backoff", "confidence": 0.65, "usage": 5},
|
|
570
|
+
]
|
|
571
|
+
|
|
572
|
+
# Similarity matrix (computed):
|
|
573
|
+
# M1 M2 M3 M4
|
|
574
|
+
# M1 [ 1.0, 0.96, 0.91, 0.15 ]
|
|
575
|
+
# M2 [ 0.96, 1.0, 0.88, 0.12 ]
|
|
576
|
+
# M3 [ 0.91, 0.88, 1.0, 0.18 ]
|
|
577
|
+
# M4 [ 0.15, 0.12, 0.18, 1.0 ]
|
|
578
|
+
|
|
579
|
+
# Clustering process:
|
|
580
|
+
Initial clusters: [[M1], [M2], [M3], [M4]]
|
|
581
|
+
|
|
582
|
+
Round 1: Merge M1 and M2 (similarity 0.96 > 0.95)
|
|
583
|
+
Clusters: [[M1, M2], [M3], [M4]]
|
|
584
|
+
|
|
585
|
+
Round 2: Check similarities
|
|
586
|
+
- [M1,M2] ↔ [M3]: max(0.91, 0.88) = 0.91 < 0.95 ✗
|
|
587
|
+
- [M1,M2] ↔ [M4]: max(0.15, 0.12) = 0.15 < 0.95 ✗
|
|
588
|
+
- [M3] ↔ [M4]: 0.18 < 0.95 ✗
|
|
589
|
+
Stop clustering.
|
|
590
|
+
|
|
591
|
+
Final clusters: [[M1, M2], [M3], [M4]]
|
|
592
|
+
|
|
593
|
+
Select representatives:
|
|
594
|
+
- Cluster [M1, M2]:
|
|
595
|
+
- M1 quality: 0.8 × sqrt(15) = 3.10
|
|
596
|
+
- M2 quality: 0.7 × sqrt(8) = 1.98
|
|
597
|
+
- Winner: M1 (higher quality)
|
|
598
|
+
- Merge: M1.usage_count = 15 + 8 = 23
|
|
599
|
+
- Merge: M1.confidence = max(0.8, 0.7) = 0.8
|
|
600
|
+
- Delete: M2
|
|
601
|
+
|
|
602
|
+
- Cluster [M3]: Keep M3 (singleton)
|
|
603
|
+
- Cluster [M4]: Keep M4 (singleton)
|
|
604
|
+
|
|
605
|
+
Result:
|
|
606
|
+
representatives = [M1 (enhanced), M3, M4]
|
|
607
|
+
duplicates_removed = 1
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
#### Contradiction Detection with Semantic Analysis
|
|
611
|
+
|
|
612
|
+
```python
|
|
613
|
+
def detect_contradictions_advanced(memories, threshold=0.8):
|
|
614
|
+
"""
|
|
615
|
+
Detect contradicting memories using:
|
|
616
|
+
1. High semantic similarity (same topic)
|
|
617
|
+
2. Opposite outcomes or recommendations
|
|
618
|
+
3. Contextual conflict analysis
|
|
619
|
+
"""
|
|
620
|
+
contradictions = []
|
|
621
|
+
|
|
622
|
+
for i, mem1 in enumerate(memories):
|
|
623
|
+
for mem2 in memories[i+1:]:
|
|
624
|
+
# Check semantic similarity
|
|
625
|
+
similarity = cosine_similarity(
|
|
626
|
+
mem1.embedding,
|
|
627
|
+
mem2.embedding
|
|
628
|
+
)
|
|
629
|
+
|
|
630
|
+
if similarity < threshold:
|
|
631
|
+
continue # Too dissimilar to contradict
|
|
632
|
+
|
|
633
|
+
# Extract outcomes/recommendations
|
|
634
|
+
outcome1 = extract_outcome(mem1)
|
|
635
|
+
outcome2 = extract_outcome(mem2)
|
|
636
|
+
|
|
637
|
+
# Check for contradiction indicators
|
|
638
|
+
is_contradiction = False
|
|
639
|
+
|
|
640
|
+
# Type 1: Opposite success/failure outcomes
|
|
641
|
+
if (outcome1.type == "success" and outcome2.type == "failure") or \
|
|
642
|
+
(outcome1.type == "failure" and outcome2.type == "success"):
|
|
643
|
+
is_contradiction = True
|
|
644
|
+
|
|
645
|
+
# Type 2: Conflicting recommendations
|
|
646
|
+
if contains_negation(mem1.content, mem2.content):
|
|
647
|
+
# Example: "Always cache" vs "Never cache"
|
|
648
|
+
is_contradiction = True
|
|
649
|
+
|
|
650
|
+
# Type 3: Mutually exclusive actions
|
|
651
|
+
if are_mutually_exclusive(outcome1.action, outcome2.action):
|
|
652
|
+
# Example: "Scale up" vs "Scale down"
|
|
653
|
+
is_contradiction = True
|
|
654
|
+
|
|
655
|
+
if is_contradiction:
|
|
656
|
+
contradictions.append({
|
|
657
|
+
"memory1": mem1,
|
|
658
|
+
"memory2": mem2,
|
|
659
|
+
"similarity": similarity,
|
|
660
|
+
"conflict_type": determine_conflict_type(mem1, mem2)
|
|
661
|
+
})
|
|
662
|
+
|
|
663
|
+
# Resolve contradictions
|
|
664
|
+
for conflict in contradictions:
|
|
665
|
+
mem1 = conflict["memory1"]
|
|
666
|
+
mem2 = conflict["memory2"]
|
|
667
|
+
|
|
668
|
+
# Resolution strategy
|
|
669
|
+
if mem1.confidence > mem2.confidence + 0.15:
|
|
670
|
+
# mem1 significantly more confident
|
|
671
|
+
flag_for_review(mem2.id, reason=f"Contradicts {mem1.id} (higher confidence)")
|
|
672
|
+
elif mem2.confidence > mem1.confidence + 0.15:
|
|
673
|
+
flag_for_review(mem1.id, reason=f"Contradicts {mem2.id} (higher confidence)")
|
|
674
|
+
else:
|
|
675
|
+
# Similar confidence: flag both for human review
|
|
676
|
+
flag_for_review(mem1.id, reason=f"Contradicts {mem2.id} (manual review needed)")
|
|
677
|
+
flag_for_review(mem2.id, reason=f"Contradicts {mem1.id} (manual review needed)")
|
|
678
|
+
|
|
679
|
+
return contradictions
|
|
680
|
+
|
|
681
|
+
|
|
682
|
+
def contains_negation(text1, text2):
|
|
683
|
+
"""Check if texts contain negating keywords"""
|
|
684
|
+
negation_pairs = [
|
|
685
|
+
("always", "never"),
|
|
686
|
+
("must", "must not"),
|
|
687
|
+
("enable", "disable"),
|
|
688
|
+
("allow", "deny"),
|
|
689
|
+
("cache", "bypass cache"),
|
|
690
|
+
("scale up", "scale down"),
|
|
691
|
+
("increase", "decrease"),
|
|
692
|
+
]
|
|
693
|
+
|
|
694
|
+
text1_lower = text1.lower()
|
|
695
|
+
text2_lower = text2.lower()
|
|
696
|
+
|
|
697
|
+
for pos, neg in negation_pairs:
|
|
698
|
+
if (pos in text1_lower and neg in text2_lower) or \
|
|
699
|
+
(neg in text1_lower and pos in text2_lower):
|
|
700
|
+
return True
|
|
701
|
+
|
|
702
|
+
return False
|
|
703
|
+
|
|
704
|
+
|
|
705
|
+
# Example:
|
|
706
|
+
memories = [
|
|
707
|
+
{
|
|
708
|
+
"id": "M1",
|
|
709
|
+
"title": "Always cache API responses",
|
|
710
|
+
"content": "Caching API responses improves performance...",
|
|
711
|
+
"confidence": 0.75,
|
|
712
|
+
"embedding": [...]
|
|
713
|
+
},
|
|
714
|
+
{
|
|
715
|
+
"id": "M2",
|
|
716
|
+
"title": "Never cache authentication responses",
|
|
717
|
+
"content": "Auth responses must not be cached for security...",
|
|
718
|
+
"confidence": 0.85,
|
|
719
|
+
"embedding": [...]
|
|
720
|
+
}
|
|
721
|
+
]
|
|
722
|
+
|
|
723
|
+
# Detection:
|
|
724
|
+
similarity = cosine_similarity(M1.embedding, M2.embedding) = 0.82
|
|
725
|
+
# High similarity (same topic: caching)
|
|
726
|
+
|
|
727
|
+
contains_negation(M1.content, M2.content) = True
|
|
728
|
+
# "always cache" vs "never cache" → Negation detected!
|
|
729
|
+
|
|
730
|
+
# Resolution:
|
|
731
|
+
M2.confidence (0.85) > M1.confidence (0.75) + 0.15? No.
|
|
732
|
+
M1.confidence (0.75) > M2.confidence (0.85) + 0.15? No.
|
|
733
|
+
|
|
734
|
+
# Both have similar confidence → Flag for human review
|
|
735
|
+
flag_for_review(M1.id, reason="Contradicts M2: caching policy conflict")
|
|
736
|
+
flag_for_review(M2.id, reason="Contradicts M1: caching policy conflict")
|
|
737
|
+
|
|
738
|
+
# Human decision options:
|
|
739
|
+
# 1. Keep both (they apply to different contexts: general vs auth)
|
|
740
|
+
# 2. Keep M2 only (security takes precedence)
|
|
741
|
+
# 3. Merge into nuanced memory: "Cache non-auth responses"
|
|
742
|
+
```
|
|
743
|
+
|
|
744
|
+
---
|
|
745
|
+
|
|
746
|
+
## 🎓 Advanced Use Cases
|
|
747
|
+
|
|
748
|
+
### Use Case: Multi-Agent Code Review System
|
|
749
|
+
|
|
750
|
+
```typescript
|
|
751
|
+
import { runTask, retrieveMemories, consolidate } from 'agentic-flow/reasoningbank';
|
|
752
|
+
|
|
753
|
+
// Specialized code review agents with learning
|
|
754
|
+
async function multiAgentCodeReview(pullRequest: PullRequest) {
|
|
755
|
+
console.log(`\n🔍 Starting Multi-Agent Code Review for PR #${pullRequest.number}\n`);
|
|
756
|
+
|
|
757
|
+
// Agent 1: Security Auditor (learns from past vulnerabilities)
|
|
758
|
+
const securityReview = await runTask({
|
|
759
|
+
taskId: `security-${pullRequest.id}`,
|
|
760
|
+
agentId: 'security-auditor',
|
|
761
|
+
query: `Security audit for: ${pullRequest.description}
|
|
762
|
+
Changed files: ${pullRequest.files.join(', ')}
|
|
763
|
+
Focus: SQL injection, XSS, CSRF, auth bypasses`,
|
|
764
|
+
domain: 'code-review.security',
|
|
765
|
+
executeFn: async (memories) => {
|
|
766
|
+
console.log(`🔒 Security Agent using ${memories.length} known vulnerabilities\n`);
|
|
767
|
+
|
|
768
|
+
const findings = [];
|
|
769
|
+
|
|
770
|
+
for (const file of pullRequest.files) {
|
|
771
|
+
const code = await readFile(file);
|
|
772
|
+
|
|
773
|
+
// Check against learned vulnerability patterns
|
|
774
|
+
for (const memory of memories) {
|
|
775
|
+
const pattern = memory.content;
|
|
776
|
+
if (code.includes(pattern.indicator)) {
|
|
777
|
+
findings.push({
|
|
778
|
+
file,
|
|
779
|
+
line: findLine(code, pattern.indicator),
|
|
780
|
+
severity: pattern.severity,
|
|
781
|
+
description: memory.title,
|
|
782
|
+
recommendation: pattern.fix
|
|
783
|
+
});
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
return {
|
|
789
|
+
findings,
|
|
790
|
+
severity: findingsToSeverity(findings)
|
|
791
|
+
};
|
|
792
|
+
}
|
|
793
|
+
});
|
|
794
|
+
|
|
795
|
+
// Agent 2: Performance Reviewer (learns from performance anti-patterns)
|
|
796
|
+
const perfReview = await runTask({
|
|
797
|
+
taskId: `perf-${pullRequest.id}`,
|
|
798
|
+
agentId: 'perf-reviewer',
|
|
799
|
+
query: `Performance review for: ${pullRequest.description}
|
|
800
|
+
Check for: N+1 queries, memory leaks, inefficient algorithms`,
|
|
801
|
+
domain: 'code-review.performance',
|
|
802
|
+
executeFn: async (memories) => {
|
|
803
|
+
console.log(`⚡ Performance Agent using ${memories.length} known anti-patterns\n`);
|
|
804
|
+
|
|
805
|
+
const issues = [];
|
|
806
|
+
|
|
807
|
+
for (const file of pullRequest.files) {
|
|
808
|
+
// ... check for performance issues using learned patterns
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
return { issues };
|
|
812
|
+
}
|
|
813
|
+
});
|
|
814
|
+
|
|
815
|
+
// Agent 3: Best Practices Reviewer (learns from style guide violations)
|
|
816
|
+
const styleReview = await runTask({
|
|
817
|
+
taskId: `style-${pullRequest.id}`,
|
|
818
|
+
agentId: 'style-reviewer',
|
|
819
|
+
query: `Code style review for: ${pullRequest.description}
|
|
820
|
+
Check: naming conventions, error handling, testing`,
|
|
821
|
+
domain: 'code-review.best-practices',
|
|
822
|
+
executeFn: async (memories) => {
|
|
823
|
+
console.log(`📝 Style Agent using ${memories.length} coding standards\n`);
|
|
824
|
+
|
|
825
|
+
// ... check for style violations
|
|
826
|
+
|
|
827
|
+
return { violations: [] };
|
|
828
|
+
}
|
|
829
|
+
});
|
|
830
|
+
|
|
831
|
+
// Aggregate results
|
|
832
|
+
const allFindings = [
|
|
833
|
+
...securityReview.result.findings,
|
|
834
|
+
...perfReview.result.issues,
|
|
835
|
+
...styleReview.result.violations
|
|
836
|
+
];
|
|
837
|
+
|
|
838
|
+
// Generate review comment
|
|
839
|
+
const reviewComment = generateReviewComment(allFindings);
|
|
840
|
+
|
|
841
|
+
// Post to GitHub
|
|
842
|
+
await postCodeReviewComment(pullRequest.number, reviewComment);
|
|
843
|
+
|
|
844
|
+
// Learn from this review
|
|
845
|
+
if (allFindings.length === 0) {
|
|
846
|
+
console.log(`\n✅ Clean PR! All agents learned this is a good pattern.\n`);
|
|
847
|
+
} else {
|
|
848
|
+
console.log(`\n📚 Agents learned ${allFindings.length} new patterns to check.\n`);
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
// Consolidate knowledge periodically
|
|
852
|
+
const stats = await getMemoryStatistics();
|
|
853
|
+
if (stats.total % 20 === 0) {
|
|
854
|
+
console.log(`\n🔄 Consolidating knowledge base...\n`);
|
|
855
|
+
await consolidate();
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
return {
|
|
859
|
+
approved: allFindings.filter(f => f.severity === 'critical').length === 0,
|
|
860
|
+
findings: allFindings,
|
|
861
|
+
learnings: {
|
|
862
|
+
security: securityReview.newMemories.length,
|
|
863
|
+
performance: perfReview.newMemories.length,
|
|
864
|
+
style: styleReview.newMemories.length
|
|
865
|
+
}
|
|
866
|
+
};
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
// Example evolution over 100 PRs:
|
|
870
|
+
// Week 1: 45 findings per PR (agents learning)
|
|
871
|
+
// Week 4: 23 findings per PR (patterns recognized)
|
|
872
|
+
// Week 12: 7 findings per PR (team improved + agents learned)
|
|
873
|
+
// Month 6: 2 findings per PR (mature knowledge base)
|
|
874
|
+
```
|
|
875
|
+
|
|
876
|
+
### Use Case: Intelligent API Client with Retry Logic
|
|
877
|
+
|
|
878
|
+
```typescript
|
|
879
|
+
import { runTask, mattsSequential } from 'agentic-flow/reasoningbank';
|
|
880
|
+
|
|
881
|
+
// API client that learns optimal retry strategies
|
|
882
|
+
class IntelligentAPIClient {
|
|
883
|
+
async request(endpoint: string, options: RequestOptions) {
|
|
884
|
+
return await mattsSequential({
|
|
885
|
+
taskId: `api-${endpoint}-${Date.now()}`,
|
|
886
|
+
agentId: 'api-client',
|
|
887
|
+
query: `Make API request to ${endpoint} with reliability
|
|
888
|
+
Options: ${JSON.stringify(options)}
|
|
889
|
+
Learn from past failures and apply retry logic`,
|
|
890
|
+
domain: 'api.http-client',
|
|
891
|
+
r: 3, // Up to 3 retry attempts
|
|
892
|
+
executeFn: async (memories, iteration) => {
|
|
893
|
+
console.log(`\n📡 API Request Attempt ${iteration + 1}/3`);
|
|
894
|
+
console.log(` Using ${memories.length} learned patterns\n`);
|
|
895
|
+
|
|
896
|
+
// Apply learned retry strategies
|
|
897
|
+
const retryStrategy = selectRetryStrategy(memories, endpoint, iteration);
|
|
898
|
+
|
|
899
|
+
if (iteration > 0) {
|
|
900
|
+
// Wait before retry (exponential backoff or learned pattern)
|
|
901
|
+
const waitTime = retryStrategy.backoff || Math.pow(2, iteration) * 1000;
|
|
902
|
+
console.log(` ⏱️ Waiting ${waitTime}ms before retry...\n`);
|
|
903
|
+
await sleep(waitTime);
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
try {
|
|
907
|
+
const response = await fetch(endpoint, {
|
|
908
|
+
...options,
|
|
909
|
+
timeout: retryStrategy.timeout || 5000,
|
|
910
|
+
headers: {
|
|
911
|
+
...options.headers,
|
|
912
|
+
...retryStrategy.headers // Learned headers
|
|
913
|
+
}
|
|
914
|
+
});
|
|
915
|
+
|
|
916
|
+
if (!response.ok) {
|
|
917
|
+
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
return {
|
|
921
|
+
success: true,
|
|
922
|
+
data: await response.json(),
|
|
923
|
+
strategy_used: retryStrategy.name
|
|
924
|
+
};
|
|
925
|
+
|
|
926
|
+
} catch (error) {
|
|
927
|
+
console.log(` ❌ Attempt ${iteration + 1} failed: ${error.message}\n`);
|
|
928
|
+
|
|
929
|
+
if (iteration === 2) {
|
|
930
|
+
// Final attempt failed - return error
|
|
931
|
+
return {
|
|
932
|
+
success: false,
|
|
933
|
+
error: error.message,
|
|
934
|
+
attempts: 3
|
|
935
|
+
};
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
// Continue to next iteration
|
|
939
|
+
throw error;
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
});
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
function selectRetryStrategy(memories, endpoint, iteration) {
|
|
947
|
+
// Find memories matching this endpoint or similar APIs
|
|
948
|
+
const relevantMemories = memories.filter(m =>
|
|
949
|
+
m.pattern_data.endpoint_pattern === parseEndpointPattern(endpoint) ||
|
|
950
|
+
m.pattern_data.error_type === 'rate_limit' ||
|
|
951
|
+
m.pattern_data.error_type === 'timeout'
|
|
952
|
+
);
|
|
953
|
+
|
|
954
|
+
if (relevantMemories.length === 0) {
|
|
955
|
+
// No learned patterns - use default exponential backoff
|
|
956
|
+
return {
|
|
957
|
+
name: 'exponential-backoff',
|
|
958
|
+
backoff: Math.pow(2, iteration) * 1000,
|
|
959
|
+
timeout: 5000,
|
|
960
|
+
headers: {}
|
|
961
|
+
};
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
// Use highest-confidence learned strategy
|
|
965
|
+
const bestStrategy = relevantMemories.sort((a, b) => b.confidence - a.confidence)[0];
|
|
966
|
+
|
|
967
|
+
return {
|
|
968
|
+
name: bestStrategy.title,
|
|
969
|
+
backoff: bestStrategy.pattern_data.backoff_ms,
|
|
970
|
+
timeout: bestStrategy.pattern_data.timeout_ms,
|
|
971
|
+
headers: bestStrategy.pattern_data.retry_headers || {}
|
|
972
|
+
};
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
// Example usage:
|
|
976
|
+
const client = new IntelligentAPIClient();
|
|
977
|
+
|
|
978
|
+
// First few requests: Agent learns retry patterns
|
|
979
|
+
const result1 = await client.request('/api/users', { method: 'GET' });
|
|
980
|
+
// Attempt 1: Failed (rate limit)
|
|
981
|
+
// Learned: "Wait 2s on 429 responses for /api/* endpoints"
|
|
982
|
+
|
|
983
|
+
const result2 = await client.request('/api/users', { method: 'GET' });
|
|
984
|
+
// Attempt 1: Used learned 2s backoff → Success!
|
|
985
|
+
|
|
986
|
+
// After 50 requests, agent knows:
|
|
987
|
+
// - "/api/* endpoints: 429 → wait 2s, then 4s"
|
|
988
|
+
// - "/api/analytics/*: timeout → increase to 10s"
|
|
989
|
+
// - "/api/media/*: always include Range header for large files"
|
|
990
|
+
```
|
|
991
|
+
|
|
992
|
+
---
|
|
993
|
+
|
|
994
|
+
## 📈 Performance Optimization Techniques
|
|
995
|
+
|
|
996
|
+
### Database Query Optimization
|
|
997
|
+
|
|
998
|
+
```sql
|
|
999
|
+
-- Optimized retrieval query with multiple filters
|
|
1000
|
+
EXPLAIN QUERY PLAN
|
|
1001
|
+
SELECT
|
|
1002
|
+
r.id,
|
|
1003
|
+
r.title,
|
|
1004
|
+
r.description,
|
|
1005
|
+
r.content,
|
|
1006
|
+
r.confidence,
|
|
1007
|
+
r.usage_count,
|
|
1008
|
+
r.created_at,
|
|
1009
|
+
r.pattern_data,
|
|
1010
|
+
e.embedding,
|
|
1011
|
+
-- Computed fields
|
|
1012
|
+
julianday('now') - julianday(r.created_at) as age_days,
|
|
1013
|
+
-- Reliability score
|
|
1014
|
+
MIN(
|
|
1015
|
+
r.confidence * SQRT(r.usage_count / 10.0),
|
|
1016
|
+
1.0
|
|
1017
|
+
) as reliability
|
|
1018
|
+
FROM reasoning_memory r
|
|
1019
|
+
JOIN pattern_embeddings e ON r.id = e.pattern_id
|
|
1020
|
+
WHERE
|
|
1021
|
+
r.confidence >= 0.3 -- Min confidence filter
|
|
1022
|
+
AND (
|
|
1023
|
+
r.pattern_data LIKE '%"domain":"web.admin"%' -- Domain filter
|
|
1024
|
+
OR r.pattern_data LIKE '%"domain":"web.%"'
|
|
1025
|
+
)
|
|
1026
|
+
AND r.tenant_id = 'tenant-123' -- Multi-tenant filter
|
|
1027
|
+
ORDER BY
|
|
1028
|
+
r.confidence DESC,
|
|
1029
|
+
r.usage_count DESC
|
|
1030
|
+
LIMIT 50;
|
|
1031
|
+
|
|
1032
|
+
-- Query plan:
|
|
1033
|
+
-- SEARCH reasoning_memory USING INDEX idx_reasoning_memory_confidence (confidence>?)
|
|
1034
|
+
-- SEARCH pattern_embeddings USING PRIMARY KEY (pattern_id=?)
|
|
1035
|
+
-- USE TEMP B-TREE FOR ORDER BY
|
|
1036
|
+
|
|
1037
|
+
-- Performance: 0.92ms for 1,000 memories
|
|
1038
|
+
```
|
|
1039
|
+
|
|
1040
|
+
### Embedding Cache Strategy
|
|
1041
|
+
|
|
1042
|
+
```typescript
|
|
1043
|
+
// Multi-level caching for embeddings
|
|
1044
|
+
class EmbeddingCache {
|
|
1045
|
+
private l1Cache: Map<string, Float32Array>; // In-memory (fast)
|
|
1046
|
+
private l2Cache: LRUCache<string, Float32Array>; // Larger LRU
|
|
1047
|
+
private redis: RedisClient; // Distributed cache
|
|
1048
|
+
|
|
1049
|
+
async get(text: string, provider: string): Promise<Float32Array | null> {
|
|
1050
|
+
const key = `${provider}:${hashText(text)}`;
|
|
1051
|
+
|
|
1052
|
+
// L1: In-memory cache (0.001ms)
|
|
1053
|
+
if (this.l1Cache.has(key)) {
|
|
1054
|
+
this.metrics.hit('l1');
|
|
1055
|
+
return this.l1Cache.get(key);
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
// L2: LRU cache (0.01ms)
|
|
1059
|
+
if (this.l2Cache.has(key)) {
|
|
1060
|
+
this.metrics.hit('l2');
|
|
1061
|
+
const embedding = this.l2Cache.get(key);
|
|
1062
|
+
this.l1Cache.set(key, embedding); // Promote to L1
|
|
1063
|
+
return embedding;
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
// L3: Redis distributed cache (1-5ms)
|
|
1067
|
+
if (this.redis) {
|
|
1068
|
+
const cached = await this.redis.get(key);
|
|
1069
|
+
if (cached) {
|
|
1070
|
+
this.metrics.hit('l3');
|
|
1071
|
+
const embedding = deserializeEmbedding(cached);
|
|
1072
|
+
this.l1Cache.set(key, embedding);
|
|
1073
|
+
this.l2Cache.set(key, embedding);
|
|
1074
|
+
return embedding;
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
// Cache miss - will need to compute
|
|
1079
|
+
this.metrics.miss();
|
|
1080
|
+
return null;
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
async set(text: string, provider: string, embedding: Float32Array) {
|
|
1084
|
+
const key = `${provider}:${hashText(text)}`;
|
|
1085
|
+
|
|
1086
|
+
// Write to all cache levels
|
|
1087
|
+
this.l1Cache.set(key, embedding);
|
|
1088
|
+
this.l2Cache.set(key, embedding);
|
|
1089
|
+
|
|
1090
|
+
if (this.redis) {
|
|
1091
|
+
await this.redis.setex(
|
|
1092
|
+
key,
|
|
1093
|
+
3600, // 1 hour TTL
|
|
1094
|
+
serializeEmbedding(embedding)
|
|
1095
|
+
);
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
// Cache hit rates after warmup:
|
|
1101
|
+
// L1: 45% (ultra-fast)
|
|
1102
|
+
// L2: 35% (very fast)
|
|
1103
|
+
// L3: 15% (fast)
|
|
1104
|
+
// Miss: 5% (slow - requires API call)
|
|
1105
|
+
```
|
|
1106
|
+
|
|
1107
|
+
### Batch Processing for Consolidation
|
|
1108
|
+
|
|
1109
|
+
```typescript
|
|
1110
|
+
// Efficient batch consolidation
|
|
1111
|
+
async function consolidateBatch(batchSize: number = 100) {
|
|
1112
|
+
const stats = {
|
|
1113
|
+
processed: 0,
|
|
1114
|
+
duplicates: 0,
|
|
1115
|
+
contradictions: 0,
|
|
1116
|
+
pruned: 0,
|
|
1117
|
+
duration: 0
|
|
1118
|
+
};
|
|
1119
|
+
|
|
1120
|
+
const startTime = Date.now();
|
|
1121
|
+
|
|
1122
|
+
// Process in batches to avoid memory overload
|
|
1123
|
+
let offset = 0;
|
|
1124
|
+
let hasMore = true;
|
|
1125
|
+
|
|
1126
|
+
while (hasMore) {
|
|
1127
|
+
// Fetch batch
|
|
1128
|
+
const batch = await fetchMemories({
|
|
1129
|
+
limit: batchSize,
|
|
1130
|
+
offset,
|
|
1131
|
+
orderBy: 'created_at DESC'
|
|
1132
|
+
});
|
|
1133
|
+
|
|
1134
|
+
if (batch.length === 0) {
|
|
1135
|
+
hasMore = false;
|
|
1136
|
+
break;
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
// Parallel processing within batch
|
|
1140
|
+
const [dupResult, contrResult, pruneResult] = await Promise.all([
|
|
1141
|
+
deduplicateBatch(batch),
|
|
1142
|
+
detectContradictionsBatch(batch),
|
|
1143
|
+
pruneBatch(batch)
|
|
1144
|
+
]);
|
|
1145
|
+
|
|
1146
|
+
stats.processed += batch.length;
|
|
1147
|
+
stats.duplicates += dupResult.removed;
|
|
1148
|
+
stats.contradictions += contrResult.found;
|
|
1149
|
+
stats.pruned += pruneResult.pruned;
|
|
1150
|
+
|
|
1151
|
+
offset += batchSize;
|
|
1152
|
+
|
|
1153
|
+
// Progress indicator
|
|
1154
|
+
console.log(`Processed ${stats.processed} memories...`);
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
stats.duration = Date.now() - startTime;
|
|
1158
|
+
|
|
1159
|
+
return stats;
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
// Performance:
|
|
1163
|
+
// 10,000 memories: 8.2 seconds (1,220 memories/sec)
|
|
1164
|
+
// Memory usage: <200MB peak
|
|
1165
|
+
```
|
|
1166
|
+
|
|
1167
|
+
---
|
|
1168
|
+
|
|
1169
|
+
## 🔧 Production Deployment Guide
|
|
1170
|
+
|
|
1171
|
+
### Docker Compose Setup
|
|
1172
|
+
|
|
1173
|
+
```yaml
|
|
1174
|
+
version: '3.8'
|
|
1175
|
+
|
|
1176
|
+
services:
|
|
1177
|
+
# Main application with ReasoningBank
|
|
1178
|
+
app:
|
|
1179
|
+
build: .
|
|
1180
|
+
environment:
|
|
1181
|
+
- NODE_ENV=production
|
|
1182
|
+
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
|
|
1183
|
+
- DATABASE_PATH=/data/memory.db
|
|
1184
|
+
- REDIS_URL=redis://redis:6379
|
|
1185
|
+
volumes:
|
|
1186
|
+
- app-data:/data
|
|
1187
|
+
depends_on:
|
|
1188
|
+
- redis
|
|
1189
|
+
deploy:
|
|
1190
|
+
replicas: 3
|
|
1191
|
+
resources:
|
|
1192
|
+
limits:
|
|
1193
|
+
memory: 1G
|
|
1194
|
+
cpus: '1.0'
|
|
1195
|
+
|
|
1196
|
+
# Redis for embedding cache
|
|
1197
|
+
redis:
|
|
1198
|
+
image: redis:7-alpine
|
|
1199
|
+
command: redis-server --maxmemory 512mb --maxmemory-policy allkeys-lru
|
|
1200
|
+
volumes:
|
|
1201
|
+
- redis-data:/data
|
|
1202
|
+
|
|
1203
|
+
# Prometheus for metrics
|
|
1204
|
+
prometheus:
|
|
1205
|
+
image: prom/prometheus:latest
|
|
1206
|
+
volumes:
|
|
1207
|
+
- ./prometheus.yml:/etc/prometheus/prometheus.yml
|
|
1208
|
+
- prometheus-data:/prometheus
|
|
1209
|
+
ports:
|
|
1210
|
+
- "9090:9090"
|
|
1211
|
+
|
|
1212
|
+
# Grafana for dashboards
|
|
1213
|
+
grafana:
|
|
1214
|
+
image: grafana/grafana:latest
|
|
1215
|
+
environment:
|
|
1216
|
+
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD}
|
|
1217
|
+
volumes:
|
|
1218
|
+
- grafana-data:/var/lib/grafana
|
|
1219
|
+
- ./grafana/dashboards:/etc/grafana/provisioning/dashboards
|
|
1220
|
+
ports:
|
|
1221
|
+
- "3000:3000"
|
|
1222
|
+
depends_on:
|
|
1223
|
+
- prometheus
|
|
1224
|
+
|
|
1225
|
+
volumes:
|
|
1226
|
+
app-data:
|
|
1227
|
+
redis-data:
|
|
1228
|
+
prometheus-data:
|
|
1229
|
+
grafana-data:
|
|
1230
|
+
```
|
|
1231
|
+
|
|
1232
|
+
### Monitoring & Alerting
|
|
1233
|
+
|
|
1234
|
+
```yaml
|
|
1235
|
+
# prometheus.yml
|
|
1236
|
+
global:
|
|
1237
|
+
scrape_interval: 15s
|
|
1238
|
+
|
|
1239
|
+
scrape_configs:
|
|
1240
|
+
- job_name: 'reasoningbank'
|
|
1241
|
+
static_configs:
|
|
1242
|
+
- targets: ['app:8080']
|
|
1243
|
+
|
|
1244
|
+
# Alert rules
|
|
1245
|
+
rule_files:
|
|
1246
|
+
- 'alerts.yml'
|
|
1247
|
+
|
|
1248
|
+
# alerts.yml
|
|
1249
|
+
groups:
|
|
1250
|
+
- name: reasoningbank
|
|
1251
|
+
interval: 30s
|
|
1252
|
+
rules:
|
|
1253
|
+
# Memory bank health
|
|
1254
|
+
- alert: MemoryBankGrowthStalled
|
|
1255
|
+
expr: rate(reasoningbank_memories_total[5m]) == 0
|
|
1256
|
+
for: 1h
|
|
1257
|
+
annotations:
|
|
1258
|
+
summary: "No new memories created in 1 hour"
|
|
1259
|
+
|
|
1260
|
+
# Retrieval performance
|
|
1261
|
+
- alert: SlowMemoryRetrieval
|
|
1262
|
+
expr: reasoningbank_retrieval_latency_ms > 100
|
|
1263
|
+
for: 5m
|
|
1264
|
+
annotations:
|
|
1265
|
+
summary: "Memory retrieval taking >100ms"
|
|
1266
|
+
|
|
1267
|
+
# Consolidation backlog
|
|
1268
|
+
- alert: ConsolidationBacklog
|
|
1269
|
+
expr: reasoningbank_memories_since_consolidation > 50
|
|
1270
|
+
for: 30m
|
|
1271
|
+
annotations:
|
|
1272
|
+
summary: "50+ memories pending consolidation"
|
|
1273
|
+
|
|
1274
|
+
# Success rate degradation
|
|
1275
|
+
- alert: LowSuccessRate
|
|
1276
|
+
expr: rate(reasoningbank_task_success_total[1h]) / rate(reasoningbank_task_total[1h]) < 0.7
|
|
1277
|
+
for: 30m
|
|
1278
|
+
annotations:
|
|
1279
|
+
summary: "Success rate dropped below 70%"
|
|
1280
|
+
```
|
|
1281
|
+
|
|
1282
|
+
### Backup Strategy
|
|
1283
|
+
|
|
1284
|
+
```bash
|
|
1285
|
+
#!/bin/bash
|
|
1286
|
+
# backup-reasoningbank.sh
|
|
1287
|
+
|
|
1288
|
+
DATE=$(date +%Y%m%d_%H%M%S)
|
|
1289
|
+
BACKUP_DIR="/backups/reasoningbank"
|
|
1290
|
+
DB_PATH="/data/memory.db"
|
|
1291
|
+
|
|
1292
|
+
# Create backup directory
|
|
1293
|
+
mkdir -p "$BACKUP_DIR"
|
|
1294
|
+
|
|
1295
|
+
# SQLite backup (online, no locking)
|
|
1296
|
+
sqlite3 "$DB_PATH" ".backup '$BACKUP_DIR/memory_$DATE.db'"
|
|
1297
|
+
|
|
1298
|
+
# Compress backup
|
|
1299
|
+
gzip "$BACKUP_DIR/memory_$DATE.db"
|
|
1300
|
+
|
|
1301
|
+
# Upload to S3
|
|
1302
|
+
aws s3 cp "$BACKUP_DIR/memory_$DATE.db.gz" "s3://my-backups/reasoningbank/"
|
|
1303
|
+
|
|
1304
|
+
# Cleanup old local backups (keep 7 days)
|
|
1305
|
+
find "$BACKUP_DIR" -name "memory_*.db.gz" -mtime +7 -delete
|
|
1306
|
+
|
|
1307
|
+
# Verify backup integrity
|
|
1308
|
+
gunzip -c "$BACKUP_DIR/memory_$DATE.db.gz" | sqlite3 :memory: "PRAGMA integrity_check;"
|
|
1309
|
+
|
|
1310
|
+
echo "Backup completed: memory_$DATE.db.gz"
|
|
1311
|
+
```
|
|
1312
|
+
|
|
1313
|
+
---
|
|
1314
|
+
|
|
1315
|
+
## 🔮 Future Roadmap & Research Directions
|
|
1316
|
+
|
|
1317
|
+
### Phase 1: Enhanced Memory Systems (Q1 2025)
|
|
1318
|
+
|
|
1319
|
+
**1. Hierarchical Memory Organization**
|
|
1320
|
+
```typescript
|
|
1321
|
+
// Multi-level memory hierarchy
|
|
1322
|
+
interface MemoryHierarchy {
|
|
1323
|
+
episodic: {
|
|
1324
|
+
// Short-term: Last 24 hours
|
|
1325
|
+
recent: Memory[];
|
|
1326
|
+
|
|
1327
|
+
// Medium-term: Last 30 days
|
|
1328
|
+
working: Memory[];
|
|
1329
|
+
};
|
|
1330
|
+
|
|
1331
|
+
semantic: {
|
|
1332
|
+
// Long-term: Consolidated patterns
|
|
1333
|
+
knowledge: Memory[];
|
|
1334
|
+
|
|
1335
|
+
// Meta-knowledge: Patterns about patterns
|
|
1336
|
+
meta: Memory[];
|
|
1337
|
+
};
|
|
1338
|
+
|
|
1339
|
+
procedural: {
|
|
1340
|
+
// How-to memories
|
|
1341
|
+
skills: Memory[];
|
|
1342
|
+
};
|
|
1343
|
+
}
|
|
1344
|
+
|
|
1345
|
+
// Automatic promotion based on usage
|
|
1346
|
+
async function promoteMemory(memory: Memory) {
|
|
1347
|
+
if (memory.usage_count > 50 && memory.confidence > 0.85) {
|
|
1348
|
+
await promoteToSemantic(memory); // Long-term knowledge
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
if (memory.teaches_process) {
|
|
1352
|
+
await promoteToProced ural(memory); // Skill memory
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
```
|
|
1356
|
+
|
|
1357
|
+
**2. Memory Relationships & Graph**
|
|
1358
|
+
```typescript
|
|
1359
|
+
// Build knowledge graph from memories
|
|
1360
|
+
interface MemoryGraph {
|
|
1361
|
+
nodes: Memory[];
|
|
1362
|
+
edges: MemoryLink[];
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
interface MemoryLink {
|
|
1366
|
+
source: string;
|
|
1367
|
+
target: string;
|
|
1368
|
+
type: 'entails' | 'contradicts' | 'refines' | 'requires' | 'enables';
|
|
1369
|
+
confidence: number;
|
|
1370
|
+
}
|
|
1371
|
+
|
|
1372
|
+
// Example: Multi-hop reasoning
|
|
1373
|
+
// "Login requires CSRF token" + "CSRF token extracted from form"
|
|
1374
|
+
// → "Login requires form parsing"
|
|
1375
|
+
```
|
|
1376
|
+
|
|
1377
|
+
**3. Cross-Agent Memory Sharing**
|
|
1378
|
+
```typescript
|
|
1379
|
+
// Shared team memory pool
|
|
1380
|
+
interface TeamMemoryBank {
|
|
1381
|
+
shared: Memory[]; // Accessible to all agents
|
|
1382
|
+
private: Map<string, Memory[]>; // Agent-specific
|
|
1383
|
+
|
|
1384
|
+
async shareMemory(memory: Memory, agents: string[]) {
|
|
1385
|
+
for (const agent of agents) {
|
|
1386
|
+
await grantAccess(agent, memory);
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
async learnFromPeer(sourceAgent: string, targetAgent: string) {
|
|
1391
|
+
const sharedKnowledge = await fetchMemories({
|
|
1392
|
+
agent: sourceAgent,
|
|
1393
|
+
confidence: { min: 0.8 },
|
|
1394
|
+
usage: { min: 10 }
|
|
1395
|
+
});
|
|
1396
|
+
|
|
1397
|
+
await transferKnowledge(sharedKnowledge, targetAgent);
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
```
|
|
1401
|
+
|
|
1402
|
+
### Phase 2: Advanced ML Integration (Q2 2025)
|
|
1403
|
+
|
|
1404
|
+
**1. Learned Scoring Functions**
|
|
1405
|
+
```python
|
|
1406
|
+
# Replace hand-tuned weights with learned model
|
|
1407
|
+
class LearnedScorer:
|
|
1408
|
+
def __init__(self):
|
|
1409
|
+
self.model = NeuralNetwork([
|
|
1410
|
+
Dense(128, activation='relu'),
|
|
1411
|
+
Dropout(0.3),
|
|
1412
|
+
Dense(64, activation='relu'),
|
|
1413
|
+
Dense(1, activation='sigmoid')
|
|
1414
|
+
])
|
|
1415
|
+
|
|
1416
|
+
def train(self, memories_with_outcomes):
|
|
1417
|
+
"""
|
|
1418
|
+
Learn optimal scoring from past successes/failures
|
|
1419
|
+
|
|
1420
|
+
Features:
|
|
1421
|
+
- Embedding similarity
|
|
1422
|
+
- Recency
|
|
1423
|
+
- Usage count
|
|
1424
|
+
- Confidence
|
|
1425
|
+
- Domain match
|
|
1426
|
+
- Agent match
|
|
1427
|
+
- Time of day
|
|
1428
|
+
- Task complexity
|
|
1429
|
+
|
|
1430
|
+
Label: Did this memory help? (1 = yes, 0 = no)
|
|
1431
|
+
"""
|
|
1432
|
+
X, y = prepare_training_data(memories_with_outcomes)
|
|
1433
|
+
self.model.fit(X, y, epochs=50, validation_split=0.2)
|
|
1434
|
+
|
|
1435
|
+
def score(self, memory, query_context):
|
|
1436
|
+
features = extract_features(memory, query_context)
|
|
1437
|
+
return self.model.predict(features)[0]
|
|
1438
|
+
```
|
|
1439
|
+
|
|
1440
|
+
**2. Active Learning for Memory Quality**
|
|
1441
|
+
```typescript
|
|
1442
|
+
// Actively seek feedback on low-confidence memories
|
|
1443
|
+
async function activelyImproveMemory(memory: Memory) {
|
|
1444
|
+
if (memory.confidence < 0.6 && memory.usage_count > 5) {
|
|
1445
|
+
// Memory used multiple times but low confidence → needs validation
|
|
1446
|
+
|
|
1447
|
+
const feedback = await requestHumanFeedback({
|
|
1448
|
+
memory,
|
|
1449
|
+
question: `Is this strategy correct?
|
|
1450
|
+
"${memory.title}"
|
|
1451
|
+
|
|
1452
|
+
Used ${memory.usage_count} times with mixed results.
|
|
1453
|
+
|
|
1454
|
+
Please verify:
|
|
1455
|
+
☐ Correct and useful
|
|
1456
|
+
☐ Partially correct (needs refinement)
|
|
1457
|
+
☐ Incorrect (should be removed)`
|
|
1458
|
+
});
|
|
1459
|
+
|
|
1460
|
+
switch (feedback.response) {
|
|
1461
|
+
case 'correct':
|
|
1462
|
+
memory.confidence = 0.9; // Boost confidence
|
|
1463
|
+
break;
|
|
1464
|
+
case 'partial':
|
|
1465
|
+
await refineMemory(memory, feedback.suggestions);
|
|
1466
|
+
break;
|
|
1467
|
+
case 'incorrect':
|
|
1468
|
+
await deleteMemory(memory.id);
|
|
1469
|
+
break;
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
```
|
|
1474
|
+
|
|
1475
|
+
### Phase 3: Distributed ReasoningBank (Q3 2025)
|
|
1476
|
+
|
|
1477
|
+
**1. Federated Learning Across Orgs**
|
|
1478
|
+
```typescript
|
|
1479
|
+
// Learn from multiple organizations without sharing data
|
|
1480
|
+
class FederatedReasoningBank {
|
|
1481
|
+
async federatedTrain(participants: Organization[]) {
|
|
1482
|
+
// Each org trains locally
|
|
1483
|
+
const localModels = await Promise.all(
|
|
1484
|
+
participants.map(org => org.trainLocalModel())
|
|
1485
|
+
);
|
|
1486
|
+
|
|
1487
|
+
// Aggregate model updates (not raw data)
|
|
1488
|
+
const globalModel = aggregateModels(localModels);
|
|
1489
|
+
|
|
1490
|
+
// Distribute updated model
|
|
1491
|
+
for (const org of participants) {
|
|
1492
|
+
await org.updateModel(globalModel);
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
// No org sees others' memories, but all benefit!
|
|
1496
|
+
}
|
|
1497
|
+
}
|
|
1498
|
+
```
|
|
1499
|
+
|
|
1500
|
+
**2. Multi-Region Replication**
|
|
1501
|
+
```typescript
|
|
1502
|
+
// Eventual consistency across regions
|
|
1503
|
+
interface RegionalReasoningBank {
|
|
1504
|
+
region: 'us-east' | 'eu-west' | 'ap-southeast';
|
|
1505
|
+
localDb: Database;
|
|
1506
|
+
syncService: ReplicationService;
|
|
1507
|
+
|
|
1508
|
+
async writeMemory(memory: Memory) {
|
|
1509
|
+
// Write locally (fast)
|
|
1510
|
+
await this.localDb.insert(memory);
|
|
1511
|
+
|
|
1512
|
+
// Async replicate to other regions
|
|
1513
|
+
this.syncService.enqueueReplication({
|
|
1514
|
+
operation: 'insert',
|
|
1515
|
+
data: memory,
|
|
1516
|
+
targetRegions: ['us-east', 'eu-west', 'ap-southeast'].filter(r => r !== this.region)
|
|
1517
|
+
});
|
|
1518
|
+
}
|
|
1519
|
+
|
|
1520
|
+
async readMemories(query: string) {
|
|
1521
|
+
// Always read from local region (low latency)
|
|
1522
|
+
return await this.localDb.retrieve(query);
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1525
|
+
```
|
|
1526
|
+
|
|
1527
|
+
---
|
|
1528
|
+
|
|
1529
|
+
**This addendum will be posted as a comment on the main issue for additional technical depth.**
|