Observational Memory: Human-Inspired Context Compression for Agent Systems
mastra · Tech · 2026 · source Agentic: yes · promotional bias: med · summary-only (no fetched source) · extracted with prompt 0.5.6 (schema v2)
Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.
Problem
Domain: Agent memory and context compression
Mastra needed agent memory that preserves useful temporal context while compressing long conversations enough for production agent applications.
Constraints:
- Long conversations can exceed context budgets.
- Compression must discard noise without losing relevant temporal facts.
- The system must avoid blocking user interactions.
- Production applications include hiring and healthcare.
Architecture
Mastra built observational memory with two background agents, an observer and a reflector, that extract meaningful information from conversations and compress context 5-40x while preserving relevance.
Diagram confidence: reconstructed (reconstructed from prose).
flowchart LR conversation-stream["Conversation Stream"] observer-agent["Observer Agent"] reflector-agent["Reflector Agent"] agent-memory-store["Agent Memory Store"] production-agent-applications["Production Agent Applications"] conversation-stream --> observer-agent observer-agent --> reflector-agent reflector-agent --> agent-memory-store agent-memory-store --> production-agent-applications production-agent-applications --> agent-memory-store
Components
| Component | Role | Interacts with |
|---|---|---|
Conversation Stream |
Provides the raw long-running interaction history. | Observer Agent |
Observer Agent |
Extracts meaningful information from conversation events. | Reflector Agent |
Reflector Agent |
Consolidates observations and discards noise into compressed memory. | Agent Memory Store |
Agent Memory Store |
Serves compressed temporally aware memory to production agents. | Production Agent Applications |
Production Agent Applications |
Use memory in hiring and healthcare workflows. | Agent Memory Store |
Data flow
Conversation history is observed in the background, the observer extracts meaningful facts, the reflector consolidates and filters them into memory, prompt caching reduces cost, and the compressed memory is used by production agents without blocking the user path.
Why this architecture
Background observer/reflector agents let memory compression happen outside the user path while modeling the selective, temporal nature of human memory.
Models used: GPT-5-mini · GPT-4o · Mastra TypeScript agent framework
Scale
- The system compresses conversations 5-40x.“compresses conversations 5-40x”summary, stated
- The system achieved 94.87% on LongMemEval with GPT-5-mini.“achieved 94.87% on the LongMemEval benchmark with GPT-5-mini”summary, stated
- The system achieved 84.23% on LongMemEval with GPT-4o.“84.23% with GPT-4o”summary, stated
Alternatives considered (roads not taken)
Keep full conversation history
Rejected because: Long histories exceed practical context budgets and include noise.
Synchronous compression in the user path
Rejected because: Compression should not block user interactions.
Patterns
agent-memory (memory)
The system stores compressed temporally aware observations for future agent behavior.
context-compaction (context)
Conversation context is compressed 5-40x by background agents.
multi-agent-orchestration (agent-architecture)
Observer and reflector agents split extraction and reflection work.
cost-aware-routing (operations)
Prompt caching is used to keep memory compression cost efficient.
Tradeoffs
Use background memory agents
Chose Observer and reflector agents over Inline monolithic memory summarization.
Rationale: Background separation preserves user responsiveness and gives memory its own extraction/reflection workflow.
Compress rather than retain all context
Chose 5-40x observational memory compression over Full-history context stuffing.
Rationale: Compression keeps temporal relevance while controlling context size.
Gotchas (what bit them)
Memory compression can preserve too much noise or lose temporal relevance.
Root cause: Long conversations mix meaningful facts with irrelevant details.
Resolution: Use observer and reflector agents to extract meaningful information and discard noise.
Memory maintenance can hurt interaction latency.
Root cause: Compression work may block the user path if done synchronously.
Resolution: Run compression in the background.
Evaluation
Mastra evaluated memory quality on LongMemEval with GPT-5-mini and GPT-4o and reports production deployment in hiring and healthcare applications.
Metrics: LongMemEval score · Compression ratio · User-path blocking avoidance
Outcomes
- Conversation compression reached 5-40x.
- LongMemEval reached 94.87% with GPT-5-mini.
- The system is deployed in production hiring and healthcare applications.
The case reports benchmark scores, compression ratio, and production domains rather than total user count.