[Bug] Agent prefers bash heredoc over file write tool due to classifier misconfiguration
Bug Description
Claude Code/Windows: Agents often use a bash tool call to invoke sed or cat to read files, and sed/cat/awk/etc to edit files. When they run afoul of escaping they will revert to writing code, typically python, to do the edit. Perversely, they will sometimes use write file to create the script, then run it to do the edit/modify. Sometimes they'll use a heredoc to create the python script! According to Opus, this was traced back to a changelog.md regarding classifier confliction: the model thinks it should use bash cat <<... to avoid user consent prompting. Surely read/write file have their own permission system. It's bloody annoying due to the number of tokens wasted by a model trying to get escapes correct, so I guess you won't fix it but rather lean in to it?
Environment Info
- Platform: win32
- Terminal: windows-terminal
- Version: 2.1.258
- Feedback ID: 2e85e0a6-a070-48fc-8e7b-c4a373860636
Errors
● Bash(python - <<'PYEOF'
…
⎿ Error: Exit code 2
/usr/bin/bash: -c: line 186: unexpected EOF while looking for matching `''
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