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.
Evidence
“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.Why it is archived
Trimmed to 100-cap (lowest opportunity_score)
Scoring breakdown
Existing players
- 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.
What they are missing
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.
Stack hint
#ATB22 · Canonical URL: https://www.realproblem.ai/archive/why-does-claude-code-forget-its-own-instructions-mid-task-after-compacting