In short.
This Claude Agent SDK guide helps developers add file restore points to coding agents, but recovery covers only eligible tracked local files and leaves the conversation intact. It documents Python and TypeScript options, checkpoint capture, immediate rewinds and recovery after resuming a session. Shell and ordinary subagent edits have restricted coverage, and some paths are deliberately skipped. The examples were not executed; costs, licensing and compatibility with a particular project remain unknown.
Researched and written by an AI model and checked by a second AI model. How it works
Covers the complete documentation page at [https://code.claude.com/docs/en/agent-sdk/file-checkpointing.md], including its implementation examples, CLI instructions, warnings, limitations, troubleshooting and linked next-step notices. The documentation index and all linked pages are excluded. No code or commands were executed. Runtime behavior, project compatibility, restoration reliability, performance, costs and licensing were not independently established.
The overview
Identity
Rewind file changes with checkpointing is a Claude Code documentation guide about the Claude Agent SDK. It teaches a specific recovery feature through Python's claude_agent_sdk package and TypeScript's @anthropic-ai/claude-agent-sdk package.
The original resource is the documentation page at [https://code.claude.com/docs/en/agent-sdk/file-checkpointing.md]. Its scope includes implementation instructions, several checkpoint patterns, an interactive demonstration, limitations and troubleshooting.
Assessment
The guide is useful for developers who want their coding application to restore a known file state after an unwanted edit or validation failure. It explains operational details that matter in an implementation, including identifying valid checkpoints and keeping the connection open when requesting a rewind.
Its suitability depends on how the agent changes files. Projects that rely heavily on shell commands or ordinary subagents need recovery beyond these checkpoints. Restoration reliability, performance and compatibility with a particular project are not established by execution evidence.
Who it helps
The main audience is developers integrating Claude into applications that edit local project files. Beginners get a small utility-file demonstration; experienced developers get API details for streamed messages, session identifiers, multiple restore points and error handling.
Readers need enough Python or TypeScript knowledge to configure an SDK client and process asynchronous responses. The page links to installation guidance but does not provide a complete introduction to SDK installation or authentication.
Capabilities
Checkpointing backs up files changed through Write, Edit and NotebookEdit. Rewinding restores modified files to their checkpoint content and deletes files created after that restore point, subject to the documented path restrictions.
The guide shows how to retain the latest checkpoint, store multiple checkpoints with descriptive metadata, rewind during a response stream, and resume a session later to restore files. Python exposes rewind_files(); TypeScript exposes rewindFiles().
Using it
Requirements
The examples require an installed Claude Agent SDK and local files the agent can edit. Checkpointing must be enabled in the original session and in any resumed session performing a rewind. Restore points remain tied to the session that created them.
Claude Code v2.1.216 or later is required for the documented behavior that skips linked and other unsafe tracked paths. Earlier versions wrote and deleted through links at tracked paths. The page does not specify minimum Python, Node.js or SDK versions, or explain authentication requirements.
Using the separate CLI recovery command requires the claude executable supplied by Claude Code installation.
How it works
The SDK creates backups before covered tools modify files. Each user prompt that starts a turn establishes a checkpoint, identified by that user message's UUID. User messages carrying tool results also have UUIDs, but those identifiers are not checkpoints.
Rewinding to the first prompt's checkpoint restores tracked files to their starting state. Later checkpoints support intermediate recovery, such as retaining a refactor while removing changes from a subsequent prompt.
The operation changes files on disk. Conversation history and context remain intact, so a rewind does not return the entire agent session to an earlier state.
Setup
In Python, set enable_file_checkpointing=True and extra_args={"replay-user-messages": None}. In TypeScript, set enableFileCheckpointing: true and extraArgs: {"replay-user-messages": null}. The replay option exposes the user-message UUIDs needed to identify restore points.
Capture a checkpoint UUID from a prompt-starting user message. Retain the session ID if recovery will happen after the stream finishes. For later recovery, complete the original session, resume it with an empty prompt and checkpointing enabled, then call rewind inside the new response loop. Calling rewind after the original loop ends can produce the documented ProcessTransport connection error.
The examples also use acceptEdits, which approves file edits without prompting. This permission setting is separate from enabling checkpointing. The CLI route uses CLAUDE_CODE_ENABLE_SDK_FILE_CHECKPOINTING=true claude -p --resume <session-id> --rewind-files <checkpoint-uuid>; the page notes that --rewind-files is accepted despite being absent from CLI help.
Example
The interactive demonstration starts with utils.py or utils.ts containing addition, subtraction, multiplication and division functions. A companion script asks Claude to add documentation comments while retaining the first checkpoint UUID and session ID.
After the response finishes, the script asks whether to rewind. Choosing yes resumes the session and requests restoration of the original utility file. This is the behavior described by the documentation; the example was not run.
The separate risky-operation examples contain an undefined application-specific revert condition. Readers must replace that placeholder with their own validation, error detection or user decision.
Assessment & evidence
Limitations
Bash changes and ordinary subagent edits are not independently tracked. A rewind can revert them only in files the main conversation had already edited through a covered tool. Edits from a skill using context: fork while running in the foreground are tracked.
Rewinding skips tracked paths that are symlinks, hard links or other non-regular files. It also skips files whose parent directory no longer resolves to its checkpoint-time location, or whose backup cannot be read safely. The TypeScript RewindFilesResult.skippedLinks field counts every skipped path, including skips unrelated to links.
Checkpoints cannot be transferred between sessions. Directory creation, movement and deletion are not undone, and remote or network files are not tracked. These boundaries prevent file checkpointing from serving as a complete rollback of everything an agent might change.
Practical implications
The documented design supports application-controlled recovery: the application chooses a checkpoint and decides when restoration is needed. Checkpointing itself does not supply validation or determine whether an edit was correct.
Because conversation history survives and some files can be skipped, a successful rewind request alone cannot establish that the whole project matches an earlier state. A developer needs to inspect the restored files and any reported skips before continuing work. This is an implication of the documented limits, rather than a measured result.
Alternatives and complements
The page recommends git for reverting subagent changes outside checkpoint coverage. Version control is therefore a documented complement when edits fall beyond the files tracked by the main conversation.
The Claude Code CLI provides another way to invoke the same session-based rewind. The supplied evidence does not compare other recovery libraries, backup systems or their capabilities.
Evidence
Support comes from the complete documentation page's explanations, Python and TypeScript examples, limitation table and troubleshooting guidance. These establish the documented interface and intended behavior, without demonstrating actual execution outcomes.
No execution logs, independent benchmarks or restoration test results are supplied. Linked installation, permissions, sessions and API reference pages are outside the available evidence.
Access & freshness
Costs
The page gives no prices, billing prerequisites, model usage estimates or example execution costs. The cost of using the SDK and running the demonstrated agent requests is unknown from this evidence.
Checkpointing creates file backups, but the documentation does not quantify their storage requirements, retention or performance overhead.
Rights
The supplied page does not state a license for the documentation or its example code. It also does not establish the SDK's license or applicable service terms.
Permission to redistribute the page or reuse its snippets under particular licensing conditions is unknown. Readers planning redistribution need the applicable rights information separately.
Freshness
The page was captured on 2026-11-23 at 05:03:08.461 UTC. Its captured source revision is sha256:004c69ad606b2e96872840ecf1a1bb63068e55c29a488d351ba2d38fba3ca760.
A publication date, last-update date and current SDK release number are not established. The explicit Claude Code v2.1.216 threshold applies to skipped-path behavior; it does not establish a minimum SDK version for the entire guide.
Suggested next steps
Start with the utility-file demonstration in a disposable local project. Confirm checkpoint UUID capture, recovery after session resumption and the actual file contents after restoration. Replace the risky-operation placeholder with a real validation condition before adapting that pattern.
For a project integration, identify which edits come from covered tools, Bash and subagents. Confirm the installed Claude Code version supports the required path protections, inspect skippedLinks in TypeScript rewind results, and keep version-control recovery available for changes outside checkpoint coverage.
Resolve SDK prerequisites, pricing and applicable licensing terms separately; the page does not provide enough information to settle them.
