Codex Rescue Resume vs Fresh: Using --resume and --fresh in codex-plugin-cc

Use --resume to continue an existing Codex rescue thread and --fresh to start a completely new investigation, or omit both to let the system prompt you when a resumable thread exists.

The codex-plugin-cc repository provides a powerful rescue command for continuing or restarting AI-assisted debugging sessions. Understanding when to use resume vs fresh flags determines whether you continue previous context or begin with a clean slate. These flags control how the underlying Codex sub-agent manages conversation state and history.

Understanding the Codex Rescue Command Flags

Continuing with --resume

When you invoke /codex:rescue --resume, you instruct the sub-agent to continue the current Codex thread. This flag forwards directly to the underlying task call, instructing Codex to reuse the existing session and retain all prior context from your previous rescue run. Use this when you want to pick up exactly where you left off, such as applying a suggested fix or continuing an investigation without losing accumulated context.

Starting Clean with --fresh

The --fresh flag tells the sub-agent to start a new Codex thread, ignoring any prior rescue state. When forwarded to the task call, this causes Codex to open a brand-new session with no memory of previous attempts. This is ideal when you want a completely new investigation or when previous context might confound the current problem.

Default Behavior When No Flag Is Provided

When neither flag is provided, the command executes task-resume-candidate (implemented in plugins/codex/scripts/codex-companion.mjs) to detect whether a resumable thread exists. If the helper finds an existing thread, the system prompts you to choose between:

  • "Continue current Codex thread" (automatically adds --resume)
  • "Start a new Codex thread" (automatically adds --fresh)

If no prior thread exists, the command proceeds without prompting, effectively behaving like a fresh start but without explicitly setting the flag.

Code Examples


# Continue the existing rescue thread (no prompt needed)

/codex:rescue --resume "Investigate why the login fails on the new UI"

# Force a fresh rescue thread (ignores any prior thread)

/codex:rescue --fresh "Add unit tests for the authentication module"

# Let the system decide and ask you (default behaviour)

# If a resumable thread exists, you'll be asked to pick "Continue" or "Start new"

/codex:rescue "Refactor the data-processing pipeline"

Implementation Details

According to the source code in plugins/codex/commands/rescue.md (lines 21-23 and 30-36), the command header and execution mode section define these flag behaviors. The job-type handling that distinguishes rescue jobs lives in plugins/codex/scripts/lib/job-control.mjs, while the rescue sub-agent that receives forwarded flags is described in plugins/codex/agents/codex-rescue.md.

Summary

  • --resume continues the existing Codex thread, preserving all previous context and conversation history according to the implementation in plugins/codex/commands/rescue.md
  • --fresh forces a brand-new session, discarding any prior rescue state and forwarding the flag to the underlying task call
  • Default behavior uses task-resume-candidate to detect existing threads and prompts for choice when found
  • Key files include the rescue command definition, job control scripts, and the rescue sub-agent configuration

Frequently Asked Questions

What happens if I use both --resume and --fresh flags together?

The source code in plugins/codex/commands/rescue.md treats these as mutually exclusive execution modes. You should specify only one flag per rescue command, as they represent opposing behaviors—continuing versus resetting session state.

How does codex-plugin-cc detect if a rescue thread is resumable?

The system uses the task-resume-candidate helper implemented in plugins/codex/scripts/codex-companion.mjs to check for existing resumable threads before prompting you. This helper evaluates the current job state to determine if continuation is possible.

Can I switch from --fresh to --resume later in the same rescue session?

No, the session mode is determined at invocation time when the command forwards the flag to the underlying task call. Once a fresh session starts, it becomes the new current thread, and you would use --resume on subsequent calls to continue that specific new session.

Where is the rescue sub-agent behavior documented?

The rescue sub-agent specifications and flag handling are documented in plugins/codex/agents/codex-rescue.md, while the command-line interface and parsing logic reside in plugins/codex/commands/rescue.md (lines 21-23 and 30-36).

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →