SpyBara
Go Premium

Documentation 2026-07-01 21:01 UTC to 2026-07-02 23:59 UTC

18 files changed +883 −28. View all changes and history on the product overview
2026
Sat 4 03:01 Fri 3 23:00 Thu 2 23:59 Wed 1 21:01

advisor.md +1 −1

Details

148/advisor off148/advisor off

149```149```

150 150 

151To disable the advisor tool entirely, including the `/advisor` command and the `--advisor` flag, set `CLAUDE_CODE_DISABLE_ADVISOR_TOOL=1`. See [Environment variables](/en/env-vars).151To disable the advisor tool entirely, set `CLAUDE_CODE_DISABLE_ADVISOR_TOOL=1`. The `/advisor` command becomes unavailable and any configured `advisorModel` is ignored. The `--advisor` flag is accepted but has no effect; existing scripts that pass it continue to work without errors. See [Environment variables](/en/env-vars).

152 152 

153## Compare with related features153## Compare with related features

154 154 

Details

85| :----------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |85| :----------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

86| Managed policy settings | Endpoint-managed policy, such as an MDM plist, registry policy, or managed settings file, loads from the host. [Server-managed settings](/en/server-managed-settings) are fetched on an [eligible configuration](/en/server-managed-settings#platform-availability) when the session authenticates with an organization OAuth login or a directly configured API key | Endpoint policy: remove the managed settings file, plist, or registry policy from the host. Server-managed settings: controlled by your org admin; cannot be disabled from the SDK |86| Managed policy settings | Endpoint-managed policy, such as an MDM plist, registry policy, or managed settings file, loads from the host. [Server-managed settings](/en/server-managed-settings) are fetched on an [eligible configuration](/en/server-managed-settings#platform-availability) when the session authenticates with an organization OAuth login or a directly configured API key | Endpoint policy: remove the managed settings file, plist, or registry policy from the host. Server-managed settings: controlled by your org admin; cannot be disabled from the SDK |

87| `~/.claude.json` global config | Always read | Relocate with `CLAUDE_CONFIG_DIR` in `env` |87| `~/.claude.json` global config | Always read | Relocate with `CLAUDE_CONFIG_DIR` in `env` |

88| Auto memory at `~/.claude/projects/<project>/memory/` | Loaded by default into the system prompt | Set `autoMemoryEnabled: false` in settings, or `CLAUDE_CODE_DISABLE_AUTO_MEMORY=1` in `env` |88| Auto memory at `~/.claude/projects/<project>/memory/` | Loaded into the system prompt at session start. The agent writes new memories there with the standard `Write` and `Edit` tools rather than a dedicated memory tool, so those tools must be enabled for the agent to save memories | Set `autoMemoryEnabled: false` in settings, or `CLAUDE_CODE_DISABLE_AUTO_MEMORY=1` in `env` |

89| [claude.ai MCP connectors](/en/mcp#use-mcp-servers-from-claude-ai) | Loaded when the active authentication method is a claude.ai subscription. Passing `mcpServers: {}` does not suppress them | Set `strictMcpConfig: true`, [`disableClaudeAiConnectors: true`](/en/mcp#disable-claude-ai-connectors) in settings, or `ENABLE_CLAUDEAI_MCP_SERVERS=false` in `env` |89| [claude.ai MCP connectors](/en/mcp#use-mcp-servers-from-claude-ai) | Loaded when the active authentication method is a claude.ai subscription. Passing `mcpServers: {}` does not suppress them | Set `strictMcpConfig: true`, [`disableClaudeAiConnectors: true`](/en/mcp#disable-claude-ai-connectors) in settings, or `ENABLE_CLAUDEAI_MCP_SERVERS=false` in `env` |

90 90 

91<Warning>91<Warning>

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

5# Rewind file changes with checkpointing

6 

7> Track file changes during agent sessions and restore files to any previous state

8 

9File checkpointing tracks file modifications made through the Write, Edit, and NotebookEdit tools during an agent session, allowing you to rewind files to any previous state. Want to try it out? Jump to the [interactive example](#try-it-out).

10 

11With checkpointing, you can:

12 

13* **Undo unwanted changes** by restoring files to a known good state

14* **Explore alternatives** by restoring to a checkpoint and trying a different approach

15* **Recover from errors** when the agent makes incorrect modifications

16 

17<Warning>

18 Only changes made through the Write, Edit, and NotebookEdit tools are tracked. Changes made through Bash commands (like `echo > file.txt` or `sed -i`) are not captured by the checkpoint system.

19</Warning>

20 

21## How checkpointing works

22 

23When you enable file checkpointing, the SDK creates backups of files before modifying them through the Write, Edit, or NotebookEdit tools. User messages in the response stream include a checkpoint UUID that you can use as a restore point.

24 

25Checkpoint works with these built-in tools that the agent uses to modify files:

26 

27| Tool | Description |

28| ------------ | ------------------------------------------------------------------ |

29| Write | Creates a new file or overwrites an existing file with new content |

30| Edit | Makes targeted edits to specific parts of an existing file |

31| NotebookEdit | Modifies cells in Jupyter notebooks (`.ipynb` files) |

32 

33<Note>

34 File rewinding restores files on disk to a previous state. It does not rewind the conversation itself. The conversation history and context remain intact after calling `rewindFiles()` (TypeScript) or `rewind_files()` (Python).

35</Note>

36 

37The checkpoint system tracks:

38 

39* Files created during the session

40* Files modified during the session

41* The original content of modified files

42 

43When you rewind to a checkpoint, created files are deleted and modified files are restored to their content at that point.

44 

45## Implement checkpointing

46 

47To use file checkpointing, enable it in your options, capture checkpoint UUIDs from the response stream, then call `rewindFiles()` (TypeScript) or `rewind_files()` (Python) when you need to restore.

48 

49The following example shows the complete flow: enable checkpointing, capture the checkpoint UUID and session ID from the response stream, then resume the session later to rewind files. Each step is explained in detail below. The examples in this section use the prompt "Refactor the authentication module". Run them in a project that contains an authentication module, or change the prompt to name files that exist in your project, so you can watch files change and see the rewind restore them.

50 

51<CodeGroup>

52 ```python Python theme={null}

53 import asyncio

54 from claude_agent_sdk import (

55 ClaudeSDKClient,

56 ClaudeAgentOptions,

57 UserMessage,

58 ResultMessage,

59 )

60 

61 

62 async def main():

63 # Step 1: Enable checkpointing

64 options = ClaudeAgentOptions(

65 enable_file_checkpointing=True,

66 permission_mode="acceptEdits", # Auto-accept file edits without prompting

67 extra_args={

68 "replay-user-messages": None

69 }, # Required to receive checkpoint UUIDs in the response stream

70 )

71 

72 checkpoint_id = None

73 session_id = None

74 

75 # Run the query and capture checkpoint UUID and session ID

76 async with ClaudeSDKClient(options) as client:

77 await client.query("Refactor the authentication module")

78 

79 # Step 2: Capture checkpoint UUID from the first user message

80 async for message in client.receive_response():

81 if isinstance(message, UserMessage) and message.uuid and not checkpoint_id:

82 checkpoint_id = message.uuid

83 if isinstance(message, ResultMessage) and not session_id:

84 session_id = message.session_id

85 

86 # Step 3: Later, rewind by resuming the session with an empty prompt

87 if checkpoint_id and session_id:

88 async with ClaudeSDKClient(

89 ClaudeAgentOptions(enable_file_checkpointing=True, resume=session_id)

90 ) as client:

91 await client.query("") # Empty prompt to open the connection

92 async for message in client.receive_response():

93 await client.rewind_files(checkpoint_id)

94 break

95 print(f"Rewound to checkpoint: {checkpoint_id}")

96 

97 

98 asyncio.run(main())

99 ```

100 

101 ```typescript TypeScript theme={null}

102 import { query } from "@anthropic-ai/claude-agent-sdk";

103 

104 async function main() {

105 // Step 1: Enable checkpointing

106 const opts = {

107 enableFileCheckpointing: true,

108 permissionMode: "acceptEdits" as const, // Auto-accept file edits without prompting

109 extraArgs: { "replay-user-messages": null } // Required to receive checkpoint UUIDs in the response stream

110 };

111 

112 const response = query({

113 prompt: "Refactor the authentication module",

114 options: opts

115 });

116 

117 let checkpointId: string | undefined;

118 let sessionId: string | undefined;

119 

120 // Step 2: Capture checkpoint UUID from the first user message

121 for await (const message of response) {

122 if (message.type === "user" && message.uuid && !checkpointId) {

123 checkpointId = message.uuid;

124 }

125 if ("session_id" in message && !sessionId) {

126 sessionId = message.session_id;

127 }

128 }

129 

130 // Step 3: Later, rewind by resuming the session with an empty prompt

131 if (checkpointId && sessionId) {

132 const rewindQuery = query({

133 prompt: "", // Empty prompt to open the connection

134 options: { ...opts, resume: sessionId }

135 });

136 

137 for await (const msg of rewindQuery) {

138 await rewindQuery.rewindFiles(checkpointId);

139 break;

140 }

141 console.log(`Rewound to checkpoint: ${checkpointId}`);

142 }

143 }

144 

145 main();

146 ```

147</CodeGroup>

148 

149<Steps>

150 <Step title="Enable checkpointing">

151 Configure your SDK options to enable checkpointing and receive checkpoint UUIDs:

152 

153 | Option | Python | TypeScript | Description |

154 | ------------------------ | ------------------------------------------- | --------------------------------------------- | ------------------------------------------------ |

155 | Enable checkpointing | `enable_file_checkpointing=True` | `enableFileCheckpointing: true` | Tracks file changes for rewinding |

156 | Receive checkpoint UUIDs | `extra_args={"replay-user-messages": None}` | `extraArgs: { 'replay-user-messages': null }` | Required to get user message UUIDs in the stream |

157 

158 <CodeGroup>

159 ```python Python theme={null}

160 options = ClaudeAgentOptions(

161 enable_file_checkpointing=True,

162 permission_mode="acceptEdits",

163 extra_args={"replay-user-messages": None},

164 )

165 

166 async with ClaudeSDKClient(options) as client:

167 await client.query("Refactor the authentication module")

168 ```

169 

170 ```typescript TypeScript theme={null}

171 const response = query({

172 prompt: "Refactor the authentication module",

173 options: {

174 enableFileCheckpointing: true,

175 permissionMode: "acceptEdits" as const,

176 extraArgs: { "replay-user-messages": null }

177 }

178 });

179 ```

180 </CodeGroup>

181 </Step>

182 

183 <Step title="Capture checkpoint UUID and session ID">

184 With the `replay-user-messages` option set (shown above), each user message in the response stream has a UUID that serves as a checkpoint.

185 

186 For most use cases, capture the first user message UUID (`message.uuid`); rewinding to it restores all files to their original state. To store multiple checkpoints and rewind to intermediate states, see [Multiple restore points](#multiple-restore-points).

187 

188 Capturing the session ID (`message.session_id`) is optional; you only need it if you want to rewind later, after the stream completes. If you're calling `rewindFiles()` immediately while still processing messages (as the example in [Checkpoint before risky operations](#checkpoint-before-risky-operations) does), you can skip capturing the session ID.

189 

190 <CodeGroup>

191 ```python Python theme={null}

192 checkpoint_id = None

193 session_id = None

194 

195 async for message in client.receive_response():

196 # Update checkpoint on each user message (keeps the latest)

197 if isinstance(message, UserMessage) and message.uuid:

198 checkpoint_id = message.uuid

199 # Capture session ID from the result message

200 if isinstance(message, ResultMessage):

201 session_id = message.session_id

202 ```

203 

204 ```typescript TypeScript theme={null}

205 let checkpointId: string | undefined;

206 let sessionId: string | undefined;

207 

208 for await (const message of response) {

209 // Update checkpoint on each user message (keeps the latest)

210 if (message.type === "user" && message.uuid) {

211 checkpointId = message.uuid;

212 }

213 // Capture session ID from any message that has it

214 if ("session_id" in message) {

215 sessionId = message.session_id;

216 }

217 }

218 ```

219 </CodeGroup>

220 </Step>

221 

222 <Step title="Rewind files">

223 To rewind after the stream completes, resume the session with an empty prompt and call `rewind_files()` (Python) or `rewindFiles()` (TypeScript) with your checkpoint UUID. You can also rewind during the stream; see [Checkpoint before risky operations](#checkpoint-before-risky-operations) for that pattern.

224 

225 <CodeGroup>

226 ```python Python theme={null}

227 async with ClaudeSDKClient(

228 ClaudeAgentOptions(enable_file_checkpointing=True, resume=session_id)

229 ) as client:

230 await client.query("") # Empty prompt to open the connection

231 async for message in client.receive_response():

232 await client.rewind_files(checkpoint_id)

233 break

234 ```

235 

236 ```typescript TypeScript theme={null}

237 const rewindQuery = query({

238 prompt: "", // Empty prompt to open the connection

239 options: { ...opts, resume: sessionId }

240 });

241 

242 for await (const msg of rewindQuery) {

243 await rewindQuery.rewindFiles(checkpointId);

244 break;

245 }

246 ```

247 </CodeGroup>

248 

249 If you capture the session ID and checkpoint ID, you can also rewind from the CLI. This command requires the `claude` executable, which comes from [installing Claude Code](/en/setup) and is not installed by the SDK package:

250 

251 ```bash theme={null}

252 claude -p --resume <session-id> --rewind-files <checkpoint-uuid>

253 ```

254 </Step>

255</Steps>

256 

257## Common patterns

258 

259These patterns show different ways to capture and use checkpoint UUIDs depending on your use case.

260 

261### Checkpoint before risky operations

262 

263This pattern keeps only the most recent checkpoint UUID, updating it before each agent turn. If something goes wrong during processing, you can immediately rewind to the last safe state and break out of the loop.

264 

265<CodeGroup>

266 ```python Python theme={null}

267 import asyncio

268 from claude_agent_sdk import ClaudeSDKClient, ClaudeAgentOptions, UserMessage

269 

270 

271 async def main():

272 options = ClaudeAgentOptions(

273 enable_file_checkpointing=True,

274 permission_mode="acceptEdits",

275 extra_args={"replay-user-messages": None},

276 )

277 

278 safe_checkpoint = None

279 

280 async with ClaudeSDKClient(options) as client:

281 await client.query("Refactor the authentication module")

282 

283 async for message in client.receive_response():

284 # Update checkpoint before each agent turn starts

285 # This overwrites the previous checkpoint. Only keep the latest

286 if isinstance(message, UserMessage) and message.uuid:

287 safe_checkpoint = message.uuid

288 

289 # Decide when to revert based on your own logic

290 # For example: error detection, validation failure, or user input

291 if your_revert_condition and safe_checkpoint:

292 await client.rewind_files(safe_checkpoint)

293 # Exit the loop after rewinding, files are restored

294 break

295 

296 

297 asyncio.run(main())

298 ```

299 

300 ```typescript TypeScript theme={null}

301 import { query } from "@anthropic-ai/claude-agent-sdk";

302 

303 async function main() {

304 const response = query({

305 prompt: "Refactor the authentication module",

306 options: {

307 enableFileCheckpointing: true,

308 permissionMode: "acceptEdits" as const,

309 extraArgs: { "replay-user-messages": null }

310 }

311 });

312 

313 let safeCheckpoint: string | undefined;

314 

315 for await (const message of response) {

316 // Update checkpoint before each agent turn starts

317 // This overwrites the previous checkpoint. Only keep the latest

318 if (message.type === "user" && message.uuid) {

319 safeCheckpoint = message.uuid;

320 }

321 

322 // Decide when to revert based on your own logic

323 // For example: error detection, validation failure, or user input

324 if (yourRevertCondition && safeCheckpoint) {

325 await response.rewindFiles(safeCheckpoint);

326 // Exit the loop after rewinding, files are restored

327 break;

328 }

329 }

330 }

331 

332 main();

333 ```

334</CodeGroup>

335 

336### Multiple restore points

337 

338If Claude makes changes across multiple turns, you might want to rewind to a specific point rather than all the way back. For example, if Claude refactors a file in turn one and adds tests in turn two, you might want to keep the refactor but undo the tests.

339 

340This pattern stores all checkpoint UUIDs in an array with metadata. After the session completes, you can rewind to any previous checkpoint:

341 

342<CodeGroup>

343 ```python Python theme={null}

344 import asyncio

345 from dataclasses import dataclass

346 from datetime import datetime

347 from claude_agent_sdk import (

348 ClaudeSDKClient,

349 ClaudeAgentOptions,

350 UserMessage,

351 ResultMessage,

352 )

353 

354 

355 # Store checkpoint metadata for better tracking

356 @dataclass

357 class Checkpoint:

358 id: str

359 description: str

360 timestamp: datetime

361 

362 

363 async def main():

364 options = ClaudeAgentOptions(

365 enable_file_checkpointing=True,

366 permission_mode="acceptEdits",

367 extra_args={"replay-user-messages": None},

368 )

369 

370 checkpoints = []

371 session_id = None

372 

373 async with ClaudeSDKClient(options) as client:

374 await client.query("Refactor the authentication module")

375 

376 async for message in client.receive_response():

377 if isinstance(message, UserMessage) and message.uuid:

378 checkpoints.append(

379 Checkpoint(

380 id=message.uuid,

381 description=f"After turn {len(checkpoints) + 1}",

382 timestamp=datetime.now(),

383 )

384 )

385 if isinstance(message, ResultMessage) and not session_id:

386 session_id = message.session_id

387 

388 # Later: rewind to any checkpoint by resuming the session

389 if checkpoints and session_id:

390 target = checkpoints[0] # Pick any checkpoint

391 async with ClaudeSDKClient(

392 ClaudeAgentOptions(enable_file_checkpointing=True, resume=session_id)

393 ) as client:

394 await client.query("") # Empty prompt to open the connection

395 async for message in client.receive_response():

396 await client.rewind_files(target.id)

397 break

398 print(f"Rewound to: {target.description}")

399 

400 

401 asyncio.run(main())

402 ```

403 

404 ```typescript TypeScript theme={null}

405 import { query } from "@anthropic-ai/claude-agent-sdk";

406 

407 // Store checkpoint metadata for better tracking

408 interface Checkpoint {

409 id: string;

410 description: string;

411 timestamp: Date;

412 }

413 

414 async function main() {

415 const opts = {

416 enableFileCheckpointing: true,

417 permissionMode: "acceptEdits" as const,

418 extraArgs: { "replay-user-messages": null }

419 };

420 

421 const response = query({

422 prompt: "Refactor the authentication module",

423 options: opts

424 });

425 

426 const checkpoints: Checkpoint[] = [];

427 let sessionId: string | undefined;

428 

429 for await (const message of response) {

430 if (message.type === "user" && message.uuid) {

431 checkpoints.push({

432 id: message.uuid,

433 description: `After turn ${checkpoints.length + 1}`,

434 timestamp: new Date()

435 });

436 }

437 if ("session_id" in message && !sessionId) {

438 sessionId = message.session_id;

439 }

440 }

441 

442 // Later: rewind to any checkpoint by resuming the session

443 if (checkpoints.length > 0 && sessionId) {

444 const target = checkpoints[0]; // Pick any checkpoint

445 const rewindQuery = query({

446 prompt: "", // Empty prompt to open the connection

447 options: { ...opts, resume: sessionId }

448 });

449 

450 for await (const msg of rewindQuery) {

451 await rewindQuery.rewindFiles(target.id);

452 break;

453 }

454 console.log(`Rewound to: ${target.description}`);

455 }

456 }

457 

458 main();

459 ```

460</CodeGroup>

461 

462## Try it out

463 

464This complete example creates a small utility file, has the agent add documentation comments, shows you the changes, then asks if you want to rewind.

465 

466Before you begin, make sure you have the [Claude Agent SDK installed](/en/agent-sdk/quickstart).

467 

468<Steps>

469 <Step title="Create a test file">

470 Create a new file called `utils.py` (Python) or `utils.ts` (TypeScript) and paste the following code:

471 

472 <CodeGroup>

473 ```python utils.py theme={null}

474 def add(a, b):

475 return a + b

476 

477 

478 def subtract(a, b):

479 return a - b

480 

481 

482 def multiply(a, b):

483 return a * b

484 

485 

486 def divide(a, b):

487 if b == 0:

488 raise ValueError("Cannot divide by zero")

489 return a / b

490 ```

491 

492 ```typescript utils.ts theme={null}

493 export function add(a: number, b: number): number {

494 return a + b;

495 }

496 

497 export function subtract(a: number, b: number): number {

498 return a - b;

499 }

500 

501 export function multiply(a: number, b: number): number {

502 return a * b;

503 }

504 

505 export function divide(a: number, b: number): number {

506 if (b === 0) {

507 throw new Error("Cannot divide by zero");

508 }

509 return a / b;

510 }

511 ```

512 </CodeGroup>

513 </Step>

514 

515 <Step title="Run the interactive example">

516 Create a new file called `try_checkpointing.py` (Python) or `try_checkpointing.ts` (TypeScript) in the same directory as your utility file, and paste the following code.

517 

518 This script asks Claude to add doc comments to your utility file, then gives you the option to rewind and restore the original.

519 

520 <CodeGroup>

521 ```python try_checkpointing.py theme={null}

522 import asyncio

523 from claude_agent_sdk import (

524 ClaudeSDKClient,

525 ClaudeAgentOptions,

526 UserMessage,

527 ResultMessage,

528 )

529 

530 

531 async def main():

532 # Configure the SDK with checkpointing enabled

533 # - enable_file_checkpointing: Track file changes for rewinding

534 # - permission_mode: Auto-accept file edits without prompting

535 # - extra_args: Required to receive user message UUIDs in the stream

536 options = ClaudeAgentOptions(

537 enable_file_checkpointing=True,

538 permission_mode="acceptEdits",

539 extra_args={"replay-user-messages": None},

540 )

541 

542 checkpoint_id = None # Store the user message UUID for rewinding

543 session_id = None # Store the session ID for resuming

544 

545 print("Running agent to add doc comments to utils.py...\n")

546 

547 # Run the agent and capture checkpoint data from the response stream

548 async with ClaudeSDKClient(options) as client:

549 await client.query("Add doc comments to utils.py")

550 

551 async for message in client.receive_response():

552 # Capture the first user message UUID - this is our restore point

553 if isinstance(message, UserMessage) and message.uuid and not checkpoint_id:

554 checkpoint_id = message.uuid

555 # Capture the session ID so we can resume later

556 if isinstance(message, ResultMessage):

557 session_id = message.session_id

558 

559 print("Done! Open utils.py to see the added doc comments.\n")

560 

561 # Ask the user if they want to rewind the changes

562 if checkpoint_id and session_id:

563 response = input("Rewind to remove the doc comments? (y/n): ")

564 

565 if response.lower() == "y":

566 # Resume the session with an empty prompt, then rewind

567 async with ClaudeSDKClient(

568 ClaudeAgentOptions(enable_file_checkpointing=True, resume=session_id)

569 ) as client:

570 await client.query("") # Empty prompt opens the connection

571 async for message in client.receive_response():

572 await client.rewind_files(checkpoint_id) # Restore files

573 break

574 

575 print(

576 "\n✓ File restored! Open utils.py to verify the doc comments are gone."

577 )

578 else:

579 print("\nKept the modified file.")

580 

581 

582 asyncio.run(main())

583 ```

584 

585 ```typescript try_checkpointing.ts theme={null}

586 import { query } from "@anthropic-ai/claude-agent-sdk";

587 import * as readline from "readline";

588 

589 async function main() {

590 // Configure the SDK with checkpointing enabled

591 // - enableFileCheckpointing: Track file changes for rewinding

592 // - permissionMode: Auto-accept file edits without prompting

593 // - extraArgs: Required to receive user message UUIDs in the stream

594 const opts = {

595 enableFileCheckpointing: true,

596 permissionMode: "acceptEdits" as const,

597 extraArgs: { "replay-user-messages": null }

598 };

599 

600 let sessionId: string | undefined; // Store the session ID for resuming

601 let checkpointId: string | undefined; // Store the user message UUID for rewinding

602 

603 console.log("Running agent to add doc comments to utils.ts...\n");

604 

605 // Run the agent and capture checkpoint data from the response stream

606 const response = query({

607 prompt: "Add doc comments to utils.ts",

608 options: opts

609 });

610 

611 for await (const message of response) {

612 // Capture the first user message UUID - this is our restore point

613 if (message.type === "user" && message.uuid && !checkpointId) {

614 checkpointId = message.uuid;

615 }

616 // Capture the session ID so we can resume later

617 if ("session_id" in message) {

618 sessionId = message.session_id;

619 }

620 }

621 

622 console.log("Done! Open utils.ts to see the added doc comments.\n");

623 

624 // Ask the user if they want to rewind the changes

625 if (checkpointId && sessionId) {

626 const rl = readline.createInterface({

627 input: process.stdin,

628 output: process.stdout

629 });

630 

631 const answer = await new Promise<string>((resolve) => {

632 rl.question("Rewind to remove the doc comments? (y/n): ", resolve);

633 });

634 rl.close();

635 

636 if (answer.toLowerCase() === "y") {

637 // Resume the session with an empty prompt, then rewind

638 const rewindQuery = query({

639 prompt: "", // Empty prompt opens the connection

640 options: { ...opts, resume: sessionId }

641 });

642 

643 for await (const msg of rewindQuery) {

644 await rewindQuery.rewindFiles(checkpointId); // Restore files

645 break;

646 }

647 

648 console.log("\n✓ File restored! Open utils.ts to verify the doc comments are gone.");

649 } else {

650 console.log("\nKept the modified file.");

651 }

652 }

653 }

654 

655 main();

656 ```

657 </CodeGroup>

658 

659 This example demonstrates the complete checkpointing workflow:

660 

661 1. **Enable checkpointing**: configure the SDK with `enable_file_checkpointing=True` and `permission_mode="acceptEdits"` to auto-approve file edits

662 2. **Capture checkpoint data**: as the agent runs, store the first user message UUID (your restore point) and the session ID

663 3. **Prompt for rewind**: after the agent finishes, check your utility file to see the doc comments, then decide if you want to undo the changes

664 4. **Resume and rewind**: if yes, resume the session with an empty prompt and call `rewind_files()` to restore the original file

665 </Step>

666 

667 <Step title="Run the example">

668 Run the script from the same directory as your utility file.

669 

670 <Tip>

671 Open your utility file (`utils.py` or `utils.ts`) in your IDE or editor before running the script. You'll see the file update in real-time as the agent adds doc comments, then revert back to the original when you choose to rewind.

672 </Tip>

673 

674 <Tabs>

675 <Tab title="Python">

676 ```bash theme={null}

677 python try_checkpointing.py

678 ```

679 </Tab>

680 

681 <Tab title="TypeScript">

682 ```bash theme={null}

683 npx tsx try_checkpointing.ts

684 ```

685 </Tab>

686 </Tabs>

687 

688 You'll see the agent add doc comments, then a prompt asking if you want to rewind. If you choose yes, the file is restored to its original state.

689 </Step>

690</Steps>

691 

692## Limitations

693 

694File checkpointing has the following limitations:

695 

696| Limitation | Description |

697| ---------------------------------- | -------------------------------------------------------------------- |

698| Write/Edit/NotebookEdit tools only | Changes made through Bash commands are not tracked |

699| Same session | Checkpoints are tied to the session that created them |

700| File content only | Creating, moving, or deleting directories is not undone by rewinding |

701| Local files | Remote or network files are not tracked |

702 

703## Troubleshooting

704 

705### Checkpointing options not recognized

706 

707If `enableFileCheckpointing` or `rewindFiles()` isn't available, you may be on an older SDK version.

708 

709**Solution**: Update to the latest SDK version:

710 

711* **Python**: `pip install --upgrade claude-agent-sdk`

712* **TypeScript**: `npm install @anthropic-ai/claude-agent-sdk@latest`

713 

714### User messages don't have UUIDs

715 

716If `message.uuid` is `undefined` or missing, you're not receiving checkpoint UUIDs.

717 

718**Cause**: The `replay-user-messages` option isn't set.

719 

720**Solution**: Add `extra_args={"replay-user-messages": None}` (Python) or `extraArgs: { 'replay-user-messages': null }` (TypeScript) to your options.

721 

722### "No file checkpoint found for message" error

723 

724This error occurs when the checkpoint data doesn't exist for the specified user message UUID.

725 

726**Common causes**:

727 

728* File checkpointing was not enabled on the original session (`enable_file_checkpointing` or `enableFileCheckpointing` was not set to `true`)

729* The session wasn't properly completed before attempting to resume and rewind

730 

731**Solution**: Ensure `enable_file_checkpointing=True` (Python) or `enableFileCheckpointing: true` (TypeScript) was set on the original session, then use the pattern shown in the examples: capture the first user message UUID, complete the session fully, then resume with an empty prompt and call `rewindFiles()` once.

732 

733### "ProcessTransport is not ready for writing" error

734 

735This error occurs when you call `rewindFiles()` or `rewind_files()` after you've finished iterating through the response. The connection to the CLI process closes when the loop completes.

736 

737**Solution**: Resume the session with an empty prompt, then call rewind on the new query:

738 

739<CodeGroup>

740 ```python Python theme={null}

741 # Resume session with empty prompt, then rewind

742 async with ClaudeSDKClient(

743 ClaudeAgentOptions(enable_file_checkpointing=True, resume=session_id)

744 ) as client:

745 await client.query("")

746 async for message in client.receive_response():

747 await client.rewind_files(checkpoint_id)

748 break

749 ```

750 

751 ```typescript TypeScript theme={null}

752 // Resume session with empty prompt, then rewind

753 const rewindQuery = query({

754 prompt: "",

755 options: { ...opts, resume: sessionId }

756 });

757 

758 for await (const msg of rewindQuery) {

759 await rewindQuery.rewindFiles(checkpointId);

760 break;

761 }

762 ```

763</CodeGroup>

764 

765## Next steps

766 

767* **[Sessions](/en/agent-sdk/sessions)**: learn how to resume sessions, which is required for rewinding after the stream completes. Covers session IDs, resuming conversations, and session forking.

768* **[Permissions](/en/agent-sdk/permissions)**: configure which tools Claude can use and how file modifications are approved. Useful if you want more control over when edits happen.

769* **[TypeScript SDK reference](/en/agent-sdk/typescript)**: complete API reference including all options for `query()` and the `rewindFiles()` method.

770* **[Python SDK reference](/en/agent-sdk/python)**: complete API reference including all options for `ClaudeAgentOptions` and the `rewind_files()` method.

Details

32 32 

33## Examples33## Examples

34 34 

35Before running these examples, install the Claude Agent SDK by following the [quickstart](/en/agent-sdk/quickstart).

36 

35### Monitoring Todo Changes37### Monitoring Todo Changes

36 38 

37<CodeGroup>39<CodeGroup>

agent-view.md +2 −2

Details

62 </Step>62 </Step>

63 63 

64 <Step title="Bring an existing session in">64 <Step title="Bring an existing session in">

65 To move a session you already have open into agent view, run `/bg` inside it, or press `←` on an empty prompt to background it and open agent view in one step. The session keeps running and appears as a row alongside the ones you dispatched.65 This step needs a running session. If you followed the earlier steps you don't have one open in this terminal, so open a regular `claude` session in another terminal and send it a message first. To move a session you already have open into agent view, run `/bg` inside it, or press `←` on an empty prompt to background it and open agent view in one step. The session keeps running and appears as a row alongside the ones you dispatched.

66 </Step>66 </Step>

67</Steps>67</Steps>

68 68 


324claude --bg --name "flaky-test-fix" "investigate the flaky SettingsChangeDetector test"324claude --bg --name "flaky-test-fix" "investigate the flaky SettingsChangeDetector test"

325```325```

326 326 

327After backgrounding, Claude prints the session's short ID and the commands for managing it. When you pass `--name`, the name appears after the short ID:327After backgrounding, Claude prints the session's short ID and the commands for managing it. When the service that hosts background sessions isn't already running, `--bg` may first print `Starting background service…` above this output. When you pass `--name`, the name appears after the short ID:

328 328 

329```text theme={null}329```text theme={null}

330backgrounded · 7c5dcf5d · flaky-test-fix330backgrounded · 7c5dcf5d · flaky-test-fix

artifacts.md +7 −7

Details

4 4 

5# Share session output as artifacts5# Share session output as artifacts

6 6 

7> Artifacts turn Claude Code's work into live, interactive pages at a private URL you can share inside your organization.7> Artifacts turn Claude Code's work into live, interactive pages at a private URL on claude.ai.

8 8 

9{/* plan-availability: feature=artifacts plans=team,enterprise providers=anthropic */}9{/* plan-availability: feature=artifacts plans=pro,max,team,enterprise providers=anthropic */}

10 10 

11<Note>11<Note>

12 Artifacts are in beta. They require a Team or Enterprise plan and a session signed in with [`/login`](/en/setup#authenticate). See [Availability](#availability) for the full set of requirements.12 Artifacts are available on Pro, Max, Team, and Enterprise plans and require a session signed in with [`/login`](/en/setup#authenticate). See [Availability](#availability) for the full set of requirements.

13</Note>13</Note>

14 14 

15An artifact is a live, interactive web page that Claude Code publishes from your session to a private URL on claude.ai. You open it in a browser, and it updates in place as the session continues. Share it from the page header when you want a teammate to see it too. For example, use an artifact to walk a reviewer through a pull request with annotated diffs, build a dashboard from session data, or keep an investigation timeline that fills in as Claude works.15An artifact is a live, interactive web page that Claude Code publishes from your session to a private URL on claude.ai. You open it in a browser, and it updates in place as the session continues. On Team and Enterprise plans, share it from the page header when you want a teammate to see it too. For example, use an artifact to walk a reviewer through a pull request with annotated diffs, build a dashboard from session data, or keep an investigation timeline that fills in as Claude works.

16 16 

17<Frame>17<Frame>

18 <img src="https://mintcdn.com/claude-code/kaHIYYMIYMYPxQg9/images/artifacts-viewer.png?fit=max&auto=format&n=kaHIYYMIYMYPxQg9&q=85&s=dbfd671cdb0d15f49f808b9e89778fe1" alt="An artifact open in a browser at claude.ai/code/artifact. The viewer header shows the artifact title acme-funnel-fix, a Share button, and the author avatar. The Share menu is open with the Always share latest version toggle, a version picker reading Sharing version 2, an Everyone at Acme audience selector, and a Copy link button. Below the header, the artifact page shows two mobile mockups side by side, a funnel chart, and a row of metric cards." width="2511" height="1890" data-path="images/artifacts-viewer.png" />18 <img src="https://mintcdn.com/claude-code/kaHIYYMIYMYPxQg9/images/artifacts-viewer.png?fit=max&auto=format&n=kaHIYYMIYMYPxQg9&q=85&s=dbfd671cdb0d15f49f808b9e89778fe1" alt="An artifact open in a browser at claude.ai/code/artifact. The viewer header shows the artifact title acme-funnel-fix, a Share button, and the author avatar. The Share menu is open with the Always share latest version toggle, a version picker reading Sharing version 2, an Everyone at Acme audience selector, and a Copy link button. Below the header, the artifact page shows two mobile mockups side by side, a funnel chart, and a row of metric cards." width="2511" height="1890" data-path="images/artifacts-viewer.png" />


74 74 

75## Share an artifact75## Share an artifact

76 76 

77A new artifact is visible only to you. Open it in your browser and use the **Share** control in the page header to grant access to specific people in your organization, or to everyone in it. The header names you as the artifact's author, so anyone you share it with can see who published the page. It also links to your gallery at [claude.ai/code/artifacts](https://claude.ai/code/artifacts), which lists every artifact you have created.77A new artifact is visible only to you. On Pro and Max plans, artifacts stay private to you. On Team and Enterprise plans, open the artifact in your browser and use the **Share** control in the page header to grant access to specific people in your organization, or to everyone in it. The header names you as the artifact's author, so anyone you share it with can see who published the page. It also links to your gallery at [claude.ai/code/artifacts](https://claude.ai/code/artifacts), which lists every artifact you have created.

78 78 

79Sharing stops at your organization. Viewers must sign in to claude.ai as a member of the same organization that published the artifact, and there is no option to make an artifact viewable outside it. To send the underlying content to someone outside your organization, ask Claude for the HTML file and share that file directly.79Sharing stops at your organization. Viewers must sign in to claude.ai as a member of the same organization that published the artifact, and there is no option to make an artifact viewable outside it. To send the underlying content to someone outside your organization, ask Claude for the HTML file and share that file directly.

80 80 


161Artifacts require every condition below. When one is not met, Claude writes a local HTML file or says it cannot publish instead.161Artifacts require every condition below. When one is not met, Claude writes a local HTML file or says it cannot publish instead.

162 162 

163| Requirement | Available when |163| Requirement | Available when |

164| :------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |164| :------------------ | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

165| Plan | Team or Enterprise. On Team plans, artifacts are on by default. On Enterprise plans, an Owner [enables them](#manage-artifacts-for-your-organization) in claude.ai admin settings. |165| Plan | Pro, Max, Team, or Enterprise. On Pro and Max plans, artifacts are private to you, and no admin management applies. On Team plans, artifacts are on by default. On Enterprise plans, an Owner [enables them](#manage-artifacts-for-your-organization) in claude.ai admin settings. |

166| Authentication | Signed in to claude.ai with `/login`. Sessions using an API key, [gateway token](/en/llm-gateway), or cloud-provider credential cannot publish. |166| Authentication | Signed in to claude.ai with `/login`. Sessions using an API key, [gateway token](/en/llm-gateway), or cloud-provider credential cannot publish. |

167| Model provider | Anthropic API. Not available on [Amazon Bedrock](/en/amazon-bedrock), [Google Cloud Vertex AI](/en/google-vertex-ai), or [Microsoft Foundry](/en/microsoft-foundry). |167| Model provider | Anthropic API. Not available on [Amazon Bedrock](/en/amazon-bedrock), [Google Cloud Vertex AI](/en/google-vertex-ai), or [Microsoft Foundry](/en/microsoft-foundry). |

168| Organization policy | Customer-managed encryption keys (CMEK), HIPAA, and [Zero Data Retention](/en/zero-data-retention) are not enabled for the organization. |168| Organization policy | Customer-managed encryption keys (CMEK), HIPAA, and [Zero Data Retention](/en/zero-data-retention) are not enabled for the organization. |

costs.md +3 −3

Details

93* **Clear between tasks**: Use `/clear` to start fresh when switching to unrelated work. Stale context wastes tokens on every subsequent message. Use `/rename` before clearing so you can easily find the session later, then `/resume` to return to it.93* **Clear between tasks**: Use `/clear` to start fresh when switching to unrelated work. Stale context wastes tokens on every subsequent message. Use `/rename` before clearing so you can easily find the session later, then `/resume` to return to it.

94* **Add custom compaction instructions**: `/compact Focus on code samples and API usage` tells Claude what to preserve during summarization.94* **Add custom compaction instructions**: `/compact Focus on code samples and API usage` tells Claude what to preserve during summarization.

95 95 

96You can also customize compaction behavior in your CLAUDE.md:96You can also customize compaction behavior in your CLAUDE.md file at the root of your project:

97 97 

98```markdown theme={null}98```markdown theme={null}

99# Compact instructions99# Compact instructions


148 </Tab>148 </Tab>

149 149 

150 <Tab title="filter-test-output.sh">150 <Tab title="filter-test-output.sh">

151 The hook calls this script, which checks if the command is a test runner and modifies it to show only failures:151 The hook calls this script. Create the folder with `mkdir -p ~/.claude/hooks`, save the script below as `~/.claude/hooks/filter-test-output.sh`, and make it executable with `chmod +x ~/.claude/hooks/filter-test-output.sh`. It checks if the command is a test runner and modifies it to show only failures:

152 152 

153 ```bash theme={null}153 ```bash theme={null}

154 #!/bin/bash154 #!/bin/bash


172 172 

173### Adjust extended thinking173### Adjust extended thinking

174 174 

175Extended thinking is enabled by default because it significantly improves performance on complex planning and reasoning tasks. Thinking tokens are billed as output tokens, and the default budget can be tens of thousands of tokens per request depending on the model. For simpler tasks where deep reasoning isn't needed, you can reduce costs by lowering the [effort level](/en/model-config#adjust-effort-level) with `/effort` or in `/model`, disabling thinking in `/config`, or, on models with a [fixed thinking budget](/en/model-config#adaptive-reasoning-and-fixed-thinking-budgets), lowering the budget with `MAX_THINKING_TOKENS=8000`. Adaptive-reasoning models ignore nonzero budgets, so use effort levels there instead. Disabling thinking is not available on Fable 5, which always uses extended thinking.175Extended thinking is enabled by default because it significantly improves performance on complex planning and reasoning tasks. Thinking tokens are billed as output tokens, and the default budget can be tens of thousands of tokens per request depending on the model. For simpler tasks where deep reasoning isn't needed, you can reduce costs by lowering the [effort level](/en/model-config#adjust-effort-level) with `/effort` or in `/model`, disabling thinking in `/config`, or, on models with a [fixed thinking budget](/en/model-config#adaptive-reasoning-and-fixed-thinking-budgets), lowering the budget by setting the `MAX_THINKING_TOKENS` [environment variable](/en/env-vars), for example `MAX_THINKING_TOKENS=8000`. Adaptive-reasoning models ignore nonzero budgets, so use effort levels there instead. Disabling thinking is not available on Fable 5, which always uses extended thinking.

176 176 

177### Delegate verbose operations to subagents177### Delegate verbose operations to subagents

178 178 

Details

46 46 

47 <Step title="Launch and sign in">47 <Step title="Launch and sign in">

48 Launch **Claude** from your application launcher, or run `claude-desktop` from a terminal, and sign in with your Anthropic account.48 Launch **Claude** from your application launcher, or run `claude-desktop` from a terminal, and sign in with your Anthropic account.

49 

50 The Linux app signs in the same way as on macOS and Windows: with a claude.ai subscription, or through your organization's SSO. Desktop doesn't accept a Claude Console API key directly; use the [CLI](/en/quickstart) for API-key authentication. For enterprise deployments that route Desktop to Google Cloud's Agent Platform or an LLM gateway, see the [enterprise configuration guide](https://support.claude.com/en/articles/12622667-enterprise-configuration) and [network configuration](/en/network-config).

49 </Step>51 </Step>

50</Steps>52</Steps>

51 53 

env-vars.md +1 −1

Details

162| `CLAUDE_CODE_DEBUG_LOG_LEVEL` | Minimum log level written to the debug log file. Values: `verbose`, `debug` (default), `info`, `warn`, `error`. Set to `verbose` to include high-volume diagnostics like full status line command output, or raise to `error` to reduce noise |162| `CLAUDE_CODE_DEBUG_LOG_LEVEL` | Minimum log level written to the debug log file. Values: `verbose`, `debug` (default), `info`, `warn`, `error`. Set to `verbose` to include high-volume diagnostics like full status line command output, or raise to `error` to reduce noise |

163| `CLAUDE_CODE_DISABLE_1M_CONTEXT` | Set to `1` to disable [1M context window](/en/model-config#extended-context) support. When set, 1M model variants are unavailable in the model picker, and [Sonnet 5](/en/model-config#sonnet-5-context-window) sessions are treated as having a 200K window. Useful for enterprise environments with compliance requirements |163| `CLAUDE_CODE_DISABLE_1M_CONTEXT` | Set to `1` to disable [1M context window](/en/model-config#extended-context) support. When set, 1M model variants are unavailable in the model picker, and [Sonnet 5](/en/model-config#sonnet-5-context-window) sessions are treated as having a 200K window. Useful for enterprise environments with compliance requirements |

164| `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` | Set to `1` to disable [adaptive reasoning](/en/model-config#adjust-effort-level) on Opus 4.6 and Sonnet 4.6 and fall back to the fixed thinking budget controlled by `MAX_THINKING_TOKENS`. {/* min-version: 2.1.111 */}From v2.1.111, has no effect on Fable 5, Sonnet 5, or Opus 4.7 and later, which always use adaptive reasoning |164| `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` | Set to `1` to disable [adaptive reasoning](/en/model-config#adjust-effort-level) on Opus 4.6 and Sonnet 4.6 and fall back to the fixed thinking budget controlled by `MAX_THINKING_TOKENS`. {/* min-version: 2.1.111 */}From v2.1.111, has no effect on Fable 5, Sonnet 5, or Opus 4.7 and later, which always use adaptive reasoning |

165| `CLAUDE_CODE_DISABLE_ADVISOR_TOOL` | {/* min-version: 2.1.98 */}Set to `1` to disable the [advisor tool](/en/advisor). The `/advisor` command and `--advisor` flag become unavailable and any configured `advisorModel` is ignored. Requires Claude Code v2.1.98 or later |165| `CLAUDE_CODE_DISABLE_ADVISOR_TOOL` | {/* min-version: 2.1.98 */}Set to `1` to disable the [advisor tool](/en/advisor). The `/advisor` command becomes unavailable, any configured `advisorModel` is ignored, and the `--advisor` flag is accepted but has no effect, so existing scripts that pass it continue to work without errors. Requires Claude Code v2.1.98 or later |

166| `CLAUDE_CODE_DISABLE_AGENT_VIEW` | Set to `1` to turn off [background agents and agent view](/en/agent-view): `claude agents`, `--bg`, `/background`, and the on-demand supervisor. Equivalent to the [`disableAgentView`](/en/settings#available-settings) setting |166| `CLAUDE_CODE_DISABLE_AGENT_VIEW` | Set to `1` to turn off [background agents and agent view](/en/agent-view): `claude agents`, `--bg`, `/background`, and the on-demand supervisor. Equivalent to the [`disableAgentView`](/en/settings#available-settings) setting |

167| `CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN` | Set to `1` to disable [fullscreen rendering](/en/fullscreen) and use the classic main-screen renderer. The conversation stays in your terminal's native scrollback so `Cmd+f` and tmux copy mode work as usual. Takes precedence over `CLAUDE_CODE_NO_FLICKER` and the [`tui`](/en/settings#available-settings) setting. You can also switch with `/tui default`. Does not apply to background sessions opened from [agent view](/en/agent-view), which always use fullscreen rendering |167| `CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN` | Set to `1` to disable [fullscreen rendering](/en/fullscreen) and use the classic main-screen renderer. The conversation stays in your terminal's native scrollback so `Cmd+f` and tmux copy mode work as usual. Takes precedence over `CLAUDE_CODE_NO_FLICKER` and the [`tui`](/en/settings#available-settings) setting. You can also switch with `/tui default`. Does not apply to background sessions opened from [agent view](/en/agent-view), which always use fullscreen rendering |

168| `CLAUDE_CODE_DISABLE_ARTIFACT` | Set to `1` to disable the [Artifact](/en/artifacts) tool, which publishes session output as a private web page on claude.ai. Equivalent to the [`disableArtifact`](/en/settings#available-settings) setting |168| `CLAUDE_CODE_DISABLE_ARTIFACT` | Set to `1` to disable the [Artifact](/en/artifacts) tool, which publishes session output as a private web page on claude.ai. Equivalent to the [`disableArtifact`](/en/settings#available-settings) setting |

errors.md +1 −1

Details

663 663 

664### Model is restricted by your organization's settings664### Model is restricted by your organization's settings

665 665 

666Your organization admin has disabled this model in the Claude Console, or it is excluded by an [`availableModels`](/en/model-config#restrict-model-selection) allowlist in managed settings. When the restricted model was set with `--model`, `ANTHROPIC_MODEL`, or the `model` setting, Claude Code substitutes an allowed model and continues. Typing `/model <name>` for a restricted model is rejected with `Run /model to choose a different model.` and the session keeps its current model.666Your organization admin has disabled this model in the claude.ai admin console, or it is excluded by an [`availableModels`](/en/model-config#restrict-model-selection) allowlist in managed settings. When the restricted model was set with `--model`, `ANTHROPIC_MODEL`, or the `model` setting, Claude Code substitutes an allowed model and continues. Typing `/model <name>` for a restricted model is rejected with `Run /model to choose a different model.` and the session keeps its current model.

667 667 

668```text theme={null}668```text theme={null}

669Model "claude-opus-4-8" is restricted by your organization's settings. Using claude-sonnet-4-6 instead.669Model "claude-opus-4-8" is restricted by your organization's settings. Using claude-sonnet-4-6 instead.

Details

44* [Remote Control](/en/remote-control)44* [Remote Control](/en/remote-control)

45* [Chrome extension](/en/chrome)45* [Chrome extension](/en/chrome)

46* [Computer use](/en/computer-use): Pro and Max plans46* [Computer use](/en/computer-use): Pro and Max plans

47* [Artifacts](/en/artifacts): Team and Enterprise plans47* [Artifacts](/en/artifacts): Pro, Max, Team, and Enterprise plans

48* [Voice dictation](/en/voice-dictation)48* [Voice dictation](/en/voice-dictation)

49 49 

50Desktop is the partial exception: Enterprise deployments can route Desktop to Vertex AI or a gateway provider via [managed settings](https://support.claude.com/en/articles/12622667-enterprise-configuration), and the [Cowork on 3P research preview](https://claude.com/docs/cowork/3p/overview) runs the Code tab on Bedrock, Vertex AI, Foundry, or a self-hosted LLM gateway. For per-plan availability of these features, see [Availability by subscription plan](#availability-by-subscription-plan).50Desktop is the partial exception: Enterprise deployments can route Desktop to Vertex AI or a gateway provider via [managed settings](https://support.claude.com/en/articles/12622667-enterprise-configuration), and the [Cowork on 3P research preview](https://claude.com/docs/cowork/3p/overview) runs the Code tab on Bedrock, Vertex AI, Foundry, or a self-hosted LLM gateway. For per-plan availability of these features, see [Availability by subscription plan](#availability-by-subscription-plan).


272| [Computer use](/en/computer-use) | ✓ | ✓ | ✗ | ✗ |272| [Computer use](/en/computer-use) | ✓ | ✓ | ✗ | ✗ |

273| Dispatch ([Desktop](/en/desktop#sessions-from-dispatch)) | ✓ | ✓ | ✗ | ✗ |273| Dispatch ([Desktop](/en/desktop#sessions-from-dispatch)) | ✓ | ✓ | ✗ | ✗ |

274| [Code Review](/en/code-review) | ✗ | ✗ | ✓ | ✓ |274| [Code Review](/en/code-review) | ✗ | ✗ | ✓ | ✓ |

275| [Artifacts](/en/artifacts) | | | ✓ | Admin-enabled |275| [Artifacts](/en/artifacts) | | | ✓ | Admin-enabled |

276| [Analytics dashboard, API, and contribution metrics](/en/analytics) | ✗ | ✗ | ✓ | ✓ |276| [Analytics dashboard, API, and contribution metrics](/en/analytics) | ✗ | ✗ | ✓ | ✓ |

277| [Server-managed settings](/en/server-managed-settings) | ✗ | ✗ | ✓ | ✓ |277| [Server-managed settings](/en/server-managed-settings) | ✗ | ✗ | ✓ | ✓ |

278| [SSO](https://support.claude.com/en/articles/9266767-what-is-the-team-plan) | ✗ | ✗ | ✓ | ✓ |278| [SSO](https://support.claude.com/en/articles/9266767-what-is-the-team-plan) | ✗ | ✗ | ✓ | ✓ |

Details

33| `Ctrl+R` | Reverse search command history | Search through previous commands interactively |33| `Ctrl+R` | Reverse search command history | Search through previous commands interactively |

34| `Ctrl+V` or `Cmd+V` (iTerm2) or `Alt+V` (Windows and WSL) | Paste image from clipboard | Inserts an `[Image #N]` chip at the cursor so you can reference it positionally in your prompt. On WSL, both `Ctrl+V` and `Alt+V` are bound; use `Alt+V` if your terminal intercepts `Ctrl+V` |34| `Ctrl+V` or `Cmd+V` (iTerm2) or `Alt+V` (Windows and WSL) | Paste image from clipboard | Inserts an `[Image #N]` chip at the cursor so you can reference it positionally in your prompt. On WSL, both `Ctrl+V` and `Alt+V` are bound; use `Alt+V` if your terminal intercepts `Ctrl+V` |

35| `Ctrl+B` | Background running tasks | Backgrounds Bash commands and agents. Tmux users press twice |35| `Ctrl+B` | Background running tasks | Backgrounds Bash commands and agents. Tmux users press twice |

36| `Ctrl+T` | Toggle task list | Show or hide the [task list](#task-list) in the terminal status area |36| `Ctrl+T` | Toggle Claude's task checklist | Show or hide [Claude's to-do checklist](#task-list) in the status area. This is not the background-task view; use [`/tasks`](/en/commands) to see running shells and subagents |

37| `Left/Right arrows` | Cycle through dialog tabs | Navigate between tabs in permission dialogs and menus |37| `Left/Right arrows` | Cycle through dialog tabs | Navigate between tabs in permission dialogs and menus |

38| `Up/Down arrows` or `Ctrl+P`/`Ctrl+N` | Move cursor or navigate command history | When the input spans more than one visual row, whether wrapped or multiline, first moves the cursor within the prompt. Once the cursor is on the first or last visual row, pressing again navigates command history. {/* min-version: 2.1.169 */}As of v2.1.169, wrapped single-line input behaves the same as multiline |38| `Up/Down arrows` or `Ctrl+P`/`Ctrl+N` | Move cursor or navigate command history | When the input spans more than one visual row, whether wrapped or multiline, first moves the cursor within the prompt. Once the cursor is on the first or last visual row, pressing again navigates command history. {/* min-version: 2.1.169 */}As of v2.1.169, wrapped single-line input behaves the same as multiline |

39| `Esc` | Interrupt Claude | Stop the current response or tool call mid-turn so you can redirect. Claude keeps the work done so far |39| `Esc` | Interrupt Claude | Stop the current response or tool call mid-turn so you can redirect. Claude keeps the work done so far |


345 345 

346## Task list346## Task list

347 347 

348When working on complex, multi-step work, Claude creates a task list to track progress. Tasks appear in the status area of your terminal with indicators showing what's pending, in progress, or complete.348The task list is Claude's to-do checklist: items Claude created to plan multi-step work, with indicators showing what's pending, in progress, or complete. It's separate from the background-task view. To see running shells and subagents, use [`/tasks`](/en/commands) instead.

349 349 

350* Press `Ctrl+T` to toggle the task list view. The display shows up to 5 tasks at a time350* Press `Ctrl+T` to toggle the task list view. The display shows up to five tasks at a time. When Claude hasn't created any checklist items yet, the toggle has no visible effect because there's nothing to display

351* To see all tasks or clear them, ask Claude directly: "show me all tasks" or "clear all tasks"351* To see all tasks or clear them, ask Claude directly: "show me all tasks" or "clear all tasks"

352* Tasks persist across context compactions, helping Claude stay organized on larger projects352* Tasks persist across context compactions, helping Claude stay organized on larger projects

353* To share a task list across sessions, set `CLAUDE_CODE_TASK_LIST_ID` to use a named directory in `~/.claude/tasks/`: `CLAUDE_CODE_TASK_LIST_ID=my-project claude`353* To share a task list across sessions, set `CLAUDE_CODE_TASK_LIST_ID` to use a named directory in `~/.claude/tasks/`: `CLAUDE_CODE_TASK_LIST_ID=my-project claude`

keybindings.md +2 −2

Details

78Actions available in the `Global` context:78Actions available in the `Global` context:

79 79 

80| Action | Default | Description |80| Action | Default | Description |

81| :--------------------- | :-------- | :-------------------------- |81| :--------------------- | :-------- | :----------------------------------------------------------------------------------------------------------- |

82| `app:interrupt` | Ctrl+C | Cancel current operation |82| `app:interrupt` | Ctrl+C | Cancel current operation |

83| `app:exit` | Ctrl+D | Exit Claude Code |83| `app:exit` | Ctrl+D | Exit Claude Code |

84| `app:redraw` | (unbound) | Force terminal redraw |84| `app:redraw` | (unbound) | Force terminal redraw |

85| `app:toggleTodos` | Ctrl+T | Toggle task list visibility |85| `app:toggleTodos` | Ctrl+T | Toggle visibility of Claude's to-do checklist. This is not the [`/tasks`](/en/commands) background-task view |

86| `app:toggleTranscript` | Ctrl+O | Toggle verbose transcript |86| `app:toggleTranscript` | Ctrl+O | Toggle verbose transcript |

87 87 

88### History actions88### History actions

model-config.md +5 −1

Details

213 213 

214### Organization model restrictions214### Organization model restrictions

215 215 

216Organization admins restrict which models members can run by disabling individual models in the Claude Console. Use this Console toggle instead of `availableModels` when your members authenticate through the Anthropic API and you want one org-wide switch without deploying settings files. This restriction is delivered with the account's entitlements when Claude Code authenticates, separate from any `availableModels` list in settings, and the server enforces the same restriction independently when a session is created. Requires Claude Code v2.1.187 or later.216Organization admins on Claude Enterprise plans restrict which models members can run by disabling individual models in the claude.ai admin console. This restriction is delivered with the account's entitlements when Claude Code authenticates, separate from any `availableModels` list in settings, and the server enforces the same restriction independently when a session is created. Requires Claude Code v2.1.187 or later.

217 

218The restriction applies when a member signs in or uses their own API key. Organization-scoped credentials, such as organization service keys, are not tied to a user, so the restriction does not apply to them.

219 

220The Claude Console has no model restriction control. Organizations without a Claude Enterprise plan, including those whose members authenticate through the Anthropic API, restrict models with [`availableModels`](#restrict-model-selection) in [managed settings](/en/settings#settings-files) instead, adding [`enforceAvailableModels`](#enforce-the-allowlist-for-the-default-model) to cover the Default option. These settings are enforced by Claude Code itself, not by the server.

217 221 

218A restricted model is hidden from the `/model` picker. Selecting it by name with `--model`, the `ANTHROPIC_MODEL` environment variable, or the `model` setting shows the notice `Model "<name>" is restricted by your organization's settings. Using <model> instead.` and the session starts on an allowed model. Typing `/model <name>` for a restricted model is rejected with `Model '<name>' is restricted by your organization's settings. Run /model to choose a different model.` and the session keeps its current model.222A restricted model is hidden from the `/model` picker. Selecting it by name with `--model`, the `ANTHROPIC_MODEL` environment variable, or the `model` setting shows the notice `Model "<name>" is restricted by your organization's settings. Using <model> instead.` and the session starts on an allowed model. Typing `/model <name>` for a restricted model is rejected with `Model '<name>' is restricted by your organization's settings. Run /model to choose a different model.` and the session keeps its current model.

219 223 

Details

312 312 

313## Allow only pre-approved tools with dontAsk mode313## Allow only pre-approved tools with dontAsk mode

314 314 

315`dontAsk` mode auto-denies every tool call that would otherwise prompt. Only actions matching your `permissions.allow` rules and [read-only Bash commands](/en/permissions#read-only-commands) can execute; explicit [`ask` rules](/en/permissions#manage-permissions) are denied rather than prompting. This makes the mode fully non-interactive for CI pipelines or restricted environments where you pre-define exactly what Claude may do. Cloud sessions on [Claude Code on the web](/en/claude-code-on-the-web) ignore `defaultMode: "dontAsk"`; see [bypassPermissions](#skip-all-checks-with-bypasspermissions-mode) for details.315`dontAsk` mode auto-denies every tool call that would otherwise prompt. The status bar shows `⏵⏵ don't ask on` while this mode is active. Only actions matching your `permissions.allow` rules and [read-only Bash commands](/en/permissions#read-only-commands) can execute; explicit [`ask` rules](/en/permissions#manage-permissions) are denied rather than prompting. This makes the mode fully non-interactive for CI pipelines or restricted environments where you pre-define exactly what Claude may do. Cloud sessions on [Claude Code on the web](/en/claude-code-on-the-web) ignore `defaultMode: "dontAsk"`; see [bypassPermissions](#skip-all-checks-with-bypasspermissions-mode) for details.

316 316 

317Set it at startup with the flag:317Set it at startup with the flag:

318 318 

plugins.md +4 −2

Details

54 54 

55<Steps>55<Steps>

56 <Step title="Create the plugin directory">56 <Step title="Create the plugin directory">

57 Every plugin lives in its own directory containing your skills, agents, or hooks, optionally alongside a `.claude-plugin/plugin.json` manifest. Create one now:57 Every plugin lives in its own directory containing your skills, agents, or hooks, optionally alongside a `.claude-plugin/plugin.json` manifest. The location doesn't matter for this quickstart because you'll point Claude Code at the directory with `--plugin-dir` in the test step. Create it anywhere convenient, such as a scratch folder or a projects directory:

58 58 

59 ```bash theme={null}59 ```bash theme={null}

60 mkdir my-first-plugin60 mkdir my-first-plugin

61 ```61 ```

62 

63 The remaining steps run from the parent directory and reference paths like `my-first-plugin/...` relative to it.

62 </Step>64 </Step>

63 65 

64 <Step title="Create the plugin manifest">66 <Step title="Create the plugin manifest">


402 404 

403<Steps>405<Steps>

404 <Step title="Create the plugin structure">406 <Step title="Create the plugin structure">

405 Create a new plugin directory:407 Create a new plugin directory in your project root, alongside the existing `.claude/` folder, so the relative `cp` paths in the next step resolve:

406 408 

407 ```bash theme={null}409 ```bash theme={null}

408 mkdir -p my-plugin/.claude-plugin410 mkdir -p my-plugin/.claude-plugin

Details

13| Tool | Description | Permission Required |13| Tool | Description | Permission Required |

14| :--------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------ |14| :--------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------ |

15| `Agent` | Spawns a [subagent](/en/sub-agents) with its own context window to handle a task. See [Agent tool behavior](#agent-tool-behavior) | No |15| `Agent` | Spawns a [subagent](/en/sub-agents) with its own context window to handle a task. See [Agent tool behavior](#agent-tool-behavior) | No |

16| `Artifact` | Publishes an HTML or Markdown file as an [artifact](/en/artifacts): a private, interactive page on claude.ai you can share inside your organization. {/* plan-availability: feature=artifacts plans=team,enterprise providers=anthropic */}Requires a Team or Enterprise plan and `/login` authentication; see [Availability](/en/artifacts#availability) | Yes |16| `Artifact` | Publishes an HTML or Markdown file as an [artifact](/en/artifacts): a private, interactive page on claude.ai. On Team and Enterprise plans, you can share it inside your organization. {/* plan-availability: feature=artifacts plans=pro,max,team,enterprise providers=anthropic */}Requires a Pro, Max, Team, or Enterprise plan and `/login` authentication; see [Availability](/en/artifacts#availability) | Yes |

17| `AskUserQuestion` | Asks multiple-choice questions to gather requirements or clarify ambiguity | No |17| `AskUserQuestion` | Asks multiple-choice questions to gather requirements or clarify ambiguity | No |

18| `Bash` | Executes shell commands in your environment. See [Bash tool behavior](#bash-tool-behavior) | Yes |18| `Bash` | Executes shell commands in your environment. See [Bash tool behavior](#bash-tool-behavior) | Yes |

19| `CronCreate` | Schedules a recurring or one-shot prompt within the current session. Tasks are session-scoped and restored on `--resume` or `--continue` if unexpired. See [scheduled tasks](/en/scheduled-tasks) | No |19| `CronCreate` | Schedules a recurring or one-shot prompt within the current session. Tasks are session-scoped and restored on `--resume` or `--continue` if unexpired. See [scheduled tasks](/en/scheduled-tasks) | No |

workflows.md +75 −0

Details

192 192 

193Claude passes the list as structured data, so the script can call array and object methods on `args` directly without parsing it first. If `args` is omitted, the global is `undefined` inside the script.193Claude passes the list as structured data, so the script can call array and object methods on `args` directly without parsing it first. If `args` is omitted, the global is `undefined` inside the script.

194 194 

195## Example workflow prompts

196 

197A workflow fits best when the task is larger than one agent can hold in context, or when the same step needs to run across many items. The prompts below show common shapes. Each one asks Claude to write and run a workflow for that task; you don't write the script yourself.

198 

199### Audit many files for the same issue

200 

201Fan out one agent per file, then collect and verify the findings.

202 

203```text theme={null}

204> use a workflow to audit every route handler under src/routes/ for missing authentication checks, and adversarially verify each finding before reporting it

205```

206 

207### Keep fixing until a check passes

208 

209Run a checker, fix what failed, and repeat until it passes or stops making progress.

210 

211```text theme={null}

212> use a workflow to run npx tsc --noEmit and keep fixing the reported errors until the type check passes or two rounds in a row make no progress

213```

214 

215### Migrate many files in parallel

216 

217Discover the files to migrate, transform each one in an isolated copy so edits don't conflict, and verify each result.

218 

219```text theme={null}

220> use a workflow to migrate every component under src/components/ from styled-components to Tailwind, working on each file in its own isolated copy

221```

222 

223### Review every changed file and write one summary

224 

225Run a reviewer per file, then hand all the findings to one agent that ranks and deduplicates them.

226 

227```text theme={null}

228> use a workflow to review every file changed in this PR for correctness issues, then merge the per-file findings into one ranked summary

229```

230 

231### Research a topic across many sources

232 

233Fan out readers across changelogs, issues, and docs, then synthesize. The bundled `/deep-research` workflow does this; you can also describe a narrower version.

234 

235```text theme={null}

236> use a workflow to research how our three competitors handle rate limiting: read their public docs and recent changelog entries in parallel, then compare the approaches

237```

238 

239### Find issues until the list stops growing

240 

241Keep searching in rounds and stop when new rounds turn up nothing new.

242 

243```text theme={null}

244> use a workflow to find flaky tests in this repo: run the suite repeatedly, record which tests fail intermittently, and stop once two rounds in a row find nothing new

245```

246 

247### What the saved script looks like

248 

249When you [save a workflow](#save-the-workflow-for-reuse), the file in `.claude/workflows/` holds a `meta` block followed by a script body that orchestrates subagents. You usually don't need to edit it, but here is the shape of a small one so you can recognize what Claude generated:

250 

251```javascript theme={null}

252export const meta = {

253 name: 'audit-routes',

254 description: 'Audit every route handler for missing auth checks',

255}

256 

257const found = await agent('List every .ts file under src/routes/.', {

258 schema: { type: 'object', required: ['files'], properties: { files: { type: 'array', items: { type: 'string' } } } },

259})

260 

261const audits = await pipeline(found.files, file =>

262 agent(`Audit ${file} for missing authentication checks.`, { label: file }),

263)

264 

265return audits.filter(Boolean)

266```

267 

268The body is plain JavaScript with top-level `await`. `agent()` spawns one subagent and `pipeline()` runs one per item in a list. If you want to edit a script by hand, ask Claude to walk you through the change, or see the Workflow tool entry in the [Agent SDK reference](/en/agent-sdk/typescript) for the full set of options.

269 

195## How a workflow runs270## How a workflow runs

196 271 

197The workflow runtime executes the script in an isolated environment, separate from your conversation. Intermediate results stay in script variables instead of landing in Claude's context.272The workflow runtime executes the script in an isolated environment, separate from your conversation. Intermediate results stay in script variables instead of landing in Claude's context.