Edison SinaniAI implementation architectBook a call

AI Team Playbook / Rule 3 of 12

Prose is advice, hooks are enforcement

Any rule the agent must not break is enforced by a setting or a hook. A sentence in the instruction file is advice, and advice is not enough.

Contents

The playbook

  1. Overview

Before code

  1. 1Write the constitution first
  2. 2One instruction file, under 200 lines
  3. 3Prose is advice, hooks are enforcement
  4. 4Three gates before any code
  5. 5A walkable demo before any screen

Building

  1. 6One task, one worktree, one pull request
  2. 7Every contract has a file and two tests

Reviewing

  1. 8AI review first, and filtered
  2. 9Human review by risk tier
  3. 10Done means the evidence is in the pull request

Over time

  1. 11Measure five numbers from day one
  2. 12Protect the people who are still learning

Appendix

  1. AInstall checklist
  2. BOther tools, limits and sources
  3. CTightening the process
  4. DRun the agent with no entitlements

Get the kit

Who owns it
The lead owns the settings and the hooks. Developers may add permissions locally and may never remove a deny rule.
In the kit
.claude/settings.json.claude/hooks/block-destructive.sh.claude/hooks/lint-on-edit.sh.claude/hooks/stop-gate.sh
Enforced by
By itself. A deny rule wins over any local override. A hook that exits with code 2 blocks the action.

Why

An agent under pressure does what gets the task finished. Told in prose not to force push, it will not, most of the time. Most of the time is not a policy. Anthropic’s own guidance for Claude Code is that the instruction file is advisory and hooks are deterministic [13], and its engineers run agents on remote machines whose outbound network access is limited to an allow list [12].

The same applies to “verify before saying done”. An agent will assert success. A hook that runs the test command and refuses to let the session end while it fails does not need to be trusted.

How

The settings file is committed and shared. It has three permission lists. Allow is what runs without asking: build, test, lint, read-only git. Ask is what a human confirms each time: commit, push, open a pull request, apply a migration. Deny is what never runs: reading .env and key files, force pushes, rm -rf, every deploy command. Settings stack in a fixed order, and a deny anywhere in the stack wins, so a developer can add convenience locally but cannot remove protection. The sandbox setting limits network access to the package registries and the git host.

Three hooks ship in the kit. Each is a small shell script that receives what is about to happen as JSON, and its exit code decides what happens next.

  • block-destructive.sh runs before every shell command and catches the variants the deny list misses: chained commands, sudo, flags in a different order. Exit code 2 blocks the command and the script’s message becomes the agent’s explanation.
  • lint-on-edit.sh runs after every file edit, formats the file, and never blocks. A problem it finds is printed, and the agent fixes it in its next step.
  • stop-gate.sh runs when the agent is about to say it has finished. If the project check fails, the agent keeps working with the failure as its next instruction.
CHECK="${PLAYBOOK_CHECK:-dotnet test --no-restore}"   # the project's real, fast check

out="$(bash -c "$CHECK" 2>&1)"
if [ $? -ne 0 ]; then
  {
    echo "Stop gate: the project check failed. Fix it before finishing."
    echo "$out" | tail -60
  } >&2
  exit 2
fi

Install is two lines: make the scripts executable, and set the check command to the project’s real one. Keep it under a few minutes to run. The full suite belongs in CI.

Identity without privileges.

The settings bound what the agent may run. They do not, by themselves, bound who the agent is. When it runs as the developer, with the developer’s git credentials, cloud logins and files, everything it can reach is everything the developer can reach. The stronger version, which JPMorgan adopted for its engineers in 2026 and Anthropic uses for its own, gives the agent its own scoped identity, keeps it away from secrets and internal systems, and caps what it can spend [20, 12]. Appendix D is the checklist for that.

What this does not do. A developer can edit any of these files locally, or skip the tool altogether. The hooks protect against the agent, not against the developer. What protects against the developer is the pull request, which is rules 8, 9 and 10. A team that wants the rule files themselves locked down follows appendix C.

References

  1. 12Anthropic, "How Anthropic secures its AI-native software development lifecycle", July 2026. claude.com/blog/how-anthropic-secures-its-ai-native-software-development-lifecycle
  2. 13Anthropic, Claude Code documentation, "Best practices for Claude Code". code.claude.com/docs/en/best-practices
  3. 20Business Insider, report on JPMorgan's Claude Code spending limits and its Devspace sandbox, September 2026. A 2,000 dollar monthly cap per engineer, a containerized environment on AWS, and CISO Pat Opet on agents with no entitlements. Paywalled; the figures here are as reported by the outlets that covered it. www.businessinsider.com/jpmorgan-claude-spending-limit-security-engineers-2026-9