[Bug] 106 agent definitions ship by default — ~300K tokens of context bloat, most agents are non-functional
- Dominant language
- TypeScript
- Stars
- 72.7k
- Forks
- 8.6k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 83
Description
## Summary
Ruflo ships **106 agent definition files** (1.19MB / ~300K tokens) in `.claude/agents/`. The majority of these agents reference MCP servers that don't exist in a standard installation, making them dead weight that inflates every conversation's context window.
When you try to use one of these agents (e.g. `frontend-design`), you get:
```
Error: Agent type 'frontend-design' not found. Available agents: general-purpose, statusline-setup, Explore, Plan, ...
```
...followed by a wall of **90+ agent names** dumped into the error message and into the system prompt. This list alone costs significant tokens on every single interaction.
## The Numbers
| Category | Files | Size | Actually functional? |
|----------|-------|------|---------------------|
| `v3/` | 16 | 238KB | Partially — references internal v3 architecture |
| `github/` | 13 | 186KB | Some work (pr-manager, issue-tracker) |
| `consensus/` | 7 | 107KB | References non-existent MCP servers |
| `optimization/` | 5 | 95KB | Generic, no project-specific value |
| `swarm/` | 3 | 88KB | Partially useful |
| `sparc/` | 4 | 70KB | SPARC methodology — niche |
| `core/` | 5 | 70KB | **Actually useful** (coder, reviewer, tester, planner, researcher) |
| `sublinear/` | 5 | 55KB | **100% non-functional** — requires `sublinear-time-solver` MCP (not installed) |
| `flow-nexus/` | 9 | 32KB | **100% non-functional** — requires `flow-nexus` MCP (not installed) |
| `hive-mind/` | 5 | 25KB | Partially useful with ruflo MCP |
| `payments/` | 1 | 5KB | **100% non-functional** — requires `agentic-payments` MCP (not installed) |
| `templates/` | 9 | 59KB | Template files, rarely used |
| Others | 24 | ~84KB | Mixed — duplicates, niche specialists |
**Total: 1,194,421 bytes (~300K tokens)** loaded or indexed per session.
## Specific Problems
### 1. Agents reference MCP servers that don't ship with Ruflo
These 15+ agents call tools from MCP servers that are never installed in a standard `npx @claude-flow/cli@latest` setup:
- **`flow-nexus/*` (9 agents)** — call `mcp__flow-nexus__*` tools. Flow Nexus is a separate SaaS platform. These agents are useless without it.
- **`sublinear/*` (5 agents)** — call `mcp__sublinear-time-solver__*` tools. This MCP server doesn't exist in any standard install.
- **`payments/agentic-payments`** — calls `mcp__agentic-payments__*` tools. Not installed.
These agents will **always fail** when spawned. They're marketing material, not functional agents.
### 2. 7 duplicate agent files
Several agents exist twice — once at the category root and once in a nested subdirectory:
```
analysis/analyze-code-quality.md ← duplicate
analysis/code-review/analyze-code-quality.md ← duplicate
architecture/arch-system-design.md
architecture/system-design/arch-system-design.md
development/dev-backend-api.md
development/backend/dev-backend-api.md
devops/ops-cicd-github.md
devops/ci-cd/ops-cicd-github.md
documentation/docs-api-openapi.md
documentation/api-docs/docs-api-openapi.md
specialized/spec-mobile-react-native.md
specialized/mobile/spec-mobile-react-native.md
data/data-ml-model.md
data/ml/data-ml-model.md
```
### 3. The agent list bloats every error message and system prompt
When Claude Code lists available agents (on error, or in the system prompt), it dumps all 90+ names. This is pure token waste on every single message in a conversation.
### 4. Many "agents" are just verbose prompt templates with no differentiation
Agents like `trading-predictor` (claims to "execute trades before market data physically arrives" via "temporal advantage") and `pagerank-analyzer` are marketing copy, not useful tooling. A `coder` agent with a good system prompt can do everything these claim to do.
## What's Actually Useful (from real-world usage)
From the 106 agents, roughly **10-15 are genuinely useful** for day-to-day development:
- **Core**: `coder`, `reviewer`, `tester`, `planner`, `researcher`
- **GitHub**: `pr-manager`, `issue-tracker` (maybe `code-review-swarm`)
- **Swarm**: `hierarchical-coordinator`
- **V3**: `security-auditor`, `memory-specialist` (if you use AgentDB)
- **Misc**: `sparc-coder`, `task-orchestrator`
Everything else is either non-functional (missing MCP dependencies), duplicated, or a verbose wrapper around a basic prompt that the `coder` or `planner` agent could handle.
## Proposed Solutions
### Option A: Ship a minimal core set (recommended)
Ship only the ~15 agents that work out of the box. Move everything else to an opt-in registry:
```bash
ruflo agents install flow-nexus # only if you have Flow Nexus configured
ruflo agents install sublinear # only if you have sublinear-time-solver
ruflo agents install github-full # extended GitHub agents beyond pr-manager
```
### Option B: Lazy loading
Don't register agents in the system prompt until they're first used. Only load the full agent definition when `Agent(subagent_type="X")` is called.
### Option C: At minimum, remove non-functional agents
Delete agents that reference MCP servers not included in the standard install. This alone would remove 15+ agents and ~90KB of dead definitions.
### Option D: Deduplication + size audit
1. Remove the 7 duplicate files
2. Trim agent definitions to <2KB each (most are 15-35KB of verbose prompts)
3. Move detailed instructions into the agent's runtime prompt, not the static definition
## Environment
- Ruflo v3.5.x (via `npx @claude-flow/cli@latest`)
- Claude Code (Opus 4.6)
- macOS / Ubuntu 24.04
## Impact
Every conversation pays the token tax of 106 agent definitions whether or not you use agents. At ~$0.015/1K input tokens on Opus, that's roughly **$4.50 per conversation just for agent definitions** that are mostly non-functional. Over a workday of 20 conversations, that's ~$90 in wasted input tokens on agent bloat alone.
Contributor guide
Research direction
Start by auditing the .claude/agents/ tree and the standard `npx @claude-flow/cli@latest` installation described in the issue, including the listed duplicate and MCP-dependent files. Determine which proposed scope is intended—minimal set, lazy loading, removal, or deduplication—and identify how agent names enter errors or the system prompt. Done should be demonstrated by reduced shipped definitions and verification that supported agents still work without unavailable MCP servers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- ai-infra-agents, tooling
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100