Protocol
Set an allowed-file envelope before the agent starts
Review anchoring makes unrelated edits easy to miss when the requested fix looks correct.
When it fits
- A small task produces a surprisingly wide diff.
When to avoid it
- Some legitimate changes reveal new required files during work; the envelope is a review trigger, not a ban on discovery.
Why it matters
Before execution, name the files or directories expected to change and sensitive areas that should not change. Afterward, compare the actual file list with that envelope. Require an explanation and extra review for every unexpected file rather than normalizing 'the agent cleaned things up.'
Steps
- Every changed file is either expected or explicitly justified and reviewed.
An example
A UI copy task that also changes a lockfile and workflow fails the envelope check even if the copy itself is correct.
Check your result
Every changed file is either expected or explicitly justified and reviewed.
Keep this limit in mind
- Some legitimate changes reveal new required files during work; the envelope is a review trigger, not a ban on discovery.
Connected ideas
Useful withReview the file list before reading the agent's explanation
Evidence and sources
Supports
OWASP recommends reviewing every file in an agent-generated change and flagging out-of-scope edits, especially lockfiles, CI configuration, tests and other sensitive files.
Automation can flag suspicious diffs but does not determine intent or correctness.
Secure Coding with AI Cheat Sheet · Out-of-Scope Edits and Review Anchoring