You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When Squad agents (EECOM, CONTROL, etc.) make code changes via the task tool, they frequently include unintended files in their commits — dirty template files, .squad/ state changes, or working-tree artifacts from other branches. This happens because agents use git add . or git commit -a instead of staging specific files.
Evidence from This Session
PR fix(nap): archive undated decisions and add count-based fallback #38 (nap.ts bug fix): EECOM's commit included 8 extra template files (squad.agent.md, casting-reference.md, orchestration-log.md, squad-heartbeat.yml) that were dirty in the working tree but unrelated to the fix. The diff showed 3,365 insertions / 3,166 deletions when the actual change was +199 lines across 2 files.
PR feat(ci): add test count guard to prevent AI agents from deleting tests #41 (test count guard): Same pattern — EECOM committed 13 files when only 5 were deliverables. Template files from the working tree leaked into the commit. Required manual cleanup: git reset --soft HEAD~1, selective re-staging of only the 5 intended files, and recommit.
Add to the standard agent spawn template in squad.agent.md:
## Git Hygiene
- NEVER use `git add .`, `git add -A`, or `git commit -a`
- ALWAYS stage specific files: `git add path/to/file1 path/to/file2`
- Before committing, run `git status` and verify ONLY intended files are staged
- If you see unexpected files in `git status`, do NOT stage them
2. copilot-instructions.md: same rule for @copilot
Problem
When Squad agents (EECOM, CONTROL, etc.) make code changes via the
tasktool, they frequently include unintended files in their commits — dirty template files,.squad/state changes, or working-tree artifacts from other branches. This happens because agents usegit add .orgit commit -ainstead of staging specific files.Evidence from This Session
PR fix(nap): archive undated decisions and add count-based fallback #38 (nap.ts bug fix): EECOM's commit included 8 extra template files (
squad.agent.md,casting-reference.md,orchestration-log.md,squad-heartbeat.yml) that were dirty in the working tree but unrelated to the fix. The diff showed 3,365 insertions / 3,166 deletions when the actual change was +199 lines across 2 files.PR feat(ci): add test count guard to prevent AI agents from deleting tests #41 (test count guard): Same pattern — EECOM committed 13 files when only 5 were deliverables. Template files from the working tree leaked into the commit. Required manual cleanup:
git reset --soft HEAD~1, selective re-staging of only the 5 intended files, and recommit.P0: @copilot accidentally deleted 361 source files on dev (commit 1ab2f5c) bradygaster/squad#631 (@copilot mass deletion): The GitHub @copilot coding agent committed 361 file deletions alongside a 6-file docs fix because it used
git add .on an incomplete working tree. This is the same root cause at extreme scale.Root Cause
Agents default to broad staging commands (
git add .,git add -A,git commit -a) because:git statusbefore committing to verify only intended files are stagedImpact
git reset --soft, re-stage, recommit on every PR this sessionProposed Solutions
1. Agent spawn prompt: explicit staging instructions
Add to the standard agent spawn template in
squad.agent.md:2.
copilot-instructions.md: same rule for @copilotAlready partially addressed in PR #41 (test integrity section). Add explicit git staging rules.
3. Pre-commit hook or CI check
A lightweight check that warns when a commit touches >N files or includes files outside the expected scope. Could be:
.githooks/pre-commit) that warns on >20 staged files4. Agent
git addwrapperTeach agents to use a scoped staging pattern:
Or provide a helper that stages only files matching a pattern:
5. Coordinator post-work validation
After an agent commits, the coordinator should verify:
git diff --stat HEAD~1shows only expected files.squad/state, or build artifacts leaked inIf validation fails, auto-remediate:
git reset --soft HEAD~1, selective re-stage, recommit.Success Criteria
copilot-instructions.mdhas git staging rulesRelated