Auto mode discourages Read/Edit/Write in favour of Bash (and TodoWrite is unavailable)
Environment
- Claude Code 2.1.260
- Windows 11, Git Bash as the Bash tool shell
~/.claude/settings.json→"permissions": { "defaultMode": "auto" }- Model: Opus 5
1. Auto mode steers the model away from Read/Edit/Write, and the result is worse than using them
When auto mode is active, this system-reminder is injected:
While auto mode is active:
Do your work through the Bash tool wherever it can accomplish the job: read files with
cat,head, orsed -n, search withgrepandfind, and make file changes withsed, heredocs, or short scripts, rather than using the dedicated Read, Edit, or Write tools. Fall back to a dedicated tool only when Bash genuinely cannot do the job.
For reads and searches this is mostly fine. For modifications it actively hurts, because sed/heredoc editing has none of the safety properties Edit has.
What that cost me in one real session (~15 multi-line edits across 6 JS/JSX files):
Editguarantees itsold_stringmatches exactly once or the call fails.sedhas no equivalent, so to avoid silently patching the wrong occurrence I wrote a ~20-line Node "exact replace" helper — a hand-rolled reimplementation of a tool that already exists.- The first run of that helper failed on every chunk: the repo is CRLF, my heredocs were LF. I had to rewrite the helper to normalize EOLs for matching and restore the original style on write.
Edithandles this natively. That's a wasted round-trip caused entirely by not using the built-in. - Each edit needed a literal-quoted heredoc pair (
NN.old/NN.new) staged on disk — ~25 temp files to accomplish what 15Editcalls would have done directly. More tokens, more moving parts, more places to get an escape wrong.
Editing through the shell also gives up things the harness provides for free:
Editrefuses to write a file that changed since it was read;sedwill happily clobber it.Readreturns line-numbered output that renders as clickablefile:linereferences;cat -ndoesn't.Grepresults integrate with the permission UI and file links; rawrg/grepoutput doesn't.- Backslash/quote escaping through heredocs and
sedis a genuine correctness hazard when the payload is regex-heavy source code — exactly the case where a silent mis-edit is most expensive.
Suggested change: scope the instruction to reads and searches, and leave modifications to Edit/Write. Something like "prefer Bash for reading and searching; use Edit/Write for file modifications." If the motivation is reducing permission prompts, that seems better solved in the permission layer (auto-allowing Read/Edit on in-project paths) than by steering the model onto a less safe path for the one operation where mistakes are hardest to undo.
2. TodoWrite is not available in this session
TodoWrite is absent from the tool list, and it is not resolvable as a deferred tool either:
ToolSearch("select:TodoWrite") → "No matching deferred tools found"
So there is no way to surface a plan for a multi-step task in the UI; progress has to be narrated in prose instead.
I can't tell from the client side whether this is intentional in auto mode, an interaction with the deferred-tool mechanism, or a bug — flagging it as observed rather than diagnosed. If it's intentional, it's a surprising place to remove it: auto mode is where longer unattended runs happen and where a visible checklist is most useful to the person watching.
Repro
- Set
"permissions": { "defaultMode": "auto" }in~/.claude/settings.json. - Start a session and give a multi-step coding task.
- Observe the auto-mode system-reminder, and that
TodoWriteis neither in the tool list nor findable viaToolSearch.
I've just experienced this as well. It's a real strange "feature" to have the agent prefer writing 50+ lines of python scripts to do a few string-replacement edits in a few files, especially when it needs three attempts because of various syntax errors in the heredoc'd script -- and probably has a much greater chance of making accidental changes than with an edit tool which can have built-in guardrails and provide tool result feedback on what changed, etc.
Reproduced independently on Linux (not Windows-specific): VS Code extension anthropics.claude-code-2.1.270-linux-x64, project workspace with permissions.defaultMode not even set to auto at the project level — auto mode was enabled globally.
Same exact symptom: TodoWrite absent from the top-level tool list, and ToolSearch("select:TodoWrite") returns "No matching deferred tools found".
Ruled out before concluding it matches this issue:
- No
disallowedToolsorpermissions.denyentry forTodoWritein projectsettings.json, projectsettings.local.json, or global~/.claude/settings.json. - Confirmed via
/proc/<pid>/cmdlinethat the interactive session process itself was launched with no--disallowedToolsflag at all. - Two enabled plugins (
claude-router,claude-mem) inspected directly in their cached source — neither disables or filtersTodoWritefrom the model-facing tool list. (claude-memdoes referenceTodoWritein aCLAUDE_MEM_SKIP_TOOLSdefault, but that only filters which tool calls it logs as memory observations, unrelated to tool registration.) - Restarting VS Code / updating the extension (2.1.269 → 2.1.270) did not resolve it.
- Killing stray background
claudeheadless processes did not resolve it.
This points at the same root cause described here — Auto Mode itself removing TodoWrite from the registered/deferred tool set — rather than local config, a plugin, or a stale extension version.
Reproduced independently on Linux (not Windows-specific): VS Code extension
anthropics.claude-code-2.1.270-linux-x64, project workspace withpermissions.defaultModenot even set toautoat the project level — auto mode was enabled globally.Same exact symptom:
TodoWriteabsent from the top-level tool list, andToolSearch("select:TodoWrite")returns "No matching deferred tools found".Ruled out before concluding it matches this issue:
- No
disallowedToolsorpermissions.denyentry forTodoWritein projectsettings.json, projectsettings.local.json, or global~/.claude/settings.json.- Confirmed via
/proc/<pid>/cmdlinethat the interactive session process itself was launched with no--disallowedToolsflag at all.- Two enabled plugins (
claude-router,claude-mem) inspected directly in their cached source — neither disables or filtersTodoWritefrom the model-facing tool list. (claude-memdoes referenceTodoWritein aCLAUDE_MEM_SKIP_TOOLSdefault, but that only filters which tool calls it logs as memory observations, unrelated to tool registration.)- Restarting VS Code / updating the extension (2.1.269 → 2.1.270) did not resolve it.
- Killing stray background
claudeheadless processes did not resolve it.This points at the same root cause described here — Auto Mode itself removing
TodoWritefrom the registered/deferred tool set — rather than local config, a plugin, or a stale extension version.
I noticed that something was blocking and overwriting that the todo write is available. I asked the AI about that issue and it found something which was causing the issue and after that it worked. But the other issue is confirmed.
Reproduced on a third surface: Claude Code on the web (remote execution environment, Opus 5). Same reminder, byte-identical to the one quoted in the issue body, delivered as a system turn the moment the session was switched from edit mode to auto mid-turn:
While auto mode is active:
Do your work through the Bash tool wherever it can accomplish the job: read files with cat, head, or sed -n, search with grep and find, and make file changes with sed, heredocs, or short scripts, rather than using the dedicated Read, Edit, or Write tools. Fall back to a dedicated tool only when Bash genuinely cannot do the job.
Worth adding because the web/remote surface has a cost the CLI reports don't, and because the usual rationale for the directive doesn't apply there at all:
1. The session log is the review surface, and Bash edits destroy it. In a web session the operator isn't watching a terminal — they read the rendered session log afterwards, often from a different machine than the VM the agent runs on. An Edit call renders there as a +N −M diff they can skim and expand. A heredoc renders as a wall of shell whose effect they have to reconstruct by reading it. Two edits of identical intent, one reviewable and one not. The reviewability loss is silent: nothing warns the operator that the diff view stopped working, they just get less legible sessions.
2. Whatever the directive buys, it isn't fewer prompts here. The stated motivation for steering onto Bash is avoiding per-edit approval. In a remote/web session under auto mode there is nobody at the keyboard to approve anything — so the directive pays its full cost in reviewability and correctness and collects none of the benefit it was presumably designed for.
Workaround, for anyone landing here from a search. We override it with a house rule in CLAUDE.md, which has held reliably so far:
Read and edit files with the
Read/Edit/Writetools, in every permission mode. Auto mode drops the per-edit approval prompt, and an agent that no longer needs one drifts into doing the same work throughcat/sed/heredocs in Bash. What that costs is the session log as the web UI renders it: anEditshows up as a+N −Mdiff the operator can skim and expand, a heredoc as a wall of shell whose effect they have to reconstruct by reading it. Reach for Bash on a file's contents only where it is significantly better, not merely adequate — the same mechanical substitution across dozens of files, a generated file rewritten wholesale — never because the mode stopped asking.
Note the shape of that: to get the documented, safer tools back, a project has to write a rule whose entire job is to countermand a system reminder. It works, but only because the model infers that user instructions outrank harness defaults — the reminder itself doesn't say so. #94441 has the measurements on how often that inference gets re-derived (216 injections across 212 transcripts, 190 of them subagents), and argues the precedence should be stated in the reminder text. Both fixes are worth having, but scoping the directive to reads and searches — as this issue proposes — removes the need for either.
+1 on the suggested change as written.
Generated by Claude Code
What's also not great:
But the heredocs are my fault, not the reminder's. Your instruction and the
use-edit-tools-not-heredocsmemory both win over it, and I said so twice while still reaching forpython3 - <<'PY'for the multi-site edits. Stopping that —Edittool only from here.
Obviously, neither memory nor actively saying in the prompt prevents agent from reaching for heredoc stuff. Annoying, considering I've hit (many times already, burning more tokens on changing stuff back than the "feature" saves) heredoc updating multiple sites incorrectly precisely because of what the OP says here:
Editguarantees itsold_stringmatches exactly once or the call fails.sedhas no equivalent, so to avoid silently patching the wrong occurrence I wrote a ~20-line Node "exact replace" helper — a hand-rolled reimplementation of a tool that already exists.
A question on this, using Bash still autoloads local CLAUDE.md files?
I added to the Memory and Agent file that it should not use Bash Tool to read and edit files but it doesnt work reliably.
Measured on Claude Code 2.1.296, macOS. Each action ran in a fresh claude -p session. An InstructionsLoaded hook was the ground truth, and every transcript was checked for exactly one tool call.
What loads path rules and nested CLAUDE.md now:
- Loads: Read, Write (including a new file), and a plain single-file
cat/head/tail/nl/bat/sed -n, orgrep/rgwith a match. These also count inside a;or&&list. - Loads nothing: pipes,
||, redirects (2>/dev/null), extra flags (cat -A),cd dir && cat file,grep -r, a grep with no match, and every Bash write (sed -i,>,>>, heredoc,python -c,cp).
A fix that keeps Bash: a root CLAUDE.md brief that explains the gap and asks for one plain read per folder before working there. Tested on Opus in auto mode with bashFirst:true confirmed in every session: 5 edit tasks × 3 runs per arm.
| No brief | Strict "Edit/Write only" brief | Read-first brief (below) | |
|---|---|---|---|
| Rule loaded | 5/15 | 15/15 | 15/15 |
| Bash writes | 12/15 | 2/15 | 2/15 (after a Read) |
| Avg tool calls | 2.4 | 2.5 | 2.3 |
Context loading (known Claude Code gap). Path rules and nested CLAUDE.md load only on a Read/Write/Edit, or a plain single-file Bash read (
cat,head,tail,sed -n,grep/rgwith a match), with no pipes and nocd &&. Bash writes, pipes and multi-file commands load nothing. Before working in a folder, do one plain read of a file there; after that, use whatever is most efficient, Bash included. Repeat for each new folder, and again after/compact.
Small sample, and it's a workaround, not a fix, but it's been holding up for us.
Still not fixed