A rule must always apply to agent tool use. What does GitHub offer, instead of custom instructions?
Why D is the answer
A hook, which runs code to approve or deny the tool request
GitHub contrasts them directly: hooks run code rather than asking the model to follow a rule.
In detail
- A hook runs code to approve or deny a tool request.
- Unlike instructions, it can enforce a rule.
- Use instructions for guidance, and hooks for rules.
Use case
An illustrative scenario, not a real incident.
A team must block a dangerous command. A hook runs code that denies the tool request, which an instruction could never guarantee.
See it in different ways
flowchart LR
A["Agent requests a tool"] --> B{"Hook script"}
B -->|"Deny"| C["Tool does not run"]
B -->|"Approve"| D["Tool runs"]mindmap
root((Agent limits))
Identity
Write access to trigger
Repository
One branch
Branch protection
Tools
MCP allow list
Tool permissions
Network
Firewall allowlistsequenceDiagram participant P0 as Agent participant P1 as Hook participant P2 as Tool P0->>P1: Tool request P1->>P2: Approved P1-->>P0: Denied
Key point: Hooks enforce rules on tool use.
Why the other options are wrong
- A. A note in the pull request template for the reviewer to read
- A template only reaches a reviewer.
- B. A request in the prompt asking the agent to take more care
- A request cannot enforce anything.
- C. A longer custom instructions file repeated in each folder
- More instructions are still only guidance.

