--- name: emergency-procedures description: > Recover from repeated failed fixes, tangled git state, or lost task context when ordinary debugging cannot make progress or recovery is requested. scope: global --- # Recovery 1. Stop speculative edits. Inspect status, diffs, branch, HEAD, and the current failure. Re-read the active objective and relevant repository conventions. 2. Preserve work before changing branches or discarding anything. A branch at HEAD preserves commits only. Save tracked staged/unstaged diffs and copy relevant untracked files into an identified recovery location; or use a repository-approved snapshot method that captures those files. Verify the snapshot can recover them. Account for ignored files when relevant; do not accidentally collect credentials. 3. Identify a known-good checkpoint from tests or history. Prefer a separate worktree for investigation so the user's current checkout remains intact. Returning to the previous branch is not evidence that it is healthy. 4. Recover or fix the smallest demonstrated cause. Split work by meaningful behavior, without line-count limits or a new approval gate for the same task. 5. Verify the relevant recovery outcome and report the preserved state and next step. Never bulk-stage user work, clean untracked files, or reset the checkout just to make status clean. Existing authorization governs recovery; ask only if the next step would discard work or change scope without authorization. Follow [shared workflow](../../protocols/workflow.md).