Agent Instructions as Executable Constraints
Instructions written as prose are wishes. Instructions written as constraints are tests. The workbench turns each rule into something an agent can check at runtime and a reviewer can verify after the fact. Separate routing prose from operational rules. Express startup rules, forbidden actions, definition of done, uncertainty handling, and approval boundaries as machine-checkable constraints. Implement a rule checker that scores a run against the rule set. Make the rule set diff-friendly so review can see what changed. A typical AGENTS.md reads like onboarding documentation. It tells the agent to "be careful" and "test thoroughly" and "ask if unsure." Three days later, the agent ships a change with no tests, writes to a forbidden directory, and never asks because it never knew where the line was. Instructions are powerful when they are operational and weak when they are aspirational. The fix is to write rules the workbench can interpret and the reviewer can score. Rules belong in docs/agent-rules.md, away from the short root router. Each rule has a name, a category, and a check. A rule that does not fit one of these five usually wants to be two rules. Force the split. Each rule has a slug, a category, a one-line description, and a check field that names a function in rulechecker.py. Adding a rule means adding a check;…
Agent Instructions as Executable Constraints: Instructions written as prose are wishes. Instructions written as constraints are tests. The workbench turns…
This free lesson is part of the AI Engineering from Scratch curriculum. Read the full explanation, run the lesson code, and verify the result in the interactive reader or from the repository source.
Browse the complete course catalog or open this lesson on GitHub.