Each proposed step now dispatches the serial agent/step-boundary event
after claiming input, then agent/model, and publishes the chosen model
selection as the optional agent.step until the step ends or its proposal
is rejected, fails, or is cancelled. agent/pre-step listeners, tool
conditions, prompt sections, and the provider and model variables read
agent.step, so the pre-step payload, AssembleContext, and
ToolActivationContext carry no model selection field.
Plan mode commits pending selections at the step boundary, before model
choice, and still narrates the switch in the first admitted step. The
system prompt assembles once after step/start, including runtime context,
and system-prompt/prepare is removed. The runtime-context snapshot is
admitted after the step's accepted messages, so a changed runtime context
alone no longer opens a step.
Rename agent/route to agent/model and make its result a complete
ModelSelection, so each step fixes its provider, model, and reasoning
effort before prompt preparation, agent/pre-step, tool conditions, and
every request attempt. agent/request may change only sampling controls;
returning another provider, model, or reasoning effort fails the step.
installModelSelection installs one agent/model listener and
ModelSelectionRef drops assembled. The pre-step payload, AssembleContext,
and ToolActivationContext carry modelSelection. Webhook initial
selection and the CLI mock effort switch move to agent/model.
- Add the agent/route waterfall, dispatched once per proposed step before
system-prompt/prepare and agent/pre-step; model selection captures its
choice there, and a later selection applies from the next step.
- Pass the chosen StepRoute to prompt preparation and assembly, the
agent/pre-step payload, and tool conditions; remove Agent.currentRoute().
- Run agent/request and prepareCall() for each attempt after step/start and
prompt assembly; agent/request may change only call controls, and another
provider or model fails the step.
- Resolve conditional tools and assemble the prompt once per step; retries
reuse the route, tool set, and rendered assembly.
- Update documentation, Agent Notes, generated catalogs, tests, and the
cordis-inspect-jsdoc snapshot.