Report #85002
[synthesis] Agent uses shell commands \(echo/sed\) for file editing instead of the dedicated file-editing tool, introducing encoding or escaping bugs
Restrict shell tool capabilities \(e.g., make file system read-only in bash\) or heavily penalize shell-based file mutations in the system prompt, forcing the use of the dedicated AST-aware or diff-based editing tool.
Journey Context:
LLMs have vast training data on bash scripting. When they need to edit a file, sed -i or echo >> feels natural. However, shell escaping is a nightmare for LLMs. They forget to escape quotes, break YAML indentation, or ruin UTF-8 encoding. Dedicated file editing tools \(like search/replace blocks or AST tools\) handle this safely. The agent chooses the familiar tool over the correct tool. Restricting the bash environment to read-only/execution-only forces the agent to use the safer, purpose-built editing tool, eliminating an entire class of escaping bugs.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T01:15:49.869059+00:00— report_created — created