AI / Agents Agents Archived

Cite as: Real Problem AI problem “Why does Claude Code forget its own instructions mid-task and undo its own work after compacting?”. Opportunity score 7.2 out of 10 (severity 8, AI feasibility 7, market signal 7, competition gap 7). Category AI / Agents. Trend Agents. Source signal: anthropics/claude-code GitHub issue #21925, gizyckik, 30 Jan 2026.. Canonical URL: https://www.realproblem.ai/archive/why-does-claude-code-forget-its-own-instructions-mid-task-after-compacting.

Why does Claude Code forget its own instructions mid-task and undo its own work after compacting?

Context compaction doesn't re-read CLAUDE.md and auto-continues with degraded context, so the agent sometimes actively undoes work it just built because it forgot doing it, with no pause or confirmation.

Who has it: Developers running long, complex Claude Code sessions on real production codebases.

Heard in public

“It's like having a brilliant employee who every 5 minutes becomes an imbecile and has to relearn everything, while actively destroying what they just built.”

Quoted word for word from the public post linked below. Nobody submitted it to Real Problem AI.

anthropics/claude-code GitHub issue #21925, gizyckik, 30 Jan 2026.

What nothing does yet

A compaction mode that pauses for confirmation, re-reads CLAUDE.md, and shows a diff of what context was dropped before the agent is allowed to continue acting on a degraded memory.

Tools that solve this

2 named so far, and where each one stops.

  • Automatic compaction

    Built-in but silent, no pause, no CLAUDE.md reload, no warning.

  • Manual /clear + restart

    Avoids the bug but loses all session context deliberately.

Why it is archived

Trimmed to 100-cap (lowest opportunity_score)

How you might build it

  1. 01Compaction pause/confirm gate
  2. 02CLAUDE.md re-injection on resume
  3. 03Context-loss diff viewer
  4. 04Session checkpoint/rollback

#ATB22 · Canonical URL: https://www.realproblem.ai/archive/why-does-claude-code-forget-its-own-instructions-mid-task-after-compacting