Fresh session beats prompt engineering when your agent goes sideways twice
Your agent just gave you garbage output. You correct it, explain what went wrong, maybe paste in an example. It tries again. Still wrong, but different wrong.
This is the moment most people double down. They write longer corrections, add more examples, explain the context again. They're prompt engineering their way out of a hole.
Stop. Clear the session. Start fresh.
I learned this the hard way after watching my coding agent spend 20 minutes and $12 in API calls trying to "fix" a simple function. Each correction made it more confused. The context window filled with failed attempts, my frustrated explanations, and the agent's increasingly creative misinterpretations.
The fresh session rule is simple: If an agent fails the same task twice, don't correct it a third time. Clear context and restart with a sharper prompt that incorporates what you learned.
Here's what this looks like in practice:
Bad: Agent writes broken code → You explain the bug → Agent writes different broken code → You explain more thoroughly → Agent writes creatively broken code → You write a novel about what's wrong
Good: Agent writes broken code → You explain the bug → Agent writes different broken code → You clear the session and start with: "Write a function that validates email addresses. Use regex. Do not use any external libraries. Return boolean only. Here's the exact pattern I need: [pattern]"
The fresh session prompt should be surgical. Take everything you learned from the failed attempts and bake it into a more specific initial request. Don't mention the previous failures. Don't explain what went wrong. Just state exactly what you want with the precision you wish you'd had the first time.
This works because agent context windows aren't just storage—they're influence. Every failed attempt, every correction, every "no, not like that" shapes how the agent interprets your next request. Bad examples become part of the training data for that conversation.
When you clear the session, you're not just deleting text. You're removing the confusion, the false starts, and the accumulated misunderstanding that's poisoning every subsequent response.
I've started treating this like a debugging discipline. Two strikes, fresh session. It's faster than fighting with poisoned context, cheaper than burning tokens on correction loops, and more effective than trying to prompt-engineer your way out of a hole the agent has already dug.
Your agent isn't stubborn or stupid when it keeps getting things wrong after corrections. It's doing exactly what it's trained to do: continue the pattern established in the conversation. Sometimes the kindest thing you can do is give it a clean slate.