Skip to content

[Research] Survey and benchmark modern agent memory and context management for CAMEL #4206

Description

@fengju0213

Required prerequisites

  • I have searched the Issue Tracker and Discussions and did not find an issue that benchmarks modern memory and context-management strategies end to end.
  • Consider asking first in a Discussion.

Motivation

CAMEL already provides useful memory and context-management building blocks:

  • ChatHistoryMemory, VectorDBMemory, and LongtermAgentMemory
  • message windows and dense top-k recall
  • proactive progressive summarization in ChatAgent
  • manual and agent-driven context summarization
  • tool-call pruning, snapshot cleanup, and long tool-result truncation/offloading
  • JSON/Mem0 persistence and Workforce workflow memory

However, the current pieces do not yet form a unified, evaluated memory lifecycle and context-assembly policy.

A code audit of current master found that ScoreBasedContextCreator now preserves the first system message, sorts the remaining records chronologically, and counts tokens; it does not use ContextRecord.score for selection, and its token_limit is retained for API compatibility rather than enforcing a budget. LongtermAgentMemory uses the latest user message for dense retrieval and inserts the retrieved records into chat history, without a shared policy for deduplication, per-layer token budgets, temporal updates, consolidation, or forgetting.

Recent work has also expanded the design space beyond simple chat buffers and vector recall: typed episodic/semantic/procedural memory, recoverable raw event logs, temporal graphs, hybrid retrieval, structured compaction, evaluator-guided retention, agent-controlled memory actions, and cache-aware context editing.

Before CAMEL adopts a specific product or performs a broad memory refactor, we should establish reproducible baselines and determine which abstractions measurably improve agent behavior.

This issue is intended as a research/RFC and benchmark umbrella. Production implementation should be split into focused follow-up issues after the evidence is available.

Research questions

  1. Should durable memory storage and per-call context assembly be separate abstractions?
  2. Should raw interaction/tool trajectories remain the recoverable source of truth, with summaries, facts, graphs, and skills treated as derived views?
  3. Which logical memory types are useful in CAMEL: working, episodic, semantic, procedural, and possibly prospective memory?
  4. Is a strong flat hybrid-retrieval baseline sufficient, and for which workloads does a temporal or multi-relational graph add measurable value?
  5. Which operations should be deterministic policies, agent-callable tools, background jobs, or learned controllers?
  6. How should provenance, writer identity, scope, supersession, confidence, retention, and multi-agent access be represented?
  7. How should context be budgeted across pinned instructions, working state, recent turns, summaries, retrieved memories, tool schemas, and tool results?
  8. Which benchmarks and invariants should gate future memory/context changes?

Research landscape to evaluate

Research reviewed on 2026-07-20 suggests the following families. Recent preprints should be independently reproduced rather than treated as established engineering results.

Family Core idea Potential value for CAMEL Main trade-off
Layered context hierarchy Stable/pinned prefix, structured working set, recent raw turns, summaries, on-demand retrieval, and cold archive Separates always-visible state from recoverable long-term data More lifecycle, synchronization, and budgeting complexity
Ground-truth-preserving episodic memory Keep raw events/episodes and build replaceable derived indexes Prevents irreversible information loss and supports audit/rehydration Higher storage use and background indexing cost
Flat hybrid retrieval Dense + BM25 + temporal/metadata filters, fusion, reranking, MMR/dedup, and query expansion Strong, simple, reproducible baseline May be weaker for temporal, causal, or multi-hop relations
Typed/consolidated memory Distinguish facts, experiences, beliefs/observations, and verified procedures; merge or supersede over time Better updates, personalization, and explainability Extraction/classification errors can become persistent
Temporal or multi-graph memory Track entities and semantic, temporal, causal, or provenance relations Better evolving-fact and multi-hop reasoning Construction latency, operational cost, and graph noise
Evaluator-guided lifecycle Use execution outcomes to decide what to retain, update, down-rank, or delete Limits error propagation from failed trajectories Evaluator quality, latency, and bias become critical
Agentic/learned memory actions Let agents store, retrieve, update, summarize, or discard as explicit actions Task-adaptive context management Model dependence, non-determinism, training cost, and difficult debugging
Structured compaction and JIT disclosure Compact at thresholds/milestones, clear stale tool results, and load artifacts only when needed Controls active tokens and distraction Lossy summaries and retrieval misses can remove future-critical evidence
Cache-aware context editing Keep stable prefixes and evict context in lifecycle-aware batches Can preserve prompt/KV-cache reuse while reducing context Cache reuse reduces prefill cost, but does not reduce active attention or the context-window limit
Multi-agent organizational memory Store collaboration episodes, reusable insights, and shared procedures with explicit scopes Directly relevant to Workforce and agent handoffs Cross-agent leakage, poisoning, provenance, and write conflicts

Candidate architecture to benchmark

