AIToday
Large Language ModelsAI Coding AssistantsZenn AI/MLPublished: Oct 18, 2026, 22:00 JST

Claude Code: after two failed fixes, run /clear

Claude Code: after two failed fixes, run /clear

3 Key Points

  1. What happened

    The tutorial, based on official Claude Code documentation and checked as of October 18, 2026, says failed fixes and corrections pile up in the context window. It cites the guidance to run /clear after more than two corrections on one issue.

  2. Why it matters

    A clean session with a better prompt tends to beat a long session full of corrections, per the documentation. The tutorial suggests restating the goal, the file location, and the approach to avoid.

Not sure about something? Ask the AI

Questions and answers are published on this page.

Summaries like this, in your inbox every morning.

Context & Analysis

The tutorial frames the problem as one of resource management: the context window holds everything in the conversation, including failed code and the corrections pointing it out. Because Claude reads all of it when composing the next reply, those failed approaches can become reference material that steers the next attempt wrong. The documentation's own language is stark — a clean session plus a good prompt almost always beats a long correction-heavy session. The tutorial's recommended fix is not just /clear but a rewritten prompt that adds three things learned from the failures: the goal, the place to make the change, and the approach to avoid. It gives the example of a login redirect in Next.js, where Claude kept adding router.push inside useEffect; the restarted prompt specifies middleware.ts and rules out useEffect transitions. Beyond /clear, the piece maps out the other commands: /compact summarizes while letting you say what to keep, /btw asks a side question without adding to the main history, and CLAUDE.md holds rules for what summaries must preserve. The author notes using /rewind, /compact with instructions, and /clear to split a problem into smaller sessions.

FAQ
When should I use /clear instead of just correcting again?
According to the tutorial, if you have corrected Claude more than twice on the same issue in one session, run /clear and start fresh with a more specific prompt. The official documentation says a clean session with a good prompt almost always beats a long session of accumulated corrections.
What is the difference between /clear and /compact?
/clear resets the context and starts a new conversation, while /compact summarizes the conversation to shrink it. The tutorial recommends /clear when mistakes keep repeating or you switch to an unrelated task, and /compact when you want to keep working on the same task but the conversation has grown long.
How do I keep information from disappearing in a summary?
Write it into CLAUDE.md, the instruction file Claude Code reads every time. The tutorial shows an example rule telling the summarizer to always preserve the full list of modified files and test commands.

AI news that matters for your work, delivered every morning.

Pick your industry and the AI tools you use, and get news related to your work every day.

Free · 30 seconds with Google · unsubscribe anytimeWhat is AIToday? →

Ask AI

Ask AI anything about this article. The AI reads this article, earlier AIToday articles, and Wikipedia, and cites its sources. Q&As are published on this page for other readers too.

Questions and answers are published on this page.

Related Articles

Next articleOnlyFans creators question Meta's Muse sexting while Instagram restricts them