v3/docs/adr/ADR-362-dream-cycle-swarm-hnsw-comms-fabric.md
Status: Proposed
Authors: claude (dream-cycle agent, 2026-07-09)
References: arXiv:2606.28781 (HyphaeDB), arXiv:2606.02107 (ND-MARL), arXiv:2606.30668 (Emergent Culture)
Tonight's dream-cycle research (SLOT=4, DEEP=swarm) surfaced three Grade-A/B findings that jointly motivate a new architectural direction for ruvector and the Ruflo swarm layer:
HyphaeDB (arXiv:2606.28781, Grade B): Proposes reinterpreting HNSW's neighbor graph topology not as a search optimization but as a communication fabric — agents placed as nodes in vector space exchange knowledge updates via gossip-protocol propagation to their HNSW neighbors. This creates "semantic neighborhoods" where conceptually-similar agents share state without explicit routing.
ND-MARL (arXiv:2606.02107, Grade A): Demonstrates zero-shot 83× swarm scalability (3-agent policy → 250-agent deployment) via 2-neighbor sparse communication topology. The constraint is the bottleneck: agents only see 2 neighbors, limiting information propagation but enabling scale. This validates sparse neighbor graphs as a viable swarm communication primitive.
Emergent Culture (arXiv:2606.30668, Grade A): 3 LLM agents develop spontaneous coordination via shared decaying-TTL storage + message passing — no explicit role prompts required. Entropy pressure catalyzes cooperation. Core insight: information decay forces agents to maintain and re-encode knowledge, producing emergent protocols.
Current Ruflo gaps exposed by these findings:
AgentDB / ruvector treats HNSW purely as a search optimization. The index is never used for agent-to-agent communication.topology: "minimal" variant exists for entropy-driven emergent coordination.Add an opt-in commsMode: "hcf" to AgentDB that activates the HNSW graph as a gossip-protocol communication substrate:
interface AgentDBCommsConfig {
commsMode: 'search-only' | 'hcf'; // default: 'search-only'
hcf?: {
gossipFanout: number; // neighbors to propagate to (default: 2, per ND-MARL)
ttlMs: number; // gossip message TTL before entropy decay
propagationDepth: number; // max hop count (default: 3)
dedupeWindow: number; // ms window for dedup (default: 500)
};
}
When commsMode: "hcf" is active:
k-nearest neighbors in vector space.post-edit hook with source attribution.This turns AgentDB from a passive retrieval store into an active communication substrate — agents sharing semantic space automatically receive related updates without explicit SendMessage calls.
Before HCF can be meaningful, ruvector must ship hybrid search. All three competitor databases (Qdrant p99=12ms, Weaviate p99=16ms, Milvus p99=18ms @ 10M vectors) implement BM25 + ANN in a single pass. Without hybrid search, keyword-heavy agent queries that the swarm produces during HCF gossip will miss lexically-exact matches.
Target interface:
interface HybridSearchParams {
vector: number[];
keyword?: string; // BM25 term query
hybridAlpha?: number; // 0=pure keyword, 1=pure vector, default 0.5
limit: number;
filter?: Record<string, unknown>;
}
topology: "minimal" swarm variantAdd a new swarm topology based on the Emergent Culture paper's pattern:
Positive:
SendMessage overhead for closely-related agents.Risks / Mitigations:
propagationDepth and dedupeWindow. Must be validated with load tests at maxAgents=8 before enabling at scale.ttlMs=60000 (1 min) is conservative.Implementation order: Part B (hybrid search) → Part A (HCF mode) → Part C (minimal topology).
Estimated scope: Part B: 2–3 weeks. Part A: 3–4 weeks. Part C: 1 week.
docs/dream/2026-07-09-swarm-sota.md)