Migrate to codex

From zuharz/ccode-to-codex · View interactive version

Migrate to codex is an AI agent skill from the GitHub repository zuharz/ccode-to-codex. Migrate Claude-era skills into native Codex skill artifacts with a preservation-first workflow. Also migrate project-local Claude slash commands and command hooks in batch mode as review-required Codex artifacts. Classify migration risk, preserve control shape, validate runtime-coupling leaks, and r

How to use this skill

Skill file

<!-- Generated by the ccode-to-codex mirror sync on 2026-04-14 from input revision 9a2403fb. -->

Migrate to Codex

Preserve the source workflow first. The goal is not to transliterate Claude

primitives. The goal is to produce the Codex skill artifact that best preserves

the source skill's behavior.

Conversation-First Entry

Bare or vague requests should not dump raw script flags immediately. Resolve the

request through the shared contract in

references/conversational-migration-contract.md.

Default menu for underspecified requests:

  1. Assess one skill
  2. Preview one skill
  3. Migrate one skill live
  4. Batch assess pending skills
  5. Review one migrated skill for nativeness
  6. Explain blockers and statuses

Routing rules:

migrate <skill>, or review <skill>, route directly.

in plain text.

Advanced CLI

Explicit Non-Goals

output. They are compatibility artifacts that require manual review.

Sandbox Policy

Recommended mode: workspace-write

Rationale: this workflow creates skill files, updates repo-local documentation,

and runs validation scripts. Infrastructure or deployment access is not needed.

