You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit fade657
Browse filesBrowse the repository at this point in the historyBrowse files
authored
feat(team-builder): use claude agents command for agent discovery (anomalyco#1021)
Replace file glob probe order with `claude agents` as the primary
discovery mechanism so ECC marketplace plugin agents are included
automatically, regardless of install path or version.
Co-authored-by: lichangze <[email protected]>
Co-authored-by: Claude Sonnet 4.6 <[email protected]>
2.`~/.claude/agents/**/*.md` + `~/.claude/agents/*.md` — global agents (both depths)
52
+
1.**`claude agents` command** (primary) — run `claude agents` to get all agents known to the CLI, including user agents, plugin agents (e.g. `everything-claude-code:architect`), and built-in agents. This automatically covers ECC marketplace installs without any path configuration.
53
+
2.**File glob** (fallback, for reading agent content) — agent markdown files are read from:
-`~/.claude/agents/**/*.md` + `~/.claude/agents/*.md` — global user agents
54
56
55
-
Results from all locations are merged and deduplicated by agent name. Project-local agents take precedence over global agents with the same name. A custom path can be used instead if the user specifies one.
57
+
Earlier sources take precedence when names collide: user agents > plugin agents > built-in agents. A custom path can be used instead if the user specifies one.
56
58
57
59
## How It Works
58
60
59
61
### Step 1: Discover Available Agents
60
62
61
-
Glob agent directories using the probe order above. Exclude README files. For each file found:
63
+
Run `claude agents` to get the full agent list. Parse each line:
64
+
-**Plugin agents** are prefixed with `plugin-name:` (e.g., `everything-claude-code:security-reviewer`). Use the part after `:` as the agent name and the plugin name as the domain.
65
+
-**User agents** have no prefix. Read the corresponding markdown file from `~/.claude/agents/` or `./agents/` to extract the name and description.
66
+
-**Built-in agents** (e.g., `Explore`, `Plan`) are skipped unless the user explicitly asks to include them.
67
+
68
+
For user agents loaded from markdown files:
62
69
-**Subdirectory layout:** extract the domain from the parent folder name
63
70
-**Flat layout:** collect all filename prefixes (text before the first `-`). A prefix qualifies as a domain only if it appears in 2 or more filenames (e.g., `engineering-security-engineer.md` and `engineering-software-architect.md` both start with `engineering` → Engineering domain). Files with unique prefixes (e.g., `code-reviewer.md`, `tdd-guide.md`) are grouped under "General"
64
71
- Extract the agent name from the first `# Heading`. If no heading is found, derive the name from the filename (strip `.md`, replace hyphens with spaces, title-case)
65
72
- Extract a one-line summary from the first paragraph after the heading
66
73
67
-
If no agent files are found after probing all locations, inform the user: "No agent files found. Checked: [list paths probed]. Expected: markdown files in one of those directories." Then stop.
74
+
If no agents are found after running `claude agents` and probing file locations, inform the user: "No agents found. Run `claude agents` to verify your setup." Then stop.
0 commit comments