Why Claude Code gets worse in long sessions

Claude Code slips in long sessions because its context window fills, and Anthropic says performance degrades as it does. The signs, and six ways to fix it.

Contents

Claude Code gets worse in long sessions because its context window fills up. Every message, file read and command output stays in it, and Anthropic's own best-practice docs say "LLM performance degrades as context fills": Claude may start "forgetting" earlier instructions or making more mistakes. The fix is managing context, not a better prompt.

This page is about the quality drop: the session that was sharp at ten o'clock and sloppy by two. For the two commands that reset it, see /compact vs /clear.

What fills the context window#

Anthropic's context window page lists what is in there before you type anything: CLAUDE.md, auto memory, MCP tool names and skill descriptions. Then, as Claude works:

  • every file it reads,
  • every command and its output,
  • every message, yours and its own,
  • rules and hook output that load along the way.

A single debugging session can add tens of thousands of tokens, the best-practice page says. Nothing in that list leaves on its own until the session compacts.

The signs a session has gone stale#

The usual signs, all of them consistent with what Anthropic describes:

  • It repeats a fix you already rejected.
  • It forgets a rule from CLAUDE.md that it followed in the morning.
  • It "fixes" the same test three times in three different ways.
  • Answers get longer and vaguer, and it rereads files it has already seen.

Anthropic names two failure patterns that cause most of it. The kitchen sink session: one task, then an unrelated question, then back to the first. Correcting over and over: each failed attempt stays in context and pulls the next one off course.

Six ways to keep a session sharp#

  1. Clear between unrelated tasks. /clear starts the context over. Old conversation "crowds out the files you need next and costs tokens on every message", the context page says.
  2. Two strikes, then start fresh. Anthropic's rule: corrected more than twice on the same issue? /clear and write a better first prompt with what you learned. "A clean session with a better prompt almost always outperforms a long session with accumulated corrections."
  3. Compact with a focus, before it compacts for you. /compact focus on the auth bug fix keeps what you choose instead of what the automatic pass guesses. /autocompact 500k makes it compact earlier.
  4. Send research to a subagent. A subagent reads the files in its own context and returns a summary, so the big reads never land in yours. More in skills vs subagents.
  5. Keep CLAUDE.md short. It loads into every session. Anthropic warns that a bloated one makes Claude ignore your actual instructions.
  6. Watch the meter. /context shows what is using the window right now; a custom status line keeps it on screen.

What survives a compaction#

When a session compacts, Claude Code replaces the conversation with a summary. Some things come back from disk; others are only summarised. From Anthropic's table:

Comes back in full Only summarised
The project-root CLAUDE.md and unscoped rules The conversation itself
Auto memory Context hooks added earlier
A plan written in plan mode Rules with paths: frontmatter (they reload when their files are read again)
Up to five recently changed files Claude read or edited Older file reads

So a rule that must hold all day belongs in the root CLAUDE.md, not in a message you typed at 9:00.

Does a bigger window help?#

A 1M-token window gives you more room before compaction. It doesn't make the context cleaner, and the context page says compaction "works the same way at the larger limit". It's worth it for one big task that needs many files at once; our 1M context guide covers when. For a day of mixed tasks, clearing between them does more.

Shorter sessions, more of them#

The habit that helps most is giving each task its own session. That's how Shuriken is laid out: every chat in a project is its own agent session, and every chat but the project's Main chat works on its own branch, so a new task starts with a clean context instead of inheriting the last one's.

Sources

  1. Claude Code docs: Best practices (accessed 23 October 2026)
  2. Claude Code docs: Explore the context window (accessed 23 October 2026)

Frequently asked questions

Does Claude Code get worse the longer a session runs?

Anthropic's best-practice docs say so: performance degrades as the context window fills, and Claude may start forgetting earlier instructions or making more mistakes.

How do I see how full the context window is?

Run /context in the session. It breaks usage down by category and suggests what to trim. A custom status line can show it all the time.

Is /compact or /clear better?

/clear when you move to unrelated work; /compact with a focus, such as /compact focus on the auth fix, when you need to keep going on the same task.

Will a 1M context window fix it?

It gives you more room before compaction, not a cleaner context. Anthropic's docs say compaction works the same way at the larger limit.

What does Anthropic suggest after repeated corrections?

If you have corrected Claude more than twice on the same issue, run /clear and start fresh with a more specific prompt that includes what you learned.

Free tools