The real reason agents 'forget'
AI coding agents feel forgetful because they are stateless. Every new session is a blank slate — the model only knows what's in its context window right now. The architecture you explained yesterday, the library you standardized on, the workaround you agreed never to touch again: all gone unless something re-supplies them.
This isn't a bug you can prompt your way out of. It's the fundamental shape of how these tools work, and the teams that ship fastest design around it instead of fighting it.
Context windows are a budget, not a memory
Even within a single session, the context window is finite. As a conversation grows, earlier messages get summarized or pushed out. The model doesn't announce this — it just quietly stops accounting for the constraint you mentioned 200 messages ago.
That's why long agent sessions tend to drift: the assistant reintroduces a pattern you already rejected, or 'rediscovers' a decision because the original reasoning fell out of the window.
Why bigger prompts don't solve it
The instinct is to paste more into the prompt. But dumping your whole repo into context is slow, expensive, and noisy — relevant facts get buried, and you pay for tokens that don't help.
What works is curated, durable project memory: a compact, high-signal record of the decisions, conventions, and constraints that matter, kept where the agent reads it every session.
Capture decisions at the moment they're made
The most expensive context to recover is a decision and its rationale. Six weeks later, nobody remembers why you chose one queue over another — so the agent (and the next engineer) relitigates it.
Capture decisions when they happen, in a structured place. A short entry — what was decided, why, and what it rules out — saves hours of archaeology and keeps the agent aligned with reality.
Treat agent context like code
Project memory should be versioned, reviewed, and kept current — the same discipline you apply to source. A stale memory file is worse than none, because the agent confidently acts on outdated facts.
Automate the upkeep so it doesn't depend on anyone remembering. When your context file stays current on its own, every session starts informed instead of blind.