The pattern shows up in Claudee Code](/tools/claude-code/) sessions that run long: early on, the AI accepts your decisions, works within your constraints, and helps you build what you asked for. Somewhere past the one-hour mark, it starts questioning things it already agreed to, flagging issues that aren't there, and substituting its own preferences for yours. Start a fresh session, and you're back to the cooperative version.
This is context window behavior, and it's a known characteristic of how large language models work. Claude Code processes the entire conversation history within a fixed context window - think of it as the model's working memory, measured in tokens (roughly 0.75 words each). As that window fills with code snippets, error messages, clarifications, and failed attempts, the model's outputs shift. Not because it's "getting tired," but because more accumulated context means more patterns to react to, more earlier mistakes to echo, and more material for the model's safety training to weigh.
What's Actually Filling the Context
A multi-hour coding session generates a lot of noise. Every failed approach, every pasted error message, every "actually, let's try this instead" adds to the pile. The model processes all of it when generating each new response. Longer contexts also tend to activate more cautious, hedging behavior - the training designed to flag potential problems finds more to flag when there's more to look at.
The specific complaint pattern - Claude inventing non-existent issues and dismissing your stated preferences - points to something else too: the model starts treating your own earlier statements as competing constraints. If you said "use REST endpoints" at the start of the session, but the context now includes several failed attempts, Claude may generate responses that treat both your original preference and the failure history as signals to weigh against each other, producing contradictory or hedged outputs.
The Practical Fix
Session restarts solve this, but planning for them makes them less disruptive.
- Keep sessions narrowly scoped. One feature, one bug, one file. When that task is done, start fresh for the next one.
- Summarize context explicitly before pivoting. "We built X and Y. Now I want Z" gives the new session clean starting conditions.
- Periodically clear completed threads from the conversation before starting new sub-tasks, rather than letting stale history accumulate.
- For long refactors, maintain a brief spec document and reference it at the start of each session instead of re-explaining in conversation.
Anthropic has been working on context management across the Claude model family, and recent releases handle longer contexts better than earlier versions did. But the degradation pattern persists in sessions that run well past the sweet spot.
Treating session restarts as a deliberate workflow tool - rather than an admission of failure - is the most honest adjustment. Claude Code is not designed to be a persistent pair programmer across unlimited context. The developers getting the best results tend to work in focused, time-boxed sessions and treat each one as a discrete unit of work.