Subagent Frontmatter
An agent file is a Markdown file that defines a subagent.
The keys at the top of the file (the frontmatter) set its name, tools, model, and limits. The body is its prompt.
For example, a file with name: reviewer and tools: Read, Grep makes a read-only review agent.
Edit the file, or pass --agents JSON. To turn a subagent off, delete the file or deny Agent(name) in permissions.deny.
Example
claude --agents '{
"tester": {
"description": "Runs the test suite and reports failures.",
"prompt": "Run the tests. Report each failing test and its error.",
"tools": ["Bash", "Read"],
"model": "haiku",
"maxTurns": 10
}
}'
Keys
| Key | Status | What it does | Notes |
|---|---|---|---|
name | Documented: An official docs page names this item. | The unique ID of the agent. | At most 256 characters. Must not start with - or contain :. Hooks receive it as agent_. Claude Code treats a file with no name as documentation. |
description | Documented: An official docs page names this item. | Tells Claude when to delegate to the agent. | Required. Claude Code skips a file with name but no description. A literal \n becomes a newline. It may not be empty in -- JSON. |
tools | Documented: An official docs page names this item. | An allowlist of tools. | A comma-separated string or a YAML list. If you omit it, the agent inherits all tools that subagents can use. Agent(a, b) limits which types a -- main thread can start. mcp__ picks a whole server. |
disallowed | Documented: An official docs page names this item. | A denylist of tools. Claude Code applies it first. Then tools resolves against what remains. | An entry such as Bash(git push *) removes the whole tool. mcp__ withholds MCP tools. |
model | Documented: An official docs page names this item. | The model of the agent. | sonnet, opus, haiku, fable, a full model ID, or inherit. Order of choice: the per-call model, this field, CLAUDE_, the main model. CLAUDE_ forces one model. See Models. |
permission | Documented: An official docs page names this item. | The permission mode of the agent. | default, accept, auto, dont, bypass, plan, or manual (same as default). bypass applies only when the main session has it. Claude Code ignores it for plugin agents. |
max | Documented: An official docs page names this item. | The most agentic turns before the agent stops. | A positive integer. At the limit the output returns marked partial, and you can resume the agent. The program accepts a number or a string. |
auto | Documented: An official docs page names this item. | Lowers the auto-compact window for this agent. | An integer from 100000 to 1000000. Needs 2.1.296. Since 2., it also lowers the window that CLAUDE_ sets. It never raises a window. See Context and Compaction. |
skills | Documented: An official docs page names this item. | Skills preloaded into the agent context. | Claude Code injects the full skill text, for at most 32 names. A skill with disable- cannot be preloaded. Claude Code skips a missing skill and logs it. |
mcp | Documented: An official docs page names this item. | MCP servers for this agent. | A list of server names, or inline {name: objects. Inline servers connect at start and disconnect at the end. Claude Code ignores it for plugin agents. |
hooks | Documented: An official docs page names this item. | Hooks scoped to this agent. | Events: Pre, Post, Stop (becomes Subagent). Claude Code ignores it for plugin agents. See Hooks. |
memory | Documented: An official docs page names this item. | The scope of persistent memory. | user is ~/.. project is .. local is .. Claude Code logs an invalid value and drops it. |
background | Documented: An official docs page names this item. | Keeps the agent in the background. | true or false, as a string or boolean. Other values log an error. A teammate may not start such an agent. |
omit | Documented: An official docs page names this item. | Starts without user, project, and local CLAUDE.. | true only. Managed policy files still load. Explore, Plan, and the web-reading agent set it. |
effort | Documented: An official docs page names this item. | The effort level while the agent runs. | low, medium, high, xhigh, max. The program text also lists an integer. CLAUDE_ wins. |
isolation | Documented: An official docs page names this item. | Runs the agent in a temporary git worktree. | The docs name worktree. The program schema also accepts remote. The worktree branches from the default branch. In a probe in -, isolation: in a file ran the agent in a local worktree and started no cloud session. It was not tried with a cloud login. |
color | Documented: An official docs page names this item. | The display color. | red, blue, green, yellow, purple, orange, pink, cyan. |
initial | Documented: An official docs page names this item. | The first user turn when the agent is the main session. | Used with -- or the agent setting. Claude Code processes commands and skills. Not read when the agent starts as a subagent. |
experimental | Documented: An official docs page names this item. Experimental: The program or the official docs call this experimental or beta. | A map of experimental options. | cache: 5m or 1h sets the prompt cache TTL when neither a subagent setting nor an env var sets a value. Claude Code ignores 1h in subscription overage. Claude Code ignores unknown keys. |
observer | Undocumented: Only the program shows this item. It can change without notice. Gated: Works only behind a flag or a server gate. CLAUDE_CODE_EXPERIMENTAL_OBSERVER_AGENTS | An agent type that starts as a background observer whenever this agent runs. | A trimmed string. Needs CLAUDE_. Without it, Claude Code ignores the field. With it, the named agent starts in the background. It gets an activity digest after each turn of this agent. It has an Observer tool. An observer cannot have its own observer. Source: the program and Probes. |
observer | Undocumented: Only the program shows this item. It can change without notice. Gated: Works only behind a flag or a server gate. Same gate as observer. | Text added to each activity digest sent to the observer. | A string. It follows the default digest instruction as the last line (checked by a probe). |
observe | Undocumented: Only the program shows this item. It can change without notice. Gated: Works only behind a flag or a server gate. Same gate as observer. | Whether subagents inherit the observer. | A boolean, default true. false stops inheritance. |
Rules for Files
-
Claude Code skips a file in any of these cases. It has no
name. Its opening---is not on line 1. It has a badnameor nodescription. Its YAML does not parse. Details go to the--debuglog. -
A plugin agent whose frontmatter has no
nameor does not parse still loads, under its file name. -
A plugin agent has the name
plugin:folder:file. The fileagents/review/security.mdinmy-pluginismy-plugin:review:security. -
A plugin agent cannot use
permissionMode,hooks, ormcpServers. -
Frontmatter keys are case-sensitive and use camelCase. In a probe, Claude Code ignored
Toolsanddisallowed-tools, whiletoolsanddisallowedToolsworked. See Probes.
The --agents JSON
--agents takes a JSON object. Each key is an agent name. The value uses these fields:
description (required), prompt (required), tools, disallowedTools, model, effort (level or integer), permissionMode, mcpServers, hooks, maxTurns, autoCompactWindow, skills, initialPrompt, memory, background, omitClaudeMd, isolation, observer, observerMessage, observeSubagents.
The prompt field replaces the file body.
These agents have priority 2, below managed settings.
In print mode (-p), --agents also takes a file path (since 2.1.281).
An interactive session refuses a path.
The plugin mod call $.agent.register uses the same schema.
Exact Fields
The exact fields are in two files. For the --agents JSON, see https://clawdipedia.cc/schemas/claude-code-agents-json.json, made from the program's own validator. For the frontmatter, see the agent definition in https://clawdipedia.cc/schemas/claude-code-frontmatter.json, made from the program's frontmatter validators.
It lists every field of this release. Build on the fields it names. Look up each one there before you rely on it.
Related Pages
- Subagents: where agent files live.
- Subagent Runtime: built-in agents and limits.
- Skill Frontmatter: the keys of a skill.
- Hooks: the
hookskey.
Source: Create Custom Subagents and the program (the frontmatter schema, the frontmatter parser, and the --agents JSON schema).