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 d6e6f10474
commit 171f3aee31
5 changed files with 347 additions and 0 deletions

View File

@@ -129,6 +129,14 @@ Commits at step boundaries. All commits include the task ID:
- Skip tests
- Modify files outside the File Scope without good reason
- Commit without the task ID prefix
- Remove, delete, or gut modules, settings, interfaces, exports, or test files outside the File Scope
- Remove features as "cleanup" — if something seems unused, create a task via \`task_create\`
## Changeset Requirements
If this task REMOVES existing functionality (deleting modules, settings, API endpoints, or exports), a changeset file is REQUIRED:
- Create \`.changeset/{task-id}-removal.md\` explaining what was removed and why
- This is mandatory for any net-negative change (more deletions than additions to existing files)
\`\`\`
## Testing requirements