← ClaudeAtlas

dev-repo-checkpointslisted

Auto-stash uncommitted work in code repos on every Claude Code Stop/SubagentStop event, so 60+ exchange sessions can't lose work to a branch switch. Stop hook scoped to ~/dev/* repos (vault is covered by its own snapshot script). Recoverable via `git stash list | grep claude-checkpoint`.
adelaidasofia/ai-brain-starter · ★ 18 · AI & Automation · score 81
Install: claude install-skill adelaidasofia/ai-brain-starter
# Dev-Repo Session Checkpoints A Stop/SubagentStop hook that auto-stashes the working tree of any `~/dev/<repo>` you're working in at every Claude Code session end. No manual checkpointing, no git discipline required, no commit pollution. Recovery is one `git stash apply` away. This closes a real failure mode: a 60+ exchange Claude Code session in a code repo, branch switches mid-flow, uncommitted work disappears. The vault has `auto-snapshot.sh` covering that surface, but code repos don't — until this hook. ## Why this exists **The failure mode:** Long Claude Code sessions accumulate uncommitted work — half-finished features, exploratory branches, debugging instrumentation. A branch switch or `git reset --hard` (intentional or auto-triggered by another hook) can wipe that working tree silently. Pre-existing branch-switch-safety hooks catch *unauthorized* switches; this hook catches the broader case where work just isn't saved often enough. **The fix:** every time Claude Code's session ends (Stop event) or a subagent completes (SubagentStop), the hook detects whether the session was working in a `~/dev/<repo>` git repository and, if there are uncommitted changes, stashes them with a `claude-checkpoint:` prefix and a UTC timestamp. The working tree is unchanged — `git stash create` + `git stash store` doesn't modify state. Old checkpoints rotate out at 20 by default (configurable). Stashes accumulate in `git stash list` where any normal recovery path picks them up. **Re