Skip to content

ADR-053: AgentDB v3 Controller Activation & Runtime Wiring #1228

@ruvnet

Description

@ruvnet

Summary

ADR-053 addresses the systemic gap where AgentDB v3 exports 42 named exports (28 in controllers barrel) but the CLI runtime instantiates none of them. This ADR proposes a 6-phase activation plan with a ControllerRegistry wrapping the AgentDB class.

ADR Location: v3/implementation/adrs/ADR-053-agentdb-v3-controller-activation.md
Status: Accepted (v1.2.0)

AgentDB v3 Status (alpha.7)

Metric Value
Main exports 42
Controllers barrel 28
Internal controllers (AgentDB.ts) 14 (8 core + 3 proof-gated + 2 services + graph adapter)
Hard deps 4 (sql.js, ajv, zod, MCP SDK)
Size 3.5 MB
CVEs 0
CJS + ESM Both working (dynamic import)
sql.js fallback Works without better-sqlite3
@claude-flow/memory Upgraded to ^3.0.0-alpha.7

Key Capabilities in alpha.7

  1. Proof-Gated Mutations — MutationGuard validates all inserts/searches, 4-tier fallback (native→wasm→legacy-wasm→js), 82-byte cryptographic attestations
  2. GraphTransformerService — 8 verified modules (sublinearAttention, verifiedStep, causalAttention, grangerExtract, hamiltonianStep, spikingAttention, gameTheoreticAttention, productManifoldDistance), all with JS fallbacks
  3. GuardedVectorBackend — Wraps RuVectorBackend with proof-gated access, automatic SQL fallback
  4. AttestationLog — Append-only SQLite audit trail with denial pattern aggregation
  5. SemanticRouter — Embedding-based query routing with keyword fallback
  6. SonaTrajectoryService — RL-backed trajectory learning with frequency prediction fallback
  7. LLMRouter — Multi-provider (OpenRouter/Gemini/Anthropic/ONNX) with auto-selection

Release History

Version Key Change Status
alpha.3 Initial v3 ESM-only, CJS broken
alpha.4 Native deps Regression: 33.4MB
alpha.5 Zero-native, proof-gated 6 high CVEs
alpha.6 sqlite3→peerDeps Import crash
alpha.7 Dynamic import, all controllers All clear

Problem

CLI's memory-initializer.js (1929 lines) runs a self-contained SQLite system that duplicates what @claude-flow/memory + AgentDB provides. The CLI never imports @claude-flow/memory at runtime.

Phased Plan

Phase 1: Foundation (P0) — Blocks everything

Phase 2: Core Intelligence (P1)

Phase 3: Advanced Memory (P2)

Phase 4: Specialization (P3)

Phase 5: Proof-Gated Intelligence (P3) — Already activated in AgentDB.ts

  • GuardedVectorBackend → wire into HybridBackend
  • MutationGuard → route CLI mutations through guard
  • AttestationLog → expose in session-start health checks
  • GraphTransformerService → wire 8 modules into MemoryGraph
  • SemanticRouter → replace hand-rolled hooks_route routing
  • SonaTrajectoryService → replace LocalSonaCoordinator

Phase 6: MCP Surface (P3)

Related Issues

#1196 #1202 #1204 #1206 #1207 #1208 #1209 #1210 #1211 #1212 #1213 #1214 #1215 #1216 #1217 #1218 #1219 #1220 #1221 #1222 #1223 #1224 #1225 #1226 #1227 #1229 #1230

Contributors

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions