Skip to content

feat: Tiered memory architecture (Active / Cached / Archived) #78

@alexeymorozua

Description

@alexeymorozua

Problem

As agents accumulate memory over time, MAINMEMORY.md and its modules grow large. Currently all memory is loaded into context every session — regardless of relevance. This creates unnecessary token consumption and increases context noise.

Proposed Solution

A three-tier memory architecture inspired by OS memory management (reference: AgentRM paper, arxiv 2603.13110):

  • Tier 1 — Active: Current session context (always in context window)
  • Tier 2 — Cached: Recently accessed modules, TTL-based (e.g. last 24h), loaded on demand
  • Tier 3 — Archived: Long-term storage, loaded only when explicitly relevant to the request

Implementation Sketch

The agent (or framework) decides which tier to load based on request topic matching:

  • Short casual request → only Active tier
  • Request about cron jobs → Active + Cached crons.md
  • Deep historical lookup → Active + Archived search
memory:
  tiered:
    enabled: true
    cache_ttl_hours: 24
    always_load: [user.md, decisions.md]  # Active tier
    on_demand: [crons.md, tools.md, business.md, browser.md, infrastructure.md]

Impact

  • Significant token reduction per session as memory grows
  • Cleaner context = better agent reasoning
  • Scales naturally as agents accumulate more memory over months

Reference: OpenClaw uses a similar MEMORY.md + SOUL.md split. AgentRM formalizes this as three tiers with measured +168% throughput improvement in multi-agent scenarios.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions