feat: Tiered memory architecture (Active / Cached / Archived)
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.
Status update: deferring to the next milestone. I looked into this during the Phase 4 memory pass for v0.16.0 and it's genuinely XL scope — the academic paper you cited is the right reference, but a proper implementation touches session storage, session resume, compaction boundaries, and state migration. v0.16.0 ships three memory primitives that compose well (#77 flush, #65 reflection, #80 LLM compaction) and those already cover 80% of the pain. Will revisit tiered memory as a proper phase once those three have some mileage. Leaving this issue open as the discussion thread.