Choose which preset claude-mode <provider> picks

Omitting the preset used a fixed name per provider (default, zai,
lmstudio). It can now be chosen:

  claude-mode preset default                     what each picks, and why
  claude-mode preset default openrouter cheap
  claude-mode preset default openrouter --clear

The choice is stored in ~/.claude-mode/defaults.json and read first by
default_preset_for, while its file still exists. A choice whose file is gone
falls back to the built-in name, and if that is gone too, to the first
preset by name, as before. Renaming a chosen preset moves the choice with it,
and deleting it clears the choice. The terminal menu marks what
resolve_preset would actually pick.

health.json publishes defaultPresetFor (what each provider resolves to, in
the CLI's order) and defaultPresetChosen (the explicit choices only). The
panel sorts and tags from it, and the editor gains Make default / Clear
default. preset new, rename and rm now refresh health.json, so the bar
follows edits made in a terminal too.

This changes existing CLI behaviour only once a default is chosen. The
Windows build does not read defaults.json yet.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
smoido
2026-09-15 00:34:14 +03:00
co-authored by Claude Opus 5
parent de9f10a8c2
commit c5c3fc57d9
4 changed files with 213 additions and 13 deletions
+16 -2
View File
@@ -185,6 +185,7 @@ claude-mode preset new <name> [from] copy an existing preset (default: `defaul
claude-mode preset new <name> --provider <p> [--blank]
copy that provider's default, or start empty
claude-mode preset rename <name> <new-name> repoints state.json if it is in use
claude-mode preset default [provider] [name|--clear] which preset `claude-mode <provider>` picks
claude-mode preset set <name> <tier> <model-id>
claude-mode preset all <name> <model-id> point every tier at one model
claude-mode preset rm <name>
@@ -204,8 +205,21 @@ claude-mode sessions --dry-run show what either would do, and do nothing
claude-mode <mode> --force switch even when preflight says no
```
Omitting the preset uses a **fixed** per-provider default, not "most recently
used" — so `claude-mode openrouter` always means `default`.
Omitting the preset uses a per-provider default, never "most recently used".
Out of the box that is a fixed name — `claude-mode openrouter` means `default`,
`zai` means `zai`, `lmstudio` means `lmstudio` — and it can be changed:
```bash
claude-mode preset default # what each provider picks, and why
claude-mode preset default openrouter cheap # `claude-mode openrouter` now means `cheap`
claude-mode preset default openrouter --clear # back to the built-in name
```
The choice lives in `~/.claude-mode/defaults.json`. If the chosen preset is
deleted the choice is cleared with it, renaming moves it along, and a choice
whose file has gone some other way simply falls back to the built-in name. If
that is gone too, the provider's first preset by name is used. The Windows build
does not read this file yet, and keeps the built-in names.
Editing the active preset re-applies it straight away. For `preset set` and
`preset all` that happens **without** asking about running sessions: a switch