From claude-ecosystem
Analyzes Claude Code agents for consolidation: groups by config similarity, tracks references in skills/memory/agents, assesses impact, tracks progress, executes refactoring plans.
npx claudepluginhub melodic-software/claude-code-plugins --plugin claude-ecosystemThis skill is limited to using the following tools:
Analyze agents for consolidation opportunities and track refactoring progress.
Audits agent lifecycles in Claude Code plugins, validating execution capabilities against configs via 8 semantic audits on alignments, skill loading, contracts, prompts, tools, dead agents, and patterns. Writes reports to .claude/audits/.
Analyzes Claude Code plugins for sub-agent opportunities, identifying skills with verbose output, gaps in agent coverage, and model selection improvements like opus for complex reasoning.
Audits Claude Code subagents for YAML frontmatter validity, naming conventions, description quality, tool configs, and model selection. Runs smart audits on modified/stale agents or forces all with flags like --plugin-only.
Share bugs, ideas, or general feedback.
Analyze agents for consolidation opportunities and track refactoring progress.
Before auditing, initialize the environment:
.claude/temp/) exists.ecosystem-health skill for consolidation criteria access.| Argument | Description |
|---|---|
| (none) | Analyze mode: discover agents, group by config, recommend consolidation |
--force | Re-analyze even if recent analysis exists (<24h) |
--plugin-only | Only analyze plugin agents (plugins/*/agents/) |
--project-only | Only analyze project agents (.claude/agents/) |
--references | Show all component references for each agent |
--impact <group> | Show detailed impact analysis for consolidating a specific group |
--track | Persist analysis to tracking file in .claude/temp/ |
--execute <plan> | Execute consolidation plan (interactive with confirmation) |
Discovers agents, groups by configuration, calculates consolidation scores.
Steps:
--references)Shows all components that reference each agent.
Searches:
skills/*/SKILL.md for delegation patterns and Task invocations.claude/memory/*.md for agent referencesagents/*.md for chaining patterns--impact <group>)Shows detailed analysis of what would break if a group is consolidated.
Reports:
--track)Persists analysis to .claude/temp/agent-consolidation-{timestamp}.json for:
--execute <plan>)Interactive mode to apply a consolidation plan.
REQUIRES explicit user confirmation for each step.
Check for mode flags:
--force: Set force_reanalyze = true--plugin-only: Set scope = "plugin"--project-only: Set scope = "project"--references: Set mode = "references"--impact <group>: Set mode = "impact", capture group ID--track: Set track = true--execute <plan>: Set mode = "execute", capture plan pathDefault: mode = "analyze", scope = "all"
Search for agent files based on scope:
Plugin agents:
plugins/*/agents/*.mdProject agents:
.claude/agents/*.mdUser agents (if scope = all):
~/.claude/agents/*.md (note: may not be accessible)Build list of discovered agents with:
## Agent Discovery
**Scope**: [ALL | PLUGIN | PROJECT]
**Agents Found**: [N]
| Scope | Count | Location |
| ----- | ----- | -------- |
| plugin:claude-ecosystem | 17 | plugins/claude-ecosystem/agents/ |
| plugin:code-quality | 3 | plugins/code-quality/agents/ |
| project | 2 | .claude/agents/ |
For Analyze mode, spawn agent-consolidation-analyst subagent with context:
For large agent counts (>10), batch into groups of 5 for parallel analysis.
The subagent will:
.claude/temp/After subagent(s) complete:
.claude/temp/Agent Consolidation Analysis
============================
Scope: [scope]
Agents Analyzed: [N]
Groups Found: [N]
Configuration Groups:
---------------------
Group 1: auditor-opus-plan ([N] agents)
Config: tools=[standard+MCP], model=opus, permissionMode=plan
Members:
- skill-auditor (skills: skill-development) [2 refs]
- skill-auditor (skills: skill-development) [2 refs, handles both skills and commands]
- agent-auditor (skills: subagent-development) [2 refs]
- hook-auditor (skills: hook-management) [2 refs]
... ([N] more)
Consolidation: NO
Score: 45/100
Reason: Each agent's `skills:` field provides domain-specific
knowledge via auto-load guarantee. Cannot replicate via
Task tool prompt injection.
Group 2: researcher-haiku ([N] agents)
Config: tools=[Read,Grep,WebFetch], model=haiku
Members:
- docs-researcher (skills: none) [1 ref]
- issue-researcher (skills: none) [3 refs]
Consolidation: REVIEW
Score: 78/100
Reason: Similar purpose, no skills field. Could potentially merge
with query-based specialization in prompt.
Recommendations:
----------------
1. [NO ACTION] auditor-opus-plan - skills: auto-load justifies separation
2. [REVIEW] researcher-haiku - Consider meta-skill approach
Total Reference Count: [N]
Highest Impact Agent: [agent-name] ([N] references)
Agent References Analysis
=========================
skill-auditor:
Commands: 1
- audit-skills.md:87 "spawn skill-auditor agent"
Skills: 0
Memory: 1
- audit-protocol.md:45 "uses skill-auditor for validation"
Total: 2 references
skill-auditor (commands):
Commands: 1
- audit-skills.md:66 "spawn skill-auditor agent"
Skills: 0
Memory: 1
- audit-protocol.md:48 "uses skill-auditor for validation"
Total: 2 references
...
After analysis, if --track flag:
Analysis persisted to:
.claude/temp/agent-consolidation-2026-01-10T193000Z.json
Use --execute to apply consolidation plan.
skills: Auto-Load GuaranteeCRITICAL: The skills: field provides an auto-load guarantee:
Task tool CANNOT replicate this:
skills: parameter in Task toolTherefore: Agents with different skills: fields should NOT be consolidated unless their skills can be merged into one meta-skill.
| Field | Weight | Notes |
|---|---|---|
tools | HIGH | Different tools = different capabilities |
model | HIGH | Different models = different cost/capability |
permissionMode | MEDIUM | Affects security posture |
skills | CRITICAL | Auto-load guarantee cannot be replicated |
color | LOW | Cosmetic, ignored for grouping |
| Score | Recommendation | Action |
|---|---|---|
| 85-100 | CONSOLIDATE | Strong candidate for merging |
| 70-84 | REVIEW | May consolidate with skill refactoring |
| 50-69 | UNLIKELY | Keep separate unless skills merge |
| 0-49 | NO ACTION | Different purposes, keep separate |
CRITICAL: Plugins cannot reference resources outside their individual plugin directory.
This means:
plugin-a/agents/ cannot consolidate with agents in plugin-b/agents/When the analysis identifies similar agents across different plugins (e.g., *-docs-researcher agents), these should be noted as following a common pattern but are NOT consolidation candidates.
Scope filtering recommendation:
--plugin-only and analyze each plugin separatelyUser: /audit-agent-consolidation
Claude: Discovering agents...
## Agent Discovery
Scope: ALL
Agents Found: 22
[Analysis proceeds...]
Agent Consolidation Analysis
============================
...
User: /audit-agent-consolidation --plugin-only
Claude: Discovering plugin agents only...
## Agent Discovery
Scope: PLUGIN
Agents Found: 20
...
User: /audit-agent-consolidation --references
Claude: Analyzing agent references...
Agent References Analysis
=========================
...
User: /audit-agent-consolidation --track
Claude: [Analysis...]
Analysis persisted to:
.claude/temp/agent-consolidation-2026-01-10T193000Z.json
User: /audit-agent-consolidation --impact auditor-opus-plan
Claude: Analyzing impact for group: auditor-opus-plan
Impact Analysis: auditor-opus-plan
==================================
Agents in Group: 13
Total References: 26
If consolidated, would need to update:
- 13 command files (Task invocations)
- 13 memory references
Risk Assessment: HIGH
Reason: skills: field provides domain-specific knowledge
Recommendation: Do NOT consolidate. The auto-load guarantee
cannot be replicated via Task tool.
This command integrates with the ecosystem-health skill:
references/consolidation-criteria.md for scoring rubricRun /ecosystem-health --status to see overall audit coverage including agent consolidation.