diff --git a/AGENTS.md b/AGENTS.md index dd6d39c0..fbc8bcda 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -142,3 +142,43 @@ The script handles: version bump, CHANGELOG finalization, commit, tag, publish, ## **CRITICAL** Tool Usage Rules **CRITICAL** - NEVER use sed/cat to read a file or a range of a file. Always use the read tool (use offset + limit for ranged reads). - You MUST read every file you modify in full before editing. + +## **CRITICAL** Git Rules for Parallel Agents **CRITICAL** + +Multiple agents may work on different files in the same worktree simultaneously. You MUST follow these rules: + +### Committing +- **ONLY commit files YOU changed in THIS session** +- NEVER use `git add -A` or `git add .` - these sweep up changes from other agents +- ALWAYS use `git add ` listing only files you modified +- Before committing, run `git status` and verify you are only staging YOUR files +- Track which files you created/modified/deleted during the session + +### Forbidden Git Operations +These commands can destroy other agents' work: +- `git reset --hard` - destroys uncommitted changes +- `git checkout .` - destroys uncommitted changes +- `git clean -fd` - deletes untracked files +- `git stash` - stashes ALL changes including other agents' work +- `git add -A` / `git add .` - stages other agents' uncommitted work + +### Safe Workflow +```bash +# 1. Check status first +git status + +# 2. Add ONLY your specific files +git add packages/ai/src/providers/transform-messages.ts +git add packages/ai/CHANGELOG.md + +# 3. Commit +git commit -m "fix(ai): description" + +# 4. Push (pull --rebase if needed, but NEVER reset/checkout) +git pull --rebase && git push +``` + +### If Rebase Conflicts Occur +- Resolve conflicts in YOUR files only +- If conflict is in a file you didn't modify, abort and ask the user +- NEVER force push