grandamenium/cortextos/claude-to-codex-migration
Claude Code and agent skill by grandamenium/cortextos
- community
Checking that the SKILL.md file is still in the repository.
Migrate ANY cortextOS agent from the claude-code runtime to the live codex-app-server runtime. Use this whenever a user wants to convert, port, move, or switch a Claude-cortextOS agent to Codex / gpt-5-codex / gpt-5.5, "make agent X run on codex", "turn this claude agent into a codex agent", or asks how a Claude agent's CLAUDE.md / .claude/skills / .mcp.json / hooks map onto the codex-app-server adapter. Takes a source agent name and produces a SEPARATE codex-shaped agent (non-destructive, dry-run by default). Trigger even if they only say "migrate <agent> to codex" without naming the artifacts. Do NOT use for creating a brand-new codex agent from scratch (use `cortextos add-agent`) or for hermes/orchestrator/analyst runtimes.
Install
npx vskill@latest install grandamenium/cortextos/claude-to-codex-migrationSKILL.md
The same SKILL.md was published earlier as grandamenium/cortextos/claude-to-codex-migration.
Claude -> Codex Agent Migration
Convert a runtime: claude-code cortextOS agent into a runtime: codex-app-server agent that the live CodexAppServerPTY adapter can boot and loop. The migration is mostly a transform of the agent's in-repo directory plus a config.json runtime/model flip; the bus, crons, heartbeat, dashboard, and Telegram surfaces are already runtime-agnostic and carry over unchanged.
This skill is GENERAL: it takes any source agent name/path as input. It is NON-DESTRUCTIVE: the source agent is never modified or deleted; you produce a separate codex-form agent. It is DRY-RUN BY DEFAULT: nothing is written until you pass --apply.
The promise and the contract
The codex adapter (src/pty/codex-app-server-pty.ts) re-implements most of what Claude's .claude/settings.json hooks did, natively in code. So the migration is NOT "everything Claude-specific is lost." The honest decomposition is:
- 1:1 -> copy verbatim (identity/soul/goals/memory/.env/workspaces/crons).
- TRANSFORM -> rewrite into codex shape (config.json, CLAUDE.md, skills, MCP, refs).
- DROPPED (no equivalent) -> exactly THREE in-turn Telegram behaviors lose their
hook: plan-mode->Telegram, AskUserQuestion->Telegram, PreCompact->Telegram. Re-home them to the out-of-band bus approvals flow.
- NEEDS-HUMAN -> items that cannot be mechanically converted and block enable.
The cardinal rule: never silently drop an artifact. Every file the source agent owns lands in a bucket and appears in the report, including files this skill has no specific rule for (they go to a port-verbatim catch-all). If the tree-walk finds something with no rule, it is surfaced, not skipped.
How to run this: walk the USER through it (interactive, 5 steps)
You (the implementing agent) do NOT run this silently. Migration changes a live agent's runtime and can take over a Telegram bot — the user must steer the irreversible choices. Run a conversation in exactly these five steps. The scripts below do the work; THIS section is the script YOU follow with the user.
The whole flow maps onto the engine flags like this: STEP 1-2 gather the user's answers; STEP 3 is the deterministic convert; the bot/boot choices from STEP 2 become --bot-mode / --boot / --new-bot-token on convert.py; STEP 5 reads the engine's end_state. With NO flags the engine is fully non-destructive (dry-run, source untouched, codex disabled) — so always do the STEP 1 detect as a dry-run first, ask, THEN apply with the user-confirmed flags.
STEP 1 — DETECT + plain-language SUMMARY (no changes yet)
Run Step 0 + Step 1 (DETECT) below, read the manifest, then tell the user, in plain language (not JSON):
- the agent name and its current runtime,
- N skills (X custom / Y bundled-for-free),
- M crons, the MCP servers (or "none"),
- the Telegram bot it runs on,
- what migrates CLEAN (1:1), what is LOSSY (the 3 dropped Telegram behaviors,
any leaky skills), and what will NEED THEM (the needs-human set). Make NO changes. This is the orientation read.
STEP 2 — ASK the user these 3 decisions, then WAIT for answers
Present all three with their defaults; do not proceed until answered.
- Q1 TARGET. Create a new agent
<name>-codexALONGSIDE the original
(DEFAULT — safe, fully rollbackable), OR replace the original in place? Default is new-alongside. "Replace" is advanced/destructive — warn explicitly that it removes the rollback path.
- Q2 BOT TOKEN (the key one).
- (a) REUSE the existing Telegram bot -> the skill performs a CUTOVER: it
DISABLES the source Claude agent, copies its bot token into the codex agent, and boots the codex agent on the SAME token. Telegram allows only ONE poller per bot, so reuse REQUIRES disabling the source — this is intended and seamless. End state: "X is now codex, same bot." (Sets --bot-mode reuse, which implies boot.)
- (b) NEW bot -> the user pastes a new bot token (from @BotFather); it goes
in the codex agent's env, and BOTH source and codex can run side by side. (Sets --bot-mode new --new-bot-token <token>.)
- Q3 BOOT. After migrating, boot the codex agent now, or leave it DISABLED
for the user to inspect first? (If Q2=reuse-cutover, booting is implied — still confirm with the user.) (Sets --boot now or --boot no, default no.)
STEP 2b — WRITE-SIDE HANDOFF GATE (HARD, cutover only — block before any teardown)
This is a NON-NEGOTIABLE pre-cutover gate. A clean cutover requires real session continuity, not a synthesized handoff. Before any --bot-mode reuse:
- Record the migration-start timestamp and pass it as
--migration-start-ts. - AUTHORIZE the migration — the gate depends on REVERSIBILITY. A
security-hardened source agent will (CORRECTLY) REFUSE a cold bus demand to run a handoff — it reads "produce a handoff now, urgent, via bus" as a prompt-injection pattern and escalates instead of complying (good behavior; clean-room test runs proved it). How you authorize depends on what the migration DOES:
2a. OWNER-DIRECT-CONFIRM — REQUIRED for an irreversible / external-surface / shared-system cutover (defect 9). --bot-mode reuse is a BOT-HANDOVER: the target takes over the source's live Telegram surface — irreversible and externally visible. Per the approval doctrine, an irreversible external-surface action requires the OWNER (the user) to confirm DIRECTLY, OUT-OF-BAND, over the TARGET agent's own trusted surface (e.g. the principal sends the SOURCE agent a direct Telegram: "migration to <target> is authorized, comply with the next handoff request"). This is the AUTHORIZATION gate. An orchestrator-minted in-band token is NOT sufficient for it: a transmitted token is itself an attack surface (any agent that sees the bus can quote it), and request-authenticity is not owner-authorization for an irreversible action. The source complies because its OWNER told it to, directly. Do NOT substitute a delegated/relayed approval for the owner's direct confirm on an irreversible cutover.
The owner confirm must be EXPLICIT, UNAMBIGUOUS, and verified at the RECIPIENT (defect 10). Three hard sub-rules, all proven by a clean-room test run where a relayer inflated a bare owner "Authorized" into the full gate phrase:
- SPECIFIC: the owner's confirm must NAME the target AND the action ("migration to
<target> authorized, comply with the next handoff request"). A bare affirmation ("Authorized", "ok", "go", "bet") is ACK, NOT approval — it does not satisfy the gate, especially if it answers nothing specific or leaves a target's clarifying question unanswered.
- VERBATIM RELAY ONLY: anyone relaying the owner's authorization must quote the
owner's LITERAL words — NEVER a characterization or upgraded interpretation. An owner saying "I sent it" to a relayer is an action-CLAIM, not verification of CONTENT. If the owner's words are ambiguous, the gate is NOT met and you HOLD — you do NOT fill the gap. (Pairs with the fleet provenance-travels-verbatim rule.)
- GATE-SIGNAL = RECIPIENT CONFIRMS RECEIPT: the gate is satisfied ONLY when the
TARGET agent confirms, in ITS OWN channel, that it received the owner's specific unambiguous confirm — NOT when a relayer claims the owner "sent it." The recipient is always the source of truth for what was actually received. Fire the cutover only after the target confirms receipt. (The architecture must not depend on the relayer being perfect; the target verifying is the safety, which is why it exists.)
- STRONGEST / CANONICAL FORM (preferred): TARGET-INITIATED — the target itself asks
its owner, IN ITS OWN CHANNEL, to authorize the migration; the owner approves THERE verbatim; the target confirms receipt. This keeps the entire authorization path inside the target's own trusted channel with ZERO relayer, structurally closing the inflation gap rather than relying on relay discipline. (You may still paste the owner the exact phrase to send — but the GATE is the target's receipt-confirmation, never your claim.)
2b. ONE-TIME TOKEN — defense-in-depth for REQUEST AUTHENTICITY (defect 8ii), optional layer / sufficient alone only for REVERSIBLE migrations. The orchestrator mints a short ONE-TIME TOKEN, pre-arms the source ("comply when the migration agent requests handoff:create AND quotes token <TOKEN>"), and the migration agent ECHOES that exact token INLINE with the provenance. This proves the handoff request is the authentic migration agent (defeats an attacker riding the window) and is appropriate for low-stakes/reversible migrations — but for an irreversible cutover it is a SUPPLEMENT to 2a, never a replacement.
In all cases: NEVER a bare urgent demand, and NEVER bypass a refusal — if the source refuses, the authorization gate was not satisfied; fix it (get the owner confirm), do not force past it.
- FLUSH IN-SESSION CORRECTIONS FIRST (defect 13 — HARD pre-handoff step).
Before the source runs handoff:create, tell it to FLUSH any recent in-session behavioral corrections to PERSISTED state (memory/ + GUARDRAILS.md): routing rules, suppression rules ("never surface X"), triage-only rules, per-recipient overrides — anything a human told it THIS session that it has not yet written down. The migration carries only PERSISTED artifacts + the handoff; unpersisted in-session context does NOT exist as migratable state and will be LOST at cutover. It is also not enough for the correction to change behavior while leaving a stale config/cron in place — e.g. if the operator said "stop sending pending-items direct to the principal" but the cron prompt still says so, the migrated cron inherits the WRONG behavior. So the source must, in this flush: (a) write the correction to memory/GUARDRAILS.md, AND (b) fix any config/cron whose text still encodes the pre-correction behavior. This is a KNOWN HARD LIMITATION of migration, not a bug to engineer around: the handoff is a summary, not a substitute for persisted guardrails. (Observed failure mode: a migrated agent inherited several same-day behavioral corrections that were never persisted — it resumed sending items directly to the principal, surfaced messages it had been told to suppress, and re-surfaced a suppressed item — because the source agent never wrote those corrections down before cutover.)
- Tell the (now pre-armed) LIVE source agent to run its NORMAL handoff procedure
(the same handoff:create it runs at its context-handoff threshold). Do NOT synthesize a handoff yourself.
- convert.py BLOCKS and polls the SOURCE WORKSPACE
<src-dir>/memory/handoffs/—
where agents ACTUALLY write handoffs (defect 8i: NOT state/<source>/handoffs/, which usually does not exist) — for a handoff whose mtime is AFTER the migration-start timestamp. A pre-existing stale handoff does NOT satisfy the gate. If no fresh handoff appears within --handoff-wait seconds (default 300), the cutover ABORTS: the source is NOT disabled, the target is NOT enabled (end_state cutover-aborted). That fresh handoff is then carried into a DETERMINISTIC location in the new agent's dir so it is ALWAYS reliably read on boot (not a "newest file" guess): into BOTH the daemon boot-state dir state/<target>/handoffs/ AND the new agent's WORKSPACE memory/handoffs/ (its native handoff:resume dir), as the NEWEST file in each, and a deterministic boot directive (state/<target>/.handoff-doc-path) is written so the daemon points the new agent at the exact file as its FIRST action on boot (the same CONTEXT HANDOFF injection mechanism the daemon uses for restarts). The side-by-side (--bot-mode new) and disabled (default) paths do NOT take over the source and are NOT gated.
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 93 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingcommunity/skills/claude-to-codex-migration/SKILL.md
Popularity
- Repository stars
- 92
- Repository forks
- 114
- 7-day trend score
- 23
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/grandamenium/cortextos/claude-to-codex-migration)