HyperAIHyperAI

Command Palette

Search for a command to run...

エージェンティック・コンテキスト管理:エージェントの記憶とコストをライフサイクルとアーキテクチャの問題として解決する

Gaurav Dadhich

概要

本番環境のAIエージェントの失敗は、推論能力の不足よりも、推論コンテキスト内の情報を管理できないことに起因することが多い。会話履歴、巨大なプロンプト、膨大なツール定義、そして肥大化するツール出力など、コンテキストに保持すべき多数の要素の中で、エージェントは蓄積する履歴に埋没し、ターンごとに増大するトークンコストを支払い、同一会話内および会話間での想起漏れを引き起こす。既存の対応策は、これを保存と検索の問題として扱う。我々は、この捉え方は狭すぎると主張する。エージェントが保持する情報を能動的に管理することは、単なる保存ではなくライフサイクルであると提案する。すなわち、何を記憶するかの決定、情報の抽出と構造化、データ型に適した保存先の選択、最適な冗長性の確保、意識的な統合、来歴を維持しつつ陳腐化した情報の忘却、現在のターンに関連する情報の判断、次に必要となる情報の予測、そして想起を損なうことなく予算内に収めるためのコンテキスト圧縮などに及ぶ。本格的な本番エージェントでは、これは単一ユーザだけでなく、組織的なスコープ階層全体にわたって機能する。我々はこの分野をエージェンティック・コンテキスト管理(ACM)と名付け、それをアーキテクチャ設計、取り込み、スコーピング、予測、圧縮・統合という5つの基本要素に分解する。次に、管理されたライフサイクルが贅沢ではない経済的理由を提示する。すなわち、単純なコンテキスト蓄積は会話の長さに対してトークンコストを二次関数的に増大させ、粗い要約は精度の急激な低下と引き換えに線形コストを実現するに過ぎず、検証された圧縮のみが忠実度を保ったまま線形コストを達成する。我々は、これら5つの基本要素をマルチテナントサービスとして実現し、第6章で詳述する設定下でLongMemEvalで92%、LoCoMoで93.2%を報告する参照実装Maximem Synapについて述べる。最後に、既存のベンチマークがまだ捉えていない次元、すなわちレイテンシ、トークン効率、コンテキスト劣化耐性、そしてこのカテゴリが指し示す意思決定レベルおよび組織レベルのコンテキストという開かれたフロンティアについて言及する。これらは、本格的な環境におけるエージェントの有用性の安定性とユーザビリティを決定づけ続けるものである。

One-sentence Summary

Gaurav Dadhich introduces Agentic Context Management (ACM), reframing agent memory as a lifecycle problem with five primitives—architecting, ingesting, scoping, anticipating, and compacting & consolidation—that economically reduce token cost from quadratic to linear while preserving fidelity, and a reference implementation, Maximem Synap, achieves 92% on LongMemEval and 93.2% on LoCoMo.

Key Contributions

  • The paper introduces Agentic Context Management (ACM) as a lifecycle decomposed into five primitives (architecting, ingesting, scoping, anticipating, and compacting and consolidation), shifting the framing from static storage to active, multi-turn context orchestration.
  • An economic analysis shows that naive context accumulation leads to quadratic token cost growth, crude summarization yields linear cost but suffers an accuracy cliff, and only validated compaction achieves linear cost with preserved fidelity, establishing the lifecycle as a practical necessity.
  • A reference multi-tenant service, Maximem Synap, implements the five ACM primitives and reports 92% on LongMemEval and 93.2% on LoCoMo, while also identifying benchmarking gaps in latency, token efficiency, and context-rot resistance.

Introduction

The authors observe that production AI agents often stumble not from reasoning failures but from undisciplined context management: agents forget earlier instructions, hallucinate from overloaded windows, and incur ballooning costs when entire histories are blindly appended. The dominant framing treats this as a “memory” problem that merely stores and retrieves facts, but it ignores essential lifecycle decisions—what to retain, how to structure it, which fraction belongs in the current turn, what to anticipate next, and how to safely compact context under a budget. The authors reframe the challenge as Agentic Context Management, a system organized around five primitives—architecting, ingesting, scoping, anticipating, and compacting/consolidation—that operate coherently across user, customer, and organizational scopes. They demonstrate that naive full-append context leads to O(n2)O(n^2)O(n2) token costs, while managed compaction reaches the efficient frontier of linear cost with verified fidelity, and they supply a reference implementation (Maximem Synap) that materializes the complete lifecycle.

Method

The authors introduce Maximem Synap, a multi-tenant hosted context-management platform that realizes the five primitives of agentic context management as a coherent lifecycle rather than as disconnected tools. The system is designed to address the failures of naive store-and-retrieve approaches: cost explosion from unbounded contexts, accuracy collapse from unchecked compaction, and reasoning insufficiency from retrieval that scores hits but misses the bridge context needed for agents to produce correct answers.

