Custom subagents not discovered when .claude is a symlink

Resolved 💬 2 comments Opened Mar 5, 2026 by marcospgp Closed Mar 5, 2026

Description

Custom subagents defined in .claude/agents/ are not discovered when .claude itself is a symlink to another directory.

Setup

Our monorepo shares agent configuration across projects via a common repo. The project's .claude directory is a symlink:

.claude -> /path/to/common/.agents

This means .claude/agents/code-reviewer.md resolves correctly via the symlink:

$ ls -la .claude
lrwxr-xr-x  .claude -> /path/to/common/.agents

$ ls .claude/agents/
code-reviewer.md
icon-fetcher.md
web-searcher.md

$ file .claude/agents
.claude/agents: directory

Expected behavior

Custom agents should be discovered through the symlink, since all other .claude functionality (skills, settings.json) works through it.

Actual behavior

The Agent tool only lists built-in types:

Agent type 'code-reviewer' not found. Available agents: general-purpose, statusline-setup, Explore, Plan, claude-code-guide

None of the three custom agents are available. This suggests the discovery code doesn't follow symlinks when scanning .claude/agents/.

Workaround

Use a general-purpose agent with the code-reviewer instructions inlined in the prompt.

Environment

  • Claude Code version: latest (as of 2026-03-05)
  • macOS Darwin 25.2.0
  • Symlink type: standard POSIX symlink created with ln -s

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