Pitfall ai-agents
Agent Memory Bloat
pitfallai-agentsKNOWLEDGE
What Happened

Hermes Agent’s persistent memory system (MEMORY.md, USER.md, SQLite FTS5) grew unboundedly over time. As memory accumulated without compaction or eviction:
- Retrieval quality degraded: FTS5 search returned irrelevant matches from old, stale memories
- Context windows filled: injected memory consumed tokens that could have been used for reasoning
- Decision quality dropped: the agent made choices based on outdated information mixed with current facts
- Skill retrieval got noisy: 40+ skills with overlapping triggers caused selection confusion
This is the persistent memory equivalent of a memory leak: the system slowly degrades as accumulated state grows.
Root Cause
See definitions/root-cause-analysis for the analytical framework. The specific cause here: no compaction or eviction policy. Every memory and skill was treated as equally valuable regardless of age, access frequency, or relevance to current tasks. The system accumulated without pruning.
How to Avoid
- Memory compaction: periodically merge related memories into consolidated summaries : three similar memories about API error handling become one
- TTL/decay: reduce weight of old, unaccessed memories. Memories not retrieved in 30 days get demoted; 90 days get archived
- LRU eviction: cap total memory size. When full, evict least-recently-used memories first
- Hot/cold separation: frequently accessed memories stay in a hot tier (injected at session start); cold memories are searchable but not injected
- Skill deduplication: detect skills with overlapping trigger conditions and merge or specialize them
- Periodic audit: LLM reviews the memory bank, identifies redundancies and obsolete entries, proposes consolidation
The value of a memory system is not the total count of memories : it is the signal-to-noise ratio at retrieval time. A smaller, curated bank outperforms a larger, uncurated one.
Related
- research/2026-04-02-hermes-agent-persistent-memory-skill-evolution : primary source
- topics/agent-skill-crystallization : skill proliferation is a specific instance of this pattern
- topics/exploration-collapse : memory bloat causes context saturation, a driver of collapse
- topics/self-improving-agent-patterns : universal anti-pattern: memory and state growth must be bounded