Phase 14: Agent Engineering

Scope Contracts and Task Boundaries

The model does not know where the work ends. A scope contract is a per-task file that says where the work begins, where it ends, and how to roll back if it spills. The contract turns "stay in scope" from a wish into a check. Write a scope contract that an agent reads at task start and a verifier reads at task end. Specify allowed files, forbidden files, acceptance criteria, rollback plan, and approval boundaries. Implement a scope checker that compares a diff against the contract and flags violations. Make scope creep visible, automatic, and reviewable. Agents creep. The task is "fix the login bug." The diff touches the login route, the email helper, the database driver, the README, and the release script. Each touch had a plausible reason in the moment. Together they are a different change than the one that was reviewed. Scope creep is the most under-monitored failure mode in agent work because the agent narrates each step in good faith. The fix is not a stricter prompt. The fix is a contract on disk that says what was promised and a check that compares the result against the promise. A contract without forbiddenfiles is incomplete. The negative space is half the contract. Real repos move files. Pin contracts to globs (app//.py, tests/testsignup.py) so a refactor between…

Scope Contracts and Task Boundaries: The model does not know where the work ends. A scope contract is a per-task file that says where the work begins, where…

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.