Skip to content

doctor — OpenAI Codex CLI

Diagnose Codex plugin, policy, app configuration, agents, skills, and managed-install state without changing it.

In practice

What it does

Inspects the Codex plugin, native skills, managed agent roles, central policy, and application configuration without changing them. It distinguishes files owned by application policy from unmanaged conflicts and reports missing or stale installation surfaces.

When to reach for it

  • Use it when a native $skill is absent, stale, or points at an old plugin cache.
  • Use it before applying policy after moving or updating the repository.
  • Not for repairing files automatically; diagnosis is deliberately read-only.

Worked example

python3 bin/harness_select.py doctor --harness codex
python3 bin/codex_app_policy.py status --repo-root . --codex-home <codex-home>

The first command checks package and skill discovery. The second explains the managed Astra orchestration and Luna, Terra, and Sol worker configuration.

Failure modes & fallbacks

If a plugin root cannot be proven, run doctor from a known repository checkout rather than guessing a cache path. If managed roles conflict with user-owned files, inspect the ownership report before applying. Missing Astra fails clearly and never weakens worker-routing restrictions.

Cost & safety

Doctor and status are local, read-only checks. They do not invoke a model, consume an implementation assignment, rewrite application configuration, or install the plugin. Review a generated plan before running the separate apply operation.

  • route previews the assignment after configuration is healthy.
  • execute enforces the same policy at dispatch.
  • effort validates model-specific reasoning levels.

The skill card — what the model reads

This is the SKILL.md body the model reads, transformed for this page: the source's own leading title, if it had one, is removed; every remaining heading is demoted one level to nest under this section; and relative links are rewritten to site or GitHub URLs. ${CLAUDE_PLUGIN_ROOT} and {{POLYTROPOS_ROOT}} are install-time path variables, left intact exactly as the model sees them. The unmodified original is codex/skills/doctor/SKILL.md.

Resolve POLYTROPOS_ROOT from this skill's location. In a managed copy use POLYTROPOS_ROOT="{{POLYTROPOS_ROOT}}"; reject the literal placeholder. Confirm pricing data, bin/harness_select.py, bin/codex_policy.py, and bin/codex_app_policy.py exist. If they do not, stop rather than guessing a path.

Run the read-only doctor and application diagnostics against explicit roots only:

python3 "$POLYTROPOS_ROOT/bin/harness_select.py" doctor --harness codex --repo-root "$POLYTROPOS_ROOT" --codex-home <codex-home> --json
python3 "$POLYTROPOS_ROOT/bin/codex_app_policy.py" status --repo-root "$POLYTROPOS_ROOT" --codex-home <codex-home> --backup-root <new-empty-dir> --json

Report package readiness, runtime activation as observed or unknown, policy availability, role-file ownership, planned application changes, and any unavailable required worker. Do not claim an arbitrary host-selected model or direct host tool is sandboxed by this policy boundary.

codex_app_policy.py apply writes configuration and needs an explicit runtime availability snapshot, explicit repository, Codex-home, and new empty backup roots. Preview with plan first, then obtain explicit user authority. It preserves unrelated TOML and refuses to overwrite unmanaged or edited agent roles. Legacy refresh remains an explicit --refresh-managed install action. Restart or start a new task after an authorized app change.