Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yeah I disallow git write in my agents.md for exactly this reason. Agents have fucked up the working tree and lost code too many times for me.

I have this in agents.md now:

  # Git operations policy

  Git is read-only for coding agents unless running in a cloud environment where git writes are explicitly allowed.

  - Never run git commands that write state, change history, change the index/staging area, change branches, or modify working tree files.
  - Never run destructive git commands.
  - The human user owns git write operations.

  Allowed read-only examples: `git status`, `git diff`, `git log`, `git show`, `git branch --show-current`, `git rev-parse`, `git blame`.

  Disallowed examples: `git add`, `git rm`, `git mv`, `git restore`, `git checkout`, `git switch`, `git commit`, `git merge`, `git rebase`, `git cherry-pick`, `git revert`, `git reset`, `git stash`, `git clean`, `git fetch`, `git pull`, `git push`, `git tag`, and `git worktree`.


This is one compaction away from being truncated to "allowed examples: `git add`...".

System prompts aren't safeguards.

A step in the right direction is auto-review, available in claude-code, codex, and Cursor products. This is not foolproof either.

This is why remote calls should be gated through an MCP or other API gateway. The MCP can restrict calls even when the provider lacks scoped privileges for their integration keys.


Does this consistently work for you? I have something like this plus some commands that are explicitly in a deny list in the harness. Roughly twice a week, the model manages to run the deny listed commands, that I need afterwards to manually revert.


Almost completely consistently. I can vaguely remember one slip up in over 6 months of daily usage. Good enough that I'm not inclined to use anything more heavy to guard against this. My agents.md is small and fokused. I only use Sol in pi.dev and Fable in Claude Code.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: