The tool line was already written when the login failed. A project file at .claude/agents/reviewer.md set tools: Read. A headless claude --print against that directory exited 1. The JSON result said is_error true, subtype success, terminal_reason api_error, and result Not logged in · Please run /login. The session file written before that result already contained this listing line:
- reviewer: Reviews a single file and returns a one-line verdict. Use when asked to review probe.txt. (Tools: Read)
The same name, passed as --agents JSON with a description and a prompt and no tools field, replaced that line with reviewer: JSON reviewer (Tools: All tools). Adding "tools": ["Read"] put Tools: Read back, and a second JSON name appeared beside it as Tools: All tools. --agent reviewer did not print a listing line at all. It made the markdown body the session system prompt, kept Read, and dropped Agent, Bash, Edit, and Write from the request.
A job that stops at the login sentence will miss all three of those records. A job that treats subtype success as a completed review will miss them too. The listing is the check, and on this binary it is available before any model reply.
The binary and the file
The binary was Claude Code 2.1.308, on Linux x86_64, on 30 November 2026. claude --version printed 2.1.308 (Claude Code). The resolved executable was 292232560 bytes, dated 22 October 2026. Its SHA-256 was 356733f185fa988e6bf3aa9a555269fdd167982a2e2a80d3c8a78037bb92ad58. This run did not install a newer build. The changelog page fetched the same morning lists 2.1.332, dated 25 November 2026, as a later heading. One fix under that heading says agents passed with --agents were lost once plugins loaded or reloaded. This run loaded the built-in plugins at startup and did not reload them. The listing below was still present at the login failure. That is not a test of 2.1.332.
Each case used a new CLAUDE_CONFIG_DIR and a new HOME. No ANTHROPIC_API_KEY was set. No claude auth login was run. No prompt was answered by a model. The account Claude directory and the account .claude.json kept the modification times recorded before the first command. The disposable config directory was not empty afterward. It gained session transcripts for the runs that reached the API error, and a small .claude.json. Delete that directory when you are done. Do not point the check at the account Claude directory.
The project file was a user-written subagent, not a plugin. The front matter set name to reviewer, description to a one-line verdict instruction, tools to Read, and model to haiku. The body was one sentence: read probe.txt and reply with exactly REVIEWED. The working directory also held probe.txt, with the text marker. The directory was not a git repository.
The subagents page fetched the same morning says a markdown file under .claude/agents/ is a project subagent, and that --agents JSON is a higher-priority definition for the current session only. The priority table puts the CLI flag above the project directory. The same page says the tools field is an allowlist, and that a subagent inherits every tool available to subagents when the field is omitted. The CLI reference says --agent specifies an agent for the current session and overrides the agent setting. It says --agents defines custom subagents from JSON, validates the value at startup, and, with --print, accepts a path to a JSON file. The file form requires 2.1.281 or later. This binary is 2.1.308, and the file form was accepted. None of those pages print the session record this binary wrote when login failed.
What the listing recorded
The decisive commands omitted --permission-mode. An earlier probe had passed plan, and plan mode adds its own reminder. That reminder is not the tool line. The runs below did not pass the flag, so the line is not a plan-mode artifact.
With only the markdown file, claude --print --output-format json and the prompt Reply PING exited 1. Standard error was empty. The JSON object had duration_api_ms 0. The result text was the login sentence. The transcript’s agent_listing_delta attachment rendered a system reminder of available agent types. The reviewer row used the file’s description and ended with (Tools: Read). The built-in names claude, Explore, general-purpose, Plan, and statusline-setup were in the same reminder. The markdown body was not in that reminder, and it was not in the parent system prompt. The parent model attachment named Opus 5.5, model id claude-opus-5-5.
A JSON file with one key, reviewer, a description JSON reviewer, and a prompt Reply JSON_AGENT, and no tools field, was passed as --agents with the path of that file. The command exited 1 with the same login result. The listing row was reviewer: JSON reviewer (Tools: All tools). The prompt string did not appear. There was one reviewer row, not the markdown row plus a JSON row. The priority table describes that replacement. The listing is how this binary showed it before login. A job that still greps for (Tools: Read) after passing --agents without a tools field will not find the limit the markdown file set.
A second JSON object set tools to a one-element array containing Read, changed the description to limited json, and added a second name, scribe, with a description and a prompt and no tools field. The listing then had both of these rows:
- reviewer: limited json (Tools: Read)
- scribe: second json agent (Tools: All tools)
The markdown description was gone. The scribe prompt was not in the listing. A second name is an addition. The same name is a replacement, and the replacement uses the JSON fields that are present. Omit tools and the row says All tools, which matches the inherit sentence on the subagents page. Include tools and the row names that list. The listing does not show the prompt. If you need to know which sentence the subagent would receive, the listing is the wrong field.
The parent request still had Write
The listing line is not the parent tool list. On the markdown-only run, and on both --agents runs, the API request shape named these tools: Agent, Bash, Edit, ListAgents, Read, ReportFindings, ScheduleWakeup, Skill, ToolSearch, Workflow, DeferredToolPlaceholder, and Write. The parent was still Opus 5.5. A grep of that shape for the absence of Write will fail, even when the reviewer row says (Tools: Read).
That split matters if the job is supposed to prove a read-only reviewer. The parent session is the process that received Reply PING. It was not restricted to Read. The reviewer row is an instruction about a later Agent tool call, and this run never made that call. Login failed first. Do not describe the spawned reviewer as tested. Describe the listing, and describe the parent request, and keep them apart.
The Agent tool schema in that same request did not enumerate reviewer. subagent_type was a string, and the description said available agent types are listed in system-reminder messages. The reminder is the record. The tool schema is not a second copy of it.
The session flag is a different object
--agent reviewer, with --print and --output-format json, also exited 1 on the login sentence. The transcript started with an agent-setting record whose value was reviewer. There was no agent_listing_delta attachment. The request system texts were two short blocks. The first said the process was a Claude agent built on the Claude Agent SDK. The second was the markdown body, unchanged. The tool names in that request were DeferredToolPlaceholder and Read. Agent, Bash, Edit, and Write were absent. The model attachment named Haiku 5.5, model id claude-haiku-5-5, which is the haiku field from the file, not the Opus parent from the other runs.
That is the session agent, not a subagent row. The CLI reference’s one-line description, “specify an agent for the current session,” is the right object. It does not say the parent tool list collapses to the file’s tools field, and it does not say the model attachment changes before login. Both happened on this binary. A pipeline that passes --agent reviewer in order to “register” the reviewer, and then expects the parent to keep Bash and Write, is reading the wrong flag. Use --agents when the parent should keep its tools and the reviewer should appear in the listing. Use --agent when the session itself should run as that file.
The help text for --agents also says a value that is not a JSON object is read as a file path when --print is set. A missing path exited 1 before any session file existed. Standard error was Error: --agents file not found, then the path, then the parenthetical that a non-object value is read as a file path. A file of truncated JSON exited 1 with Error: Invalid --agents configuration and invalid JSON. That session directory did not gain a transcript either. Validation, which the CLI reference dates to 2.1.242 or later, is the stop that happens before the listing is written. This binary performed it.
Three stops, and only one writes the listing
A missing session name is a third stop, and it is earlier than login as well. claude --print --agent missing-name exited 1. Standard output was empty. Standard error was one line: --agent 'missing-name' not found. Available agents: claude, Explore, general-purpose, Plan, reviewer, statusline-setup. The project name reviewer was on that list. No transcript was created. The missing-name error is a catalog read. It is not a login failure, and it is not proof that the tool line is (Tools: Read). The catalog names the agent. The listing, or the --agent request shape, is what names the tools.
The login failure is the stop that writes. Four transcripts existed after the four commands that reached the API error: markdown only, --agents without tools, --agents with tools and a second name, and --agent reviewer. The missing file, the bad JSON, and the missing name did not add a fifth, sixth, or seventh file. Exit code 1 is shared. The presence of a transcript is not. If the job deletes the config directory on any exit 1, it deletes the only copy of the tool line.
The JSON result makes the same trap in another field. is_error was true and terminal_reason was api_error, but subtype was success. A checker that accepts subtype success and ignores is_error will treat a login failure as a finished turn. num_turns was 1. permission_denials was an empty array. An empty denial list does not mean the reviewer ran, and it does not mean a write was allowed. It means this turn did not record a denial. The turn ended before a tool call.
Verify the listing before the next step
Point CLAUDE_CONFIG_DIR and HOME at new directories. Put the markdown file under .claude/agents/ in a disposable project. Run claude --print --output-format json with a prompt that does not ask for work, and do not pass --permission-mode unless you intend to test that mode. If the result is the login sentence, open the new transcript and read the agent_listing_delta reminder. Expect the description and the (Tools: …) suffix from the file. Do not expect the markdown body in that reminder.
To see a JSON replacement, pass --agents with --print, either as an object or as a path to an object. On this binary both forms were read. If the object uses the same name and omits tools, expect Tools: All tools and expect the markdown description to be gone. If the object sets tools, expect that array in the suffix. A second key should add a row. It should not restore the markdown row for the name you replaced.
To see the file applied to the session, pass --agent and the name. Expect an agent-setting record, the markdown body in the system texts, the file’s tool names plus DeferredToolPlaceholder, and the model the file named. Do not expect the listing reminder in that transcript. If you need both the listing and the collapsed session, they are two commands, not two views of one command.
If the name is wrong, expect the not-found line and no transcript. If the JSON path is missing or the JSON does not parse, expect the invalid-configuration line and no transcript. If you need the tool line, the login failure is the run that keeps it. Match is_error and the login sentence, not subtype. Then read the reminder, or the request shape, before you decide which flag the job should keep.
This note is 2.1.308. The 2.1.332 changelog entry about --agents definitions lost on a plugin reload is a later sentence. Repeat the listing read on the binary the job will run. Until that read shows the tool suffix you intend, a login error has not shown that the reviewer is limited to Read, and a parent request that still names Write has not shown it either.
Sources
- Claude Code 2.1.308,
claude --versionprinted2.1.308 (Claude Code), Linux x86_64, 30 November 2026. The resolved executable is 292232560 bytes, dated 22 October 2026, SHA-256356733f185fa988e6bf3aa9a555269fdd167982a2e2a80d3c8a78037bb92ad58. DisposableCLAUDE_CONFIG_DIRandHOME. No API key. Noclaude auth login. Commands wereclaude --printwith and without--agentsand--agent. claude --helpon that binary.--agentis the agent for the current session.--agentsis a JSON object defining custom agents, or, with--print, a path to a file that holds one.- Create custom subagents, fetched 30 November 2026.
--agentsoutranks.claude/agents/when the name matches. Omittingtoolsinherits every tool available to subagents. The file form of--agentsrequires 2.1.281 or later and non-interactive mode. - CLI reference, fetched 30 November 2026.
--agentoverrides theagentsetting.--agentsis validated at startup. Validation requires 2.1.242 or later. The file form requires 2.1.281 or later. - Changelog, fetched 30 November 2026. The page opens on 2.1.332, dated 25 November 2026. That heading includes a fix for
--agentsdefinitions lost once plugins loaded or reloaded. This run did not install that build and did not reload plugins.