published fresh until

Write a Claude Code subagent: file, frontmatter, not found

Summary As of October 2026, if Agent type 'x' not found appears, restart the session and check the file is at .claude/agents/x.md

Not for giving one subagent its own MCP servers, see claude-code-subagent-only-mcp-servers

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Agent type '<name>' not found. Available agents: ... means the subagent you asked for is not registered in this session. First action: create .claude/agents/<name>.md (project) or ~/.claude/agents/<name>.md (all projects) with name and description frontmatter and the system prompt as the body, then restart the session and compare path and frontmatter against the checklist below.

Do first: restart the session after creating the file.

Not for: loading an MCP server for one subagent only (see claude-code-subagent-only-mcp-servers) or starting a subagent that inherits the conversation (see claude-code-subtask-fork-subagent-inherits-conversation-context).

Evidence status: file format, locations and fields are from the official sub-agents page, checked 2026-10-30. One open public bug report supports the not-found symptom. No subagent was created in a lab run for this thread.

Diagnostic: Agent type '<name>' not found. Available agents: ...

The Agent tool returns this when the name you asked for is not in the registry for the current session. A public report (see Evidence) shows it for a valid file added mid-session.

Minimal file

.claude/agents/code-reviewer.md (the docs' example):

---
name: code-reviewer
description: Reviews code for quality and best practices
tools: Read, Glob, Grep
model: sonnet
---

You are a code reviewer. When invoked, analyze the code and provide
specific, actionable feedback on quality, security, and best practices.

Claude decides when to delegate from description, so write it as "when to use this agent".

Where files live (higher priority wins on a name clash)

PriorityLocationScope
1Managed settingsOrganization
2--agents CLI flagCurrent session
3.claude/agents/Current project
4~/.claude/agents/All your projects
5Plugin agents/ directoryWhere the plugin is enabled

Within one .claude/agents/ tree, duplicate names are not resolved by a documented rule: Claude Code loads only one of them. Across nested project directories the definition closest to the working directory wins.

Frontmatter fields

  • Required: name (cannot contain :) and description.
  • Optional: tools (allowlist, comma-separated string or YAML list; omitted means it inherits the tools available to subagents), disallowedTools (removed from the inherited or specified tool list), model (sonnet, opus, haiku, fable, a full model ID, or inherit), permissionMode (default, acceptEdits, auto, dontAsk, bypassPermissions, plan, manual), maxTurns, skills, mcpServers, hooks, memory, background, effort, isolation (worktree), color, initialPrompt and others listed on the page.
  • Multi-word field names are camelCase. Unrecognized fields are ignored without an error, so a misspelled field (for example allowed-tools instead of tools) silently does nothing.

Do first when it is not found

1. Run /agents or ask Claude to list agents. On v2.1.197 and earlier, /agents opens an interactive wizard; after that version it prints a reminder to ask Claude or edit the files directly. 2. Check the path: .claude/agents/ is relative to the project folder you started claude in; user-level is ~/.claude/agents/. A file in .claude/commands/ or .claude/skills/ is a different feature. 3. Check the file is .md, frontmatter is valid YAML between --- lines, and name and description are present. 4. Restart the session. Per the docs, Claude Code watches both agents directories and detects changes "within a few seconds", but a restart is still needed when you add or edit a subagent in a directory added with --add-dir or /add-dir, or when the session started with --disable-slash-commands. 5. If another file has the same name at a higher priority (table above), it shadows yours.

Evidence

One open report: Agent files added to ~/.claude/agents/ mid-session were not spawnable for several minutes although the docs promise detection in seconds; a fresh claude -p process loaded the same files immediately, and the error was Agent type 'zz-probe-a' not found. Available agents: ... (issue 98528, opened 2026-09-30 by george-elphick-talieisin, Claude Code 2.1.285, macOS, state open). The reporter suspects the reload follows turn boundaries; that is the reporter's guess, not confirmed.

Limits

The field list above is a subset; the docs list more fields and may change each release. Not tested here: Windows desktop-app behavior, plugin-provided agents, --agents JSON. The wizard cutoff (v2.1.197 and earlier) is as documented. checked 2026-10-30.

Started from a post by @Anthropic Claude Code documentation, packaged by the editor. Original post

Subjects

More in agent workflows

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Write a Claude Code subagent: file, frontmatter, not found
Summary: As of October 2026, if Agent type 'x' not found appears, restart the session and check the file is at `.claude/agents/x.md`
Copy for agent
get the whatworks thread write-claude-code-subagent-frontmatter-locations-not-found and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread write-claude-code-subagent-frontmatter-locations-not-found
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks