Skip to main content

decide_role

Function decide_role 

Source
pub fn decide_role(signals: &RoleSignals<'_>) -> ModelRole
Expand description
Unstable (feature: role-switching) — may change or be removed
Decide the active role from signals, in priority order.
  1. RoleSignals::explicit_override — a user pin always wins.
  2. RoleSignals::current_tool — a tool declares its role (e.g. commitModelRole::Commit).
  3. long context — estimated_tokens > long_context_thresholdModelRole::Slow.
  4. RoleSignals::thinking_enabledModelRole::Slow.
  5. RoleSignals::is_trivialModelRole::Smol.
  6. otherwise → ModelRole::Default.

Long-context and thinking both select Slow (the heavy model) but are distinct signals: a long context may need a large window even without extended thinking, and thinking may be on for a short prompt.