This is a research target, not a proposed final API:

  1. Recoverable event/trajectory store

    • Preserve messages, tool calls/results, actions, outcomes, timestamps, writer identity, and source IDs.
    • Compaction must not destroy the underlying evidence.
  2. Derived memory views

    • Logical working, episodic, semantic, and procedural views.
    • Derived entries carry provenance and may be rebuilt from raw events.
    • Prefer supersession/versioning over silently overwriting changing facts.
  3. Pluggable lifecycle policy

    • retain, update, merge, supersede, forget, retrieve, summarize, and offload decisions.
    • Start with deterministic policies; agentic/RL controllers remain optional experiments.
  4. Provider-agnostic context policy/compiler

    • Allocate independent budgets for pinned instructions, working state, recent messages, summaries, retrieved memory, tools, and results.
    • Keep tool-call/result pairs atomic and preserve provider message-sequence rules.
    • Store large tool outputs as artifacts with previews, stable references, hashes, and provenance.
    • Allow provider-native compaction/caching through adapters without making it the only implementation.
  5. Observability and governance

    • Explain why each memory was written, retrieved, omitted, compacted, or superseded.
    • Track context diffs, compression events, source IDs, token/cost/latency, and cache telemetry.
    • Define user/agent/task/workforce scopes, isolation, deletion, and memory-poisoning boundaries.

Required baselines

At minimum, compare under the same model, embedding model, reader prompt, token budget, and dataset version:

  1. Full history where it fits
  2. Current CAMEL recent/windowed chat behavior
  3. Current automatic summary + recent messages
  4. Current VectorDBMemory / LongtermAgentMemory
  5. Raw event store + flat hybrid retrieval + reranking + token-budgeted context packing
  6. Baseline 5 + typed memory, temporal supersession, and structured compaction
  7. Optional temporal/graph index, changing only the component under test
  8. Optional agent-controlled memory operations as an experimental tier

Graph-based memory should have an explicit go/no-go decision based on controlled ablations, rather than being assumed to outperform a tuned flat baseline.

Evaluation plan

Use a fixed, reproducible subset when the complete benchmark is too expensive.

Suggested suites:

  • LongMemEval: extraction, multi-session reasoning, temporal reasoning, knowledge updates, and abstention
  • LoCoMo for long conversational memory and multi-hop/temporal questions
  • Mem2ActBench: whether remembered information is actually used in tool choice and parameters
  • A CAMEL-specific long tool-use trace covering repeated observations, oversized results, unresolved tasks, and multiple compactions
  • A Workforce scenario covering handoff, shared memory, writer provenance, and agent isolation

Measure both retrieval and downstream use:

  • task success / final answer quality
  • Recall@k and MRR/NDCG, with retrieval failures separated from retrieved-but-not-used failures
  • temporal/update/multi-hop/abstention accuracy
  • constraint, decision, open-task, and artifact-reference retention after repeated compaction
  • contradiction rate, stale-fact rate, and incorrect-memory introduction rate
  • peak/average active input tokens and compression ratio
  • LLM calls, estimated cost, storage growth, and write/retrieval/compaction p50/p95 latency
  • prompt-cache read/write tokens or hit rate where available
  • duplicate/invalid tool calls and tool-call/result sequence validity
  • cross-agent leakage, poisoning resistance, and deletion/supersession correctness

Deliverables / success criteria

  • Inventory the existing CAMEL memory/context assembly path and reconcile code, docs, and examples where their described behavior differs.
  • Produce a comparison matrix for at least 10 representative papers/systems, including representation, write/update policy, retrieval, context assembly, forgetting, provenance, cost, license, and maturity.
  • Clearly distinguish peer-reviewed work, preprints, official framework guidance, and vendor-reported results.
  • Add a reproducible benchmark configuration for current CAMEL baselines and at least two candidate policies.
  • Keep model, embedding, reader, token budget, data version, and seeds controlled; report repeated runs for stochastic results.
  • Verify that pinned constraints, current goals, key decisions, unresolved work, and tool-call/result validity survive repeated compaction.
  • Verify that every derived memory can be traced back to recoverable source records.
  • Report quality/efficiency Pareto results and negative results, not only the best score.
  • Produce an RFC recommending the smallest useful data model and policy interfaces.
  • Split any chosen implementation into focused follow-up issues with compatibility and migration plans.
  • Define graph support, learned memory policies, procedural-memory generation, and prospective memory as explicit go/no-go or later-phase decisions.

The research can be considered successful even if a candidate does not beat the current baseline, provided the setup, negative result, and resulting decision are reproducible.

Non-goals

  • Selecting a memory vendor from self-reported benchmark scores
  • Implementing a complete "memory OS" in this issue
  • Replacing all current memory classes before controlled evidence exists
  • Duplicating provider/backend integrations, multimodal memory, graph storage, or prompt-only optimization work already tracked elsewhere
  • Treating a larger context window or prompt cache as a substitute for context selection

Related CAMEL work

This research should coordinate with, not replace:

Primary references

Peer-reviewed / proceedings:

Representative papers/preprints to reproduce carefully:

Official engineering guidance:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions