Your agent needs a context expiration policy (or it'll make decisions on stale data)
Your agent just recommended hiring a contractor you fired three months ago. It's still using meeting notes from a project that got cancelled. It keeps referencing a pricing strategy you abandoned in Q2.
This isn't a memory problem — it's a context hygiene problem.
Most agents accumulate context like digital hoarders. Every conversation, every document, every API response gets stuffed into the context window or memory system with no expiration date. The agent treats six-month-old strategic decisions like current reality.
Here's the pattern that fixes it: context expiration policies.
Start with three simple rules:
- Meeting notes expire after 30 days unless marked as decisions or action items
- Project context expires when status changes to 'cancelled' or 'complete'
- People context gets a staleness warning after 60 days of no interaction
Implement this with metadata tags on everything your agent stores:
# Meeting notes created: 2024-01-15 expires: 2024-02-15 type: meeting_notes project: website_redesign status: active # Project context created: 2024-01-01 expires: never type: project_context project: website_redesign status: cancelled # This should trigger context retirement
Your agent's memory system needs a garbage collector that runs daily:
def expire_stale_context():
# Archive expired meeting notes
archive_items(type="meeting_notes", expired=True)
# Retire context for cancelled projects
retire_items(project_status="cancelled")
# Flag stale people context
flag_stale(type="people", last_interaction=">60 days")Don't delete everything — retire it. Move expired context to an archive that the agent can search explicitly but won't include in regular decision-making.
Pro tip: Add a "context freshness" check to your agent's decision-making prompt. Make it explicitly note when it's working with old information: "Based on project notes from January (now archived), the website redesign was targeting mobile-first. However, I should verify current project status before proceeding."
The difference is immediate. Instead of confidently wrong answers based on stale context, you get appropriately uncertain responses that prompt you to update the agent's knowledge.
Your agent stops living in the past and starts asking the right questions about the present.
This is operational discipline, not just a technical fix. Most teams that run agents successfully have some version of this pattern — they just don't talk about it much.