Why Your Claude Agent Breaks After 3 Turns (And How to Fix It)
There's a failure pattern I see in almost every Claude agent that goes to production: it works great for 1-2 turns, then starts behaving strangely by turn 3-4. Here's what's happening and how to fi...

Source: DEV Community
There's a failure pattern I see in almost every Claude agent that goes to production: it works great for 1-2 turns, then starts behaving strangely by turn 3-4. Here's what's happening and how to fix it. The Problem: Context Poisoning Every message you send Claude adds to the context window. That's fine for conversations. It's catastrophic for agents with long-running tasks. What happens: Turn 1: Claude has your system prompt + one task. Clean context. Excellent response. Turn 2: Claude has system prompt + task + response 1 + task 2. Still manageable. Turn 3+: Claude now has a growing pile of its own previous responses in context. The problem isn't the length. It's that Claude's previous responses bias its future ones. If response 1 was slightly off-key, responses 2 and 3 will drift further in that direction. The Hidden Compounding Effect Think of it like a photocopier making copies of copies. Each generation degrades. The same thing happens with LLM context. I measured this on a task w