Runtime Contract

  1. Codex callable MCP namespaces use underscore-normalized server names.
  2. Hard MUST / NEVER / ONLY constraints survive verbatim.
  3. Preserve the source workflow's control shape unless Codex lacks a required primitive.
  4. Preserve direct execution when Codex supports it. Only redesign into manager-to-subagent when the source truly depends on task/team semantics.
  5. Do not invent spawn_agent, wait_agent, update_plan, or approval requirements unless the source workflow genuinely needs them.
  6. User interaction is mode-dependent: request_user_input exists only in Plan mode; outside Plan mode rely on normal user messages or approval workflow.
  7. File edits use apply_patch when the workflow actually edits files.
  8. Explicitly named Claude agents that exist under .claude/agents/*.md are hard runtime dependencies. Never substitute, downgrade, drop, or neutralize them during skill migration. If .codex/agents/<name>.toml is missing, stop and route to migrate-agents-to-codex.
  9. Claude skill references are context-sensitive. Only operational uses are hard migration dependencies. Related-skills tables, troubleshooting notes, provenance/history, and redirected-skill markers are not blockers by themselves.
  10. For ambiguous skill mentions, the Python migrator extracts structured candidates and returns MANUAL_REVIEW_REQUIRED. The interactive Codex skill then owns the read-only mini-auditor pass. If the auditor still cannot classify a mention confidently, keep the skill in manual-review state rather than auto-blocking or auto-migrating.

Reference Map

| Reference | Load when |

| --- | --- |

| references/primitive-mapping.md | You need authoritative primitive translation rules or sandbox inference |

| references/embedded-agent-taxonomy.md | The source skill embeds Claude Agent(...) or Task(...) sub-agent sites and you must distinguish inline slices from named agent dependencies |

| references/complexity-classifier.md | You need to decide Tier 1 vs Tier 2 vs Tier 3 |

| references/codex-skill-template.md | You are hand-authoring a Tier 3 native skill |

| references/architectural-patterns.md | You need preservation-first rules or runtime-coupling checks |

| references/conversational-migration-contract.md | You need the shared menu/direct-routing/confirmation rules for the migrate-* family |

| ../migrate-agents-to-codex/SKILL.md | You need the agent-only migration workflow or its direct script entrypoint |

| docs/how-to/claude-to-codex-agentic-migration.md | You need the repo-level migration contract and CLI examples |

Scripts

| Script | Purpose |

| --- | --- |

| .codex/skills/migrate-to-codex/scripts/migrate_claude_workflows_to_codex.py | Deterministic migration engine with preflight classification, --analysis-only, and additive --json structured output |

| .codex/skills/migrate-to-codex/scripts/migration_doctor.py | Read-only readiness layer for the migration family: blocker counts, existing validator failures, drift, pending nativeness review, and oversized packages |

| .codex/skills/migrate-to-codex/scripts/run_migration_workflow.py | Script-driven orchestration: doctor -> migrate -> validate -> tracker refresh -> dashboard summary, with optional materialized preview and markdown evidence report |

| tools/migration_support/ | Shared migration-family support package for tracker CLI, tracker state, nativeness handoff, and repo-root path helpers |

| tools/migration_support/validate_names.py | Thin wrapper around the shared Codex migration validator |

Discovery Summary

mode into single-file skills named command-* under .codex/skills/.

mode into the Codex hooks config file.

Generated hooks are always reported as "Check before using."

Known Corrections

Migration State

write. File existence may unblock downstream migrations, but native status

still requires a recorded manual nativeness review.

state. Hook config is operational-review-required and is not native-tracked in

v1.

User Checkpoints

| Checkpoint | When to stop |

| --- | --- |

| Dependency resolution | An operational referenced skill exists only in the legacy Claude skill tree, an ambiguous mention still needs manual classification, or a named agent still lacks a .codex/agents/*.toml contract |

| Audit escalation | Step 5 still returns any CRITICAL or HIGH findings after the convergence pass |

| Judgment-required rewrite | A fix changes behavior rather than restoring compatibility |

Workflow

0. Resolve Interaction Mode

Before running any backend script, decide whether the user gave a directly

actionable request or needs the family menu:

write logic and jump to Step 5 as a read-only nativeness audit

Preferred execution path:

explicit confirmation step

Keep raw migrate_claude_workflows_to_codex.py usage as the power-user path,

not the default conversational front door.

Named --skill <name> execution is intentionally narrow: it processes only the

named Claude skill package and does not convert command files or hook settings

as a side effect. Batch mode (--all or zero-argument execution) processes

non-archived skills plus project-level command and hook surfaces.

1. Resolve Gold Standard and Assess Targets

Context: The user provides one skill, a batch of skills, or --all.

Why first: bad target classification causes the rest of the workflow to produce polished but invalid output.

Action:

  1. Confirm examples/hello-world-skill/SKILL.md exists. If it does not, fail fast or fall back explicitly to the template and pattern references.
  2. Reject agent targets immediately. This workflow accepts Claude skills only; if the request points at .claude/agents/ or names an agent spec, route to migrate-agents-to-codex.
  3. Scan the skill body and active references for embedded agent sites using references/embedded-agent-taxonomy.md:
  1. Run preflight classification before any transform:
  1. Classify each skill target with references/complexity-classifier.md after preflight.
  2. Run the preservation gate before rewriting:
  1. Resolve cross-references before migrating. First classify each mention as operational, reference-only, or ambiguous.
  1. Skip skills whose entrypoint marks them archived or redirected immediately.
  2. Reframe invalid requests early:

Result: Each skill target is classified as MECHANICAL_SAFE, MANUAL_REVIEW_REQUIRED, REFACTOR_REQUIRED, or BLOCKED before any transform runs.

Anti-patterns:

2. Fix Tooling Once Per Session

Context: The migration scripts are shared infrastructure. Fix them once, then reuse them.

Why this phase exists: migration defects in shared tooling create repeated downstream drift, so fix the engine before fixing artifacts.

Action:

  1. Ensure banner insertion happens after YAML frontmatter.
  2. Expand primitive mappings using references/primitive-mapping.md.
  3. Teach shared tooling to refuse unsafe automation and over-broad dependency blocking:
  1. Add or verify --skill, --all, --dry-run, and --analysis-only.
  2. Preserve the root CLI contract: zero-argument execution must remain valid through the repo-level wrapper.

Result: The migration engine is safe to use for deterministic conversion.

Anti-patterns:

3. Verify Domain Content Before Writing

Context: Skill content drifts. Verify first, write once.

Why this phase exists: stale paths and broken examples are expensive because they survive syntax validation and only fail when a later agent executes them.

Action:

  1. Check prompt template paths, file references, and code examples against the live repo.
  2. Replace unverifiable details with neutral prose rather than shipping stale guidance.
  3. Search the active docs, scripts, and migrated tree for old-source runtime coupling.
  4. For Tier 3, scan the full skill package, not just SKILL.md.

Result: The output will not encode stale paths, broken references, or incorrect repo assertions.

Anti-patterns:

4. Execute the Migration

Why this phase exists: execution strategy must match tier; using the wrong path here is the main source of false “completed” migrations.

Tier 1:

  1. Run python3 .codex/skills/migrate-to-codex/scripts/migrate_claude_workflows_to_codex.py --skill <name>.
  2. Copy non-markdown files with the migrated package.
  3. Treat the written artifact as pending_native_review.
  4. Spot-check the output before relying on it operationally, then complete Step

5 before calling it native.

Tier 2:

  1. Run the mechanical conversion.
  2. Review MCP servers, sandbox choice, primitive semantics, and reference portability.
  3. Keep asset parity: migrate supporting references and scripts together.

Tier 3:

  1. Do NOT run mechanical conversion -- output would be non-functional.
  2. Read the gold standard and references/codex-skill-template.md.
  3. Hand-author the native skill, preserving control shape and hard constraints.
  4. For embedded agents, branch by taxonomy:
  1. Copy pure documentation reference files only when they are still correct after Step 3.

Result: A migrated skill package exists in .codex/skills/.

Classifier gate:

nativeness review is still mandatory before native completion

Anti-patterns:

5. Validate and Audit for Nativeness

Why this phase exists: structural validity is necessary but not sufficient; nativeness is a higher bar than “file parses”.

Review-only entry: If a skill already exists under .codex/skills/ and the

tracker says it is pending_native_review, this phase may be invoked directly

as a read-only single-skill review flow. In that entry path, audit first,

present findings plus next actions, and auto-record native by default when

the final audit result is NO_FINDINGS unless the user explicitly asked for

audit-only behavior.

Dashboard routing note:

phase after review next, review <number>, or review <name>.

owns the reviewer prompt, delegated lifecycle, evidence-record guidance, and

tracker close-out instructions.

Structural validation:

  1. Run python3 tools/migration_support/validate_names.py --scan-dir .codex/skills/<name>.
  2. Check YAML frontmatter, line count, naming, stale source-path leaks, absolute home paths, and missing local assets.
  3. When using preview mode, validate the preview package before touching the live .codex/skills/ tree.

Native Codex compliance audit:

verdict, top findings, next action, and evidence path. Do not paste

the full audit into the main thread.

meant to be recorded later. Reuse the existing migration evidence directories

or an explicit /tmp review path, then attach that path through

--review-evidence at tracker close-out.

Completion gate:

Anti-patterns:

6. Report

Why this phase exists: the caller needs a migration status, not just modified files.

Report each migration with:

For batch mode:

  1. Assess all targets first.
  2. Process Tier 1 in batch.
  3. Queue Tier 2 for sequential review.
  4. Queue Tier 3 for hand-authoring.
  5. For nativeness review of a completed migrated batch, auditors may run in

bounded parallel waves when write scopes do not overlap, for example

3 parallel auditors -> parent fixes -> convergence -> 3 parallel auditors.

  1. End with a consolidated summary and recorded review outcomes.

Anti-patterns:

Verification Checklist

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.