---
name: check-branch-before-commit-shared-checkout
description: "BINDING: verify git branch --show-current immediately before EVERY commit on the shared spt-core checkout — merge/gate flows switch it to main under you."
metadata: 
  node_type: memory
  type: feedback
  originSessionId: 75f8fe4c-b308-426d-8625-1f1c21e90a16
---

On the shared spt-core checkout, ALWAYS run `git branch --show-current` in the same command as (immediately before) `git commit`. Never assume the branch you pushed to minutes ago is still checked out.

**Why:** 2026-07-16, REDISPATCH-STALL W1 — between my round-1 push to `build/redispatch-stall-w1` and a follow-up rider commit, doyle's PR #18 merge flow switched this checkout to `main`. The rider (0c70253) landed and PUSHED directly to main, bypassing the gate. Same hazard family as [[no-git-add-a-shared-checkout]]: other agents operate in this working dir.

**How to apply:** chain the check into the commit itself: `test "$(git branch --show-current)" = "<expected>" && git commit ...` — fail loud on mismatch. On a fault: stop, confess to doyle with (a) retro-gate vs (b) revert+re-PR options, and do not touch main until ruled.
