--- name: git_check_state description: "Always check real git state (branch, ahead/behind, log) before git work — Lyra edits repos between sessions" metadata: node_type: memory type: feedback originSessionId: ca09fbe4-9226-4ad9-874f-04df90840eef --- Before starting any git-related work — and again before committing, amending, or resetting — inspect the actual repo state: current branch, `git status -sb` (ahead/behind), and the recent log including `origin/..` and `..origin/`. Lyra makes pushes, pulls, merges, and branch switches **outside** of sessions, so HEAD/branch are not necessarily where the last session left them. **Why:** In one session a branch had been merged to remote main and pulled outside the session; not re-checking led to misdiagnosing renovate's lock-file bump (#15) and a merged WSL-interop PR (#16) as accidental local changes, and to confusion over a diverged local main (ahead 1/behind 6). **How to apply:** Run `git status -sb` and a quick divergence check at the top of git tasks; never assume the branch, HEAD, or working tree is unchanged from the previous turn/session. Reconcile against `origin/` before building on top. Relates to [[git_conventions]] and [[git_network_ops]].