The situation Claude Code was deep into a long job and I had to step away from the machine, maybe even turn it off. I wanted to halt it and come back later with everything intact: the context it had built up, the decisions it had made, and the work that was only half done. Digging into it, I realized I was actually asking two separate questions, and each has its own answer. TLDR; if you’re on a laptop just close the lid and continue later. If you want to know more about the details and other options then read on. Just need a break? Put the machine to Sleep This is the easiest route by far. Suspend the computer and the entire system freezes exactly as it is, Claude Code and whatever command it happens to be running along with it. Wake it back up and you land right where you left off. Nothing to type, no resume steps, basically no loss. The way you put a machine to sleep varies by OS. Laptop users can usually just shut the lid, but the menu options work on any machine, desktop included: macOS: Apple menu > Sleep (laptops can also close the lid). Windows: Start > Power > Sleep (laptops can also close the lid; what the lid does is set under Power Options > “Choose what closing the lid does”). Linux: the Suspend option in your desktop environment (laptops can also close the lid; lid handling comes from your desktop environment or systemd-logind). A couple of things to keep in mind: Sleep (suspend-to-RAM) keeps memory energized, which means the box is sipping power the entire time it’s asleep. Lose that power and the running process vanishes, leaving you dependent on the saved session (covered below). For a laptop, “losing power” is the battery dying; for a desktop, it’s a blackout or someone pulling the plug. Hibernate (suspend-to-disk) dodges this by dumping memory to disk so it can survive a complete power-off, but it’s a distinct mode that frequently isn’t enabled by default and isn’t offered the same way on every system, so don’t bank on it. Should Claude Code have had an API request in flight when the machine slept, that connection may break, and the step it was on can fail and want a quick retry. That’s the only thing lost; the conversation stays put. For grabbing a coffee, hopping to another room, or a short hop with the device in your bag, that’s the whole answer. Actually shutting down, or gone a while? Checkpoint first, then resume Sleep only buys you time as long as the machine keeps sleeping. If you’re powering all the way down, or you’ll be gone long enough that the machine might lose power, get the work recorded properly before you go. Skip telling it to “wait.” Have it checkpoint instead. Something along these lines: This brings it to rest at a clean boundary rather than halfway through writing a file, and leaves you a written summary. Please note that this make take a while depending on what Claude Code is currently doing and if there are sub agents involved. After that: Quit cleanly. Power down or move the machine. From the same directory, run claude --continue (or -c ) to reopen your latest session, or claude --resume ( -r ) to choose from older ones. Then tell it “Pick up where we left off per your summary.” Every session is written to disk automatically as you go, and any files it already changed are saved like any other edit, so the live process isn’t holding anything critical. Between the summary and the reloaded session, you’re back up to speed the second you sit down. Didn’t checkpoint? Newer versions include a /recap command that summarizes the current state of the session on request, and they’ll also surface a one-line recap on their own when you come back to a terminal you’d stepped away from (it builds in the background after a few idle minutes with the terminal unfocused). So even if you powered off without asking for a summary, /recap after resuming can rebuild the picture. Prompting for a checkpoint yourself is still the better move, because you decide what gets captured and it halts at a tidy point instead of mid-edit, but /recap makes a reliable backstop. Things that look like the answer but aren’t Esc by itself. This does stop the current task right away (it’s a keypress the CLI catches directly, not text you submit), but on its own it saves nothing once you power off. Adding “please stop and wait until I tell you to continue” to your prompt. “Waiting” isn’t a state the agent can hold; it simply ends its turn early, which is what it would do on finishing anyway. And no prompt text outlives the machine shutting down. A /pause command. Whatever you type while Claude Code is busy gets queued rather than executed mid-task. It’s only picked up once the current work pauses or wraps, never while it’s genuinely running, so “pause” can’t take effect as a live instruction. The actual way to halt an in-progress turn is the Esc key (or Ctrl+C ), not anything typed. Sources Official Claude Code docs behind the points above: Interactive mode (Esc to interrupt, /recap , session recap): https://code.claude.com/docs/en/interactive-mode Manage sessions ( –continue , –resume , /resume , where sessions live): https://code.claude.com/docs/en/sessions CLI reference ( -c / -r flags): https://docs.anthropic.com/en/docs/claude-code/cli-reference Checkpointing (Esc+Esc to rewind edits): https://code.claude.com/docs/en/checkpointing Two notes on sourcing. The queuing behavior (typed input queuing rather than interrupting) isn’t documented cleanly and shows up mainly in the issue tracker, which even has a logged mismatch between the docs and the real behavior, so read it as how the CLI currently acts rather than a documented promise. And the sleep, hibernate, and lid details are operating-system behavior across macOS, Windows, and Linux, not anything from the Claude Code docs. Note: Claude Code moves fast, and parts of this (interrupt keys, queuing, /recap ) depend on both version and surface (the CLI queues typed input, while some editor extensions interrupt instead). Verified against the current version as of late May 2026, though it may change. The sleep-the-machine and checkpoint-then-resume approaches are the dependable ones. submitted by /u/One_Curious_Cats
Originally posted by u/One_Curious_Cats on r/ClaudeCode
