CLI tool for listing, inspecting, comparing, resuming, and exporting Claude Code sessions.
# List the 20 most recent sessions
python3 session-manager.py list
# Filter by project
python3 session-manager.py list --project my-app
# Last 7 days, show up to 50
python3 session-manager.py list --days 7 --limit 50Example output:
Recent Sessions
───────────────────────────────────────────────────────────────────────────────────────────────
ID When Duration Cost Msgs ⟳ Project Branch Model
───────────────────────────────────────────────────────────────────────────────────────────────
a1b2c3d4 today 09:15 45m $ 2.31 34 0 my-web-app feature/auth opus-4-6
e5f6a7b8 yesterday 14:20 2h10m $ 12.47 156 1 my-web-app main sonnet-4-6
c9d0e1f2 Mar 04 10:05 18m $ 0.52 12 0 backend-app fix/timeout opus-4-6
13a4b5c6 Mar 03 16:30 5h22m $ 45.80 287 2 my-web-app feature/dashboard opus-4-6
d7e8f9a0 Mar 02 09:00 1h05m $ 8.14 89 0 docs-site main sonnet-4-6
───────────────────────────────────────────────────────────────────────────────────────────────
Total cost: $69.24
python3 session-manager.py show abc12345Shows full metadata for a session including the claude --resume command to continue it.
python3 session-manager.py resume abc12345Launches Claude Code with --resume for the matched session.
python3 session-manager.py diff a1b2c3d4 13a4b5c6Side-by-side comparison of two sessions: model, branch, duration, messages, compactions, and cost. Highlights differences.
Session Comparison
────────────────────────────────────────────────────────────
Session A Session B
────────────────────────────────────────────────────────────
ID a1b2c3d4 13a4b5c6
Project my-web-app my-web-app
Model opus-4-6 opus-4-6
Branch feature/auth feature/dashboard
Date 2026-03-08 2026-03-03
Duration 45m 5h 22m
Messages 34 287
Compactions 0 2
Cost $2.31 $45.80
────────────────────────────────────────────────────────────
Cost difference +$43.49
# Export as readable markdown
python3 session-manager.py export abc12345
# Export as JSON
python3 session-manager.py export abc12345 --json
# Save to file
python3 session-manager.py export abc12345 > session.mdMarkdown export includes all user/assistant messages and tool calls. JSON export includes raw conversation entries.
Compaction boundaries are marked in the export:
---
**⚡ Compaction #1** (2026-03-08 06:48) — manual, 165,703 tokens before
---
Search for ⚡ Compaction to find where Claude compressed the conversation. Everything above the marker was condensed into a summary for the next segment.
All commands accept a session ID prefix — you only need enough characters to uniquely identify the session (typically 6-8).
- Python 3.13+
- No external dependencies
claudeCLI on PATH (forresumecommand)
MIT