Self-contained runbook. Also stored at ~/Documents/_Repo-System-Proposal-2026-06-14/AGENT-INSTRUCTIONS-fix-repos.md. Referenced by the repo-hygiene skill. Hand to any coding agent (Claude Code, Codex, etc.). Run on the machine via Desktop Commander/terminal, NOT the Cowork sandbox.
~/Documents/Projects/Repos/sail-*; ~/Documents/Projects/ = repo sail-projects-root (gitignores Repos/*); ~/Documents/ is not a repo. GitHub org samaguiar1982-cpu.origin/main (−9 to −19) because other agents push to origin. Origin is source of truth. Do NOT merge stale local agent branches into stale local main and push blindly.~/Documents/Codex/migration-backup-2026-06-14/ (15 bundles + .git copies of litify/seo/marketing + templates tar; removed collision refs logged in *-removed-refs.txt).The ' 2' collision refs, duplicate ... 2/... 3 folders, and stale index.lock files are the signature of a file-sync service (iCloud/Dropbox/OneDrive) replicating .git across devices, which corrupts repos. Non-negotiables: (1) GitHub origin is the ONLY cross-device channel — never sync .git via file-sync; (2) get the repo tree OUT of any synced path (Step 7); (3) per-device: git fetch + git pull --ff-only at session start, push when done; (4) run the migration on ONE device with others idle and repo-touching scheduled tasks paused.
Repos/ or any non-repo folder; verify git rev-parse --show-toplevel ends in /Repos/<repo> (if it resolves to .../Projects, STOP)..git before mutating: cp -R .git $HOME/Documents/Codex/repo-backups/$(date +%F)/<repo>.git.copy.git fetch first; plain git push (or --force-with-lease, NEVER plain --force). If rejected non-fast-forward, git pull --rebase origin main, resolve, retest, push. Never overwrite origin.*cred*/*redact*/*credential*/*leaked* are SECURITY branches — do not merge/push without Sam's explicit OK.nohup), poll, don't kill early.export GIT_OPTIONAL_LOCKS=0 and pass -c core.fsmonitor=false to checkout/merge.Delete stale *.lock, delete ' 2' collision refs (log first), remove gc.log, kill stray fsmonitor daemons.
Per repo: backup .git; git fetch origin --prune; commit any uncommitted work; count commits not on origin/main; git checkout -B main origin/main (origin wins); cherry-pick only unmerged work; safe-push (fetch again, push, rebase+push if rejected); delete stale parked branch after work is pushed. Do sail-infrastructure, sail-marketing, sail-seo, sail-templates first. Note: sail-infrastructure has a prior local-only merge (3 ahead/9 behind) — reset to origin/main.