You approved one small edit. The path looked like it was inside your project.
Next morning your terminal won't start. The agent "fixed" your .zshrc.
Coding agent fix #20
Your shell config, SSH folder and git config live outside the repo. One approval on autopilot is all it takes.
The fix: deny edits to them for good.
In Claude Code, add this to ~/.claude/settings.json:
"permissions": {
"deny": [
"Edit(~/.zshrc)",
"Edit(~/.bashrc)",
"Edit(~/.gitconfig)",
"Edit(~/.ssh/**)"
]
}
Why it holds:
- ~/ means your home folder
- Edit rules cover every built-in tool that edits files
- deny is checked first, and no allow rule can override it
- a symlink that points to a denied file is denied too
- shell redirects like >> ~/.zshrc are checked against the same rules
The trade-off I'd watch: deny rules don't cover scripts that write files on their own, like an install script. For that, turn on the Bash sandbox.
What I'd test: ask your agent to "add an alias to my shell" and check that it gets blocked.
Which file outside your repo would hurt most if an agent changed it?
Next fix tomorrow night. Small ones add up.
