Installs an evidence-first Codex workflow for Terra, Luna, and Sol while preserving the user's primary model and unrelated Codex configuration.
Routing is advisory. Codex reads the installed agents and skills and decides when to delegate. This package does not intercept prompts or guarantee a hard model switch.
Project:
npx codex-model-router@latest installCurrent user:
npx codex-model-router@latest install --globalEnable package-managed multi-agent V2:
npx codex-model-router@latest install --v2Use --global --v2 for the current user. Restart Codex after installation.
| Scope | Agent definitions | User skills |
|---|---|---|
| Project | <project>/.codex/agents |
<project>/.codex/skills |
| Current user | ~/.codex/agents |
~/.codex/skills |
Skills are installed under .codex/skills/<skill-name>; reinstalling safely migrates package-managed legacy skills and prints the resolved paths.
npx codex-model-router@latest install \
--terra-reasoning medium \
--luna-reasoning xhigh \
--sol-reasoning medium \
--terra-fastWhen --terra-reasoning is omitted, managed Terra children default to medium.
| Option | Purpose |
|---|---|
--set-default |
Set Terra/high as the primary default |
--agent-reasoning <level> |
Set reasoning for all managed agents |
--terra-reasoning <level> |
Set Terra reasoning |
--luna-reasoning <level> |
Set Luna reasoning |
--sol-reasoning <level> |
Set Sol reasoning |
--agent-fast / --no-agent-fast |
Set Fast preference for all managed child roles; role options take precedence |
--terra-fast / --no-terra-fast |
Set Terra Fast preference |
--luna-fast / --no-luna-fast |
Set Luna Fast preference |
--sol-fast / --no-sol-fast |
Set Sol Fast preference |
--v2 |
Enable or repair package-managed V2 |
--global |
Apply the installation to the current user |
Reasoning values: none, low, medium, high, xhigh, max.
Fast and reasoning are independent and retained only for the same child role. Use status [--global] to view them; Codex currently has no per-child Fast runtime control, so configured=true reports effective=not-supported.
All diagrams are collapsed by default. Select a heading to expand it.
Plan-artifact persistence and cleanup
flowchart TD
A[Terra or Sol returns plan content] --> B{Active writable executor?}
B -->|No| C[Keep a self-contained in-memory artifact\nDo not claim a file write]
B -->|Yes| D[Atomically write\n<CODEX_ROOT>/model-router/workflows/<workflow_id>/PLAN.md]
D --> E[State: active\nRecord plan_path and owner]
E --> F{Verification PASS?}
F -->|No, blocked, resume, or switch| G[Preserve path, version, and owner]
F -->|Yes| H[State: pending-cleanup]
H --> I[Same cleanup owner\nRemove only this workflow directory]
I -->|Success| J[State: removed]
I -->|Failure| K[State: cleanup-failed and report it]
- The same model is not spawned twice in one workflow.
- A matching primary model performs that role in the primary thread.
- Stage and Luna mode gate writes;
luna_execution_enabledis migration-only and cannot replace the mode. - Terra plans and independently verifies; Sol joins after a non-PASS result.
- Luna keeps the same
luna_role_idfor the root session/workflow; after demotion it runs only stage-authorized canonical action IDs asINTERACTION_ONLY. - The final response always returns through the primary model.
install --v2 → enable V2; repair a modified or missing tracked marker block
install → disable unchanged package-managed V2
uninstall → remove the router and unchanged managed V2
When install --v2 is explicitly run again and package state still exists, a changed or missing package-marked V2 block is rebuilt, its hash is updated, and unrelated TOML is preserved. Pre-existing unmanaged V2, missing state, incomplete markers, or duplicate markers remain preserved and stop the operation to prevent accidental overwrites.
Project:
npx codex-model-router@latest uninstallCurrent user:
npx codex-model-router@latest uninstall --global- Preserves unrelated TOML, comments, BOM, ordering, and LF/CRLF.
- Uses path validation, scope locking, atomic transactions, and rollback.
- Except for rebuilding the package-marked V2 block after an explicit
install --v2, it never overwrites other user-modified managed files. - Never changes
AGENTS.md, shell profiles, editor settings, hooks, MCP servers, accounts, telemetry, or environment variables.
- Node.js 18 or newer.
- Codex with custom-agent and local-skill support.
- Access to
gpt-5.6-terra,gpt-5.6-luna, andgpt-5.6-sol. - Windows, Linux, or macOS.
Security issues: see SECURITY.md. Maintainer release steps: see MAINTAINERS.md.







