Resuming a five-week-old Claude Code session, /rewind still lists its checkpoints but Restore code fails with 'No files were restored' — why, and what does that say about checkpoints?
answer
- the list outlives the files
- where the backups are stored
- a sweep with a default age
- the most recent hundred
- it used to fail silently
basics
~20 sCheckpoints are saved with the conversation, but their file backups are deleted by the retention sweep, by default about 30 days (cleanupPeriodDays) after the session last saved one. Checkpoints are short-lived, local session recovery, not version control.
solid answer
~40 sThe checkpoint list is stored with the conversation, so `/rewind` still shows it after `/resume`. The file backups live separately under `~/.claude/file-history/<session>/` and are removed by the retention sweep governed by `cleanupPeriodDays`, by default about 30 days after the session last saved one, so a five-week-old session has entries with nothing behind them. Since v2.1.260 that restore fails loudly with `No files were restored`; earlier versions skipped missing backups silently and looked successful. Snapshots are also kept for only the 100 most recent checkpoints in a session, and checkpointing can be turned off with `fileCheckpointingEnabled: false` or `CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING`. The fallback is git or asking Claude to reverse the edits; raise `cleanupPeriodDays` for future sessions.
code
json · 3 lines{
"cleanupPeriodDays": 90
}go deeper
Remember that checkpoint backups expire after about 30 days by default and that git, not rewind, is the long-term record.
Explain the split between checkpoint entries in the transcript and backups in file-history, plus the 100-checkpoint window.
Diagnose a failed restore from its message, recover through git, and know the pre-2.1.260 silent-skip behaviour older users may expect.
Weigh longer cleanupPeriodDays against plaintext transcript exposure, and set expectations that checkpoints never stand in for version control.
## Two stores, two lifetimes A Claude Code **checkpoint** has two halves that live in different places: - **The entry in the conversation.** Checkpoints are saved with the session transcript under `~/.claude/projects/`, which is why `/rewind` keeps working after you resume a session. - **The file backups.** The pre-edit snapshots of the files Claude changed live under `~/.claude/file-history/<session>/`. These are what **Restore code** writes back. The rewind menu reads the first half; a code restore needs the second. When the second half is gone, the menu still lists every prompt, and the restore fails. ## Why the backups disappeared Claude Code runs a **retention sweep** in the background after a session starts. It deletes transcripts and other application data older than `cleanupPeriodDays`, whose default is `30` and minimum `1` (`0` fails validation). For file history, the backups go about 30 days after the session last saved one. A session last touched five weeks ago has passed that line, so its backups were deleted while the checkpoint entries survived with the conversation. There are other routes to the same message: - **The 100-checkpoint window.** Claude Code keeps file snapshots for only the 100 most recent checkpoints in a session; discarding an older checkpoint deletes the snapshot files no remaining checkpoint references, except each file's first snapshot. - **A fork whose copy failed.** Forking a session copies the original's backups into the fork; if a copy fails, for example on a full disk, that backup is missing in the fork. - **A file that cannot be written or deleted**, such as one whose permissions block the write. Fixing the permissions and running `/rewind` again helps in this case only. To tell these apart quickly: - If the session is older than your retention period, expect missing backups; the message names `backup missing`. - If the message also says `N paths were skipped for link safety`, some paths were links or otherwise unsafe and were left alone on purpose. - If the session is recent and short, look at file permissions or at whether the session is a fork. ## Why this matters by release | Version | Restore with missing backups | | - | - | | Before 2.1.260 | Skipped the files silently; the rewind appeared to succeed | | 2.1.260 and later (incl. 2.1.286) | Fails with `No files were restored: N files failed (backup missing, or the file could not be updated)` | Someone who learned the tool on an older release may remember rewinds that "worked" and left files unchanged. The loud error is the fix for that, not a new limitation. ## Recovering now, and next time 1. Undo the changes another way: restore the files from version control, or ask Claude to reverse its edits. Running `/rewind` again fails the same way while the backups are gone. 2. For future sessions, raise `cleanupPeriodDays` if you really resume and rewind old sessions; it also keeps transcripts longer, which carries a privacy cost because transcripts are plaintext. 3. Check that nobody disabled snapshots: `fileCheckpointingEnabled` (default `true`, shown in `/config` as **Rewind code (checkpoints)**) and the `CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING` environment variable each turn file snapshots off, and whichever turns them off, the other cannot turn them back on. ## What it says about checkpoints This failure is the clearest illustration of why checkpoints are **not version control**: - They are **local and per-user**, stored in your home directory, never shared with teammates or pushed anywhere. - They are **per-session**, bounded to the 100 most recent checkpoints, and **expire** with the retention sweep. - They capture only the file-editing tools' changes, not shell commands or edits from outside the session. - They carry no commits, branches, messages or review; they cannot explain why a change was made. - A `claude -p` run has no rewind menu, and the setting above is ignored there. Checkpoints are designed for quick, session-level recovery: undoing the last few turns while the work is fresh. Permanent history, collaboration and anything you would need a month later belong in git, alongside the checkpoints rather than replaced by them.
- Your teammate's Claude Code /rewind offers Restore conversation but never Restore code, even after edits. What do you check?Check whether file snapshots are off. `fileCheckpointingEnabled: false` in any settings file, or `CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING=1` in the environment, stops Claude Code snapshotting files, so there are no tracked changes to revert and the code options do not appear. Whichever one disables it, the other cannot re-enable it.
- Does raising cleanupPeriodDays have a downside in Claude Code?Yes. The same setting governs how long session transcripts are kept, and transcripts are plaintext under `~/.claude/projects/`, including anything a tool read or a command printed, such as a credential. Longer retention keeps old checkpoints restorable but widens that exposure.
- If /rewind lists a checkpoint, its files can always be restored
- Checkpoint backups are kept forever with the conversation transcript
- A rewind that reports no error always restored the files
- Checkpoints sync between machines, so a teammate can rewind your session
- Setting cleanupPeriodDays to 0 keeps checkpoint backups forever
Assumes Claude Code 2.1.286; since 2.1.260 a restore with missing backups fails with 'No files were restored' instead of appearing to succeed.