At the heart of Maximem Synap lies an autonomous architecting step. When an agent is connected, the system synthesizes a bespoke memory architecture from the customer’s description of the agent’s purpose and reference material. This design, generated via multi-agent LLM reasoning and validation, determines which memory categories to capture (facts, preferences, episodes, emotions, temporal events, etc.), how they should be extracted, stored, retrieved, and compacted, and what entities and relationships matter. This architecture governs every downstream primitive, making the coupling among primitives concrete: a support agent and a coding agent receive different category schemas, retention policies, and compaction rules, all embodied in a single generated artifact.

Ingestion is an asynchronous, queue-backed pipeline. A document or conversation turn is submitted through an async-first SDK that returns an ingestion identifier immediately without blocking the calling application. In the background, the pipeline qualifies content, extracts memory categories as dictated by the agent’s architecture, and resolves entities. Entity resolution runs a confidence-ordered cascade of matching strategies—from exact identifiers through lexical, semantic, and contextual signals—linking surface mentions to canonical identities at the customer scope. Public entities are validated against a global knowledge layer; new ones are registered. The extraction and resolution results are persisted across a polyglot stack: a relational store as source of truth, a vector store for embedding-based search, a graph store for entity–relationship traversal, an object store for original content, and specialized stores for time-series telemetry and queuing/caching. The immediate consistency trade-off is deliberate: read-after-write within a session is satisfied by carrying recent turns verbatim in memory, so the agent operates on the latest information while durable, structured availability is deferred without blocking.

Retrieval is a scope-aware, budget-conscious pipeline that resolves the organizational hierarchy narrowest-first: user, then customer, then client, under strict isolation enforced at both storage and query layers. It assembles provenance-tagged, ranked memory items fitted to a token budget. Two retrieval modes are offered: a low-latency path and a higher-accuracy path that adds query decomposition and LLM reranking. Crucially, the system combines vector similarity with vector-guided multi-hop traversal of the knowledge graph. Semantic similarity informs where to enter the graph and which relationships to follow, surfacing related memories that pure vector search would miss—directly addressing the bridge-document problem that causes reasoning insufficiency.

Anticipating is treated as a retrieval primitive distinct from explicit query-time retrieval. Maximem Synap implements an anticipatory path that predicts from an agent’s evolving behavior the context it will likely need before an explicit request arrives. This prepared context is available as a cache read when needed, moving retrieval off the agent’s critical path and reducing latency. The prediction mechanism is proprietary; the authors report a sustained hit-rate above 60% in production, with the value being latency reduction rather than deduplication.

Compacting and consolidation are designed as verified operations. For long conversations, Maximem Synap compresses the context and then validates the result against the original: it tests whether key information remains recoverable and emits an explicit validation score together with a compression ratio. If the score falls below a threshold, compaction is automatically retried with less aggressive compression. This category-aware compaction—what must be preserved verbatim versus what may be abstracted is determined by the agent’s generated architecture—prevents the catastrophic accuracy loss that unvalidated summarization causes. To keep validation overhead linear, compaction operates periodically on the already-compacted context plus recent turns, not on the full transcript. The total token cost over NNN turns follows NW(1+c/p)N \cdot W \cdot (1 + c/p)NW(1+c/p), where WWW is the token budget, ppp the compaction frequency, and ccc a fixed factor; this is a linear cost raised by a constant factor, providing dramatic savings compared to the quadratic blow-up of appending full history.

The platform exposes a simple three-call integration pattern per model invocation: scoped retrieval of past context, validated compaction of the current conversation, and non-blocking ingestion of the new turn. The application code never touches schema design, embedding models, index management, or isolation logic; those are handled entirely by the lifecycle’s primitives and the generated architecture. The design choices—synthesized architecture, verified compaction, asynchronous ingestion, first-class scoping with enforced isolation, hybrid semantic-relational retrieval, and anticipatory latency design—directly address the production failure modes observed in store-and-retrieve systems and implement the lifecycle that the paper argues is necessary for agentic memory at scale.

Experiment

The evaluation uses LongMemEval and LoCoMo to validate conversational memory, where multi-session reasoning is hardest, reflecting a broader reasoning-sufficiency gap: standard retrieval benchmarks measure hits but not whether all necessary context appears, with vector and keyword search winning in complementary regimes. Despite this gap, the system achieves strong results driven by its context layer rather than a large answer model, underscoring the need for hybrid retrieval and new evaluations that directly score sufficiency and production dimensions.

Production memory systems fail in distinct modes that correspond to missing context-management primitives. Ingesting and architecting gaps cause junk accumulation, lost detail, and identity fragmentation; scoping deficits lead to scope bleeding and cross-session amnesia; unvalidated compaction creates an accuracy cliff that can drop performance below a no-context baseline. Junk accumulation, lost detail, and identity fragmentation all stem from missing ingestion and architecting primitives, including a real-world 99.6% junk rate when storing raw signals without extraction. Scope bleeding and cross-session amnesia arise without scoping, while unvalidated compaction produces an accuracy cliff where performance drops below a no-context baseline after aggressive compression.

