Skip to content

route — OpenAI Codex CLI

Estimate a Codex task and preview its central policy worker assignment.

In practice

What it does

Classifies work, estimates it from current Codex pricing data, and previews the central policy assignment. Ordinary implementation resolves among Luna, Terra, and Sol; Astra remains the orchestrator and reserved recovery target.

When to reach for it

  • Use it before a multi-file change, long agent loop, migration, or other expensive run.
  • Use it to compare worker tiers and make a per-request long-context assumption explicit.
  • Not for manufacturing recovery evidence or overriding the selected model in extra CLI arguments.

Worked example

python3 bin/codex_pricing.py models
python3 bin/codex_pricing.py est <profile> <worker-tier>
python3 bin/codex_execute.py prepare --role implementer --model <worker-tier> --json

Choose cheap for mechanical work, mid for routine implementation and debugging, and strong for hard, security-sensitive, integration, or independent-verification work.

Failure modes & fallbacks

An unpinned legacy task safely maps to the configured default worker. A legacy frontier pin maps to the strongest worker without mutating the kit. If Astra is missing, central policy fails clearly even for worker previews, preserving the orchestration invariant. Direct host actions outside the supported bridge cannot be attested by the driver.

Cost & safety

Pricing and prepare commands are read-only. Under a subscription, lead with burn index and label dollars as API-equivalent proxies; show real dollars only for API-metered runs. Availability, effort levels, limits, and model identifiers come from the pricing source at runtime.

  • architect turns routing choices into a durable kit.
  • execute dispatches through the same policy.
  • usage reports historical observed activity.

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/route/SKILL.md.

Resolve the plugin root before running commands

Resolve POLYTROPOS_ROOT from this skill's location. In a managed copy use POLYTROPOS_ROOT="{{POLYTROPOS_ROOT}}". Reject a literal placeholder. Confirm pricing data, bin/codex_pricing.py, bin/codex_policy.py, and bin/codex_execute.py exist. If not, stop and use python3 bin/harness_select.py doctor --harness codex.

Use the pricing engine for every estimate; it is the only source for availability, identities, effort levels, request-size rules, and prices. Under a ChatGPT plan, lead with burn index and call every dollar figure an API-equivalent proxy. With API-key billing, the engine's estimate is token-metered. State the per-request size assumption and keep aggregate session totals separate.

python3 "$POLYTROPOS_ROOT/bin/codex_pricing.py" models --profile <PROFILE>
python3 "$POLYTROPOS_ROOT/bin/codex_pricing.py" est <PROFILE> <worker-tier>
python3 "$POLYTROPOS_ROOT/bin/codex_execute.py" prepare --role implementer --model <worker-tier>

Choose cheap for mechanical work, mid for routine work, and strong for difficult, security, integration, or independent verification work. The policy maps each to an available worker. Astra is reserved for planning, coordination, final acceptance, and evidence-gated recovery; never recommend it as an ordinary implementation pin. prepare is a plan, not runtime proof: retain distinct planned, dispatched, and observed fields, with unknown observations left unknown.

That is the reserved policy, the default. When the user explicitly asks for direct routing, preview the opt-in adaptive policy with prepare --role implementer --model <tier> --policy adaptive --preference <cost|balanced|quality> --explain: it may send a hard task straight to an eligible capable model, the frontier included, and prints the floor, the model and effort, every alternative with the filter that set it aside, and an est. API-equivalent figure when --profile is given. Hard filters (availability, pins, unsupported effort, budget) apply before any preference. Never switch the default yourself; a kit opts in through a PLAN.md routing: line or the run's --policy flag.

For multi-task work use $architect and $execute; for a one-off, prepare through central policy rather than a custom dispatch recipe.

Optional context travel

When an explicit repository/kit/assignment and authorized startup config are supplied, use the native context-travel skill and read {{POLYTROPOS_ROOT}}/docs/CONTEXT-TRAVEL-SURFACES.md on demand for a bounded scope brief. Treat missing, stale, partial, or refused context as advisory; retain this workflow's authoritative sources, policy, pricing, permission, and mandatory verification rules. If no authorized context transport is available, continue this workflow and report context unavailable.