v3/docs/adr/ADR-367-epistemic-working-memory-intelligence-pipeline.md
| Field | Value |
|---|---|
| Status | Proposed |
| Authors | claude (dream-cycle agent, 2026-07-17) |
| Dream Cycle Issue | Filed 2026-07-17, deep surface: intelligence |
| Supersedes | None |
| Related | ADR-026 (3-tier routing), ADR-006 (Unified Memory Service), ADR-009 (Hybrid Memory Backend) |
Two July 2026 papers reveal actionable gaps in Ruflo's intelligence pipeline:
SLEUTH (arXiv:2607.12267, Ning Liu, Jul 2026, grade A): Introduces a structured epistemic working memory with three named lists per reasoning task — confirmedFacts, activeHypotheses, openQuestions — maintained across reasoning steps. Result: +11 points on multi-hop benchmarks. Ruflo's AgentDB stores long-term embeddings but has no per-task structured epistemic buffer.
GRADE (arXiv:2607.10836, Ghosh & Chakraborty, Jul 2026, grade A): Hierarchical multi-agent routing with gated depth control — learned gates govern agent selection, hierarchy depth, inter-agent communication, and branch pruning via collaborative policy optimization. Result: 44% less inference runtime vs mixture-of-agents baseline, 8.15% accuracy gain. Ruflo's SONA MoE gates token routing across 8 experts but does not gate agent-selection depth or prune reasoning branches.
Additionally, ArXiv:2607.13034 shows that a Cognitive Redundancy Ratio (CRR) gate can reduce cost by 85% on simple tasks by estimating minimum-sufficient execution scope before routing.
The existing intelligence pipeline (RETRIEVE → JUDGE → DISTILL → CONSOLIDATE) has no per-task working memory layer and no branch-level gate.
Add an EpistemicWorkingMemory (EWM) layer to the intelligence pipeline, inserted between RETRIEVE and JUDGE:
RETRIEVE → [EWM] → JUDGE → DISTILL → CONSOLIDATE
interface EpistemicWorkingMemory {
taskId: string;
confirmedFacts: string[]; // facts verified during this task
activeHypotheses: string[]; // hypotheses being tested
openQuestions: string[]; // unresolved sub-questions
stepCount: number;
createdAt: number;
flushedAt?: number;
}
At each intelligence step, the agent appends to the appropriate list. At task completion, EWM is flushed: a summary is written to AgentDB (long-term) and the in-memory buffer is released.
Before task routing, compute:
CRR = (estimated_unique_reasoning_steps) / (total_input_tokens / 500)
If CRR < 0.3 → route to Haiku with scope-bounded system prompt suffix.
If CRR ≥ 0.3 → standard 3-tier routing (ADR-026).
Extend swarm coordinator to emit a depthBudget per task (default 3). Agents that exhaust their depth budget without resolution escalate to the next tier rather than continuing horizontally. This limits runaway agent fan-out on hard tasks and prunes solved branches early on easy tasks.
| Component | File | Change |
|---|---|---|
| EWM type + in-memory store | v3/@claude-flow/memory/src/epistemic/EpistemicWorkingMemory.ts | new |
| EWM flush → AgentDB | v3/@claude-flow/memory/src/epistemic/ewm-flush.ts | new |
| Pipeline hook | v3/@claude-flow/hooks/src/intelligence.ts | insert EWM step |
| CRR pre-routing gate | v3/@claude-flow/hooks/src/route.ts | add CRR computation |
| Agent depth gate | v3/@claude-flow/cli/src/swarm/coordinator.ts | add depthBudget |
| EWM schema export | v3/@claude-flow/memory/src/index.ts | export new types |
Positive:
Negative:
Neutral:
Run npx claude-flow@v3alpha performance benchmark --suite multi-hop before and after EWM integration. Gate merge on ≥5 pt improvement on an internal multi-hop eval set. Evaluate CRR gate savings by comparing cost per task on the existing regression test suite.