switch-agent

A workflow for moving an active coding conversation between Claude Code and Codex while preserving its transcript, project state, task lane, and next step. A task lane is the named stream used to keep related handoffs connected.

In plain words
What is it for?
Use it when switching agents, handing work to another coding assistant, or continuing the same task in a different tool. It can install the handoff bridge and create a resumable target session.
Why use it?
It prevents context and work state from being lost when changing coding agents. It also checks the project directory, branch, and uncommitted changes before creating the new session.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/nerln/claude-codex-bridge/switch-agent
Any agent
npx skills add nerln/claude-codex-bridge --skill switch-agent
Clone the repo
git clone --depth 1 https://github.com/nerln/claude-codex-bridge

Made for: Claude Code, Codex.

Per session 91 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,308 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00091 $0.01308
Opus 5 $0.00046 $0.00654
Sonnet 5 $0.00018 $0.00262
Haiku 4.5 $0.00009 $0.00131

Measured 2d ago against content hash a9e5f38c157c, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

switch-agent scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

The scan reads SKILL.md. This mod also ships 3 executable files (scripts/ask.py, scripts/bridge.py, scripts/transcode.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/switch-agent/SKILL.md · 113 lines

How it starts

The opening of the file, as written. The whole thing — 113 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Switch Agent

Resolve SKILL_DIR as the directory containing this file. Use python3 "$SKILL_DIR/scripts/bridge.py"; do not assume the skill or project is the current directory.

The normal workflow

  1. Infer the source agent from the runtime and the requested target. Require different agents. Finish or explicitly interrupt the active model turn so the source session is no longer changing; identify background work that cannot transfer.

  2. Resolve the exact project root, directory/worktree, branch, and dirty state. Never commit, reset, stash, checkout, or create a worktree unless separately requested.

  3. If .agent-bridge/config.json is absent, install the bridge:

    python3 "$SKILL_DIR/scripts/bridge.py" install --hooks "$PROJECT_ROOT"
    

    Preserve existing hooks. Explain any one-time local hook review.

  4. Choose a stable task lane, defaulting to main. Reuse the same --task for later hops of one chat; use a different name for unrelated chats. When the lane is new or several sessions share the same cwd, pass the exact native --source-session instead of guessing.

  5. Run the native switch. Prefer the shortest command; it infers the source as the other agent:

    python3 "$SKILL_DIR/scripts/bridge.py" to "$TARGET" --task "$TASK" --project "$PROJECT_ROOT"
    

    The explicit equivalent, useful for audits, is:

    python3 "$SKILL_DIR/scripts/bridge.py" switch --from "$SOURCE" --to "$TARGET" --task "$TASK" --project "$PROJECT_ROOT"
    

    Keep the default --transcript auto: transfer the visible transcript plus the deterministic capsule, with capsule-only fallback when parsing is not compatible. Use --transcript required when the user requires transcript continuity and prefers a hard stop. Use --transcript off only when the user wants capsule-only transfer or transcript privacy.

  6. Let the main command create and open a new native target session. Codex opens codex://threads/<id> and Claude resumes with claude --resume <id>; do not ask the user to submit a prefilled prompt or press Enter. If opening is unavailable, rerun the identical switch with --no-open and provide the printed resume command.

  7. Report the transfer ID, task, source and target session IDs, continuity mode, redaction/truncation counts, preserved project state, and any fallback or background-process warning. State that visible history was transcoded; do not claim hidden reasoning, permissions, or live tool state transferred.

Read the full file on GitHub · 113 lines

Files

What ships with it

5 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 113 lines · 91 tokens per session scan A a9e5f38c157c

Subscribe to this mod's changes

switch-agent is a skill published in the GitHub repository nerln/claude-codex-bridge (1 stars, last pushed 21d ago), licensed MIT. It adds 91 tokens to every session and 1,308 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.