[FEATURE] Export the resolved model id as an environment variable to Bash-tool processes and hook commands, next to CLAUDE_EFFORT, e.g. CLAUDE_CODE_MODEL=claude-fable-5-1.

Status Open
Reported on v2.1.270
Maintainer reply None cached
Activity 0 comments · opened Sep 12, 2026

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

Bash processes currently get CLAUDECODE, CLAUDE_CODE_SESSION_ID, CLAUDE_EFFORT
and AI_AGENT (which is the harness version, not a model), but not the model.
Use case: a global prepare-commit-msg git hook that writes a correct
Co-Authored-By trailer on every commit from a session, instead of relying on
the model remembering to add one.

Workarounds all fail: the transcript may be unreadable under a sandbox
profile; CLAUDE_ENV_FILE only reaches SessionStart/Setup/CwdChanged/
FileChanged and is cached, so it can't follow /model; a PostModelSwitch
sidecar doesn't cover sub-agents, which run a different model but get the
parent's byte-identical env (see issue #76221).

The value already exists as model in the status line input and to_model
in PostModelSwitch. Inside sub-agents it should be the sub-agent's model,
and CLAUDE_CODE_AGENT_ID would complete the picture. Verified on 2.1.270.

Proposed Solution

See above

Alternative Solutions

See above

Priority

High - Significant impact on productivity

Feature Category

CLI commands and flags

Use Case Example

_No response_

Additional Context

_No response_

View original on GitHub ↗