Put the session's model in every hook's input

Status Open
Maintainer reply None cached
Activity 0 comments · opened Oct 6, 2026

What is missing

A hook's JSON input names the session, the transcript path and the tool call, but never the model the session runs on.

Why it matters

We run a PreToolUse hook on the task tools that limits how many tasks a session keeps open. The limit depends on the model, since a larger model tracks more open work reliably than a smaller one.

What we do today

The hook reads the tail of the file at transcript_path and takes the model of the latest assistant message. That file's shape is undocumented, so the hook can break on any release.

The SessionStart input does carry model, but in our use it can go missing after /clear, and a hook that stores it goes stale when the person switches model during the session.

The request

Add a model field, holding the model id of the session at the time of the call, to the common input of every hook event. For a subagent's tool call, name the subagent's own model.

Environment: Claude Code CLI on macOS.

View original on GitHub ↗