Custom agents under ~/.claude/agents/ intermittently fail to register at session start (non-deterministic, not file-specific)

Status Open
Reported on v2.1.286
Maintainer reply None cached
Activity 0 comments · opened Oct 1, 2026

Summary

Custom agents defined under the personal global ~/.claude/agents/ directory intermittently
fail to appear in the Agent tool's available-agent list at session start. This is
non-deterministic — the same agent, same file, same machine succeeds in some sessions and
fails in others, with no observed code or configuration change between attempts.

Impact

When a custom agent is dispatched by name (subagent_type: "<name>") and isn't registered,
the Agent tool fails with "Agent type '<name>' not found" — and ALL personal custom agents
are missing simultaneously (not just the one being dispatched), confirming this is a
registry-loading failure, not a defect in any specific agent definition file.

Evidence this isn't a file-content or config problem

  • The affected agent definition file's YAML frontmatter was validated and is well-formed.
  • A full sweep of all ~30 files under ~/.claude/agents/ found no parsing errors that could

explain a directory-wide registration failure.

  • No permissions-boundary or restriction in ~/.claude/policy-limits.json /

~/.claude/settings.json references agent loading.

  • Already on the latest CLI version (2.1.286) - not a known-fixed issue in a prior release.

Occurrences (same symptom, four separate times)

  1. Original occurrence mid-session - dispatching a custom agent by name failed; a fresh

"brand new" session (not a resume) hit the identical failure moments later.

  1. A later session in the same working directory succeeded - the same custom agents loaded

and worked normally for an extended period.

  1. A separate session, again started from the user's home directory (not the project repo),

hit the identical failure a third time.

  1. Working-directory theory ruled out: the session in (2) that succeeded was ALSO started

from the user's home directory, not the project repo - so starting location alone does not
explain the difference between success and failure.

What would help

Any insight into what differs between a session that successfully scans/loads
~/.claude/agents/*.md and one that doesn't - e.g. a startup race condition, a cache that's
sometimes stale, or a silent timeout on the directory scan - would help us stop treating this
as "try restarting and hope" and instead have a reliable mitigation.

View original on GitHub ↗