Repository navigation
Dynamic Mode for Codex — Adaptive Model and Effort Router #47576
Description
What variant of Codex are you using?
IDE Extension
What feature would you like to see?
Dynamic Mode for Codex — Adaptive Model and Effort Router
Objective
Add to Codex a Dynamic Mode that removes the need for the user to manually choose, before every request, the model and the level of reasoning effort.
The user should be able to simply describe what they want to achieve. The system should automatically choose the model and effort best suited to each individual phase of the work, re-evaluating them when the nature of the work changes.
The goal is not simply "to use the cheapest model", but to achieve the best balance between required capability, speed, reliability, and consumption of the usage allowance.
User experience
In the model selector, next to "Default" and before the list of individual models, an entry such as the following could appear:
Dynamic Mode
When it is active, the user keeps working normally: they write the request and press Enter. They do not have to interrupt their flow to decide each time which combination of model and effort to use.
The model selected at that moment can remain visible in the interface until the work starts. When the router decides to change it, Codex can briefly show the switch, for example:
GPT-6 Sol → GPT-5.6 Terra
The selector should therefore also reflect the model actually being used at that moment, making the behavior transparent.
Specialized preliminary router
When a new request arrives, a lightweight, specialized router steps in before the actual execution.
The router must not perform the task. It must quickly analyze what is needed to perform it and return an operational decision, for example:
- complexity of the work;
- quantity and type of files to inspect or modify;
- risk of regressions;
- need for reasoning;
- tools required;
- planned checks and tests;
- any subsequent steps that are already foreseeable;
- most appropriate model;
- sufficient level of effort.
The router must be designed specifically for this function: not a generic agent chosen at random for each request, but a component with a stable task and a structured response.
Advance analysis of possible branches
Where possible, the initial analysis should also anticipate plausible scenarios.
Example: the user reports that the bottom of some pages gets cut off when the content loads slowly. The analysis might uncover two possible causes:
- Scenario A: a local problem, solvable by modifying a limited part of the code;
- Scenario B: a structural problem that requires a broader change to the architecture.
If the router is already able to identify these scenarios, it should also determine in advance which model/effort combination would be appropriate for each of them.
When Codex asks the user which path to follow and the user chooses A or B, it should not be necessary to repeat the routing analysis from scratch. The decision for that branch is already available.
A new router pass is needed instead if an unforeseen Scenario C emerges during the work or if the nature of the problem changes substantially.
This reduces latency, unnecessary consumption, and duplicated work.
Dynamic routing within the same task
The choice should not happen only once at the start of the session.
A long piece of work can contain phases with very different needs. For example:
- understanding a complex bug;
- modifying a delicate component;
- making a simple change in a second file;
- running tests;
- fixing a small regression;
- committing and pushing.
It makes no sense to necessarily keep the same model and the same level of effort for all of these phases.
Dynamic Mode should therefore re-evaluate the routing when a substantially different unit of work begins, without continuously running unnecessary analyses.
A powerful model can be used for the part that requires it and, once that phase is finished, Codex can automatically go back to a lighter model for simple operations such as routine checks, small modifications, or commit/push.
Likewise, if a phase that was initially simple becomes more complex than expected, the system can escalate to a higher model or effort.
Feedback from execution
The router should not base its decisions solely on the initial estimate of the task. If that first analysis is wrong, the system risks reinforcing the same mistaken choice instead of correcting it, since it has no way of noticing the error.
For this reason, it is useful for the router to also receive a low-cost external signal coming from the execution side: for example, failed tests, unexpectedly modified files, or commands that do not complete successfully.
This signal does not require a full new analysis, but it allows the router to react to what actually happened during the work, rather than simply re-reading and confirming its initial plan. In this way, any escalation or change of course happens based on concrete evidence, not just a new theoretical estimate.
Fundamental principle: sufficient capability, not maximum capability
The criterion should not be:
"Which is the most powerful model available?"
but:
"Which model/effort combination has sufficient capability to carry out this phase of the work well?"
This avoids both the excessive use of the most expensive models and the opposite problem: choosing a model that is too weak, which makes mistakes, loses context, or forces the work to be redone, ending up consuming more resources.
The optimization must therefore consider the overall cost of the useful result, not simply the nominal cost of the individual call.
User control modes
The feature should be optional and coexist with manual selection.
There could be at least two behaviors:
Automatic: Codex performs the switches autonomously and immediately continues the work.
Automatic with confirmation: when the router proposes a significant switch, Codex shows the recommended model and effort and allows the user to confirm before proceeding.
Expert users also keep the ability to manually select model and effort whenever they wish.
Consumption transparency
The router's analysis has its own small computational cost. This should be taken into account and, if possible, made transparent.
The principle is that this overhead must be minimal compared to the real work and justified by the savings obtained by avoiding oversized models, duplicated analyses, or failed attempts with insufficient models.
If Codex shows usage statistics, it would be useful to distinguish the consumption related to routing from that related to task execution.
Complete example
The user writes:
"In my extension some pages get cut off at the bottom, especially when they load slowly. Find the problem and fix it."
- The router quickly inspects the necessary context.
- It identifies complexity, risk, and possible branches.
- It establishes the appropriate model and effort for the initial investigation.
- Codex automatically performs the switch and starts the work.
- If two plausible solutions emerge, Codex presents them to the user; the router has already prepared, when possible, the routing for both.
- The user chooses a solution.
- Codex immediately proceeds with the combination already planned, without an unnecessary second analysis.
- If a new and substantially different problem emerges during implementation, the router is called again.
- Once the complex part is finished, tests and simple operations can be automatically assigned to a lighter combination.
- The interface makes the switches visible without interrupting the flow.
Why it is different from a simple "automatic model selection"
A feature that merely says "simple task → small model, difficult task → large model" solves only part of the problem.
The proposal described here instead concerns a continuous but non-redundant orchestration system that:
- understands the task before executing it;
- anticipates, when possible, its branches;
- associates model and effort with the different phases;
- reuses decisions already made;
- re-evaluates only when the problem really changes;
- can increase or decrease capability during the same piece of work;
- keeps switches visible;
- always leaves the user the possibility to choose manually or request confirmation.
In essence, the user chooses the result; Codex dynamically manages the resources needed to achieve it.
Expected result
Dynamic Mode should make Codex simpler for those who do not want to learn the differences between dozens of model/effort combinations and, at the same time, more efficient for expert users.
The ideal result is a flow in which the user does not have to keep asking themselves:
"Which model should I choose now, and with which level of effort?"
That decision becomes part of the orchestration of the work, while manual choice always remains available.
dynamic_mode_codex_github_ready (2).md
Additional information
I’m aware of existing proposals for automatic model and reasoning-effort selection. I’m opening this as a separate issue because this proposal is materially different in scope: it describes a concrete dynamic routing mechanism, including preliminary task analysis, anticipated branches, non-redundant re-routing, and model/effort switching between different phases of the same task. The attached proposal explains these differences in detail.
Related issues:
- Automatic cost-aware model routing in Codex #46366 — cost-based automatic routing
- CLI: Make Auto the default model selection and resolve it on the first task #47785 — Auto as the CLI default, resolved once on the first task
- [Feature Request] Per-thread Auto mode that routes both model and reasoning effort #34278 — per-thread Auto mode for model and reasoning effort
- Add a Smart model picker option that automatically routes each task to the right Codex model #43868 — Smart model picker across Codex surfaces
- “Auto” reasoning effort (dynamic tiering) for Codex CLI #8649 — automatic reasoning effort for the CLI
The main difference in this proposal is model/effort switching between different phases of the same task, with pre-computed routing for anticipated branches and re-routing triggered by execution feedback. For example, #47785 explicitly keeps the selection fixed for the session and does not cover switching within an active task.
Activity
github-actions commentedon Sep 23, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
vladzdev commentedon Sep 24, 2026
One thing I'd be careful about is letting the router judge its own decision too much. If the initial task analysis is wrong, the system can end up reinforcing the same bad choice.
Having a cheap external signal from the execution side would probably help here - tests, changed files, failed commands, etc. Then the router is reacting to what actually happened rather than just re-reading its own plan.
Axagon79 commentedon Sep 25, 2026
@vladzdev Thanks, that's a very good point. If the initial analysis is wrong, a router that only re-reads its own plan would just confirm the same mistake.
I've updated the proposal with a new section, "Feedback from execution": the router should also take low-cost signals from the execution side (failed tests, unexpectedly modified files, failed commands), so that any escalation or change of course is based on what actually happened, not only on its initial estimate.
icybiz commentedon Oct 14, 2026
I built and have been using a working source prototype of a narrower,
deterministic version of the phase-level routing proposed here. It may be
useful implementation evidence for this issue:
https://github.com/icybiz/codex-taskdriven/tree/taskdriven-0.161.0
Instead of running a separate classifier before every turn, the prototype lets
the user define named work phases and assign a model plus reasoning effort to
each phase. The agent changes phase through a dedicated
set_work_phasecontrol step, and the next model request continues in the same thread with the
configured model and effort.
The default phases are Writing, Investigation, Implementation, and
Verification, but their names, descriptions, models, and effort levels are
editable from the existing
/modelflow. Available choices come from Codex'slive model catalog rather than a hard-coded model list, so newly available
models can be assigned without another UI-specific release.
The prototype also covers several details that became important in regular
use:
activation;
This provides an explicit, inspectable baseline that could complement the
fully adaptive router proposed in this issue: users can choose the allowed
phase-to-model policy, while Codex decides when the work has moved from
investigation to implementation or verification. It avoids an extra routing
inference for every ordinary transition and gives expert users deterministic
cost and capability boundaries.
The published branch is based on
rust-v0.161.0. Focused and surroundingtest suites passed in the prototype tree, including TUI, core, app-server,
CLI, Guardian, routing, and code-mode-host tests. The behavior and configuration
format are documented here:
https://github.com/icybiz/codex-taskdriven/blob/taskdriven-0.161.0/docs/taskdriven.md
I am linking the implementation as a reference rather than opening a pull
request, in accordance with the repository's external-contribution policy.
Axagon79 commentedon Oct 16, 2026
@icybiz
Hi, thank you for sharing your work and the prototype you've developed!
I find your approach interesting, and I understand its advantages, particularly in terms of control and predictability.
I believe our proposals follow two different but equally valid philosophies.
My idea primarily comes from a desire to simplify the user experience. Not everyone is familiar with the capabilities of different models or knows which reasoning effort level is appropriate for a particular task.
With a fully automatic mode, users could simply enable the option and let Codex dynamically select the most appropriate model and reasoning effort, aiming to optimize quality, speed, and resource usage.
This would still maintain full transparency about model changes, with optional user confirmation and, of course, the ability to continue using manual model selection.
The goal is to make the experience smoother and more accessible, without introducing additional complexity, especially for less experienced users.
I believe the two approaches could complement each other.
Thanks again for contributing to the discussion!