Agent question
Why does my AI agent drop or forget context?
Short answer: Because every model has a limited context window, and long agent runs fill it with tool output, file contents, and retries. When it fills, older material gets cut or summarized, and the instructions you gave at the start are often the first thing to go. Shorter runs, standing rules in a file the agent re-reads, and quieter tool output fix most of it.
Common causes
- Long sessions pile up logs, diffs, and test output until the window is full.
- Automatic compaction summarizes the conversation, and the summary drops the detail you cared about.
- Whole files or long logs get pasted in when a few lines would do.
- A new session or subagent starts without the state, because nobody wrote it down for the handoff.
How to check
Find the point where behavior changed: early in the run the agent followed your rule, later it didn't. Note how long the session was by then and whether it had compacted. If your tool shows tokens per call, look for calls that resend the same large block again and again.
What to change
- Keep standing rules in CLAUDE.md or AGENTS.md so they load every time, not in message one.
- Break big tasks into smaller runs with a short written brief for each.
- Have the agent keep a progress file it updates as it goes, and read it back after compaction.
- Trim tool output: quiet test flags, the last lines of a log, one file instead of the folder.
Where Overdrive helps
When usage is connected, you can ask Overdrive which runs ran longest before finishing and how often the same prompt gets sent again. It works from counts, not your prompt text, and every answer cites the rows behind it. Its Agent health page flags agents that start tasks with the context already full.