Research Foundations¶
symfonic-core's Hierarchical Memory System draws from four landmark papers in AI agent memory architecture. This document maps each paper's contributions to concrete symfonic-core components, then identifies where the framework innovates beyond published research.
1. Generative Agents: Interactive Simulacra of Human Behavior¶
Authors: Park et al. (Stanford / Google, 2023) Paper: https://arxiv.org/abs/2304.03442
Core idea. Introduced the Memory Stream -- a time-ordered log of agent observations -- and Reflection -- periodic synthesis of raw events into high-level insights that guide future planning. Agents score every memory by importance, recency, and relevance to decide what enters the next prompt.
Mapping to symfonic-core:
| Paper Concept | Symfonic Component | Implementation |
|---|---|---|
| Memory Stream | Episodic Layer | src/symfonic/memory/layers/episodic.py -- auto-turn writes via _consolidate() |
| Reflection | Deep Sleep Consolidation | src/symfonic/core/learning/consolidation.py -- SleepConsolidator 10-phase pipeline |
| Importance scoring | Retrieval scoring | src/symfonic/memory/graph/scoring.py -- 4-signal formula |
| Recency decay | Semantic importance decay | Phase 9 in src/symfonic/core/learning/phases_maintenance.py |
Where symfonic-core extends the paper. The paper's reflection process inspects recent memories to synthesize higher-order observations, but it operates on a flat list of text strings. symfonic-core replaces the flat list with a typed knowledge graph: co-occurrence edges (Phase 1.5), meta-node generation (Phase 4), and episodic summarization (Phase 10) compress raw history into structured, traversable knowledge rather than prose summaries.
2. MemGPT: Towards LLMs as Operating Systems¶
Authors: Packer et al. (UC Berkeley, 2023) Paper: https://arxiv.org/abs/2310.08560
Core idea. Treats the LLM's finite context window as RAM and external storage as disk. The agent must explicitly call memory functions to page information in and out -- moving data between fast-but-limited context and slow-but-persistent storage.
Mapping to symfonic-core:
| Paper Concept | Symfonic Component | Implementation |
|---|---|---|
| Main context (RAM) | Working Layer | src/symfonic/memory/layers/working.py -- session-scoped, 24h TTL |
| Archival storage (disk) | Semantic + Episodic layers | Postgres-backed persistent layers |
| Memory paging | ContextWindowNode | src/symfonic/core/nodes/context_window.py -- truncates history when budget exceeded |
| Retrieval functions | _hydrate() |
src/symfonic/agent/engine.py -- on-demand memory loading |
Where symfonic-core extends the paper. MemGPT requires the agent to
explicitly invoke memory read/write functions at runtime, placing the burden of
memory management on the LLM itself. symfonic-core automates this entirely:
_hydrate() transparently loads relevant context from all enabled layers
before every LLM call, and _consolidate() persists new knowledge afterward.
The agent never needs to "decide" to remember -- memory operations are
invisible to the consumer.
3. Hierarchical Retrieval-Augmented Generation (Hi-RAG)¶
Authors: Various (2024--2025)
Core idea. Flat vector search fails for complex knowledge because it treats every chunk as equally structured. Hierarchical retrieval organizes information at multiple levels (document, section, entity) and traverses the hierarchy to achieve better recall on multi-hop questions.
Mapping to symfonic-core:
| Paper Concept | Symfonic Component | Implementation |
|---|---|---|
| Document hierarchy | META nodes | src/symfonic/core/learning/phases.py -- generate_meta_nodes() clusters nodes by prefix |
| Entity-level retrieval | Graph traversal | src/symfonic/memory/graph/traversal.py -- BFS up to N hops |
| Scoped retrieval | label_prefix queries |
src/symfonic/memory/graph/store.py -- query_nodes(label_prefix="SOUL") |
| Sub-document chunks | Cluster projection | GET /graph/clusters endpoint |
Where symfonic-core extends the paper. Hi-RAG uses static document
hierarchies defined at index time. symfonic-core's hierarchies are dynamic --
the SleepConsolidator automatically creates meta-nodes from clusters during
consolidation (Phase 4), and spreading activation traverses across hierarchy
levels in real time. The structure evolves as the agent learns, rather than
being fixed by an upfront indexing pipeline.
4. Cognitive Architectures for Language Agents (CoALA)¶
Authors: Sumers et al. (2024) Paper: https://arxiv.org/abs/2309.02427
Core idea. Proposes a formal framework where language agents have three distinct memory types -- Procedural (how to act), Semantic (what is known), and Episodic (when and where events occurred) -- plus a working memory for active reasoning. The framework provides a taxonomy for comparing agent architectures.
Mapping to symfonic-core:
| Paper Concept | Symfonic Component | Implementation |
|---|---|---|
| Procedural memory | Procedural Layer | src/symfonic/memory/layers/procedural/ -- SkillRegistry + CapabilityRouter |
| Semantic memory | Semantic Layer | src/symfonic/memory/layers/semantic.py -- knowledge graph |
| Episodic memory | Episodic Layer | src/symfonic/memory/layers/episodic.py -- vector-stored events |
| Working memory | Working Layer | src/symfonic/memory/layers/working.py -- session context |
| Action selection | Lazy tool routing | src/symfonic/agent/engine.py -- _lazy_resolve_tools() routes tools via procedural layer |
Where symfonic-core extends the paper. CoALA defines four memory types.
symfonic-core implements all four and adds a fifth: the Prospective Layer
(src/symfonic/memory/layers/prospective.py) for future plans, triggers, and
reminders. This addresses temporal intention -- "what should happen next" --
that CoALA's framework acknowledges as important but does not formalize into a
distinct memory type.
Where Symfonic Innovates¶
The following capabilities have no direct counterpart in the papers above.
1. Real-Time Spreading Activation¶
Most retrieval systems use flat vector similarity: given a query, return the top-K nearest embeddings. symfonic-core adds a graph traversal step that activates related nodes by topological association, not just embedding distance. When a node for "UPS" activates, its graph neighbors (FedEx, logistics carriers, supply chain risks) light up automatically through edge traversal.
Implementation:
src/symfonic/memory/retrieval/spreading.py -- SpreadingActivation.expand()
fetches first-degree neighbors, filters by min_importance, deduplicates, and
caps results. Per-node ActivationEvent objects
(src/symfonic/core/contracts/types.py) are streamed to consumers in real
time.
What the papers miss. Vector search answers "what is textually similar." Graph activation answers "what is semantically connected" -- a fundamentally different cognitive operation that surfaces knowledge the query never mentioned.
2. The Mind's Eye (Observability Layer)¶
No paper addresses how a human operator supervises an AI agent's reasoning process in real time. symfonic-core provides production-grade observability:
- ActivationEvent per-node streaming during inference, showing which memories are activated and why.
- Graph visualization via vis.js with neighborhood highlight and pulse animations (MongoDB secondary mirror).
- CallbackHandler.on_llm_start() for exact prompt capture, letting operators inspect what the agent actually sees.
- Graph Service API with BFS neighborhood, shortest-path, and cluster projection endpoints for interactive exploration.
What the papers miss. Research papers assume offline evaluation against benchmarks. Production agents need live observability for trust calibration, debugging, and compliance.
3. Unified Streaming Event Protocol¶
symfonic-core's typed event stream (stream_typed(), stream_text()) with
stateful ExtractionFilter
(src/symfonic/core/streaming/extraction_filter.py) is systems engineering
that papers do not address:
- Split-tag handling across LLM output chunks --
<MEMORY_EXTRACT>tags may arrive split across two or more streaming chunks. - Lifecycle events (
MemoryExtractedEvent,ConsolidationDoneEvent,ResponseCompleteEvent) for post-response hooks. - Clean separation between user-facing text and internal memory operations -- consumers never see extraction markup.
What the papers miss. Papers show final outputs. Production systems must handle streaming partial responses and concurrent memory writes without leaking internal state to end users.
4. Ten-Phase Deep Sleep Pipeline¶
While Generative Agents introduced the concept of periodic reflection, symfonic-core implements a comprehensive ten-phase offline consolidation engine:
| Phase | Name | File |
|---|---|---|
| 1 | Strengthen recurring nodes | phases.py |
| 1.5 | Co-occurrence edge creation | phases.py |
| 2 | Risk tagging | phases.py |
| 2.5 | Pending edge consolidation | phases.py |
| 3 | Orphan pruning | phases.py |
| 4 | Meta-node generation | phases.py |
| 5 | SOUL schema corrections | phases.py |
| 8 | Working TTL cleanup | phases_maintenance.py |
| 9 | Semantic importance decay | phases_maintenance.py |
| 10 | Episodic summarization | phases_episodic.py |
All phase files live under src/symfonic/core/learning/.
This goes well beyond "reflection" -- it is a full knowledge lifecycle engine that strengthens, decays, prunes, clusters, summarizes, and corrects the agent's memory graph on a scheduled basis.
Full Mapping Table¶
| Paper | Concept | Symfonic Layer | Key File |
|---|---|---|---|
| Generative Agents | Memory Stream | Episodic | memory/layers/episodic.py |
| Generative Agents | Reflection | Consolidation | core/learning/consolidation.py |
| Generative Agents | Importance scoring | Scoring | memory/graph/scoring.py |
| Generative Agents | Recency decay | Maintenance | core/learning/phases_maintenance.py |
| MemGPT | RAM (context) | Working | memory/layers/working.py |
| MemGPT | Disk (storage) | Semantic + Episodic | memory/layers/semantic.py, memory/layers/episodic.py |
| MemGPT | Paging | ContextWindowNode | core/nodes/context_window.py |
| MemGPT | Retrieval functions | Hydration | agent/engine.py |
| Hi-RAG | Hierarchy | Meta-nodes | core/learning/phases.py |
| Hi-RAG | Scoped retrieval | label_prefix | memory/graph/store.py |
| Hi-RAG | Graph traversal | BFS | memory/graph/traversal.py |
| CoALA | Procedural | Procedural Layer | memory/layers/procedural/ |
| CoALA | Semantic | Semantic Layer | memory/layers/semantic.py |
| CoALA | Episodic | Episodic Layer | memory/layers/episodic.py |
| CoALA | Working | Working Layer | memory/layers/working.py |
| symfonic | Prospective | Prospective Layer | memory/layers/prospective.py |
| symfonic | Spreading Activation | Retrieval | memory/retrieval/spreading.py |
| symfonic | ActivationEvent | Contracts | core/contracts/types.py |
| symfonic | Event Protocol | Streaming | core/streaming/extraction_filter.py |
| symfonic | Deep Sleep (10 phases) | Learning | core/learning/consolidation.py |
All paths are relative to src/symfonic/.
Further Reading¶
- Architecture Overview -- component diagram, data flow, design principles.
- Memory (HMS) -- layer details, hydration, scoring formula, backend configuration.
- Agent Layer -- SymfonicAgent API, streaming events, domain plugins.