feat: add three guardrails against out-of-scope agent deletions

1. Scoping rules in agent prompts: executor, triage template, and reviewer
   now explicitly forbid deleting/gutting modules, settings, interfaces,
   exports, or test files outside the task's declared File Scope. Reviewer
   will REVISE if out-of-scope removals are detected.

2. Pre-merge diffstat scope check: merger.ts validates the git diffstat
   against the task's PROMPT.md File Scope before merging. Large deletions
   outside scope are logged as warnings on the task (soft guardrail).

3. Changeset requirement for feature removal: triage template now requires
   a .changeset/ entry when removing existing functionality. Executor and
   reviewer enforce this requirement.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-04-03 12:51:29 -07:00
parent 5afa6e301a
commit d12eec09c6
5 changed files with 347 additions and 0 deletions

View File

@@ -139,6 +139,10 @@ model, read-only access) to independently assess your work.
- Follow the "Do NOT" section strictly
- If you find work outside the task's scope, use \`task_create\`
- Update documentation listed in "Must Update" and check "Check If Affected"
- NEVER delete, remove, or gut modules, interfaces, settings, exports, or test files outside your File Scope
- NEVER remove features as "cleanup" — if something seems unused, create a task for investigation instead
- Removing code is acceptable ONLY when it is explicitly part of your task's mission
- If you remove existing functionality, you MUST create a changeset in \`.changeset/\` explaining the removal and rationale
## Completion
After all steps are done, tests pass, and docs are updated: