Skip to content

The agent that grows with you

feat(model-pickers): reasoning effort selection on every model picker

teknium12c0bec33f9c6
diff --git a/gateway/slash_commands_model.py b/gateway/slash_commands_model.py
index ab587f16cd6..f384216596a 100644
--- a/gateway/slash_commands_model.py
+++ b/gateway/slash_commands_model.py
@@ -70,6 +70,7 @@ class _ModelSwitchContext:
config_path: Any
persist_global: bool
one_turn: bool = False
+ reasoning_effort: str = "" # `--reasoning <level>` riding with the pick (typed path only)
restore_snapshot: Optional[dict] = None
current_model: str = ""
current_provider: str = "openrouter"
@@ -320,7 +321,15 @@ class GatewayModelCommandsMixin:
if error is not None:
return error
await self._record_model_switch(result, ctx, source=source, one_turn=one_turn, picker=picker)
- return await self._model_switch_confirmation(result, ctx, one_turn=one_turn, picker=picker)
+ reply = await self._model_switch_confirmation(result, ctx, one_turn=one_turn, picker=picker)
+ if ctx.reasoning_effort and not one_turn:
+ # `/model X --reasoning <level>`: same applier as /reasoning, same scope as the pick.
+ # The record step already evicted the cached agent, so the pin lands on the rebuild.
+ from gateway.run import _platform_config_key
+ reply += "\n" + self._apply_reasoning_selection(
+ ctx.session_key, _platform_config_key(source.platform), ctx.reasoning_effort,
+ persist_global=ctx.persist_global)
+ return reply
async def _send_model_picker(self, event: MessageEvent, source, adapter, session_key: str, listing_kwargs: dict, on_model_selected) -> bool:
"""Send the interactive /model picker; False when nothing was sent (text fallback). *source*
@@ -466,6 +475,7 @@ class GatewayModelCommandsMixin:
explicit_provider=request.explicit_provider,
),
one_turn=request.is_once,
+ reasoning_effort=request.reasoning_effort,
restore_snapshot=self._snapshot_session_model_override(session_key) if request.is_once else None,
)
ctx.read_config()
diff --git a/hermes_cli/cli_model_switch_mixin.py b/hermes_cli/cli_model_switch_mixin.py
index e8b0c7446f2..6212d8a575c 100644
--- a/hermes_cli/cli_model_switch_mixin.py
+++ b/hermes_cli/cli_model_switch_mixin.py
@@ -156,11 +156,48 @@ def _run_confirm_and_apply(cli, target, *args) -> None:
target(*args)
+def _picker_reasoning_rows() -> list[tuple[str, str]]:
+ """``(value, label)`` rows for the picker's effort step: the canonical ladder, the off state,
+ then a keep-current row (empty value = leave the effort alone)."""
+ from hermes_constants import VALID_REASONING_EFFORTS
+ rows = [(lvl, lvl) for lvl in VALID_REASONING_EFFORTS]
+ rows.append(("none", "none (disable reasoning)"))
+ rows.append(("", "Keep current effort"))
+ return rows
+
+
+def _picker_offers_reasoning(provider_data: dict, model: str) -> bool:
+ """False only when the inventory's capability map says the picked model has no reasoning
+ control; unknown capabilities keep the step (a no-op dial beats hiding a real one)."""
+ caps = (provider_data or {}).get("capabilities")
+ entry = caps.get(model) if isinstance(caps, dict) else None
+ return not (isinstance(entry, dict) and entry.get("reasoning") is False)
+
+
+def _apply_reasoning_after_switch(cli, effort: str, *, persist_global: bool) -> None:
+ """Apply a ``--reasoning <level>`` that rode along with a model pick. Runs AFTER the swap: the
+ agent's ``switch_model`` re-resolves ``reasoning_config`` from config.yaml, so an earlier write
+ would be clobbered. Session-scoped unless the pick itself persists (``--global``)."""
+ from cli import CLI_CONFIG, _cprint, _parse_reasoning_config, save_config_value
+ parsed = _parse_reasoning_config(effort)
+ if parsed is None:
+ return
+ cli.reasoning_config = parsed
+ if cli.agent is not None:
+ cli.agent.reasoning_config = parsed
+ saved = persist_global and save_config_value("agent.reasoning_effort", effort)
+ if saved:
+ CLI_CONFIG.setdefault("agent", {})["reasoning_effort"] = effort
+ _cprint(f" Reasoning effort: {effort}" + (" (saved to config)" if saved else ""))
+
+
def _commit_model_switch(
- cli, result, *, persist_global: bool, one_turn: bool = False, picker: bool = False) -> None:
+ cli, result, *, persist_global: bool, one_turn: bool = False, picker: bool = False,
+ reasoning_effort: str = "") -> None:
"""Stage + swap, print the summary, persist (session row unless --once; config on --global).
``picker``: tolerate context-resolution errors and label the config write "(--global)"; the
- typed path additionally records the one-turn restore snapshot."""
+ typed path additionally records the one-turn restore snapshot. ``reasoning_effort`` (from
+ ``--reasoning`` or the picker's effort step) is applied after the swap."""
from cli import HermesCLI, _cprint
old_model = cli.model
snapshot = cli._snapshot_model_runtime() if one_turn else None
@@ -169,6 +206,8 @@ def _commit_model_switch(
if not picker:
cli._pending_one_turn_model_restore = snapshot
_print_switch_summary(cli, result, old_model, one_turn=one_turn, strict_context=not picker)
+ if reasoning_effort:
+ _apply_reasoning_after_switch(cli, reasoning_effort, persist_global=persist_global and not one_turn)
if persist_global:
from hermes_cli.model_switch import persist_model_selection
persist_model_selection(result)
@@ -194,6 +233,7 @@ def _show_model_picker(cli, ctx, force_refresh: bool) -> None:
providers = build_models_payload(
ctx, probe_custom_providers=force_refresh,
probe_current_custom_provider=not force_refresh,
+ capabilities=True, # the effort step hides itself on reasoning-free routes
)["providers"]
except Exception:
providers = []
@@ -204,6 +244,8 @@ def _show_model_picker(cli, ctx, force_refresh: bool) -> None:
_cprint(" /model <name> --global switch model and persist as default")
_cprint(" /model <name> --once switch for the next turn only")
_cprint(" /model <name> --session switch for this session only")
+ _cprint(" /model <name> --provider <slug> switch provider + model")
+ _cprint(" /model <name> --reasoning <level> switch and set reasoning effort")
_cprint(" /model --provider <slug> switch provider")
_cprint(" /model --refresh re-fetch live model lists")
return
@@ -438,14 +480,14 @@ class CLIModelSwitchMixin:
return self._normalize_slash_confirm_choice(raw, choices) == "once"
def _confirm_and_apply_model_switch_result(
- self, result, persist_global: bool, custom_providers=None) -> None:
+ self, result, persist_global: bool, custom_providers=None, reasoning_effort: str = "") -> None:
from cli import _cprint
try:
if result.success and not self._confirm_expensive_model_switch(result):
_cprint(" Model switch cancelled.")
return
self._apply_model_switch_result(
- result, persist_global, custom_providers=custom_providers)
+ result, persist_global, custom_providers=custom_providers, reasoning_effort=reasoning_effort)
except Exception as exc:
_cprint(f" ✗ Model selection failed: {exc}")
@@ -459,6 +501,7 @@ class CLIModelSwitchMixin:
agent = getattr(self, "agent", None)
return {
**_runtime_fields(self),
+ "reasoning_config": copy.deepcopy(getattr(self, "reasoning_config", None)),
"agent_primary_runtime": copy.deepcopy(
getattr(agent, "_primary_runtime", None)
) if agent is not None else None}
@@ -471,10 +514,15 @@ class CLIModelSwitchMixin:
for key in _RUNTIME_FIELDS:
if key in snapshot:
setattr(self, key, snapshot.get(key))
+ # `/model X --reasoning high --once` must not leave the effort behind with the model.
+ if "reasoning_config" in snapshot:
+ self.reasoning_config = snapshot["reasoning_config"]
agent = getattr(self, "agent", None)
if agent is None:
return
+ if "reasoning_config" in snapshot:
+ agent.reasoning_config = snapshot["reasoning_config"]
primary = snapshot.get("agent_primary_runtime")
if primary and hasattr(agent, "_restore_primary_runtime"):
try:
@@ -492,6 +540,8 @@ class CLIModelSwitchMixin:
api_key=snapshot.get("api_key", ""), base_url=snapshot.get("base_url", ""),
api_mode=snapshot.get("api_mode", ""),
capabilities=snapshot.get("capabilities"))
+ if "reasoning_config" in snapshot:
+ agent.reasoning_config = snapshot["reasoning_config"]
except Exception as exc:
logger.warning("CLI one-turn model restore failed: %s", exc)
@@ -572,14 +622,15 @@ class CLIModelSwitchMixin:
return True
def _apply_model_switch_result(
- self, result, persist_global: bool, custom_providers=None) -> None:
+ self, result, persist_global: bool, custom_providers=None, reasoning_effort: str = "") -> None:
"""Picker-path commit (see _commit_model_switch)."""
from cli import _cprint
if not result.success:
_cprint(f" ✗ {result.error_message}")
return
_merge_preflight_warning(self, result, custom_providers)
- _commit_model_switch(self, result, persist_global=persist_global, picker=True)
+ _commit_model_switch(self, result, persist_global=persist_global, picker=True,
+ reasoning_effort=reasoning_effort)
def _handle_model_picker_selection(self, persist_global: bool = False) -> None:
state = self._model_picker_state
@@ -632,14 +683,38 @@ class CLIModelSwitchMixin:
explicit_provider=provider_data.get("slug"),
user_providers=state.get("user_provs"),
custom_providers=state.get("custom_provs"))
- # Capture before close — picker state is cleared on close.
- _picker_custom_provs = state.get("custom_provs")
- self._close_model_picker()
- _run_confirm_and_apply(
- self, self._confirm_and_apply_model_switch_result,
- result, persist_global, _picker_custom_provs)
+ if result.success and _picker_offers_reasoning(provider_data, result.new_model):
+ # Third step: effort for the picked model (skipped for routes the catalog
+ # marks reasoning-free). Rows come from the canonical level set.
+ state.update(stage="reasoning", switch_result=result, selected=0, _scroll_offset=0)
+ self._invalidate(min_interval=0.0)
+ return
+ self._commit_picker_result(result, persist_global)
return
self._close_model_picker()
+ if stage == "reasoning":
+ rows = _picker_reasoning_rows()
+ result = state.get("switch_result")
+ if selected == len(rows): # ← Back to the model list
+ state.update(stage="model", selected=0, _scroll_offset=0, switch_result=None)
+ self._invalidate(min_interval=0.0)
+ return
+ if selected > len(rows) or result is None:
+ self._close_model_picker()
+ return
+ self._commit_picker_result(result, persist_global, reasoning_effort=rows[selected][0])
+
+ def _commit_picker_result(self, result, persist_global: bool, reasoning_effort: str = "") -> None:
+ """Close the picker and run the confirm+apply sequence for ``result``."""
+ state = self._model_picker_state or {}
+ # Capture before close — picker state is cleared on close.
+ _picker_custom_provs = state.get("custom_provs")
+ self._close_model_picker()
+ # The effort is appended only when picked: stubs/tests pin the historical arity.
+ extra = (reasoning_effort,) if reasoning_effort else ()
+ _run_confirm_and_apply(
+ self, self._confirm_and_apply_model_switch_result,
+ result, persist_global, _picker_custom_provs, *extra)
def _handle_model_switch(self, cmd_original: str):
"""Handle /model command — switch model.
@@ -651,6 +726,7 @@ class CLIModelSwitchMixin:
/model <name> --session — switch for this session only (explicit)
/model <name> --global — switch and persist to config.yaml
/model <name> --provider <provider> — switch provider + model
+ /model <name> --reasoning <level> — switch and set reasoning effort in one step
/model --provider <provider> — switch to provider, auto-detect model
Switches are session-scoped unless ``model.persist_switch_by_default`` or ``--global``.
@@ -701,19 +777,21 @@ class CLIModelSwitchMixin:
_cprint(f" ✗ {result.error_message}")
return
_merge_preflight_warning(self, result, custom_provs)
+ extra = (request.reasoning_effort,) if request.reasoning_effort else ()
_run_confirm_and_apply(
self, self._confirm_and_apply_cli_model_switch,
- result, persist_global, one_turn, custom_provs)
+ result, persist_global, one_turn, custom_provs, *extra)
def _confirm_and_apply_cli_model_switch(
- self, result, persist_global: bool, one_turn: bool, custom_provs=None) -> None:
+ self, result, persist_global: bool, one_turn: bool, custom_provs=None, reasoning_effort: str = "") -> None:
"""Confirm an expensive model switch and apply it (typed /model path). Runs on a worker
thread when the TUI is active (see _run_confirm_and_apply) so the modal can render."""
from cli import _cprint
if not self._confirm_expensive_model_switch(result):
_cprint(" Model switch cancelled.")
return
- _commit_model_switch(self, result, persist_global=persist_global, one_turn=one_turn)
+ _commit_model_switch(self, result, persist_global=persist_global, one_turn=one_turn,
+ reasoning_effort=reasoning_effort)
def _handle_codex_runtime(self, cmd_original: str) -> None:
"""Handle /codex-runtime — toggle the codex app-server runtime opt-in.
diff --git a/hermes_cli/cli_tui_mixin.py b/hermes_cli/cli_tui_mixin.py
index cc3c6b4cbd5..77d9e995348 100644
--- a/hermes_cli/cli_tui_mixin.py
+++ b/hermes_cli/cli_tui_mixin.py
@@ -636,6 +636,18 @@ class CLITuiMixin:
hint = (
f"Current: {state.get('current_model', 'unknown')} "
f"on {state.get('current_provider', 'unknown')}")
+ elif state.get("stage") == "reasoning":
+ from hermes_cli.cli_model_switch_mixin import _picker_reasoning_rows
+ result = state.get("switch_result")
+ picked = getattr(result, "new_model", "") or "model"
+ title = f"⚙ Model Picker — Reasoning effort for {picked}"
+ rc = self.reasoning_config
+ current = ("none" if isinstance(rc, dict) and rc.get("enabled") is False
+ else (rc or {}).get("effort", "medium") if isinstance(rc, dict) else "medium")
+ choices = [f"{label} ← current" if value == current else label
+ for value, label in _picker_reasoning_rows()]
+ choices += ["← Back", "Cancel"]
+ hint = "Applies with the model switch (same scope) — Enter to choose"
else:
provider_data = state.get("provider_data") or {}
model_list = state.get("model_list") or []
@@ -1166,6 +1178,9 @@ class CLITuiMixin:
return
if state.get("stage") == "provider":
max_idx = len(state.get("providers") or [])
+ elif state.get("stage") == "reasoning":
+ from hermes_cli.cli_model_switch_mixin import _picker_reasoning_rows
+ max_idx = len(_picker_reasoning_rows()) + 1 # + Back + Cancel
else:
# +1 for "← Back" and Cancel over the filtered visible rows.
_fp = state.get("_filtered_pairs")
@@ -1186,12 +1201,16 @@ class CLITuiMixin:
st["_scroll_offset"] = 0
def _tui_model_picker_escape(self, event):
- """ESC clears an active filter first, else closes the picker."""
+ """ESC clears an active filter first, else steps back from the effort stage, else closes."""
st = self._model_picker_state
if st and st.get("stage") == "model" and (st.get("filter") or ""):
self._tui_set_filter(st, "")
event.app.invalidate()
return
+ if st and st.get("stage") == "reasoning":
+ st.update(stage="model", selected=0, _scroll_offset=0, switch_result=None)
+ event.app.invalidate()
+ return
self._close_model_picker()
event.app.current_buffer.reset()
event.app.invalidate()
diff --git a/hermes_cli/commands.py b/hermes_cli/commands.py
index 75f8ba55159..6a38112c4e6 100644
--- a/hermes_cli/commands.py
+++ b/hermes_cli/commands.py
@@ -151,7 +151,7 @@ COMMAND_REGISTRY: list[CommandDef] = [
CommandDef("config", "Show current configuration", "Configuration",
cli_only=True, desktop="terminal"),
CommandDef("model", "Switch model (session-scoped; --global to persist)", "Configuration",
- args_hint="[model] [--provider name] [--global|--session] [--refresh]",
+ args_hint="[model] [--provider name] [--reasoning level] [--global|--session] [--refresh]",
busy_policy="reject", busy_handler="model", desktop="hidden"),
CommandDef("codex-runtime", "Toggle codex app-server runtime for OpenAI/Codex models",
"Configuration", aliases=("codex_runtime",), args_hint="[auto|codex_app_server]",
diff --git a/hermes_cli/main.py b/hermes_cli/main.py
index 31c95eec3cc..e530ad45cc6 100644
--- a/hermes_cli/main.py
+++ b/hermes_cli/main.py
@@ -714,6 +714,8 @@ from hermes_cli.main_provider_setup import (
_clear_stale_openai_base_url,
_is_profile_api_key_provider,
_named_custom_provider_map,
+ _offer_reasoning_after_pick,
+ _prompt_main_reasoning_effort,
_prompt_provider_choice,
_remove_custom_provider,
)
@@ -1997,6 +1999,10 @@ def select_provider_and_model(args=None):
if selected_provider == "aux-config":
_aux_config_menu()
return
+ if selected_provider == "reasoning":
+ # Effort for the CURRENT default model, no model change.
+ _prompt_main_reasoning_effort(current_model, active or "")
+ return
# Provider-specific setup + model selection. Flows resolve the
# _model_flow_* names at call time so test monkeypatches on
@@ -2024,6 +2030,10 @@ def select_provider_and_model(args=None):
):
_model_flow_api_key_provider(config, selected_provider, current_model)
+ # Every flow persists through _save_model_choice; a changed model.default means a pick
+ # landed, so offer its reasoning effort here once instead of inside each flow.
+ _offer_reasoning_after_pick(current_model)
+
# Post-switch cleanup: switching to a named provider (anything except
# "custom") leaves a stale OPENAI_BASE_URL in ~/.hermes/.env that poisons
# auxiliary clients using provider:auto — clear it proactively. (#5161)
diff --git a/hermes_cli/main_provider_setup.py b/hermes_cli/main_provider_setup.py
index 6e18cb40352..d21855045c1 100644
--- a/hermes_cli/main_provider_setup.py
+++ b/hermes_cli/main_provider_setup.py
@@ -94,13 +94,23 @@ def _format_aux_current(task_cfg: dict) -> str:
base_url = str(task_cfg.get("base_url") or "").strip()
provider = str(task_cfg.get("provider") or "auto").strip() or "auto"
model = str(task_cfg.get("model") or "").strip()
+ effort = _aux_effort_word(task_cfg)
+ suffix = (f" · {model}" if model else "") + (f" · {effort}" if effort else "")
if base_url:
- return f"custom ({_short_url(base_url)})" + (f" · {model}" if model else "")
+ return f"custom ({_short_url(base_url)})" + suffix
if provider == "auto":
- return "auto" + (f" · {model}" if model else "")
+ return "auto" + suffix
if model:
- return f"{provider} · {model}"
- return provider
+ return f"{provider}{suffix}"
+ return provider + suffix
+
+
+def _aux_effort_word(task_cfg: dict) -> str:
+ """The stored ``reasoning_effort`` as a display word ("" = provider default; YAML False = "none")."""
+ raw = task_cfg.get("reasoning_effort") if isinstance(task_cfg, dict) else None
+ if raw is False:
+ return "none"
+ return str(raw or "").strip().lower()
def _delegation_cfg_as_task(cfg: dict) -> dict:
@@ -109,7 +119,9 @@ def _delegation_cfg_as_task(cfg: dict) -> dict:
d = cfg.get("delegation")
if not isinstance(d, dict):
d = {}
- return {k: str(d.get(k) or "").strip() for k in ("provider", "model", "base_url", "api_key")}
+ out = {k: str(d.get(k) or "").strip() for k in ("provider", "model", "base_url", "api_key")}
+ out["reasoning_effort"] = d.get("reasoning_effort", "")
+ return out
def _aux_task_cfg(cfg: dict, task: str) -> dict:
@@ -128,9 +140,10 @@ def _aux_task_display_name(task: str) -> str:
def _save_aux_choice(task: str, *, provider: str, model: str = "", base_url: str = "",
- api_key: str = "") -> None:
+ api_key: str = "", reasoning_effort: Optional[str] = None) -> None:
"""Persist an aux task's four routing fields (timeout etc. untouched; main model config never
- modified). ``delegation`` writes the top-level section, with "auto" stored as an empty provider."""
+ modified). ``delegation`` writes the top-level section, with "auto" stored as an empty provider.
+ ``reasoning_effort``: a level word or "" (provider default) to write; None leaves the key alone."""
from hermes_cli.config import load_config, save_config
cfg = load_config()
if task == _DELEGATION_TASK_KEY:
@@ -142,9 +155,31 @@ def _save_aux_choice(task: str, *, provider: str, model: str = "", base_url: str
entry["model"] = model or ""
entry["base_url"] = base_url or ""
entry["api_key"] = api_key or ""
+ if reasoning_effort is not None and _aux_task_takes_reasoning(task):
+ entry["reasoning_effort"] = reasoning_effort
save_config(cfg)
+def _aux_task_takes_reasoning(task: str) -> bool:
+ """Whether the task's config block honours ``reasoning_effort``. MoA slots and
+ ``memory_query_rewrite`` omit the key by design (``config_defaults._aux``); ``review``
+ routes through delegation which reads ``delegation.reasoning_effort``, not its own block."""
+ if task == _DELEGATION_TASK_KEY:
+ return True
+ from hermes_cli.config_defaults import DEFAULT_CONFIG
+ block = (DEFAULT_CONFIG.get("auxiliary") or {}).get(task)
+ if isinstance(block, dict):
+ return "reasoning_effort" in block
+ return True # plugin-registered task: the runtime folds the key in via _get_task_extra_body
+
+
+def _prompt_aux_reasoning_effort(task: str, current: str) -> Optional[str]:
+ """Effort step for an aux task: a level, "none", "" (provider default), or None to keep current."""
+ from hermes_constants import VALID_REASONING_EFFORTS
+ return _prompt_reasoning_effort_selection(
+ list(VALID_REASONING_EFFORTS), current_effort=current, default_label="Provider default")
+
+
def _reset_aux_to_auto() -> int:
"""Reset every known aux task (built-in + plugin) back to auto/empty. Returns number reset."""
from hermes_cli.config import load_config, save_config
@@ -156,8 +191,8 @@ def _reset_aux_to_auto() -> int:
if entry.get("provider") not in {None, "", auto}:
entry["provider"] = auto
changed = True
- for field in ("model", "base_url", "api_key"):
- if entry.get(field):
+ for field in ("model", "base_url", "api_key", "reasoning_effort"):
+ if entry.get(field) or entry.get(field) is False:
entry[field] = ""
changed = True
return changed
@@ -244,17 +279,18 @@ def _aux_select_for_task(task: str) -> None:
if slug == "__back__":
return
if slug == "__auto__":
- _save_aux_choice(task, provider="auto", model="", base_url="", api_key="")
+ _save_aux_choice(task, provider="auto", model="", base_url="", api_key="", reasoning_effort="")
print(f"{display_name}: reset to auto.")
elif slug == "__custom__":
_aux_flow_custom_endpoint(task, task_cfg)
else:
- _aux_flow_provider_model(task, slug, models, current_model)
+ _aux_flow_provider_model(task, slug, models, current_model, current_effort=_aux_effort_word(task_cfg))
def _aux_flow_provider_model(task: str, provider_slug: str, curated_models: list,
- current_model: str = "") -> None:
- """Prompt for a model under an already-authenticated provider, save to aux."""
+ current_model: str = "", current_effort: str = "") -> None:
+ """Prompt for a model under an already-authenticated provider (then its reasoning effort),
+ save to aux."""
from hermes_cli.auth import _prompt_model_selection
from hermes_cli.models_pricing import get_pricing_for_provider
display_name = _aux_task_display_name(task)
@@ -278,11 +314,14 @@ def _aux_flow_provider_model(task: str, provider_slug: str, curated_models: list
print("No change.")
return
- _save_aux_choice(task, provider=provider_slug, model=selected or "", base_url="", api_key="")
+ effort = _prompt_aux_reasoning_effort(task, current_effort) if _aux_task_takes_reasoning(task) else None
+ _save_aux_choice(task, provider=provider_slug, model=selected or "", base_url="", api_key="",
+ reasoning_effort=effort)
+ effort_note = f" · reasoning {effort}" if effort else ""
if selected:
- print(f"{display_name}: {provider_slug} · {selected}")
+ print(f"{display_name}: {provider_slug} · {selected}{effort_note}")
else:
- print(f"{display_name}: {provider_slug} (provider default model)")
+ print(f"{display_name}: {provider_slug} (provider default model){effort_note}")
def _aux_flow_custom_endpoint(task: str, task_cfg: dict) -> None:
@@ -308,9 +347,12 @@ def _aux_flow_custom_endpoint(task: str, task_cfg: dict) -> None:
api_key = _ask("API key (optional, blank = use OPENAI_API_KEY): ", secret=True, cancel_msg="")
if api_key is None:
return
+ effort = (_prompt_aux_reasoning_effort(task, _aux_effort_word(task_cfg))
+ if _aux_task_takes_reasoning(task) else None)
- _save_aux_choice(task, provider="custom", model=model, base_url=url, api_key=api_key)
- print(f"{display_name}: custom ({_short_url(url)})" + (f" · {model}" if model else ""))
+ _save_aux_choice(task, provider="custom", model=model, base_url=url, api_key=api_key, reasoning_effort=effort)
+ print(f"{display_name}: custom ({_short_url(url)})" + (f" · {model}" if model else "")
+ + (f" · reasoning {effort}" if effort else ""))
_CANCELLED = object()
@@ -523,8 +565,9 @@ def _remove_custom_provider(config):
print(f'✅ Removed "{removed_name}" from custom providers.')
-def _prompt_reasoning_effort_selection(efforts, current_effort=""):
- """Prompt for a reasoning effort. Returns effort, 'none', or None to keep current."""
+def _prompt_reasoning_effort_selection(efforts, current_effort="", *, default_label=""):
+ """Prompt for a reasoning effort. Returns a level, 'none', "" (only with *default_label*: the
+ "use the provider default" row), or None to keep current."""
deduped = list(dict.fromkeys(str(effort).strip().lower() for effort in efforts if str(effort).strip()))
canonical_order = ("minimal", "low", "medium", "high", "xhigh", "max", "ultra")
ordered = [effort for effort in canonical_order if effort in deduped]
@@ -537,33 +580,91 @@ def _prompt_reasoning_effort_selection(efforts, current_effort=""):
disable_label = "Disable reasoning"
skip_label = "Skip (keep current)"
+ # (return value, label) for the rows after the ladder; "" = provider default (aux tasks only).
+ tail: list[tuple[Optional[str], str]] = [("none", disable_label)]
+ if default_label:
+ tail.append(("", default_label + (" ← currently in use" if current_effort == "" else "")))
+ tail.append((None, skip_label))
+ tail_values = [v for v, _ in tail]
if current_effort == "none":
- default_idx = len(ordered)
+ default_idx = len(ordered) + tail_values.index("none")
elif current_effort in ordered:
default_idx = ordered.index(current_effort)
+ elif default_label and current_effort == "":
+ default_idx = len(ordered) + tail_values.index("")
elif "medium" in ordered:
default_idx = ordered.index("medium")
else:
default_idx = 0
n = len(ordered)
- idx = _radiolist("Select reasoning effort:", [_label(effort) for effort in ordered] + [disable_label, skip_label],
- default_idx)
+ rows = [_label(effort) for effort in ordered] + [label for _, label in tail]
+ idx = _radiolist("Select reasoning effort:", rows, default_idx)
if idx is not None:
if idx < 0:
return None
print()
else:
print("Select reasoning effort:")
- for i, effort in enumerate(ordered, 1):
- print(f" {i}. {_label(effort)}")
- _say(f" {n + 1}. {disable_label}", f" {n + 2}. {skip_label}", "")
- idx = _ask_index(f"Choice [1-{n + 2}] (default: keep current): ", n + 2, echo_cancel=False)
+ for i, row in enumerate(rows, 1):
+ print(f" {i}. {row}")
+ print()
+ idx = _ask_index(f"Choice [1-{len(rows)}] (default: keep current): ", len(rows), echo_cancel=False)
if idx is None or idx is _CANCELLED:
return None
if idx < n:
return ordered[idx]
- return "none" if idx == n else None
+ return tail_values[idx - n]
+
+
+def _offer_reasoning_after_pick(model_before: str) -> None:
+ """Post-flow effort step for ``select_provider_and_model``: when a flow saved a different
+ ``model.default`` (every flow persists through ``_save_model_choice``), offer the effort for
+ the new model + provider. A flow that made no change (cancel, "No change.") never prompts."""
+ from hermes_cli.config import load_config
+ model_cfg = load_config().get("model")
+ if not isinstance(model_cfg, dict):
+ return
+ model = str(model_cfg.get("default") or "").strip()
+ if not model or model == model_before:
+ return # same model re-picked or nothing saved: the "Reasoning effort" row covers that
+ _prompt_main_reasoning_effort(model, str(model_cfg.get("provider") or ""))
+
+
+def _prompt_main_reasoning_effort(model: str, provider: str) -> None:
+ """The effort step every ``hermes model`` flow shares: after a main-model pick, offer the
+ model's supported levels (Copilot publishes a per-model set; everything else gets the full
+ ladder) and persist ``agent.reasoning_effort``. Skipped when the catalog says the route has
+ no reasoning control; "Skip" leaves the current value alone."""
+ from hermes_cli.config import load_config, save_config
+ from hermes_cli.setup import _current_reasoning_effort, _set_reasoning_effort
+ efforts = _main_model_reasoning_efforts(model, provider)
+ if efforts is None:
+ return
+ selected = _prompt_reasoning_effort_selection(efforts, current_effort=_current_reasoning_effort(load_config()))
+ if selected is None:
+ return
+ cfg = load_config()
+ _set_reasoning_effort(cfg, selected)
+ save_config(cfg)
+ print("Reasoning disabled for this model." if selected == "none" else f"Reasoning effort set to: {selected}")
+
+
+def _main_model_reasoning_efforts(model: str, provider: str) -> Optional[list[str]]:
+ """Levels to offer for *model* on *provider*: None when the route has no reasoning control."""
+ from hermes_constants import VALID_REASONING_EFFORTS
+ slug = (provider or "").strip().lower()
+ if slug == "copilot":
+ from hermes_cli.models import github_model_reasoning_efforts
+ return github_model_reasoning_efforts(model) or None
+ try:
+ from agent.models_dev import get_model_capabilities
+ meta = get_model_capabilities(slug, model)
+ except Exception:
+ meta = None
+ if meta is not None and not meta.supports_reasoning:
+ return None
+ return list(VALID_REASONING_EFFORTS)
def _prompt_api_key(pconfig, existing_key: str, provider_id: str = "", existing_source: str = "") -> tuple:
@@ -836,6 +937,7 @@ def _build_provider_picker_rows(config: dict, active: str, provider_labels: dict
ordered.append(("custom", "Custom endpoint (enter URL manually)", []))
if isinstance(config.get("custom_providers"), list) and config.get("custom_providers"):
ordered.append(("remove-custom", "Remove a saved custom provider", []))
+ ordered.append(("reasoning", "Reasoning effort for the current model...", []))
ordered.append(("aux-config", "Configure auxiliary models...", []))
ordered.append(("cancel", "Leave unchanged", []))
- return ordered, default_idx
+ return ordered, default_idx
\ No newline at end of file
diff --git a/hermes_cli/model_setup_flows.py b/hermes_cli/model_setup_flows.py
index 45fc4f47e0a..d5a7b7ba845 100644
--- a/hermes_cli/model_setup_flows.py
+++ b/hermes_cli/model_setup_flows.py
@@ -537,12 +537,11 @@ def _copilot_obtain_token() -> bool:
def _model_flow_copilot(config, current_model=""):
- """GitHub Copilot flow using env vars, gh CLI, or OAuth device code."""
- from hermes_cli.main_provider_setup import _prompt_reasoning_effort_selection
- from hermes_cli.setup import _current_reasoning_effort, _set_reasoning_effort
+ """GitHub Copilot flow using env vars, gh CLI, or OAuth device code. The reasoning-effort step
+ is the shared post-pick one in ``select_provider_and_model`` (Copilot's per-model level set
+ comes from ``github_model_reasoning_efforts`` there)."""
from hermes_cli.auth import PROVIDER_REGISTRY, resolve_api_key_provider_credentials
- from hermes_cli.config import load_config
- from hermes_cli.models import fetch_api_models, github_model_reasoning_efforts, copilot_model_api_mode
+ from hermes_cli.models import fetch_api_models, copilot_model_api_mode
provider_id = "copilot"
pconfig = PROVIDER_REGISTRY[provider_id]
creds = resolve_api_key_provider_credentials(provider_id)
@@ -572,25 +571,9 @@ def _model_flow_copilot(config, current_model=""):
print("No change.")
return
selected = _normalize(selected)
- current_effort = _current_reasoning_effort(load_config())
- reasoning_efforts = github_model_reasoning_efforts(selected, catalog=catalog, api_key=api_key)
- selected_effort = None
- if reasoning_efforts:
- print(f" {selected} supports reasoning controls.")
- selected_effort = _prompt_reasoning_effort_selection(reasoning_efforts, current_effort=current_effort)
-
- def _finish(cfg, _model):
- if selected_effort is not None:
- _set_reasoning_effort(cfg, selected_effort)
-
_persist_model(selected, provider_id, base_url=effective_base,
- api_mode=copilot_model_api_mode(selected, catalog=catalog, api_key=api_key), finish=_finish)
+ api_mode=copilot_model_api_mode(selected, catalog=catalog, api_key=api_key))
print(f"Default model set to: {selected} (via {pconfig.name})")
- if reasoning_efforts:
- if selected_effort == "none":
- print("Reasoning disabled for this model.")
- elif selected_effort:
- print(f"Reasoning effort set to: {selected_effort}")
def _model_flow_copilot_acp(config, current_model=""):
diff --git a/hermes_cli/model_switch.py b/hermes_cli/model_switch.py
index e9030d6f780..e019505746b 100644
--- a/hermes_cli/model_switch.py
+++ b/hermes_cli/model_switch.py
@@ -447,6 +447,7 @@ class ModelFlagParseResult:
"""Parsed flags for a /model command."""
model_input: str
explicit_provider: str = ""
+ reasoning_effort: str = ""
is_global: bool = False
force_refresh: bool = False
is_session: bool = False
@@ -456,32 +457,36 @@ class ModelFlagParseResult:
# --- Flag parsing
_BOOL_FLAGS = {"--global": "is_global", "--session": "is_session", "--refresh": "force_refresh", "--once": "is_once"}
+_VALUE_FLAGS = {"--provider": "explicit_provider", "--reasoning": "reasoning_effort"}
def parse_model_flags_detailed(raw_args: str) -> ModelFlagParseResult:
- """Parse /model flags: ``--provider X``, ``--global``, ``--session``, ``--refresh``, ``--once``.
+ """Parse /model flags: ``--provider X``, ``--reasoning <level>``, ``--global``, ``--session``,
+ ``--refresh``, ``--once``.
``--once`` is parsed here but interpreted by each caller (each frontend has its own
live-session restore hook). ``is_global`` / ``is_session`` are raw flag presences; the
- effective persistence decision belongs to :func:`resolve_persist_behavior`."""
+ effective persistence decision belongs to :func:`resolve_persist_behavior`. ``reasoning_effort``
+ is the raw level word (validated by :func:`hermes_constants.parse_reasoning_effort` at apply
+ time) so a model pick and its effort travel as ONE request on every surface."""
# Telegram/iOS auto-convert ``--`` to an em/en dash: normalize a single Unicode dash before
# a flag keyword.
- raw_args = re.sub(r'[\u2012\u2013\u2014\u2015](provider|global|session|refresh|once)', r'--\1', raw_args)
+ raw_args = re.sub(r'[\u2012\u2013\u2014\u2015](provider|reasoning|global|session|refresh|once)', r'--\1', raw_args)
# Hand-rolled: model IDs may contain colons/slashes and the historical parser did not
# require shell quoting.
- flags = dict.fromkeys(_BOOL_FLAGS.values(), False)
- explicit_provider = ""
+ flags: dict[str, bool] = dict.fromkeys(_BOOL_FLAGS.values(), False)
+ values: dict[str, str] = dict.fromkeys(_VALUE_FLAGS.values(), "")
filtered: list[str] = []
tokens = iter(raw_args.split())
for tok in tokens:
if tok in _BOOL_FLAGS:
flags[_BOOL_FLAGS[tok]] = True
- elif tok == "--provider" and (value := next(tokens, None)) is not None:
- explicit_provider = value
+ elif tok in _VALUE_FLAGS and (value := next(tokens, None)) is not None:
+ values[_VALUE_FLAGS[tok]] = value
else:
filtered.append(tok) # a trailing bare ``--provider`` stays part of the model text
- return ModelFlagParseResult(model_input=" ".join(filtered).strip(), explicit_provider=explicit_provider, **flags)
+ return ModelFlagParseResult(model_input=" ".join(filtered).strip(), **values, **flags)
def parse_model_flags(raw_args: str) -> tuple[str, str, bool, bool, bool]:
@@ -534,12 +539,14 @@ def resolve_persist_behavior(
# Error codes emitted by parse_model_switch_args().
MODEL_SWITCH_ERR_ONCE_WITH_GLOBAL = "once_with_global"
MODEL_SWITCH_ERR_ONCE_REQUIRES_TARGET = "once_requires_target"
+MODEL_SWITCH_ERR_BAD_REASONING = "bad_reasoning"
# Canonical (surface-neutral) error copy. Surfaces prepend their own decoration (" ✗ " in the
# CLI, "❌ " in the gateway) but MUST NOT change the core sentence — it is shared user-visible copy.
MODEL_SWITCH_ERROR_TEXT = {
MODEL_SWITCH_ERR_ONCE_WITH_GLOBAL: "/model --once cannot be combined with --global",
- MODEL_SWITCH_ERR_ONCE_REQUIRES_TARGET: "/model --once requires a model or provider."}
+ MODEL_SWITCH_ERR_ONCE_REQUIRES_TARGET: "/model --once requires a model or provider.",
+ MODEL_SWITCH_ERR_BAD_REASONING: "/model --reasoning takes none, minimal, low, medium, high, xhigh, max or ultra."}
@dataclass(frozen=True)
@@ -554,6 +561,7 @@ class ModelSwitchRequest:
raw: str
target: str
explicit_provider: str = ""
+ reasoning_effort: str = ""
is_global: bool = False
is_session: bool = False
is_once: bool = False
@@ -574,7 +582,8 @@ def parse_model_switch_args(raw: str) -> ModelSwitchRequest:
"""The ONE parser for every /model surface: tokenization plus flag-conflict validation.
``--once`` + ``--global`` -> ``MODEL_SWITCH_ERR_ONCE_WITH_GLOBAL``; ``--once`` with neither
- a model nor ``--provider`` -> ``MODEL_SWITCH_ERR_ONCE_REQUIRES_TARGET``. Targets pass through
+ a model nor ``--provider`` -> ``MODEL_SWITCH_ERR_ONCE_REQUIRES_TARGET``; an unknown
+ ``--reasoning`` level -> ``MODEL_SWITCH_ERR_BAD_REASONING``. Targets pass through
untouched (bare names, ``vendor/model``, ``vendor:model``) for :func:`switch_model`."""
raw = str(raw or "")
parsed = parse_model_flags_detailed(raw)
@@ -584,13 +593,17 @@ def parse_model_switch_args(raw: str) -> ModelSwitchRequest:
errors.append(MODEL_SWITCH_ERR_ONCE_WITH_GLOBAL)
if parsed.is_once and not parsed.model_input and not parsed.explicit_provider:
errors.append(MODEL_SWITCH_ERR_ONCE_REQUIRES_TARGET)
+ if parsed.reasoning_effort:
+ from hermes_constants import parse_reasoning_effort
+ if parse_reasoning_effort(parsed.reasoning_effort) is None:
+ errors.append(MODEL_SWITCH_ERR_BAD_REASONING)
# First matching flag wins: once > session > global > default.
scope = next((name for name, on in (("once", parsed.is_once), ("session", parsed.is_session),
("global", parsed.is_global)) if on), "default")
return ModelSwitchRequest(
raw=raw, target=parsed.model_input, scope=scope, errors=tuple(errors),
**{f: getattr(parsed, f)
- for f in ("explicit_provider", "is_global", "is_session", "is_once", "force_refresh")})
+ for f in ("explicit_provider", "reasoning_effort", "is_global", "is_session", "is_once", "force_refresh")})
def _effective_model_candidate(value: Any) -> str:
diff --git a/tests/gateway/test_model_command_reasoning_flag.py b/tests/gateway/test_model_command_reasoning_flag.py
new file mode 100644
index 00000000000..89a89030d5a
--- /dev/null
+++ b/tests/gateway/test_model_command_reasoning_flag.py
@@ -0,0 +1,53 @@
+"""Gateway ``/model <m> --reasoning <level>``: the effort rides with the pick through the same
+applier ``/reasoning`` uses (session override by default, ``agent.reasoning_effort`` on --global)."""
+
+from types import SimpleNamespace
+from unittest.mock import AsyncMock
+
+import pytest
+
+from gateway.config import Platform
+from gateway.slash_commands_model import _ModelSwitchContext
+
+
+def _runner():
+ from gateway.run import GatewayRunner
+
+ runner = object.__new__(GatewayRunner)
+ calls = {}
+ runner._switch_cached_agent_model = lambda *_a, **_k: None
+ runner._record_model_switch = AsyncMock()
+ runner._model_switch_confirmation = AsyncMock(return_value="switched")
+ runner._apply_reasoning_selection = (
+ lambda session_key, platform_key, value, persist_global=False:
+ calls.setdefault("applied", (session_key, platform_key, value, persist_global)) and "effort set")
+ return runner, calls
+
+
+async def test_reasoning_flag_applies_after_the_switch_with_the_pick_scope():
+ runner, calls = _runner()
+ ctx = _ModelSwitchContext(session_key="telegram:c1", source=None, config_path=None,
+ persist_global=True, reasoning_effort="high")
+ result = SimpleNamespace(new_model="m", target_provider="nous")
+ source = SimpleNamespace(platform=Platform.TELEGRAM)
+
+ reply = await runner._commit_model_switch(result, ctx, source=source)
+
+ assert calls["applied"] == ("telegram:c1", "telegram", "high", True)
+ assert reply == "switched\neffort set"
+
+
+async def test_no_flag_and_once_leave_reasoning_untouched():
+ runner, calls = _runner()
+ source = SimpleNamespace(platform=Platform.TELEGRAM)
+ result = SimpleNamespace(new_model="m", target_provider="nous")
+ await runner._commit_model_switch(
+ result, _ModelSwitchContext(session_key="k", source=None, config_path=None, persist_global=False),
+ source=source)
+ await runner._commit_model_switch(
+ result, _ModelSwitchContext(session_key="k", source=None, config_path=None, persist_global=False,
+ one_turn=True, reasoning_effort="high"),
+ source=source)
+ assert "applied" not in calls
diff --git a/tests/hermes_cli/test_model_picker_expensive_confirm.py b/tests/hermes_cli/test_model_picker_expensive_confirm.py
index 11d472307a0..8a32bba2045 100644
--- a/tests/hermes_cli/test_model_picker_expensive_confirm.py
+++ b/tests/hermes_cli/test_model_picker_expensive_confirm.py
@@ -51,6 +51,7 @@ def test_prompt_toolkit_model_picker_defers_confirmation_off_key_handler(monkeyp
_invalidate=lambda **_kwargs: None,
)
self_._close_model_picker = _bound(cli_mod.HermesCLI._close_model_picker, self_)
+ self_._commit_picker_result = _bound(cli_mod.HermesCLI._commit_picker_result, self_)
self_._confirm_and_apply_model_switch_result = (
lambda *_args: captured.setdefault("ran_inline", True)
)
@@ -59,6 +60,14 @@ def test_prompt_toolkit_model_picker_defers_confirmation_off_key_handler(monkeyp
# which defaults to True (persist-by-default). Simulate that call.
_bound(cli_mod.HermesCLI._handle_model_picker_selection, self_)(persist_global=True)
+ # Picking a model opens the reasoning-effort step (no commit yet); "Keep current effort"
+ # (the last effort row) commits with the historical arity.
+ from hermes_cli.cli_model_switch_mixin import _picker_reasoning_rows
+ assert self_._model_picker_state["stage"] == "reasoning"
+ assert "started" not in captured
+ self_._model_picker_state["selected"] = len(_picker_reasoning_rows()) - 1
+ _bound(cli_mod.HermesCLI._handle_model_picker_selection, self_)(persist_global=True)
+
assert self_._model_picker_state is None
assert captured["started"] is True
assert captured["daemon"] is True
diff --git a/tests/hermes_cli/test_model_switch_reasoning_flag.py b/tests/hermes_cli/test_model_switch_reasoning_flag.py
new file mode 100644
index 00000000000..567d8076350
--- /dev/null
+++ b/tests/hermes_cli/test_model_switch_reasoning_flag.py
@@ -0,0 +1,65 @@
+"""``/model <name> --reasoning <level>`` — one request carries a model pick AND its effort.
+
+The parser is the single owner (hermes_cli.model_switch.parse_model_switch_args); the CLI and
+TUI-gateway commit steps apply the effort AFTER the agent swap, because ``agent.switch_model``
+re-resolves ``reasoning_config`` from config.yaml and would clobber an earlier write.
+"""
+
+from types import SimpleNamespace
+
+from hermes_cli.model_switch import (
+ MODEL_SWITCH_ERR_BAD_REASONING,
+ ModelSwitchResult,
+ parse_model_switch_args,
+)
+
+
+def test_reasoning_flag_rides_with_the_pick_and_validates():
+ req = parse_model_switch_args("sonnet --provider anthropic --reasoning high --session")
+ assert req.target == "sonnet"
+ assert req.explicit_provider == "anthropic"
+ assert req.reasoning_effort == "high"
+ assert req.scope == "session"
+ assert req.errors == ()
+
+ bad = parse_model_switch_args("sonnet --reasoning turbo")
+ assert MODEL_SWITCH_ERR_BAD_REASONING in bad.errors
+ # Unicode dash normalization (Telegram/iOS) covers the new flag too.
+ assert parse_model_switch_args("sonnet \u2014reasoning low").reasoning_effort == "low"
+
+
+def test_cli_commit_applies_effort_after_the_agent_swap(monkeypatch):
+ """The agent's switch_model resets reasoning_config from config; the ride-along effort must
+ win over that reset, on both the CLI and the live agent."""
+ import cli as cli_mod
+ from hermes_cli import cli_model_switch_mixin as mixin
+
+ class _Agent:
+ reasoning_config = {"enabled": True, "effort": "medium"}
+
+ def switch_model(self, **_kw):
+ # Mirrors agent_runtime_helpers._switch_model: re-resolve from config.yaml.
+ self.reasoning_config = {"enabled": True, "effort": "medium"}
+
+ agent = _Agent()
+ cli = SimpleNamespace(
+ model="old", provider="nous", requested_provider="nous", _explicit_api_key="", _explicit_base_url="",
+ api_key="", base_url="", api_mode="", agent=agent, reasoning_config=None,
+ _pending_one_turn_model_restore=None, _pending_model_switch_note="",
+ _snapshot_model_runtime=lambda: {}, _persist_model_switch_to_session=lambda *_a: None)
+ cli._stage_and_swap_model = lambda result, old: cli_mod.HermesCLI._stage_and_swap_model(cli, result, old)
+ monkeypatch.setattr(mixin, "_print_switch_summary", lambda *_a, **_k: None)
+ monkeypatch.setattr(cli_mod.HermesCLI, "_persist_model_switch_to_session", lambda *_a: None)
+ saved = {}
+ monkeypatch.setattr(cli_mod, "save_config_value", lambda k, v: saved.setdefault(k, v) or True)
+
+ result = ModelSwitchResult(success=True, new_model="new", target_provider="nous")
+ mixin._commit_model_switch(cli, result, persist_global=False, reasoning_effort="high")
+
+ assert agent.reasoning_config == {"enabled": True, "effort": "high"}
+ assert cli.reasoning_config == {"enabled": True, "effort": "high"}
+ assert "agent.reasoning_effort" not in saved # session scope: no config write
+
+ mixin._commit_model_switch(cli, result, persist_global=True, reasoning_effort="none")
+ assert saved.get("agent.reasoning_effort") == "none"
+ assert agent.reasoning_config == {"enabled": False}
diff --git a/tests/tui_gateway/test_model_switch_reasoning_flag.py b/tests/tui_gateway/test_model_switch_reasoning_flag.py
new file mode 100644
index 00000000000..38706a02b44
--- /dev/null
+++ b/tests/tui_gateway/test_model_switch_reasoning_flag.py
@@ -0,0 +1,64 @@
+"""``config.set model "X --reasoning <level>"`` on the TUI gateway: the effort rides with the pick.
+
+Applied AFTER the live swap (``agent.switch_model`` re-resolves ``reasoning_config`` from
+config.yaml) and scoped like the pick: a session pin by default, ``agent.reasoning_effort`` on
+``--global``. The Ink TUI picker and the classic CLI both emit this exact shape.
+"""
+
+from types import SimpleNamespace
+
+import pytest
+
+import tui_gateway.server as server
+
+
+class _Agent:
+ def __init__(self):
+ self.model, self.provider, self.base_url, self.api_key, self.api_mode = "old", "nous", "", "", ""
+ self.reasoning_config = {"enabled": True, "effort": "medium"}
+
+ def switch_model(self, **_kw):
+ self.reasoning_config = {"enabled": True, "effort": "medium"} # re-resolved from config
+
+
+def _quiet_switch(monkeypatch):
+ result = SimpleNamespace(
+ success=True, new_model="new/model", target_provider="nous", base_url="", api_key="key",
+ api_mode="chat_completions", warning_message="", model_info=None, error_message="",
+ runtime_capabilities=None)
+ monkeypatch.setattr("hermes_cli.model_switch.switch_model", lambda **_kw: result)
+ monkeypatch.setattr("hermes_cli.model_switch.persist_model_selection", lambda _r: None)
+ monkeypatch.setattr("hermes_cli.model_cost_guard.expensive_model_warning", lambda *a, **k: None)
+ for name in ("_restart_slash_worker", "_persist_live_session_runtime", "_persist_live_session_system_prompt",
+ "_append_model_switch_marker", "_emit_session_info"):
+ monkeypatch.setattr(server, name, lambda *a, **k: None)
+ written = {}
+ monkeypatch.setattr(server, "_write_config_key", lambda k, v: written.__setitem__(k, v))
+ return written
+
+
+def test_reasoning_flag_survives_the_swap_and_pins_the_session(_quiet_switch):
+ agent = _Agent()
+ session = {"agent": agent}
+
+ out = server._apply_model_switch("sid", session, "new/model --provider nous --reasoning high --session")
+
+ assert out["value"] == "new/model"
+ assert agent.reasoning_config == {"enabled": True, "effort": "high"}
+ assert session["create_reasoning_override"] == {"enabled": True, "effort": "high"}
+ assert "agent.reasoning_effort" not in _quiet_switch
+
+
+def test_reasoning_flag_with_global_writes_config_and_drops_the_pin(_quiet_switch):
+ agent = _Agent()
+ session = {"agent": agent, "create_reasoning_override": {"enabled": True, "effort": "low"}}
+
+ server._apply_model_switch("sid", session, "new/model --provider nous --reasoning none --global")
+
+ assert agent.reasoning_config == {"enabled": False}
+ assert _quiet_switch["agent.reasoning_effort"] == "none"
+ assert "create_reasoning_override" not in session
+
+ with pytest.raises(ValueError, match="--reasoning takes"):
+ server._apply_model_switch("sid", {"agent": _Agent()}, "new/model --reasoning turbo")
diff --git a/tui_gateway/model_switch.py b/tui_gateway/model_switch.py
index 1d97814da7b..297c5313824 100644
--- a/tui_gateway/model_switch.py
+++ b/tui_gateway/model_switch.py
@@ -5,6 +5,7 @@ time (method_ctx.bind_module), so they reference server.py globals bare."""
from __future__ import annotations
import contextlib
+import copy
from .method_ctx import HandlerRegistry, bind_module
@@ -17,6 +18,7 @@ _RUNTIME_KEYS = ("model", "provider", "api_key", "base_url", "api_mode")
def _snapshot_agent_model_runtime(agent) -> dict:
"""Capture the current agent model runtime for a one-turn restore."""
return {**{k: getattr(agent, k, "") for k in _RUNTIME_KEYS},
+ "reasoning_config": copy.deepcopy(getattr(agent, "reasoning_config", None)),
"primary_runtime": copy.deepcopy(getattr(agent, "_primary_runtime", None))}
@@ -24,6 +26,10 @@ def _restore_agent_model_runtime(agent, snapshot: dict | None) -> None:
"""Restore an agent model runtime captured before a one-turn override."""
if not snapshot or agent is None:
return
+ # `/model X --reasoning high --once`: the effort leaves with the model. Set before the
+ # runtime restore paths below (primary_runtime may predate a session /reasoning change).
+ if "reasoning_config" in snapshot:
+ agent.reasoning_config = snapshot["reasoning_config"]
primary = snapshot.get("primary_runtime")
if primary and hasattr(agent, "_restore_primary_runtime"):
try:
@@ -31,6 +37,8 @@ def _restore_agent_model_runtime(agent, snapshot: dict | None) -> None:
agent._fallback_activated = True
agent._rate_limited_until = 0
if agent._restore_primary_runtime():
+ if "reasoning_config" in snapshot:
+ agent.reasoning_config = snapshot["reasoning_config"]
return
except Exception:
logger.debug("TUI one-turn model restore via primary runtime failed", exc_info=True)
@@ -39,6 +47,8 @@ def _restore_agent_model_runtime(agent, snapshot: dict | None) -> None:
agent.switch_model(
new_model=model, new_provider=provider, api_key=api_key, base_url=base_url,
api_mode=api_mode, capabilities=snapshot.get("capabilities"))
+ if "reasoning_config" in snapshot:
+ agent.reasoning_config = snapshot["reasoning_config"]
@contextlib.contextmanager
@@ -87,8 +97,8 @@ def _restart_completed_failed_agent_build(sid: str, session: dict, failed_ready:
return True
-def _switch_request(raw_input: str, parsed_flags, persist_override) -> tuple[str, str, bool, bool]:
- """Normalize /model flags → (model_input, explicit_provider, one_turn, persist_global)."""
+def _switch_request(raw_input: str, parsed_flags, persist_override) -> tuple[str, str, bool, bool, str]:
+ """Normalize /model flags → (model_input, explicit_provider, one_turn, persist_global, reasoning_effort)."""
from hermes_cli.model_switch import (
MODEL_SWITCH_ERR_ONCE_WITH_GLOBAL, MODEL_SWITCH_ERROR_TEXT, parse_model_switch_args,
resolve_persist_behavior)
@@ -97,6 +107,8 @@ def _switch_request(raw_input: str, parsed_flags, persist_override) -> tuple[str
model_input, explicit_provider, is_global_flag, is_session, one_turn = (
f.model_input, f.explicit_provider, f.is_global, f.is_session, f.is_once)
# Conflict validation is the shared parser's; surface it with the canonical copy.
+ for code in getattr(f, "errors", ()):
+ raise ValueError(MODEL_SWITCH_ERROR_TEXT[code])
if is_global_flag and one_turn:
raise ValueError(MODEL_SWITCH_ERROR_TEXT[MODEL_SWITCH_ERR_ONCE_WITH_GLOBAL])
if persist_override is None:
@@ -104,7 +116,7 @@ def _switch_request(raw_input: str, parsed_flags, persist_override) -> tuple[str
is_global_flag, is_session, is_once=one_turn, explicit_provider=explicit_provider)
if not model_input:
raise ValueError("model value required")
- return model_input, explicit_provider, one_turn, persist_override
+ return model_input, explicit_provider, one_turn, persist_override, getattr(f, "reasoning_effort", "") or ""
def _current_model_runtime(agent, explicit_provider: str) -> tuple:
@@ -190,7 +202,7 @@ def _apply_model_switch(
pin_session_override: bool = True, parsed_flags: Any | None = None,
persist_override: bool | None = None) -> dict:
from hermes_cli.model_switch import switch_model
- model_input, explicit_provider, one_turn, persist_global = _switch_request(
+ model_input, explicit_provider, one_turn, persist_global, reasoning_effort = _switch_request(
raw_input, parsed_flags, persist_override)
agent = session.get("agent")
if one_turn and not agent:
@@ -231,12 +243,37 @@ def _apply_model_switch(
if persist_global:
from hermes_cli.model_switch import persist_model_selection
persist_model_selection(result)
+ if reasoning_effort:
+ _apply_switch_reasoning(sid, session, agent, reasoning_effort, persist_global=persist_global, one_turn=one_turn)
return {
"value": result.new_model, "warning": result.warning_message or "",
"confirm_required": False,
"scope": "once" if one_turn else ("global" if persist_global else "session")}
+def _apply_switch_reasoning(sid: str, session, agent, effort: str, *, persist_global: bool, one_turn: bool) -> None:
+ """``/model X --reasoning <level>``: the effort rides with the pick and shares its scope. Runs
+ AFTER ``agent.switch_model`` (which re-resolves ``reasoning_config`` from config.yaml, so an
+ earlier write would be clobbered). ``--once`` restores through ``one_turn_model_restore`` —
+ the snapshot's ``primary_runtime`` carries the pre-switch ``reasoning_config``."""
+ from hermes_constants import parse_reasoning_effort
+ parsed = parse_reasoning_effort(effort)
+ if parsed is None:
+ return
+ if agent is not None:
+ agent.reasoning_config = parsed
+ if one_turn or not isinstance(session, dict):
+ return
+ if persist_global:
+ _write_config_key("agent.reasoning_effort", effort)
+ session.pop("create_reasoning_override", None) # global wins; see _set_reasoning
+ else:
+ session["create_reasoning_override"] = parsed
+ if agent is not None:
+ _persist_live_session_runtime(session)
+ _emit_session_info(sid, session) # the switch's own emit predates the effort change
+
+
def _sync_bot_capabilities(sid: str, session: dict) -> None:
"""Rebuild a Bot Chat session's agent when its capability surface changed. Bot Chats are
eternal sessions with toolsets/MCP baked in at construction, so a capability edit would
diff --git a/ui-tui/src/__tests__/modelPickerReasoning.test.ts b/ui-tui/src/__tests__/modelPickerReasoning.test.ts
new file mode 100644
index 00000000000..fd09ee04614
--- /dev/null
+++ b/ui-tui/src/__tests__/modelPickerReasoning.test.ts
@@ -0,0 +1,34 @@
+import type { ModelOptionProvider } from '@hermes/shared/gateway-events'
+import { describe, expect, it } from 'vitest'
+
+import { draftModelNameFromArg } from '../components/activeSessionSwitcher.js'
+import { modelPickerCommand, pickerOffersReasoning, REASONING_PICKER_ROWS } from '../components/modelPicker.js'
+
+const provider = (capabilities?: ModelOptionProvider['capabilities']): ModelOptionProvider => ({
+ capabilities,
+ name: 'Nous Portal',
+ slug: 'nous'
+})
+
+describe('ModelPicker reasoning step', () => {
+ it('emits one /model request carrying provider, effort and scope', () => {
+ expect(modelPickerCommand('gpt-5.6', 'nous', false, 'high')).toBe(
+ 'gpt-5.6 --provider nous --reasoning high --tui-session'
+ )
+ expect(modelPickerCommand('gpt-5.6', 'nous', true, 'none')).toBe(
+ 'gpt-5.6 --provider nous --reasoning none --global'
+ )
+ // "Keep current effort" (empty value) adds no flag at all.
+ expect(modelPickerCommand('gpt-5.6', 'nous', false, '')).toBe('gpt-5.6 --provider nous --tui-session')
+ expect(REASONING_PICKER_ROWS.at(-1)?.value).toBe('')
+ // The new-session draft label strips the effort flag like it strips --provider.
+ expect(draftModelNameFromArg(modelPickerCommand('gpt-5.6', 'nous', false, 'low'))).toBe('gpt-5.6')
+ })
+
+ it('skips the step only when the catalog says the route has no reasoning control', () => {
+ expect(pickerOffersReasoning(provider({ 'gpt-5.6': { fast: false, reasoning: false } }), 'gpt-5.6')).toBe(false)
+ expect(pickerOffersReasoning(provider({ 'gpt-5.6': { fast: false, reasoning: true } }), 'gpt-5.6')).toBe(true)
+ expect(pickerOffersReasoning(provider(undefined), 'gpt-5.6')).toBe(true)
+ expect(pickerOffersReasoning(undefined, 'gpt-5.6')).toBe(true)
+ })
+})
diff --git a/ui-tui/src/components/activeSessionSwitcher.tsx b/ui-tui/src/components/activeSessionSwitcher.tsx
index ebd88078d57..b4aaa7f0f4f 100644
--- a/ui-tui/src/components/activeSessionSwitcher.tsx
+++ b/ui-tui/src/components/activeSessionSwitcher.tsx
@@ -218,7 +218,7 @@ export const draftModelNameFromArg = (value: string) => {
for (let i = 0; i < parts.length; i++) {
const part = parts[i]!
- if (part === '--provider') {
+ if (part === '--provider' || part === '--reasoning') {
i++
continue
diff --git a/ui-tui/src/components/modelPicker.tsx b/ui-tui/src/components/modelPicker.tsx
index 4f5c6965a0f..d9c629e1ff1 100644
--- a/ui-tui/src/components/modelPicker.tsx
+++ b/ui-tui/src/components/modelPicker.tsx
@@ -2,6 +2,7 @@ import { Box, Text, useInput, useStdout } from '@hermes/ink'
import { fuzzyRank } from '@hermes/shared/fuzzy'
import type { ModelOptionProvider, ModelOptionsResponse } from '@hermes/shared/gateway-events'
import { modelSearchText } from '@hermes/shared/model-search-text'
+import { REASONING_EFFORTS } from '@hermes/shared/reasoning-effort'
import { useEffect, useMemo, useState } from 'react'
import { providerDisplayNames } from '../domain/providers.js'
@@ -17,10 +18,38 @@ const VISIBLE = 12
const MIN_WIDTH = 40
const MAX_WIDTH = 90
-type Stage = 'provider' | 'key' | 'model' | 'disconnect'
+type Stage = 'provider' | 'key' | 'model' | 'reasoning' | 'disconnect'
type ProviderRow = { name: string; provider: ModelOptionProvider }
+/** Rows of the effort step (step 3/3): the shared ladder, the off state, then
+ * "keep current" (empty value = no `--reasoning` flag on the emitted command). */
+export const REASONING_PICKER_ROWS: ReadonlyArray<{ label: string; value: string }> = [
+ ...REASONING_EFFORTS.map(level => ({ label: level, value: level })),
+ { label: 'none (disable reasoning)', value: 'none' },
+ { label: 'Keep current effort', value: '' }
+]
+
+/** False only when the catalog says the picked model has no reasoning control;
+ * unknown capabilities keep the step (a no-op dial beats hiding a real one). */
+export function pickerOffersReasoning(provider: ModelOptionProvider | undefined, model: string): boolean {
+ return provider?.capabilities?.[model]?.reasoning !== false
+}
+
+/** The `/model` argument the picker emits: model + provider + scope, plus
+ * `--reasoning <level>` when an effort was picked. */
+export function modelPickerCommand(
+ model: string,
+ providerSlug: string,
+ persistGlobal: boolean,
+ reasoning = ''
+): string {
+ const scope = persistGlobal ? '--global' : TUI_SESSION_MODEL_FLAG
+ const effort = reasoning ? ` --reasoning ${reasoning}` : ''
+
+ return `${model} --provider ${providerSlug}${effort} ${scope}`
+}
+
export function providerIndexAfterClearingFilter(
providerRows: ProviderRow[],
provider: ModelOptionProvider | undefined
@@ -49,6 +78,9 @@ export function ModelPicker({
const [persistGlobal, setPersistGlobal] = useState(false)
const [providerIdx, setProviderIdx] = useState(0)
const [modelIdx, setModelIdx] = useState(0)
+ const [reasoningIdx, setReasoningIdx] = useState(0)
+ // Model chosen on step 2, awaiting the effort pick on step 3.
+ const [pendingModel, setPendingModel] = useState('')
const [stage, setStage] = useState<Stage>('provider')
const [keyInput, setKeyInput] = useState('')
const [keySaving, setKeySaving] = useState(false)
@@ -176,6 +208,14 @@ export function ModelPicker({
return
}
+ if (stage === 'reasoning') {
+ setStage('model')
+ setPendingModel('')
+ setReasoningIdx(0)
+
+ return
+ }
+
if (stage === 'model' || stage === 'key' || stage === 'disconnect') {
setStage('provider')
setModelIdx(0)
@@ -192,7 +232,7 @@ export function ModelPicker({
// On the list stages we capture printable keys (including 'q') into the
// filter, so the shared overlay q/Esc handler must yield to our own handler.
- const listStage = stage === 'provider' || stage === 'model'
+ const listStage = stage === 'provider' || stage === 'model' || stage === 'reasoning'
useOverlayKeys({ disabled: listStage, onBack: back, onClose: onCancel })
useInput((ch, key) => {
@@ -313,6 +353,52 @@ export function ModelPicker({
return
}
+ // Effort stage (step 3/3): plain arrow list, no filter.
+ if (stage === 'reasoning') {
+ if (key.escape) {
+ back()
+
+ return
+ }
+
+ if (ch === 'q') {
+ onCancel()
+
+ return
+ }
+
+ if (key.upArrow && reasoningIdx > 0) {
+ setReasoningIdx(v => v - 1)
+
+ return
+ }
+
+ if (key.downArrow && reasoningIdx < REASONING_PICKER_ROWS.length - 1) {
+ setReasoningIdx(v => v + 1)
+
+ return
+ }
+
+ if (allowPersistGlobal && key.ctrl && ch === 'g') {
+ setPersistGlobal(v => !v)
+
+ return
+ }
+
+ if (key.return && provider && pendingModel) {
+ onSelect(
+ modelPickerCommand(
+ pendingModel,
+ provider.slug,
+ allowPersistGlobal && persistGlobal,
+ REASONING_PICKER_ROWS[reasoningIdx]?.value ?? ''
+ )
+ )
+ }
+
+ return
+ }
+
// List-stage Esc/q handling (overlay keys are disabled while on a list
// stage so 'q' can be typed into the filter).
if (key.escape) {
@@ -384,9 +470,14 @@ export function ModelPicker({
const model = models[modelIdx]
if (provider && model) {
- onSelect(
- `${model} --provider ${provider.slug}${allowPersistGlobal && persistGlobal ? ' --global' : ` ${TUI_SESSION_MODEL_FLAG}`}`
- )
+ if (pickerOffersReasoning(provider, model)) {
+ // Step 3/3: effort for the picked model (skipped on reasoning-free routes).
+ setPendingModel(model)
+ setReasoningIdx(0)
+ setStage('reasoning')
+ } else {
+ onSelect(modelPickerCommand(model, provider.slug, allowPersistGlobal && persistGlobal))
+ }
} else {
setStage('provider')
}
@@ -567,7 +658,7 @@ export function ModelPicker({
return (
<Box flexDirection="column" width={width}>
<Text bold color={t.color.accent} wrap="truncate-end">
- Select provider (step 1/2)
+ Select provider (step 1/3)
</Text>
<Text color={t.color.muted} wrap="truncate-end">
@@ -629,6 +720,39 @@ export function ModelPicker({
)
}
+ // ── Reasoning effort stage ───────────────────────────────────────────
+ if (stage === 'reasoning') {
+ return (
+ <Box flexDirection="column" width={width}>
+ <Text bold color={t.color.accent} wrap="truncate-end">
+ Reasoning effort (step 3/3)
+ </Text>
+
+ <Text color={t.color.muted} wrap="truncate-end">
+ {pendingModel} · applies with the switch (same scope) · Esc back
+ </Text>
+
+ {REASONING_PICKER_ROWS.map((row, idx) => (
+ <Text
+ color={t.color.muted}
+ {...chipRowProps(t, reasoningIdx === idx)}
+ key={row.value || 'keep'}
+ wrap="truncate-end"
+ >
+ {reasoningIdx === idx ? '▸ ' : ' '}
+ {idx + 1}. {row.label}
+ </Text>
+ ))}
+
+ <Text color={t.color.muted} wrap="truncate-end">
+ persist: {allowPersistGlobal ? (persistGlobal ? 'global' : 'session') : 'session'}
+ {allowPersistGlobal ? ' · ^g toggle' : ' only'}
+ </Text>
+ <OverlayHint t={t}>↑/↓ select · Enter switch · Esc back · q close</OverlayHint>
+ </Box>
+ )
+ }
+
// ── Model selection stage ────────────────────────────────────────────
const { items, offset } = windowItems(models, modelIdx, VISIBLE)
const noModelMatches = !!filter.trim() && models.length === 0
@@ -636,7 +760,7 @@ export function ModelPicker({
return (
<Box flexDirection="column" width={width}>
<Text bold color={t.color.accent} wrap="truncate-end">
- Select model (step 2/2)
+ Select model (step 2/3)
</Text>
<Text color={t.color.muted} wrap="truncate-end">
@@ -692,7 +816,7 @@ export function ModelPicker({
{allowPersistGlobal ? ' · ^g toggle' : ' only'}
</Text>
<OverlayHint t={t}>
- {models.length ? '↑/↓ select · Enter switch · Esc clear/back · q close' : 'Esc back · q close'}
+ {models.length ? '↑/↓ select · Enter next · Esc clear/back · q close' : 'Esc back · q close'}
</OverlayHint>
</Box>
)
diff --git a/website/docs/reference/slash-commands.md b/website/docs/reference/slash-commands.md
index aac42a75581..63b5f70eca1 100644
--- a/website/docs/reference/slash-commands.md
+++ b/website/docs/reference/slash-commands.md
@@ -76,7 +76,7 @@ Type `/` in the CLI to open the autocomplete menu. Built-in commands are case-in
| Command | Description |
|---------|-------------|
| `/config` | Show current configuration |
-| `/model [model-name]` | Show or change the current model. Supports: `/model claude-sonnet-4`, `/model provider:model` (switch providers), `/model custom:model` (custom endpoint), `/model custom:name:model` (named custom provider), `/model custom` (auto-detect from endpoint), OpenRouter account presets (`/model @preset/<slug>` or `/model <model>@preset/<slug>` — presets are account-scoped, so they skip the public model-listing check), and user-defined aliases (`/model fav`, `/model grok` — see [Custom model aliases](#custom-model-aliases)). Flags: `--global` persists the change to config.yaml; `--session` forces session-only; `--once` applies to the next turn only; `--refresh` re-fetches the provider's model list; `--provider <name>` switches backend (session-only unless `--global`). A plain `/model <name>` is session-only unless `model.persist_switch_by_default: true` is set — except when no `model.default`/`model.provider` is configured yet, in which case the first pick persists so the profile gets a real default. The same rule governs the desktop composer picker. **Interactive picker:** running `/model` with no arguments opens the provider→model picker; on the model list you can **type to fuzzy-filter** the models (e.g. type `grok` to narrow to matching models), Backspace to trim the filter, Esc to clear it (or close the picker). Selection always resolves to one concrete model — the filter only narrows the list, it never guesses. **Note:** `/model` can only switch between already-configured providers. To add a new provider, exit the session and run `hermes model` from your terminal. **Cost note:** switching models mid-conversation resets the prompt cache — the cache key includes the model, so your next turn re-reads the entire conversation at full input price instead of the ~75%-discounted cached rate. Expected and unavoidable, but worth knowing on long sessions. |
+| `/model [model-name]` | Show or change the current model. Supports: `/model claude-sonnet-4`, `/model provider:model` (switch providers), `/model custom:model` (custom endpoint), `/model custom:name:model` (named custom provider), `/model custom` (auto-detect from endpoint), OpenRouter account presets (`/model @preset/<slug>` or `/model <model>@preset/<slug>` — presets are account-scoped, so they skip the public model-listing check), and user-defined aliases (`/model fav`, `/model grok` — see [Custom model aliases](#custom-model-aliases)). Flags: `--global` persists the change to config.yaml; `--session` forces session-only; `--once` applies to the next turn only; `--refresh` re-fetches the provider's model list; `--provider <name>` switches backend (session-only unless `--global`); `--reasoning <level>` sets the reasoning effort (`none`, `minimal` … `ultra`) in the same step and with the same scope as the pick. A plain `/model <name>` is session-only unless `model.persist_switch_by_default: true` is set — except when no `model.default`/`model.provider` is configured yet, in which case the first pick persists so the profile gets a real default. The same rule governs the desktop composer picker. **Interactive picker:** running `/model` with no arguments opens the provider→model picker; on the model list you can **type to fuzzy-filter** the models (e.g. type `grok` to narrow to matching models), Backspace to trim the filter, Esc to clear it (or close the picker). Selection always resolves to one concrete model — the filter only narrows the list, it never guesses. After the model, a third step offers the reasoning effort for that model (or **Keep current effort**); it is skipped when the catalog says the route has no reasoning control. **Note:** `/model` can only switch between already-configured providers. To add a new provider, exit the session and run `hermes model` from your terminal. **Cost note:** switching models mid-conversation resets the prompt cache — the cache key includes the model, so your next turn re-reads the entire conversation at full input price instead of the ~75%-discounted cached rate. Expected and unavoidable, but worth knowing on long sessions. |
| `/codex-runtime [auto\|codex_app_server\|on\|off]` | Toggle the optional [Codex app-server runtime](../user-guide/features/codex-app-server-runtime) for OpenAI/Codex models. `auto` (default) uses Hermes' standard chat completions; `codex_app_server` hands turns to a `codex app-server` subprocess for native shell, apply_patch, ChatGPT subscription auth, and migrated Codex plugins. Effective on next session. |
| `/personality` | Set a predefined personality. `/personality none` (or `default` / `neutral`) clears the overlay and returns to base behavior. |
| `/verbose` | Cycle tool progress display: off → new → all → verbose. Can be [enabled for messaging](#notes) via config. |
diff --git a/website/docs/user-guide/configuring-models.md b/website/docs/user-guide/configuring-models.md
index c200d46b813..22dcb6d296a 100644
--- a/website/docs/user-guide/configuring-models.md
+++ b/website/docs/user-guide/configuring-models.md
@@ -358,7 +358,9 @@ Then `/model fav` or `/model grok` in chat. User aliases shadow built-in short n
hermes model # Interactive provider + model picker (the canonical way to switch defaults)
```
-`hermes model` walks you through picking a provider, authenticating (OAuth flows open a browser; API-key providers prompt for the key), and then choosing a specific model from that provider's curated catalog. The choice is written to `model.provider` and `model.default` in `~/.hermes/config.yaml`.
+`hermes model` walks you through picking a provider, authenticating (OAuth flows open a browser; API-key providers prompt for the key), and then choosing a specific model from that provider's curated catalog. The choice is written to `model.provider` and `model.default` in `~/.hermes/config.yaml`. After a new model is saved, a reasoning-effort step follows (`minimal` … `ultra`, **Disable reasoning**, or **Skip** to keep the current value) and writes `agent.reasoning_effort`; the step is skipped for models the catalog marks as having no reasoning control. The provider list also has a **Reasoning effort for the current model...** row to change only the effort.
+
+**Configure auxiliary models...** opens the per-task side-model picker (vision, compression, approval, delegation, …). Each task's provider → model pick ends with the same effort step, stored as `auxiliary.<task>.reasoning_effort` (or `delegation.reasoning_effort`), with an extra **Provider default** row that leaves the level up to the provider. Tasks whose block has no `reasoning_effort` key by design (MoA slots, memory query rewrite) skip the step.
To list providers/models without launching the picker, use the dashboard or the REST endpoints below. To inspect what the CLI will actually use right now: `hermes config get model --json` and `hermes status`.
diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/slash-commands.md b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/slash-commands.md
index 8bb77fa52be..72e0ab7c070 100644
--- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/slash-commands.md
+++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/slash-commands.md
@@ -66,7 +66,7 @@ Hermes 有两个斜杠命令入口,均由 `hermes_cli/commands.py` 中的中
| 命令 | 描述 |
|---------|-------------|
| `/config` | 显示当前配置 |
-| `/model [model-name]` | 显示或更改当前模型。支持:`/model claude-sonnet-4`、`/model provider:model`(切换提供商)、`/model custom:model`(自定义端点)、`/model custom:name:model`(命名自定义提供商)、`/model custom`(从端点自动检测),以及用户自定义别名(`/model fav`、`/model grok`——见[自定义模型别名](#custom-model-aliases))。使用 `--global` 将更改持久化到 config.yaml。**注意:** `/model` 只能在已配置的提供商之间切换。如需添加新提供商,请退出会话后在终端运行 `hermes model`。 |
+| `/model [model-name]` | 显示或更改当前模型。支持:`/model claude-sonnet-4`、`/model provider:model`(切换提供商)、`/model custom:model`(自定义端点)、`/model custom:name:model`(命名自定义提供商)、`/model custom`(从端点自动检测)、`--reasoning <level>`(在同一步、同一作用域下设置推理强度:`none`、`minimal` … `ultra`;选择器在选完模型后会多出一步推理强度选择,目录标记为无推理控制的路线会跳过该步),以及用户自定义别名(`/model fav`、`/model grok`——见[自定义模型别名](#custom-model-aliases))。使用 `--global` 将更改持久化到 config.yaml。**注意:** `/model` 只能在已配置的提供商之间切换。如需添加新提供商,请退出会话后在终端运行 `hermes model`。 |
| `/codex-runtime [auto\|codex_app_server\|on\|off]` | 切换 OpenAI/Codex 模型的可选 [Codex app-server runtime](../user-guide/features/codex-app-server-runtime)。`auto`(默认)使用 Hermes 标准 chat completions;`codex_app_server` 将轮次交给 `codex app-server` 子进程,支持原生 shell、apply_patch、ChatGPT 订阅认证和迁移的 Codex 插件。下次会话生效。 |
| `/personality` | 设置预定义的 personality(人格) |
| `/verbose` | 循环切换工具进度显示:off → new → all → verbose。可通过配置[为消息平台启用](#notes)。 |
diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/user-guide/configuring-models.md b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/user-guide/configuring-models.md
index d24b4c43ae2..58d31c7d560 100644
--- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/user-guide/configuring-models.md
+++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/user-guide/configuring-models.md
@@ -194,7 +194,9 @@ hermes config set model.aliases.grok x-ai/grok-4
hermes model # 交互式提供商 + 模型选择器(切换默认值的标准方式)
```
-`hermes model` 引导你选择提供商、完成认证(OAuth 流程会打开浏览器;API key 提供商会提示输入密钥),然后从该提供商的精选目录中选择具体模型。选择结果写入 `~/.hermes/config.yaml` 的 `model.provider` 和 `model.model` 字段。
+`hermes model` 引导你选择提供商、完成认证(OAuth 流程会打开浏览器;API key 提供商会提示输入密钥),然后从该提供商的精选目录中选择具体模型。选择结果写入 `~/.hermes/config.yaml` 的 `model.provider` 和 `model.model` 字段。保存新模型后会紧接一步推理强度选择(`minimal` … `ultra`、**Disable reasoning**,或 **Skip** 保留当前值),写入 `agent.reasoning_effort`;目录标记为无推理控制的模型会跳过该步。提供商列表中还有 **Reasoning effort for the current model...** 一行,可只更改推理强度。
+
+**Configure auxiliary models...** 打开各辅助任务(视觉、压缩、审批、委派等)的侧模型选择器。每个任务在选完提供商 → 模型后同样会进入推理强度步骤,存为 `auxiliary.<task>.reasoning_effort`(或 `delegation.reasoning_effort`),并多一行 **Provider default** 把强度交给提供商决定。设计上没有 `reasoning_effort` 键的任务(MoA 槽位、记忆查询改写)会跳过该步。
如需在不启动选择器的情况下列出提供商/模型,请使用仪表板或下方的 REST 端点。查看 CLI 当前实际使用的配置:`hermes config get model` 和 `hermes status`。