Memory poisoning makes your agent dumber, not smarter
Our coding agent was losing its mind every restart. Three weeks into a Django migration, it would boot up and ask "What's Django?" like we'd never met.
The problem wasn't memory storage — we had plenty of that. The problem was memory architecture. We were dumping every conversation transcript into a vector database and hoping semantic search would reconstruct context. Instead, we got expensive confusion.
Here's what breaks when you treat memory like a transcript archive:
- Your agent retrieves cancelled plans from two weeks ago
- It mixes current project state with abandoned experiments
- It "remembers" bugs that were already fixed
- It forgets decisions but remembers the debates
The fix isn't more storage. It's structured persistence that separates facts from history.
The Three-Layer Pattern:
Layer 1: Current state (project config, active decisions, preferences)
Layer 2: Learned patterns (code style, common fixes, workflow habits)
Layer 3: Historical context (for reference only, never for current decisions)
We rebuilt our agent's memory with explicit tiers. Current state goes in structured files that get updated, not appended to. Learned patterns get extracted and validated before storage. Raw history stays in logs where it belongs.
The results after two weeks:
- 61% fewer "what's our coding style again?" questions
- Zero instances of re-implementing already-built features
- Agent picks up multi-day tasks without context rebuilding
- API costs dropped 40% (no more context archaeology)
Here's the key insight: your agent needs amnesia about conversations but perfect recall about decisions. Store outcomes, not transcripts. Store current state, not historical debates.
# Current state (gets updated) project_config.md active_decisions.md code_preferences.md # Learned patterns (gets curated) common_fixes.md workflow_patterns.md # Raw history (append-only, reference) conversation_logs/ session_transcripts/
The difference is architectural. Bad memory systems are digital hoarding. Good memory systems are curatorial — they decide what deserves to survive, what needs updating, and what should expire.
Memory isn't about storage capacity. It's about information hygiene. Your agent should wake up knowing what matters, not drowning in what happened.