Problem
The implement step's craftsman persona ran git add -A (or equivalent), staging 3280 files — the entire worktree — instead of only the files it modified for the issue. The prompt explicitly says "Do NOT use git add -A or git add . — stage specific files only" but the model ignored this instruction.
Observed with opencode adapter on impl-issue run for #1622. The implement prompt has this constraint but no enforcement.
Impact
- PRs contain entire repo diff instead of targeted changes
test_diff and test_count_baseline contracts can't detect test deletions (baseline is polluted by unrelated files)
- Review quality degrades — 3280-file diff is unreviewable
- Wastes git storage and CI time
Proposal: staged-file scope enforcement
Add a post-implement contract that validates the commit scope:
-
New contract type: commit_scope — after implement step commits, check that the diff contains only files related to the issue. Implementation options:
- Option A (cheap): Check file count threshold (e.g.,
max_files: 50). If exceeded → rework. Catches the git add -A case.
- Option B (smart): Compare committed files against the
impl-plan.json files_to_modify list. Any file not in the plan → warning or rework.
- Option C (hybrid): Threshold check first (Option A), then plan-aware check if threshold passes (Option B).
-
Prompt hardening: Add a stronger constraint in implement.md and fix-implement.md:
CRITICAL: After committing, run `git diff --name-only HEAD~1`. If more than 10 files
appear, you staged too much. Run `git reset HEAD`, re-stage only your changes,
and re-commit.
-
Rework loop integration: commit_scope contract with on_failure: rework feeds into the existing fix-implement step.
Recommended: Option A (threshold) + prompt hardening
Option A is cheap, catches the common case, and doesn't require plan-schema changes. Prompt hardening adds a self-check. Option B/C can be added later if threshold false-positives occur.
# impl-issue.yaml implement step handover:
- type: commit_scope
max_files: 50
on_failure: rework
Files to touch
internal/contract/commit_scope.go — new contract type
internal/contract/registry.go — register commit_scope
internal/defaults/embedfs/pipelines/impl-issue.yaml — add to implement handover
.agents/pipelines/impl-issue.yaml — same
internal/defaults/embedfs/prompts/implement/implement.md — add self-check instruction
Problem
The implement step's craftsman persona ran
git add -A(or equivalent), staging 3280 files — the entire worktree — instead of only the files it modified for the issue. The prompt explicitly says "Do NOT usegit add -Aorgit add .— stage specific files only" but the model ignored this instruction.Observed with opencode adapter on
impl-issuerun for #1622. The implement prompt has this constraint but no enforcement.Impact
test_diffandtest_count_baselinecontracts can't detect test deletions (baseline is polluted by unrelated files)Proposal: staged-file scope enforcement
Add a post-implement contract that validates the commit scope:
New contract type:
commit_scope— after implement step commits, check that the diff contains only files related to the issue. Implementation options:max_files: 50). If exceeded → rework. Catches thegit add -Acase.impl-plan.jsonfiles_to_modifylist. Any file not in the plan → warning or rework.Prompt hardening: Add a stronger constraint in
implement.mdandfix-implement.md:Rework loop integration:
commit_scopecontract withon_failure: reworkfeeds into the existingfix-implementstep.Recommended: Option A (threshold) + prompt hardening
Option A is cheap, catches the common case, and doesn't require plan-schema changes. Prompt hardening adds a self-check. Option B/C can be added later if threshold false-positives occur.
Files to touch
internal/contract/commit_scope.go— new contract typeinternal/contract/registry.go— registercommit_scopeinternal/defaults/embedfs/pipelines/impl-issue.yaml— add to implement handover.agents/pipelines/impl-issue.yaml— sameinternal/defaults/embedfs/prompts/implement/implement.md— add self-check instruction