Skip to main content

AlphaSwarm Knowledge Base

The alphaswarm_kb boundary owns AlphaSwarm's cognitive-memory layer. It extracts the historical alphaswarm/rag/ (HierarchicalRAG) and alphaswarm/llm/memory.py (RedisHybridMemory) modules into a Clean-Architecture package with a pluggable adapter trinity for memory engines, vector stores, graph stores, ACL evaluators, and policy engines.

Sub-docs

At a glance

ConcernWhere
Runtimealphaswarm_kb.runtime.KBRuntime (single executor, rule 56)
Specalphaswarm_kb.spec.KBCorpusSpec (hash-locked, rule 57)
Registryalphaswarm_kb.registry.persist_speckb_corpus_spec_versions
Composition rootalphaswarm_kb.composition_root.build_default_container
Domain portsalphaswarm_kb.domain.ports.* (zero framework imports)
Bi-temporal envelopealphaswarm_kb.domain.models.permissioned_datapoint.PermissionedDataPoint
Adapter metaclassalphaswarm_kb.domain.ports.base.KBAdapterMeta (rule 58)
Agent surfacedata.kb.* DataMCP tools (rule 59)
Federationalphaswarm_kb_federation/ standalone reverse-proxy (rule 60)

Why the boundary

See ADR-014 for the full rationale.

Hard rules

  • 56: All KB lifecycle goes through KBRuntime.
  • 57: kb_corpus_spec_versions rows are immutable.
  • 58: Adapters register via KBAdapterMeta.
  • 59: Agents read KB only through data.kb.* tools.
  • 60: Cross-silo recall goes through alphaswarm_kb_federation only.

Migration

Legacy alphaswarm.rag.* and alphaswarm.llm.memory import paths keep working through DeprecationWarning shims for one release cycle. New code imports from alphaswarm_kb.rag.* and alphaswarm_kb.memory.* directly.

Deprecations

  • Kuzu graph store — upstream archived October 2025. The alphaswarm_kb extra is kuzu-deprecated; the adapter warns on import and will be removed after one release cycle. Migrate KBCorpusSpec.graph_store.kb_alias to neo4j (default), falkordb, or memgraph. See memory-engines.md.