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:

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
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

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.

“The system uses two background agents (observer and reflector) to extract meaningful information from conversations while intelligently discarding noise”summary, stated
“leverages prompt caching for cost efficiency and runs background compression to avoid blocking user interactions.”summary, stated

Why this architecture

Background observer/reflector agents let memory compression happen outside the user path while modeling the selective, temporal nature of human memory.

“modeling how human memory retains what matters and lets details fade.”summary, stated
“runs background compression to avoid blocking user interactions.”summary, stated

Models used: GPT-5-mini · GPT-4o · Mastra TypeScript agent framework

Scale

Alternatives considered (roads not taken)

Keep full conversation history

Rejected because: Long histories exceed practical context budgets and include noise.

“compresses conversations 5-40x while maintaining temporal awareness and contextual relevance.”summary, stated

Synchronous compression in the user path

Rejected because: Compression should not block user interactions.

“runs background compression to avoid blocking user interactions.”summary, stated

Patterns

agent-memory (memory)

The system stores compressed temporally aware observations for future agent behavior.

“observational memory system for LLM agents”summary, stated

context-compaction (context)

Conversation context is compressed 5-40x by background agents.

“compresses conversations 5-40x while maintaining temporal awareness and contextual relevance.”summary, stated

multi-agent-orchestration (agent-architecture)

Observer and reflector agents split extraction and reflection work.

“two background agents (observer and reflector)”summary, stated

cost-aware-routing (operations)

Prompt caching is used to keep memory compression cost efficient.

“leverages prompt caching for cost efficiency”summary, stated

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.

“two background agents (observer and reflector)”summary, stated

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.

“compresses conversations 5-40x while maintaining temporal awareness and contextual relevance.”summary, stated

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.

“extract meaningful information from conversations while intelligently discarding noise”summary, stated

Memory maintenance can hurt interaction latency.

Root cause: Compression work may block the user path if done synchronously.

Resolution: Run compression in the background.

“runs background compression to avoid blocking user interactions.”summary, stated

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

“The solution achieved 94.87% on the LongMemEval benchmark with GPT-5-mini and 84.23% with GPT-4o”summary, stated

Outcomes

The case reports benchmark scores, compression ratio, and production domains rather than total user count.

“Deployed in production across hiring and healthcare applications within the Mastra TypeScript agent framework”summary, stated