Problem
The divergent branches incident (192 local vs 5 remote commits on main) was caused by parallel development without coordination. Two agents/sessions pushed different work to main simultaneously, creating merge conflicts in critical files.
Impact
- Development blocked until manual conflict resolution
- Risk of lost work if resolved incorrectly
- No automated detection of divergence before it becomes severe
Proposed Solution
Short-term (local)
- Configure
pull.rebase = true repo-wide (done in fe4da19)
- Add pre-push hook that warns when >10 commits ahead of remote
- Add pre-push hook that fetches and warns on divergence before push
Medium-term (CI)
- Add branch protection rules requiring PR reviews
- Enforce linear history (no merge commits) via branch protection
- Add GitHub Actions check that validates branch is up-to-date before merge
Long-term (coordination)
- Implement COORDINATION.md lockfile pattern for multi-agent work
- Each agent claims a branch scope before starting work
- Automated alerts when two agents touch the same files
Evidence
- Git log shows 192 local commits diverged from 5 remote commits
- Common ancestor:
93df31dd
- VSCode error:
fatal: Need to specify how to reconcile divergent branches
- 4 files conflicted:
.gitignore, package.json, cmd/backup/chats.go, ci.yml
Acceptance Criteria