Your Claude Code Sessions Die at Message 15

Most people let Claude Code run until it falls apart. A thread on r/PromptEngineering put a name to what’s happening: context rot. And once you understand it, it’s completely fixable.

What Context Rot Actually Is

Claude Code sessions start strong. Clean context, clear instructions, fast results. Then, somewhere around message 10-15, something shifts. The model starts looping. It patches a bug, breaks something else, patches that. Progress stops.

The cause isn’t the model getting worse. It’s context pollution. Every failed attempt, every debugging detour, every chunk of API docs pasted into the chat stays in the window. The model weighs all of it equally. You’re not fighting a capability problem. You’re fighting accumulated noise.

Think about what a session actually looks like by message 15. You’ve got your original instructions, a few code snippets that didn’t work, a stack trace or two, maybe a full config file you pasted to help diagnose something, and three variations of the same function. The model has to hold all of that simultaneously and reason through it. It doesn’t know which parts to trust and which to ignore. So it treats everything as equally valid signal, including the broken stuff.

u/Exact_Pen_8973 spent time digging into Anthropic’s session management documentation and published a clean workflow to address this. Here’s the practical breakdown.

Old Way vs. The Managed Approach

Old way: let the session run, add context as needed, hope the model figures it out.

Managed approach: treat your context window like a workspace you actively maintain, not a dump.

Four concrete changes make this work:

🗂️ Keep CLAUDE.md under 200 lines

CLAUDE.md loads into context on every session start. Most people stuff it with documentation, guidelines, and API notes. That’s a silent token tax paid before a single message is typed. Keep it strictly to build commands and core rules. Everything else lives somewhere else. A good test: if a new teammate wouldn’t need to read it on day one to run a build, it doesn’t belong in CLAUDE.md. Move it to a separate reference file and reference it only when needed.

Stop pasting API docs into the chat

Set up an MCP server connected to Google’s NotebookLM. When Claude needs to check a spec, it queries NotebookLM directly and pulls only the relevant paragraph. Instead of consuming thousands of tokens on a full API doc, it pulls a few hundred words of exactly what’s needed. The same logic applies to any large reference material. A database schema, an OpenAPI spec, a long style guide: none of it belongs in the chat window by default. Load it surgically, only when directly relevant to the task at hand.

⚡ Steer your `/compact` commands proactively

Don’t wait for autocompact to fire when context is full. That’s when the model performs worst. Fire it manually, early, and tell it what to keep: `/compact focus on the auth refactor, drop the test debugging`. You’re curating the context, not just compressing it. The difference matters. Autocompact doesn’t know what’s valuable. You do. A steered compact at message 8 is worth more than a full restart at message 20.

Never try to fix a bug three times

Failed code anchors the model to broken reasoning. If the second attempt fails, don’t try again in the same thread. Use `/rewind` (Esc Esc) to drop the failure history, or wipe it entirely with `/clear`. Starting fresh is faster than fighting the anchor. This is counterintuitive because it feels like you’re losing progress. You’re not. You’re shedding bad signal that would have cost you another five messages to untangle anyway.

The Underlying Principle

As u/jd52wtf put it in the comments: “Preserve the good stuff in the documents and purge the bad. Break all tasks into more manageable pieces.”

That’s the real insight. Claude isn’t stateless between messages. Everything that failed, every chunk of context loaded, every wrong turn stays in the window and shapes what comes next. Managing that actively is the difference between a productive session and one that slowly degrades.

The developers who get the most out of Claude Code treat context management as a first-class concern, not an afterthought. They plan their sessions the same way they’d plan a focused work block: limited scope, clear objective, regular cleanup. A two-hour session with intentional context management will consistently outperform a four-hour session that lets context sprawl.

For those chasing the million-token context window as a solution: u/macebooks made a sharp point that in coding, you never need to get anywhere near that limit. Bigger context isn’t the answer. Cleaner context is. More room for noise is still just more noise.

Where to Start

Three moves to make today:

  1. Audit your CLAUDE.md. Strip anything that isn’t a build command or a core rule. If it takes more than 30 seconds to find the build command buried in your file, it’s already too long.
  2. Set a personal rule: if the second fix attempt fails, `/clear` and restart with fresh context. Write it on a sticky note if you have to. The instinct to push through is strong, and it’s almost always wrong.
  3. Try one steered `/compact` command in your next session instead of letting autocompact fire on its own. Pick the exact phrase you want it to focus on before you type it.

Context rot is a workflow problem, not a model problem. Which means it’s entirely within your control to fix.

Frequently Asked Questions

Q: Should I use checkpoint/summary files instead of relying on chat history?

Checkpoint files work way better during deep refactors , they give Claude a clean snapshot instead of expecting it to parse a messy history. Users report this simple habit cuts confusion significantly, especially once you hit the 20+ message mark on a single task. Build the habit early.

Q: When should I use /rewind, /compact, or /clear , and which one actually fixes context rot?

Use /rewind (Esc Esc) to drop failed attempts if a fix isn’t working , the anchoring problem is real, and early reset beats fighting through. Use /compact proactively before context gets full, to drop irrelevant history. Use /clear only when switching to a totally different task. Early reset wins every time.

Q: Do I really need a million-token context window?

Nope , and honestly, most developers avoid it. Huge context windows are expensive, unreliable, and actually hurt performance (the model gets distracted). Keep your docs lean, break tasks into focused pieces, and let each session do one thing well instead of trying to load everything at once.

Q: Do I need a CLAUDE.md file, or can I use text files and databases instead?

You don’t have to follow the CLAUDE.md format , some teams use text files or other systems successfully. The principle matters more: keep your core docs tight (under 200 lines), load them on session start, and include only build commands and essential rules. Format is flexible; lean is non-negotiable.

Q: Are there alternatives to NotebookLM for feeding in API docs?

NotebookLM is solid, but it’s not your only option. Tools like claude cot (auto-manages context rot) and aspens (graph-based context) do similar work. The core idea: fetch specs on-demand instead of pasting them into chat. Use whatever works for your workflow.

How to manage “Context Rot” in Claude Code (Anthropic’s recommended workflow)
by u/Exact_Pen_8973 in PromptEngineering

Scroll to Top