Claude-Session-Backup

Git-backed Claude Code session backup with timeline view, folder analysis, deletion detection, and session restore.
The Problem
Claude Code stores session data in ~/.claude/projects/ as JSONL files. These can be silently deleted during upgrades, lossy-compacted via /compact, or lost when session compatibility breaks between versions. Once gone, your conversation history (including debugging sessions, architectural decisions, and code review context) is unrecoverable.
csb preserves every session in your existing ~/.claude git repository, builds a searchable metadata index, detects deletions, and can restore lost sessions from git history.
[!NOTE]
Beta (as of v0.6.0) -- feature-complete and in daily use. Everything on the original roadmap has shipped: backup, deletion detection, content search (JSONL+sesslogs+FTS5), full session restore (a deleted session's complete footprint recovered from git -- transcript, subagents, tool-results, logger sesslogs -- with original timestamps and symlinks, resumable in Claude Code), a viewer launcher (csb view), a human-readable chat-log layer (csb distill), and guided onboarding (csb setup).
Beta means the tool works well for real daily use, not that the interface is frozen. Breaking changes may still happen between versions when the design calls for it. Please file issues for anything rough. And, as with any backup tool, keep a second copy of anything truly irreplaceable.
Quick Start
Five commands install everything -- the CLI, the git store that holds the backups, the Claude Code plugin that fires backups automatically on PreCompact and SessionEnd, and the OS schedule that fires them when Claude Code doesn't run at all:
# 1. Install the csb CLI
pip install claude-session-backup
# 2. Guided setup -- detects/initializes the git backup store, hardens
# .gitattributes, and runs your first backup. (`csb setup --auto` for
# scripts; until setup completes, every csb run reminds you loudly.)
csb setup
# 3. Add the DazzleML marketplace (one-time)
claude plugin marketplace add "DazzleML/Claude-Session-Backup"
# 4. Install the plugin -- registers the PreCompact + SessionEnd hooks
claude plugin install claude-session-backup@dazzle-claude-session-backup
# 5. Schedule a recurring backup -- the hooks above fire only when you
# USE Claude Code; this protects the machine that sits idle while
# Claude Code's cleanup timer runs. Guided (24h default); verifies
# the scheduler works with an immediate prime run.
csb setup schedule
Then verify it works:
# Build the index from existing sessions (no git commits yet)
csb backup --no-commit
# See your session timeline
csb list
# Full backup with git commits (separate noise + user commits, unsigned)
csb backup