New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

ctx-switch

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ctx-switch

Switch coding agents without losing context. Generate handoff prompts across Claude Code, Codex, and OpenCode.

latest
Source
npmnpm
Version
2.0.7
Version published
Maintainers
1
Created
Source

ctx-switch

ctx-switch cc-continue

Formerly cc-continue — existing installs still work, just use ctx-switch going forward.

Switch coding agents without losing context. Agent handoff for Claude Code, Codex, and OpenCode.

Why this exists

You're in the middle of a coding session. Things are working. Progress is being made.

And then you need to switch.

  • Maybe the session can't continue
  • Maybe something isn't working as expected
  • Maybe you just want to move to another agent

Now you're stuck.

You switch to another agent — but:

  • it has no context
  • you have to explain everything again
  • you lose momentum

Your work shouldn't reset just because you switched tools.

What ctx-switch does

npx ctx-switch

It captures your current session — code, context, decisions, errors — and generates a clean, structured handoff prompt so another agent can continue immediately.

No re-explaining. No rebuilding context. No wasted time.

Just continue where you left off.

Core idea

Switch agents. Don't restart.

Features

  • Multi-agent support: Claude Code, Codex, OpenCode
  • Smart session detection: Finds the latest session for your current project
  • Context extraction:
    • Filters noise (confirmations, filler)
    • Keeps only relevant context
  • Error awareness:
    • Includes unresolved errors
    • Skips already-fixed issues
  • Codebase state capture:
    • Recent commits
    • Diffs (staged & unstaged)
    • Untracked files
  • Decision tracking:
    • Extracts key decisions and pivots
  • Structured output:
    • Task → Errors → Decisions → Completed Work → Current State → Instructions
  • Target-aware prompts:
    • codex, cursor, chatgpt, or generic
  • Clipboard ready: Auto-copy across macOS, Linux, Windows
  • Optional LLM refinement (--refine)
  • sessions command to browse recent sessions
  • doctor command for diagnostics

How it works

  • Select your source agent (Claude / Codex / OpenCode)
  • ctx-switch finds the latest session for your project
  • Parses:
    • conversation
    • tool calls
    • errors
  • Captures git state:
    • branch
    • commits
    • diffs
  • Builds a structured handoff prompt
  • Copies it to clipboard and prints it

Install

# Run instantly
npx ctx-switch

# Or install globally
npm i -g ctx-switch

Usage

cd my-project

# Interactive mode
ctx-switch

# Specify source
ctx-switch --source claude
ctx-switch --source codex
ctx-switch --source opencode

# Target a specific agent
ctx-switch --source claude --target codex

# Use a specific session
ctx-switch --source claude --session <id>

# Refine output with LLM
ctx-switch --refine

# List sessions
ctx-switch sessions --source claude --limit 5

# Save to a file
ctx-switch --output ./handoff.md

# Run diagnostics
ctx-switch doctor --source codex

Example use cases

  • Continue work in another agent when switching is needed
  • Move a session across tools without re-explaining everything
  • Resume work seamlessly in a different environment
  • Preserve context when changing workflows

LLM Refinement (Optional)

Use --refine to improve the generated prompt via an LLM.

On first use:

Enter your OpenRouter API key: sk-or-v1-...
Saved to ~/.ctx-switch.json

Get a key: openrouter.ai/keys

Or set manually:

export OPENROUTER_API_KEY=sk-or-v1-...

Key Flags

FlagDescription
--source <name>claude, codex, opencode
--target <name>generic, codex, cursor, chatgpt
--output <file>Save prompt
--session <id|path>Use specific session
--refineRefine prompt via LLM
--providerRefinement provider (default: openrouter)
--modelOverride model
--api-keyOverride API key

Session Storage

SourceStorage PathFormat
Claude Code~/.claude/projects/<encoded-cwd>/*.jsonlJSONL
Codex~/.codex/sessions/<year>/<month>/<day>/*.jsonlJSONL
OpenCode~/.local/share/opencode/opencode.dbSQLite

Requirements

  • Node.js >= 18
  • Claude Code, Codex, or OpenCode (used in current directory)
  • sqlite3 (only for OpenCode sessions)
  • OpenRouter API key (only if using --refine)

Migrating from cc-continue

cc-continue still works — it's now an alias for ctx-switch.

npm uninstall -g cc-continue
npm i -g ctx-switch

License

MIT

Keywords

ctx-switch

FAQs

Package last updated on 30 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts