/model picker writes ANSI escape fragment (\[1m\) into settings.json model value
Description
Selecting a model via the interactive /model picker writes an ANSI formatting fragment into the persisted model value in settings.json. After choosing a model, the saved value becomes e.g.:
"model": "claude-fable-5[1m]"
The trailing [1m] is the ANSI "bold on" escape sequence (ESC[1m) with the ESC byte stripped, leaking from the picker's own styled stdout (the confirmation line renders as Set model to <ESC>[1mFable 5<ESC>[22m ...). The [1m portion ends up concatenated onto the saved model id.
Reproduction
- Run
/modeland select any model. - Open
~/.claude/settings.json. - The
modelfield readsclaude-<name>[1m]instead ofclaude-<name>.
Reproduces every time /model is used; correcting the value by hand fixes it until the next /model run re-corrupts it.
Impact
Appears cosmetic — the model still resolves and runs correctly with the malformed value (it is not silently downgraded). But a corrupted model id is fragile: stricter validation in a future version could reject it or fall back silently, and it makes settings.json look broken to anyone reading it.
Environment
- Claude Code 2.1.215
- Windows 11, PowerShell
- Also observed after
/modelruns that reportSet model to <name> and saved as your default for new sessions with <effort> effort.
Suggested fix
Strip ANSI escape sequences from the selected value before persisting it to settings.json (or build the persisted id from the raw model identifier rather than the styled display string).
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