Chapter 3: Version control

You now know which commands destroy work. The last step is making sure an agent in a hurry can't run them.

Git guardrails

Rules at three levels that stop dangerous git commands: a deny rule in the agent's settings, a script that inspects each command before it runs, and protection on the server. Each one catches things the others miss.

A line in an instructions file is a request, and an agent trying hard to finish will do what looks like progress. Local rules catch local damage, such as reset and clean, which no server ever sees. The server catches whatever reaches it, however it was spelled. You need both, and each needs testing.

Say it to your agent

“In .claude/settings.json add these to permissions.deny: Bash(git push --force *), Bash(git push -f *), Bash(git reset --hard *), Bash(git clean *). Add a PreToolUse hook that reads the full command and exits 2 on any force push, reset --hard or --no-verify. Then try each command and show me it being refused.”

The workshop

Name a word, or describe what you mean in everyday language.