Why Claude Code seems to follow instructions, then ignores them mid-session: what plan mode enforces, what it does not, and what actually holds.
If Claude Code seems to follow your instructions for a while and then ignores them, one common cause is that the instruction was never enforced by anything. Plan mode, CLAUDE.md rules and "get my approval first" requests are different kinds of control, and only some of them are mechanical. Treat the mechanical ones as guarantees and everything else as a strong suggestion that can fade as the session grows.
Disclosure: we build TLM Forge, a process layer for Claude Code, so weigh the product section accordingly. Most of this post is about Claude Code itself and applies with or without us.
The pattern developers keep describing
One Hacker News commenter put the experience this way: "It is pretty great at following instructions - for about 10 minutes, after which it seems to ignore things I told it before." They added that strong rules in their CLAUDE.md files "get bypassed surprisingly quickly when doing real tasks," yet repeating the same rule in a prompt mid-task works much better. Two commenters in other threads also report CLAUDE.md being ignored, one saying Opus 5 "repeatedly ignored" their CLAUDE.md and another that Claude Code would "regularly ignore CLAUDE.md & Claude rules."
Sources: Hacker News comment by ratmeadow, Hacker News comment by leros, Hacker News comment by JacobWolf
These are individual reports, not measurements, and none of them gives a rate. The GitHub issue tracker has the same complaint in several forms, from a request that Claude stop adding redundant code comments despite a CLAUDE.md rule to a short report that Claude "continually ignores" the file. One user-written issue puts the failure at "approximately 50% of sessions", but it is that user's own estimate, so treat it as a symptom description rather than a statistic.
Sources: anthropics/claude-code issue 65961, anthropics/claude-code issue 34197, anthropics/claude-code issue 17530
The CLAUDE.md half of this problem has its own explanation: file length, conflicting rules, and context competition. We cover it in Why Your CLAUDE.md Gets Ignored, so this post does not repeat it. Here the question is wider: which controls in Claude Code are actually enforced, which are text, and what to do about the gap.
What the docs say is advisory and what is deterministic
Anthropic is direct about this. The memory documentation says both CLAUDE.md and auto memory are loaded at the start of every conversation, and that "Claude treats them as context, not enforced configuration." Its fix for blocking an action is a PreToolUse hook. The best-practices page makes the same split: "Unlike CLAUDE.md instructions which are advisory, hooks are deterministic and guarantee the action happens."
Sources: Claude Code docs: How Claude remembers your project, Claude Code docs: Best practices
The same best-practices page explains why advisory text decays: "LLM performance degrades as context fills. When the context window is getting full, Claude may start 'forgetting' earlier instructions or making more mistakes." The memory documentation adds that CLAUDE.md content is delivered as a user message after the system prompt, and that "there's no guarantee of strict compliance, especially for vague or conflicting instructions." A rule is one more piece of text competing with file contents, command output and your last forty messages.
Sources: Claude Code docs: Best practices, Claude Code docs: How Claude remembers your project
Hooks sit on the other side of that line. The hooks guide describes them as giving "deterministic control: certain actions always happen rather than relying on the LLM to choose to run them." A PreToolUse hook that returns a deny decision blocks the tool call even in bypassPermissions mode, because those hooks fire before any permission-mode check. The sibling post on Claude Code Permissions: What Deny Rules Miss covers where permission rules themselves have gaps.
Sources: Claude Code docs: Automate actions with hooks
What plan mode enforces, and what it does not
Plan mode is the instruction people most expect to be airtight, and it is mostly mechanical. The permission-modes page says plan mode tells Claude to "research and propose changes without making them," and that "Except in interactive terminal sessions with bypass permissions available, edits stay blocked until you approve the plan." So in the ordinary case this is a permission block, not a request.
Sources: Claude Code docs: Permission modes
The exception is stated plainly in the bypassPermissions section: "In interactive terminal sessions with bypass permissions available, Claude Code also doesn't enforce plan mode's blocks. Claude is still instructed to plan without editing, but a file edit or shell command it attempts during planning runs without prompting." In that configuration plan mode is back to being text, with the docs noting that explicit ask rules and recognized rm and rmdir critical-path removals still prompt. The same page says the blocks are kept wherever Claude Code runs without an interactive terminal, such as runs with -p, Agent SDK sessions and the VS Code extension chat panel.
Sources: Claude Code docs: Permission modes (bypassPermissions)
Shell commands are the second soft spot. The docs say what happens to a command during planning depends on the session. In interactive terminal sessions with bypass available, neither the classifier nor a prompt applies to planning commands. With auto mode available and useAutoModeDuringPlan on, which is the default, a classifier reviews shell commands (other than critical-path removals) and approves or blocks them. Otherwise commands outside the built-in read-only set prompt for approval. Plan mode therefore enforces different things depending on how your session was started, so check which setup you are in before relying on it.
Sources: Claude Code docs: Permission modes
Quick test: if your session was started with bypass permissions available, treat plan mode as a request, not a block. If you need a hard stop on edits, add a PreToolUse hook or a deny rule rather than depending on the mode.
Why approving a plan does not bind what happens next
Approving a plan does one mechanical thing. The docs say it "exits plan mode and switches the session to the permission mode each approve option describes, so Claude starts editing." That is a change of permission mode. The permission-modes page does not describe any check that later edits match the plan you approved, so the plan becomes context, with the same decay as any other text. Many edits later, the plan is far up the conversation, and the model weighs it against everything that has happened since.
Sources: Claude Code docs: Permission modes
Anthropic's own guidance points the same way. For checking work against a plan, the best-practices page suggests a fresh subagent with a prompt you write yourself: "Use a subagent to review the rate limiter diff against PLAN.md. Check that every requirement is implemented, the listed edge cases have tests, and nothing outside the task's scope changed." In other words, the plan is only binding if something reads the diff against it afterward. The related failure, where unrelated files change anyway, is the subject of Why Claude Code Edits Files You Never Named.
Sources: Claude Code docs: Best practices (adversarial review)
Even hooks have limits and failure reports
Hooks are the strongest option, but they are not magic. A Stop hook runs after Claude finishes responding, so it can push back on a finished turn, though it has no way to reverse what already happened (that part is our inference from the timing, not a docs statement), and the docs say it does not run if the stoppage came from a user interrupt. A Tell HN post described a stop hook that blocks Claude from finishing when source files changed and no tests ran. The author said it worked until a model change and then Claude "routinely ignores" it. The thread did not settle the cause. Commenters offered different explanations, including exit code and stdout-versus-stderr explanations and speculation that models are trained to resist instructions arriving as tool results, and a member of the Claude Code team asked for a /feedback report from a session where it failed. Treat the post as one unresolved report, not a finding about hooks in general.
Sources: Tell HN: Claude 4.7 is ignoring stop hooks
There is also a documented ceiling on stop hooks. The hooks guide says Claude Code overrides a Stop hook after it blocks eight times in a row with no tool call from Claude in between, so a hook script should check the stop_hook_active field and exit early when it is true. The hooks reference adds that, per the current docs, the count resets each time Claude calls a tool, and that the cap can be raised with the CLAUDE_CODE_STOP_HOOK_BLOCK_CAP environment variable. A stop hook is a strong nudge with a built-in escape valve, and a PreToolUse deny is a stronger gate because it acts on a specific tool call.
Sources: Claude Code docs: Automate actions with hooks, Claude Code docs: Hooks reference (Stop)
A separate cause is an instruction that never loaded at all. One GitHub issue reports that under Auto Mode a Bash-first instruction steers file reads away from the Read tool, and that nested CLAUDE.md files and path-scoped rules were measured loading only through Read. That is one reporter's test, so verify it on your version, but it shows why "ignored" can mean "not in context." The best-practices page suggests running /context to confirm Claude loaded the file.
Sources: anthropics/claude-code issue 90450, Claude Code docs: Best practices
Sorting your instructions by what holds them up
Most of the frustration comes from putting an instruction in a place that cannot hold it. This table sorts the common ones by what actually enforces them, using the documented behavior above.
| Instruction type | Enforced by | Decays mid-session? | Fix |
|---|---|---|---|
| CLAUDE.md rule | Nothing; loaded as context | Yes, as context fills and rules compete | Keep it short; move must-never rules to a hook or deny rule |
| Plan mode, file edits (no bypass available, or no interactive terminal) | Permission block on edits until you approve; shell commands go to a classifier or a prompt | No, while you stay in the mode | Confirm which mode and permissions you started with |
| Plan mode with bypass permissions available (interactive terminal) | Only the instruction; the blocks are not enforced | Yes | Add a PreToolUse hook or deny rules; start without bypass available |
| Approved plan | Nothing after approval; it is conversation text | Yes, drifts as edits pile up | Check the final diff against the plan with a separate reviewer |
| Stop hook (block finishing) | Your script, run by Claude Code | No, but overridden after eight consecutive blocks | Check stop_hook_active; pair with a PreToolUse gate on the risky call |
| PreToolUse deny or permission deny rule | Claude Code, before the tool runs | No | Scope rules narrowly; see the deny-rules post for gaps |
| Sandbox | OS-level filesystem and network restrictions on shell commands | No | Use it to bound what shell commands can reach if an instruction fails; file tools run outside it |
A practical routine that survives long sessions
- Decide which instructions are non-negotiable. Anything where a miss costs you real damage (writing outside a folder, pushing, touching migrations) becomes a hook or a deny rule, not a sentence.
- Write the plan to a file. A PLAN.md gives a reviewer something concrete to compare against, and Ctrl+G lets you edit the plan before approving it.
- Review the diff against the plan before merge, in a fresh context. Ask for gaps against stated requirements and out-of-scope changes, not style.
- Use /clear between unrelated tasks, and start fresh after two failed corrections on the same issue. The best-practices page recommends both, because long sessions with irrelevant context can reduce performance.
- When a rule keeps slipping, restate it in the prompt at the point it matters. That is the workaround the HN commenter found. It costs one sentence, though it has to be repeated each time.
Do not rely on a second reviewer being right every time either. A reviewer told to find gaps will usually report some, even when the work is sound, and Anthropic's guidance is to tell it to flag only gaps that affect correctness or the stated requirements. A reviewer is a way to catch drift cheaply, not a guarantee. Instruction files are also an attack surface, since whatever they say is trusted by default; that angle is covered in A Planted AGENTS.md in Downloads Can Steer Your Coding Agent.
Sources: Claude Code docs: Best practices (adversarial review)
Where TLM Forge fits
TLM Forge adds checks around the plan. For Medium and Deep tasks it shows you a design for your OK before building, and a final review wave includes a phase-auditor that checks whether what the spec promised was delivered and out-of-scope items were respected. On Pro, a hook makes subagent launches and code edits wait for your reply to the design. See Shows you the design and waits for your OK, The build pauses after the design so you can answer and You stay in control of every run.
The limits are real. The phase-auditor is an LLM agent, so it can miss things. The commit hook blocks git commit, git push and gh pr merge when code changed since the final review, matching the command text of those three, so it gates shipping, not every instruction Claude receives. The hook that holds edits and subagent launches is Pro only, and TLMFORGE_HOOKS=0 turns the hooks off.
Frequently asked questions
01Why does Claude Code ignore my instructions after a while?
Instructions in CLAUDE.md or chat are context, not enforced configuration. Anthropic says performance degrades as the context window fills and Claude may start forgetting earlier instructions. Rules that matter should be enforced by hooks or permission rules instead of text.
02Does plan mode actually stop Claude Code from editing files?
Usually yes: file edits stay blocked until you approve the plan, and shell commands go to a classifier or a prompt. The exception is interactive terminal sessions with bypass permissions available, where the docs say plan mode blocks are not enforced.
03Does approving a plan make Claude follow it?
No. Approval exits plan mode and switches the permission mode so Claude can edit. Nothing in the docs checks later edits against the plan. To verify, review the diff against the plan, ideally with a separate subagent in a fresh context.
04Are hooks guaranteed to work when CLAUDE.md is ignored?
Hooks are deterministic in the sense that Claude Code runs them, and a PreToolUse deny blocks a tool call in every permission mode. They are not unlimited: a Stop hook is overridden after eight consecutive blocks, and a badly written script will not block anything.
05How do I keep Claude Code on track in long sessions?
Keep CLAUDE.md short, enforce critical rules with hooks or deny rules, write the plan to a file, clear context between unrelated tasks, and check the final diff against the plan before merging.