Skip to content

Commit ccd14e8

Browse files
committed
docs(scripts): correct model-resolution header to four steps (#6879)
check-agent-model-declared's WHY-THIS-EXISTS header described model resolution as three steps, omitting CLAUDE_CODE_SUBAGENT_MODEL, which outranks the model argument, the frontmatter pin, and inheritance. Corrects the header to the real four-step order (already written into .claude/agents/os-dev.md by PR #6871) and adds the adjacent note that an availableModels-blocked value falls back to the inherited model, not to the frontmatter pin. Comment-only change; no behaviour change. The gate still asserts only that the model: slot is non-empty (#6803). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F8q5J1MQyocgtNspb15fSn
1 parent 3e8e669 commit ccd14e8

1 file changed

Lines changed: 16 additions & 7 deletions

File tree

scripts/check-agent-model-declared.mjs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,22 @@
22
// check-agent-model-declared — asserts that every agent definition under
33
// .claude/agents/ declares a `model:` in its frontmatter (#6803).
44
//
5-
// WHY THIS EXISTS. The Agent tool resolves a subagent's model in three steps: an
6-
// explicit `model` argument on the dispatch call → the agent definition's
7-
// frontmatter → **inherit from the parent session**. When the first two are absent
8-
// the third always applies, silently. That makes "what model does this role run
9-
// on" a property of whoever happened to dispatch it, at whatever moment their own
10-
// session was on, rather than a property of the role — and it changes with no
11-
// signal, mid-term, invisibly.
5+
// WHY THIS EXISTS. Claude Code resolves a subagent's model in four steps (verified
6+
// 2026-08-09 against the subagent documentation, "Claude Code resolves the
7+
// subagent's model in this order"): the `CLAUDE_CODE_SUBAGENT_MODEL` environment
8+
// variable, when set → an explicit `model` argument on the dispatch call → the
9+
// agent definition's frontmatter → **inherit from the parent session**. When the
10+
// first three are absent the last always applies, silently. That makes "what
11+
// model does this role run on" a property of whoever happened to dispatch it, at
12+
// whatever moment their own session was on, rather than a property of the role —
13+
// and it changes with no signal, mid-term, invisibly. (`CLAUDE_CODE_SUBAGENT_MODEL`
14+
// outranks every other step, including this gate's own pin — see
15+
// `.claude/agents/os-dev.md` for the full order and both adjacent traps.)
16+
//
17+
// A second, smaller nuance in that same order: a value blocked by the
18+
// organization's `availableModels` allowlist does NOT fall back to the frontmatter
19+
// pin below — it falls back to the INHERITED model, i.e. straight into the
20+
// silent-inheritance failure mode this gate exists to catch.
1221
//
1322
// That is measured, not theoretical, and it fails in a shape worth naming:
1423
//

0 commit comments

Comments
 (0)