Claude Code silently excludes a subset of valid custom agents from the subagent registry once fleet size grows

Status Open
Reported on v2.1.202
Maintainer reply None cached
Activity 1 comment · opened Jul 27, 2026

Claude Code version: 2.1.202
Platform: Windows 11 Pro (10.0.26200), PowerShell/Git Bash
Reproduced: interactive session AND fresh claude -p (non-interactive, new process) — ruling out session-cache

Summary

Once the number of custom agent .md files under ~/.claude/agents/ grows past a certain point, a subset of them silently disappears from the subagent registry — they don't appear in the "Available agent types" system-reminder listing, and directly invoking one by name via the Agent/Task tool returns a hard Agent type '<name>' not found error. The excluded files are not malformed: they are byte-structurally identical (valid YAML frontmatter — name:/description:/model:, correct filename-to-name: match, no duplicate name: values anywhere in the tree, same CRLF/UTF-8 encoding as files that load correctly) to sibling files in the same directories that load fine.

Environment

  • Global agents directory: ~/.claude/agents/, 5 subfolders (dev/, fsrp/, lease-tracker/, marketing/, personal/) + 2 top-level agent files + 3 non-agent reference .md docs (no name: frontmatter, correctly ignored).
  • Total valid custom agent definitions on disk (confirmed via grep -rh "^name:"): 73
  • Agents actually surfaced in the "Available agent types" listing / invocable via the Agent tool: 60 (+ 6 built-ins: Explore, Plan, general-purpose, claude, claude-code-guide, statusline-setup)
  • 13 agents excluded, confirmed by name:
api-spend-tracker          (fsrp/)
brand-deck-producer        (marketing/)
comp-analyzer              (fsrp/)
deal-sync                  (fsrp/)
lease-completeness-verifier (lease-tracker/)
lease-expiry-monitor       (lease-tracker/)
market-intel-collector     (fsrp/)
monday-bd-brief            (fsrp/)
property-flyer-producer    (marketing/)
renewal-advisor            (lease-tracker/)
sec-intel-collector        (fsrp/)
social-content-producer    (marketing/)
supabase-manager           (lease-tracker/)

Steps to reproduce

  1. Have a global ~/.claude/agents/ tree with 70+ valid agent .md files across multiple subfolders (exact threshold unknown — dev/ alone has 22 files and all 22 load correctly, so it is not a simple per-folder cap; fsrp/ has 30 and 6 are missing; marketing/ has 7 and 3 are missing).
  2. Start a Claude Code session (interactive or claude -p) from a project directory that has no project-local .claude/agents/ overrides (confirmed empty/gitignored — ruled out as a shadowing cause).
  3. Ask the model to list every subagent type name from its system reminder, or attempt Agent({subagent_type: "supabase-manager", ...}) directly.

Expected

All 73 valid agent definitions appear in the registry and are invocable.

Actual

Only 60 appear. The missing 13 return Agent type '<name>' not found with the same fixed 66-name list (60 custom + 6 built-in) shown as "Available agents" in the error message, even when the requested agent file exists on disk, is well-formed, and sits alongside sibling files in the same folder that load without issue.

What we ruled out (so this isn't a support-desk file-hygiene issue)

  • File doesn't exist — ruled out, confirmed present at documented path for all 13.
  • Filename/name: mismatch — ruled out, exact match on all 13.
  • Malformed YAML frontmatter — ruled out, structurally identical to working siblings.
  • Encoding (BOM/CRLF) — ruled out, same CRLF/UTF-8 as files that work (e.g. abstract-reviewer.md in the same folder as supabase-manager.md/lease-completeness-verifier.md, loads fine).
  • Duplicate name: collision anywhere in the tree — ruled out (grep -rh "^name:" | sort | uniq -c — every name appears exactly once).
  • Project-local shadow-copy conflict — ruled out; .claude/agents/ in the working project is empty (gitignored).
  • settings.json agent allow/deny list — ruled out; no such config exists in global or project settings.
  • A "DORMANT" convention some of our agents use in their description: text — ruled out as the mechanism. 4 of the 13 missing agents carry STATUS: DORMANT prose in their description (not a real frontmatter field, just text + an HTML comment in the body — nothing a loader would parse as a directive). But api-spend-tracker, one of the missing 13, is tagged STATUS: ACTIVE in identical style and is equally excluded — so this text has no causal effect either way.
  • Stale session cache — ruled out. A brand-new claude -p process (fresh binary invocation, not --continue, not the same session) from the same directory reproduces the identical 13-agent exclusion.

Impact

Multiple agents documented as ACTIVE in our internal CLAUDE.md and used in real production workflows are unreachable via the Agent tool despite valid definitions on disk — e.g. this forced a lease-abstraction pipeline to route around a documented pipeline-gate agent (lease-completeness-verifier) entirely, and forced raw MCP tool calls in place of a documented approval-gated database agent (supabase-manager), bypassing that agent's built-in migration-approval workflow.

Ask

  • Confirm whether there's an intentional cap on registered custom agents (and if so, what it is and how it's applied — alphabetical, insertion-order, byte-budget on the listing text, etc.), or whether this is an unintended truncation bug.
  • If a cap is intentional, surface it — right now agents disappear silently with no warning at startup.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