Problem
Hook scripts (PreToolUse, PostToolUse, etc.) have no way to determine which model is currently active in a session:
- The PreToolUse/PostToolUse JSON payload contains no
model field.
- No environment variable exposes the active model to hook processes.
/model <name> changes the model for the current session only and is not persisted anywhere a hook can read (not in .claude/settings.local.json, not in any session-state file).
- No hook event fires on a
/model switch with the new model in its payload.
Impact
Teams practicing cost-disciplined model orchestration (e.g. defaulting to a cheap model, escalating to an expensive one only for hard sub-tasks, then de-escalating) cannot enforce this technically. A PreToolUse gate that should block code edits while an expensive model is active has no reliable signal to act on — even SessionStart's model field only reflects the model at session start/resume, not later /model switches.
Request
Either:
- Include the currently active model in the PreToolUse/PostToolUse hook input payload (e.g.
model: "claude-opus-4-8"), updated live after /model switches, or
- Emit a hook event (or extend
UserPromptSubmit) when the model changes via /model, with old/new model in the payload, or
- Expose the active model via an environment variable that hook subprocesses inherit, updated on every
/model switch.
Any of the three would let hooks reliably gate tool use based on the active model — currently not possible.
Problem
Hook scripts (PreToolUse, PostToolUse, etc.) have no way to determine which model is currently active in a session:
modelfield./model <name>changes the model for the current session only and is not persisted anywhere a hook can read (not in.claude/settings.local.json, not in any session-state file)./modelswitch with the new model in its payload.Impact
Teams practicing cost-disciplined model orchestration (e.g. defaulting to a cheap model, escalating to an expensive one only for hard sub-tasks, then de-escalating) cannot enforce this technically. A
PreToolUsegate that should block code edits while an expensive model is active has no reliable signal to act on — evenSessionStart'smodelfield only reflects the model at session start/resume, not later/modelswitches.Request
Either:
model: "claude-opus-4-8"), updated live after/modelswitches, orUserPromptSubmit) when the model changes via/model, with old/new model in the payload, or/modelswitch.Any of the three would let hooks reliably gate tool use based on the active model — currently not possible.