Back to Context Engineering
Library
Memory & history compaction
Persist what matters across turns.
Context
Overview
Memory gives agents continuity across turns and sessions by storing and recalling relevant facts. The design challenge is deciding what to persist, how to summarize it, and when to retrieve it back into context.
How it works
ContextClientServiceEdgeData
Step by step, with examples
- 1
History
- Store turns and events.
- 2
Compact
- Roll up older turns.
- 3
Recall
- Fetch relevant memory on demand.
- 4
Continuity
- Stay coherent over long sessions.
- Example: sliding + summary
Overview
Summarize older turns, store durable facts in external memory, and re-inject only what's relevant to the current step.
Common pitfalls
- Unbounded history growth
- Summaries dropping key facts
- Treating memory as a cache
Where this content comes from
For full transparency, this content is curated and verified from these sources:
Frontier-lab prompting & agent guidesRetrieval-augmented generation literatureOppZen-authored context-engineering playbooks