Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk4 min

How to Pick Up Claude Code and Codex Sessions After a Restart

Claude Code uses claude --continue or claude --resume with a session ID; Codex app-server resumes a saved thread ID; the Agents API retrieves a stored session and handles required actions. Here is how each works after a restart.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The steps depend on which surface you were using. In Claude Code’s command-line interface, run claude --continue from the project directory to reload the most recent conversation, or claude --resume <session-id> to open a specific one. In a Codex app-server integration, you resume a saved thread ID with a thread/resume request after the server restarts. In an OpenAI Agents API application, you retrieve a stored session ID, check its status and any required actions, and then continue. The three paths use different identifiers and different commands, so identify your surface before you run anything.

Identify which surface you used

Most restart problems come from following a procedure written for a different tool. Match your situation to one row before you begin.

As an Amazon Associate I earn from qualifying purchases.

Surface you used Identifier you need Recovery entry point
Claude Code CLI in a terminal Most recent conversation in the current directory, or a session ID claude --continue (-c) or claude --resume <session-id> (-r)
Codex app-server (a program you build that talks to the app-server protocol) Thread ID returned when the thread was started Initialize the restarted app-server, then send thread/resume with the saved ID
OpenAI Agents API application Session ID stored with your application’s conversation record Retrieve the session, check status and required actions, then continue

This guide does not cover the resume commands of the Codex terminal interface or IDE extensions. The official material available for this topic documents the app-server protocol and the Agents API, not those interfaces, so do not assume the app-server steps apply to them.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Claude Code CLI

The Claude Code CLI reference documents two ways to load a previous conversation. Both are run from the terminal, and the first depends on your current directory.

Continue the latest conversation in the current directory

Change into the project directory where the conversation took place, then run:

cd /path/to/your/project
claude --continue

The short form is claude -c. Because this option selects the most recent conversation for the current directory, starting it from a different folder can load a different history or none at all. If you worked on several tasks in the same folder, this option returns only the newest one; use the session-ID route for anything older.

Resume a specific session by ID

When you have the session ID for the conversation you want, pass it directly:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
claude --resume <session-id>

The short form is claude -r <session-id>. Replace <session-id> with the literal identifier, not the placeholder text. The reference describes this as resuming a session. It does not promise that unsaved in-memory state, such as a command that was still running when the terminal closed, will be restored, so check the files and the last messages before continuing work that depended on it.

Codex app-server

The app-server path is a protocol flow for developers embedding Codex in their own software. Its restart behavior depends on your application saving one value: the thread ID returned when the thread was created.

Save the thread ID when you start the thread

The thread/start call returns a thread ID. Store it in your application’s database or settings before the process can exit. If you lose it, the protocol gives you no other documented way to name that thread in a resume request, so treat this step as the one that determines whether recovery is possible.

Resume after the app-server restarts

  1. Start the app-server process again.
  2. Initialize the new process using the same handshake your integration normally performs at startup.
  3. Send a thread/resume request containing the saved thread ID.

The official Codex app-server example, linked below, shows this sequence in the context of a sign-in and token-sharing setup. Treat it as a worked protocol example rather than the required procedure for every integration. Your exact request fields should match the protocol documentation for your version.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

OpenAI Agents API sessions

Agents API sessions are managed by your application rather than by a terminal. The OpenAI guides describe a retrieve-check-continue workflow that works after a process restart or a dropped stream.

Store the session ID with your conversation record

Save the session ID alongside the user, conversation, or ticket it belongs to. Without it, your application has no way to retrieve the session after restart. Storing it in process memory alone does not survive a restart.

Retrieve the session and inspect its state

  1. After the restart or disconnect, retrieve the session using the stored ID.
  2. Read the session’s status and its required_actions field.
  3. If required_actions lists items, handle each one before anything else. The guide describes these as pending actions that must be resolved first.
  4. Follow the session’s events through to the outcome of the turn that was in progress.
  5. Continue the conversation once the session is in a state that accepts new input.

The session documentation is the reference for the exact field names and event types; check them against the version of the SDK or API you use.

When the session itself has failed

A failed turn does not automatically mean the session has failed. Check the session’s status first. If the session has failed, the recovery guide says to create a new session and supply the inputs that are still needed. Your application should therefore keep enough of the conversation history to rebuild that context, because the failed session cannot be revived. For error handling in general, see the errors and recovery guide linked below.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What does not carry across surfaces

The three surfaces do not share a single resume command. A Claude Code session ID cannot be passed to thread/resume, a Codex thread ID is not an Agents API session ID, and claude --continue has no equivalent in the Agents API. If you use more than one surface, store each identifier under its own name so that a restart never leads you to pass the wrong value to the wrong tool.

Sources

“

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.