Permissions, hooks and writing a task for an agent
An instruction in AGENTS.md is a request to the model, not a lock, so prohibitions are enforced through permissions and hooks. Permissions: a command allowlist, least privilege, a sandbox; hooks block an action deterministically. A task for an agent states the goal, constraints, a done criterion and a check command the agent runs itself.
AGENTS.md says "do not run tests against prod", but one day the agent ran them. An instruction is a request to the model, not a lock.
Managing permissions:
- allowlist — a list of allowed commands and tools (run tests, lint), everything else needs confirmation;
- least privilege — the agent gets only what the task needs; tokens with a narrow scope;
- sandbox — an isolated environment where a mistake touches nothing important;
- hooks — scripts the environment runs at defined moments (for example before a command). They work deterministically and can block an action, unlike an instruction the model may fail to follow.
In practice: what must never be violated goes into hooks and permission rules; what is desirable goes into AGENTS.md.
A task brief has four parts: the goal, constraints (what not to touch), a done-when criterion and checks (a command the agent runs itself).
Example. Bad: "improve the login tests". Good: "add a test for a failed login in tests/login.spec.ts; do not change other files; done when npx playwright test login is green 10 times in a row".
Model and context choice: routine tasks with a short structured context go to a faster and cheaper model, hard ones to a stronger one; extra context costs more and distracts.
Common mistakes: "allow everything so it does not ask"; requirements only in instruction text; a task without a done-when criterion.
Short interview answer: "I turn prohibitions into hooks and permissions, and in a task I give the goal, the limits, the done-when criterion and a check command".