graphsub.com / wiki / hierarchical-memory
Hierarchical Memory for AI Agents
Hierarchical memory separates working, episodic, and semantic memory so AI agents can maintain context without losing auditability.
Definition
Hierarchical memory splits context into working memory for immediate tasks, episodic memory for events, and semantic memory for durable concepts.
Graph representation
A graph representation lets memory nodes retain links to sources, tasks, users, tools, outputs, and confidence over time.
GraphSub approach
GraphSub uses hierarchical memory as one of its native agent primitives, alongside stigmergy, goal hierarchies, prediction models, causal inference, and capability tokens.
Code example
Agent memory and replaypython
from graphsub import Client
client = Client(base_url="https://graphsub.com")
memory = client.memory.remember(
tier="working",
content="limit breach on EUR rates book",
source="risk-run-2026-07-03",
importance=0.92,
)
trace = client.capsules.execute(
capsule="trading-control-graph",
workload="risk-recompute",
evidence="source-linked",
)
print(trace.replay_id, trace.affected_outputs)
Write agent memory, launch a capsule, and inspect affected outputs.
FAQ
- Why not keep memory in a prompt?
- Prompt memory is hard to audit, reuse, and invalidate. A graph gives memory structure and provenance.
- Can memory expire?
- Yes. GraphSub models memory with importance, consolidation, scope, and lifecycle controls.