# Recover Chats

> Recover Claude Code chats after a crash across config dirs. Use for 'my vs code crashed', 'find all my open claude chats', 'recover my lost chats', or wanting labeled `claude --resume` commands across ~/.claude (and any additional config dirs).

- Skill: `dylanpulver/recover-chats` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add dylanpulver/recover-chats`
- Raw SKILL.md: https://api.skillmd.com/api/skills/dylanpulver/recover-chats/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: dylanpulver (https://skillmd.com/u/dylanpulver)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/dylanpulver/recover-chats

---


# recover-chats

If you run many parallel Claude Code sessions — possibly across multiple config dirs (`~/.claude`
plus any additional `~/.claude-*` dirs) — a crash loses track of them all. When VS Code or the terminal
crashes, the session IDs are gone from the tab strip but the transcripts survive on disk. This skill
finds the real chats and hands back ready-to-run resume commands, each labeled with its opening
prompt so they're recognizable.

## Run it

```bash
python3 ~/.claude/skills/recover-chats/recover.py
```

Defaults: last 2 days (today + yesterday), chats with >=2 human-typed turns, all config dirs.
Prints a sorted table and writes labeled resume commands to `~/resume-lost-chats.sh`.

Flags:
- `--days N` — look-back window (default 2).
- `--min-turns N` — lower to `1` to include chats typed in only once (a tab opened right before the
  crash with a single message); raises noise. Raise to cut to only substantial chats.
- `--project <substr>` — only sessions whose cwd/project matches (e.g. `--project acme-app`).
- `--out <path>` / `--no-file` — change or skip the output file.

Then tell the user: open `~/resume-lost-chats.sh`, skim the `# label` comments, paste the ones they
want into **separate terminal tabs**. Don't run the file as a script — the lines are interactive
`claude` launches, one per tab. Each line is `cd <real cwd> && CLAUDE_CONFIG_DIR=<dir> claude
--resume <id> --dangerously-skip-permissions`.

## Why it works this way (the two traps)

1. **File mtime is a lie here.** Config-dir files get bulk-touched to the same second (iCloud / Time
   Machine / git checkout), so `find -mtime` reports thousands of "recently modified" files that
   weren't touched by any session. The script uses the `timestamp` field recorded *inside* each
   `.jsonl`, which only advances on real activity.
2. **Most session files aren't chats.** Factories, workflows, and subagents spawn hundreds of
   sessions that live in `projects/` alongside real ones. The script drops them by: skipping
   `wf_*`/`subagents` dirs and `agent-*`/`journal` files, excluding machine-path buckets
   (`private-tmp`, `claude-mem-observer`, `usage-watch`, scratchpad exports), and requiring
   `>=min-turns` genuinely human-typed messages (not tool results, banners, or command wrappers).

## Notes

- Config dirs are auto-discovered: every `~/.claude` and `~/.claude-*` that has a `projects/` dir.
  A new account added later is picked up automatically — no edits needed.
- `cwd` for each command comes from inside the session file, so worktree / non-repo paths are exact.
- Completeness caveat to pass on: a chat with fewer than `--min-turns` human messages is filtered
  out. If a recovered list looks short, rerun with `--min-turns 1`.

