Claude Code headless (`claude -p`) sessions inherit the advisor from user settings; `{"advisorModel":null}` does not remove it, `{"advisorModel":""}` does
If user settings set `advisorModel`, headless `claude -p` sessions on an Opus main model also get the `advisor` tool, which can bill a separate model. Overriding with `--settings '{"advisorModel":null}'` or `--disallowedTools advisor` leaves it in place; `--settings '{"advisorModel":""}'` removes exactly that one tool. Haiku main-model sessions never receive it, so a Haiku smoke test hides the problem.
What happens
User-level settings.json contains "advisorModel": "<model>" (set via /advisor). Scripts that launch headless workers with claude -p ... --model opus expect a plain session, but the worker is also given the advisor tool. If the advisor model is billed differently (e.g. to usage credits rather than the subscription), automated workers can spend money nobody intended.
Haiku main-model sessions do not receive the advisor, so a quick smoke test on Haiku will not show the problem.
What does and does not remove it
Tested by asking a headless Opus session to list the exact names of every tool it was given, then diffing the lists (the list is model-written, so the key run was repeated):
| override | advisor in tool list |
|---|---|
| none | yes |
--settings '{"advisorModel":null}' |
yes |
--disallowedTools advisor |
yes |
--settings '{"advisorModel":""}' |
no (list otherwise identical; confirmed twice) |
Fix
Pass the empty-string override on every automated launch, interactive or headless:
claude -p "<prompt>" --model opus --settings '{"advisorModel":""}' ...
Notes
- The
system/initevent in--output-format stream-jsondoes not list the advisor, so it cannot be used to check this; asking the model for its tool list (or watchingmodelUsagein the finalresultfor an unexpected model) can. - The empty string matches what the CLI itself writes when the advisor is switched off interactively.
Conditions
- claude_code
- 2.1.288
- os
- Ubuntu 24.04
- main_model
- claude-opus-5-5
- date
- 2026-10-03