Three context-management strategies are compared: full-append, crude summarization, and validated compaction. Full-append incurs quadratic token cost and suffers from context degradation like the lost-in-the-middle effect, while crude summarization has linear cost but risks an accuracy cliff from discarding relevant detail. Validated compaction achieves linear cost with preserved and checked fidelity, as demonstrated by Maximem Synap's 92.0% LongMemEval score, avoiding both failure modes. Full-append has O(n²) token cost and eventually fails through context rot, such as the lost-in-the-middle phenomenon. Crude summarization cuts cost to O(n) but is lossy and unvalidated, creating an accuracy cliff when the summarizer discards what matters downstream. Validated compaction maintains O(n) token cost while preserving and checking needed information, making it the target with no inherent failure mode. An implementation of validated compaction reached 92.0% on LongMemEval, confirming that preserved and checked fidelity prevents the accuracy cliff seen with crude summarization.

Maximem Synap achieved 92.0% overall accuracy on the LongMemEval conversational memory benchmark and 93.2% on LoCoMo categories 1–4, both evaluated with a transparent configuration and a small answer model (gpt-5-mini). Multi-session reasoning proved the most challenging LongMemEval category (75.2%), consistent with a broader pattern across systems. The consistent use of a smaller answer model suggests that performance gains arise from the memory and context retrieval layer. The system reached 92.0% on LongMemEval (all 500 questions) and 93.2% on LoCoMo categories 1–4, both using gpt-5-mini as the answer and judge model. Multi-session reasoning, which requires joining information from separate conversations, was the weakest category at 75.2%, underscoring a well-known difficulty across published systems. LoCoMo's adversarial unanswerable category (category 5) was excluded following the official convention, preventing an artificial score swing and maintaining comparability with prior work. The evaluation harness (maximem-ai/memory_and_context_eval_harness) and methodology are publicly documented, and per-run artifacts are available on request to support reproducibility. Using a smaller answer model than many competitor configurations indicates that the performance advantage originates from the context pipeline rather than from the scale of the answering model.

Self-reported LongMemEval scores show Maximem Synap at 92.0% with a smaller answer model than competing configurations, while other systems exhibit sensitivity to answer model swaps. Because each row uses a different methodology, judge, and setup, the numbers are not directly comparable; multi-session reasoning remains the hardest category for all documented systems. Maximem Synap achieves 92.0% on LongMemEval using gpt-5-mini, a smaller answer model than those in the strongest competitor configurations, indicating that the gain comes from the context layer rather than the answer model. SuperMemory's LongMemEval results span 81.6% to 85.2% across answer models alone, demonstrating how sensitive memory benchmarks are to evaluation choices. Multi-session reasoning is the weakest category for Maximem Synap at 75.2% and is described as the hardest published category for every known system. The the table a landscape of each vendor's own best self-reported figure under differing methodologies and cannot be treated as a head-to-head comparison.

Across the surveyed memory systems, no system publicly declares full primary coverage of all five primitives. Ingesting and Scoping appear most often as either primary or partial capabilities, while Compacting & Consolidation is a primary focus for only one system. Architecting is a primary concern for some systems and absent from others, revealing divergent design priorities. MemGPT/Letta is the only system that lists Compacting & Consolidation as a primary focus. Ingesting is supported at least partially by every system except ACE/Dynamic Cheatsheet, making it the most widespread primitive. Architecting is a primary focus for MIRIX, Mem0, and SuperMemory, but it is not a stated focus for MemGPT/Letta, Zep/Graphiti, or Cognee. Scoping is partially or fully covered by six of the seven systems, with Zep/Graphiti and MemGPT/Letta giving it primary emphasis. Anticipating is never listed as a primary focus; it appears only as a partial or optional capability in four systems.

These experiments evaluate failure modes and strategies in production memory systems, showing that missing ingestion and architecting primitives lead to junk accumulation and identity fragmentation, while scoping deficits cause scope bleeding and amnesia. A comparison of full-append, crude summarization, and validated compaction finds that only validated compaction maintains linear cost and accuracy, as demonstrated by Maximem Synap's 92.0% on LongMemEval with a small answer model. Multi-session reasoning remains the hardest category across systems, and a survey of seven systems reveals no one covers all five primitives, with compacting and anticipating being the least addressed.


AIでAIを構築

アイデアからローンチまで — 無料のAIコーディング支援、すぐに使える環境、最高のGPU価格でAI開発を加速。

AI コーディング補助
すぐに使える GPU
最適な料金体系

HyperAI Newsletters

最新情報を購読する
北京時間 毎週月曜日の午前9時 に、その週の最新情報をメールでお届けします
メール配信サービスは MailChimp によって提供されています