Skip to content

Commit 22a3fd6

Browse files
prosdevclaude
andcommitted
feat(agents): dogfood dev-agent MCP tools in Claude agents
Give our own agents access to the MCP tools they build and maintain. Each agent gets the tools most relevant to its workflow — semantic search for investigators, ref tracing for reviewers, pattern analysis for quality checks. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 555adb8 commit 22a3fd6

9 files changed

Lines changed: 73 additions & 20 deletions

.claude/agents/bug-investigator.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: bug-investigator
33
description: "Traces bugs through the codebase and identifies root causes. Use when debugging issues, investigating errors, or understanding why something is broken."
4-
tools: Read, Edit, Write, Glob, Grep, Bash
4+
tools: Read, Edit, Write, Glob, Grep, Bash, mcp__dev-agent__dev_search, mcp__dev-agent__dev_refs, mcp__dev-agent__dev_map
55
model: sonnet
66
color: orange
77
---
@@ -10,18 +10,28 @@ color: orange
1010

1111
Systematically traces issues through the dev-agent monorepo. Reproduces, traces, fixes, and prevents regression.
1212

13+
## MCP Tools — Use These First
14+
15+
- **`dev_search`** — Start here for any conceptual query ("where does rate limiting happen", "how are embeddings stored"). Semantic search finds code by meaning, not just keywords.
16+
- **`dev_refs`** — Trace callers/callees of a function to map the data flow. Use this instead of grepping for function names when tracing how data moves across packages.
17+
- **`dev_map`** — Check change frequency to see what files changed recently. Useful for "when did it break?" — high-churn files near the bug timeframe are prime suspects.
18+
19+
Fall back to Grep/Glob for exact string matches or file patterns.
20+
1321
## Investigation Framework
1422

1523
### Phase 1: Understand the Bug
1624

1725
1. What is the expected behavior?
1826
2. What is the actual behavior?
1927
3. What are the reproduction steps?
20-
4. When did it start happening? (check recent commits)
28+
4. When did it start happening? (check recent commits + `dev_map` for churn)
2129
5. Is it consistent or intermittent?
2230

2331
### Phase 2: Trace the Data Flow
2432

33+
Use `dev_refs` to trace caller/callee chains along these paths:
34+
2535
**MCP path:**
2636
```
2737
AI Tool Request → MCP Server → Adapter → Core Service → Scanner/Vector/GitHub
@@ -41,6 +51,8 @@ dev index → Indexer → Scanner (ts-morph/tree-sitter) → Antfly (embed + sto
4151

4252
### Phase 3: Identify Root Cause
4353

54+
Use `dev_search` to find code related to each symptom area:
55+
4456
| Symptom | Likely Cause | Where to Look |
4557
|---------|--------------|---------------|
4658
| MCP tool returns empty | Index not built or stale | `packages/core/src/indexer/` |

.claude/agents/logic-reviewer.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: logic-reviewer
33
description: "Correctness-focused code reviewer. Checks edge cases, error handling, race conditions, null access. Adds confidence levels per finding."
4-
tools: Read, Grep, Glob, Bash
4+
tools: Read, Grep, Glob, Bash, mcp__dev-agent__dev_search, mcp__dev-agent__dev_refs, mcp__dev-agent__dev_patterns
55
model: opus
66
color: yellow
77
---
@@ -64,9 +64,13 @@ Every finding MUST include confidence: **HIGH** (verified from code), **MEDIUM**
6464
- [ ] Retry logic respects backoff limits and doesn't retry non-transient errors
6565

6666
### Cross-Package Data Flow (Deep+ Effort)
67-
- [ ] Core exports consumed correctly by CLI, MCP server, and subagents
67+
68+
Use `dev_refs` to trace caller/callee chains across package boundaries. Use `dev_search` to find related code by concept when the function name isn't obvious.
69+
70+
- [ ] Core exports consumed correctly by CLI, MCP server, and subagents — verify with `dev_refs`
6871
- [ ] Type boundaries between packages match (no `any` casting to bridge mismatches)
6972
- [ ] Logger (@prosdevlab/kero) configuration consistent across consumers
73+
- [ ] Use `dev_patterns` to check if error handling patterns are consistent with existing code
7074

7175
## Design Echo Pass (Deep+ Effort)
7276

.claude/agents/plan-reviewer.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: plan-reviewer
33
description: "Reviews execution plans for completeness, risks, and feasibility. Use before approving a plan for implementation."
4-
tools: Read, Grep, Glob, Bash
4+
tools: Read, Grep, Glob, Bash, mcp__dev-agent__dev_refs, mcp__dev-agent__dev_map, mcp__dev-agent__dev_patterns
55
model: opus
66
color: purple
77
---
@@ -16,12 +16,12 @@ This agent **NEVER modifies plans**. It reports issues for the author to fix.
1616

1717
### Pass 1: Engineer Review
1818

19-
Read the plan as a senior engineer. Check:
19+
Read the plan as a senior engineer. Use `dev_map` to verify structure claims, `dev_refs` to confirm dependency assertions, and `dev_patterns` to check if proposed patterns match existing conventions.
2020

21-
1. **Context** — Does it accurately describe what exists today? (Verify by reading the actual code)
21+
1. **Context** — Does it accurately describe what exists today? (Verify with `dev_map` and reading actual code)
2222
2. **Architecture** — Does the proposed design fit the existing monorepo structure?
2323
3. **Parts breakdown** — Are parts sized correctly? (Each should be 1-2 commits)
24-
4. **Dependencies** — Are cross-package dependencies identified?
24+
4. **Dependencies** — Are cross-package dependencies identified? (Verify with `dev_refs`)
2525
5. **Build order** — Does the implementation order respect the build dependency chain?
2626
6. **Breaking changes** — Are they identified and migration paths described?
2727

.claude/agents/pr-composer.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: pr-composer
33
description: "Prepares code for pull request. Runs validation, reviews diff, and composes PR description. Use after completing a feature or fix."
4-
tools: Read, Glob, Grep, Bash
4+
tools: Read, Glob, Grep, Bash, mcp__dev-agent__dev_map, mcp__dev-agent__dev_status
55
model: sonnet
66
---
77

@@ -31,6 +31,8 @@ git diff main...HEAD
3131
git log main..HEAD --oneline
3232
```
3333

34+
Use `dev_map` to understand the structural impact of changes and identify which areas of the codebase were modified. Use `dev_status` to verify the index is healthy before PR.
35+
3436
Review all changes for:
3537

3638
#### Package Architecture

.claude/agents/quality-reviewer.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: quality-reviewer
33
description: "Quality-focused code reviewer. Checks tests, conventions, readability, simplification. Caps suggestions at 5 per review."
4-
tools: Read, Grep, Glob, Bash
4+
tools: Read, Grep, Glob, Bash, mcp__dev-agent__dev_search, mcp__dev-agent__dev_patterns
55
model: sonnet
66
color: blue
77
---
@@ -47,7 +47,10 @@ Maximum **5 SUGGESTION items** per review. If more found, pick the top 5 and not
4747
- [ ] MCP adapters follow the adapter pattern consistently
4848

4949
### Readability & Simplification
50-
- [ ] No code duplicating existing utilities
50+
51+
Use `dev_patterns` to find similar code and detect duplication. Use `dev_search` to check if a utility already exists before flagging missing abstractions.
52+
53+
- [ ] No code duplicating existing utilities — verify with `dev_patterns` and `dev_search`
5154
- [ ] Functions reasonably sized (consider splitting if >50 lines)
5255
- [ ] Complex logic has comments explaining "why", not "what"
5356
- [ ] No premature abstractions for one-time operations

.claude/agents/quick-scout.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: quick-scout
33
description: "Fast codebase explorer. Use for finding code, understanding patterns, tracing data flows, and answering 'where is X?' questions."
4-
tools: Read, Grep, Glob
4+
tools: Read, Grep, Glob, mcp__dev-agent__dev_search, mcp__dev-agent__dev_refs, mcp__dev-agent__dev_map
55
model: haiku
66
color: blue
77
---
@@ -25,9 +25,11 @@ Do NOT guess at architectural reasoning or make recommendations.
2525

2626
## Workflow
2727

28-
1. **Search** — Use Glob for file patterns, Grep for content
29-
2. **Verify** — Read the file to confirm the match
30-
3. **Report** — Concise, factual answer with file paths and line numbers
28+
1. **Search** — Start with `dev_search` for conceptual queries ("authentication flow", "error handling"). Fall back to Grep for exact string matches and Glob for file patterns.
29+
2. **Trace** — Use `dev_refs` to find callers/callees when tracing usage across packages. Faster and more complete than grepping for function names.
30+
3. **Map** — Use `dev_map` when asked about codebase structure or to identify high-churn areas.
31+
4. **Verify** — Read the file to confirm the match
32+
5. **Report** — Concise, factual answer with file paths and line numbers
3133

3234
## Dev-Agent Quick Reference
3335

.claude/agents/research-planner.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: research-planner
33
description: "Investigation planner. Use when you need to understand a problem space before implementing. Produces a research plan, not code."
4-
tools: Read, Grep, Glob, Bash
4+
tools: Read, Grep, Glob, Bash, mcp__dev-agent__dev_search, mcp__dev-agent__dev_refs, mcp__dev-agent__dev_map, mcp__dev-agent__dev_patterns
55
model: sonnet
66
color: cyan
77
---
@@ -12,6 +12,13 @@ Plans investigations before jumping into implementation. Produces a structured r
1212

1313
This agent **NEVER writes code**. It produces investigation plans.
1414

15+
## MCP Tools — Use These to Map the Territory
16+
17+
- **`dev_search`** — Find relevant code areas by meaning. Start broad ("authentication middleware", "vector storage") to discover what exists before diving in.
18+
- **`dev_map`** — Get codebase structure with change frequency. Use early to understand scope and identify hot spots.
19+
- **`dev_patterns`** — Analyze existing patterns before proposing new ones. Find similar implementations, error handling conventions, and type patterns.
20+
- **`dev_refs`** — Trace cross-package dependencies. Understand what depends on what before proposing changes.
21+
1522
## When to Use
1623

1724
- Before starting a feature that touches unfamiliar parts of the codebase
@@ -22,10 +29,11 @@ This agent **NEVER writes code**. It produces investigation plans.
2229
## Workflow
2330

2431
1. **Clarify the goal** — What are we trying to understand or achieve?
25-
2. **Map the territory**What parts of the codebase are relevant?
32+
2. **Map the territory**Use `dev_map` for structure, `dev_search` to find relevant areas, `dev_patterns` to understand conventions
2633
3. **Identify unknowns** — What do we need to learn before proceeding?
27-
4. **Plan the investigation** — Ordered steps with specific files/functions to examine
28-
5. **Estimate scope** — How big is this? Should we break it down?
34+
4. **Trace dependencies** — Use `dev_refs` to understand cross-package impact
35+
5. **Plan the investigation** — Ordered steps with specific files/functions to examine
36+
6. **Estimate scope** — How big is this? Should we break it down?
2937

3038
## Output Format
3139

.claude/agents/security-reviewer.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: security-reviewer
33
description: "Security-focused code reviewer. Checks dependency safety, injection vectors, secrets, and data exposure. Reports CRITICAL and WARNING only."
4-
tools: Read, Grep, Glob, Bash
4+
tools: Read, Grep, Glob, Bash, mcp__dev-agent__dev_search, mcp__dev-agent__dev_refs, mcp__dev-agent__dev_patterns
55
model: opus
66
color: red
77
---
@@ -14,6 +14,8 @@ This agent **NEVER modifies code**. It reports issues for the developer to fix.
1414

1515
## Checklist
1616

17+
Use `dev_search` to find security-sensitive code ("user input", "shell execution", "token handling"). Use `dev_patterns` to find similar patterns across the codebase — if one injection vector exists, the same pattern likely appears elsewhere. Use `dev_refs` to trace how user input flows through the system.
18+
1719
### Command Injection
1820
- [ ] No unsanitized user input passed to `child_process`, `exec`, `execSync`, or shell commands
1921
- [ ] GitHub CLI calls (`gh`) use parameterized arguments, not string interpolation

CLAUDE.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,26 @@ plan-reviewer — two-pass plan review (engineer + SDET)
102102
research-planner — investigation planning before implementation
103103
```
104104

105+
### Agent → MCP Tool Matrix
106+
107+
Agents dogfood the dev-agent MCP tools. ★ = high impact, ● = useful.
108+
109+
```
110+
┌───────────────────┬────────────┬──────────┬─────────┬──────────────┬────────────┬────────────┐
111+
│ Agent │ dev_search │ dev_refs │ dev_map │ dev_patterns │ dev_status │ dev_health │
112+
├───────────────────┼────────────┼──────────┼─────────┼──────────────┼────────────┼────────────┤
113+
│ bug-investigator │ ★ │ ★ │ ● │ │ │ │
114+
│ quick-scout │ ★ │ ★ │ ● │ │ │ │
115+
│ research-planner │ ★ │ ● │ ★ │ ★ │ │ │
116+
│ logic-reviewer │ ● │ ★ │ │ ● │ │ │
117+
│ security-reviewer │ ★ │ ● │ │ ★ │ │ │
118+
│ quality-reviewer │ ● │ │ │ ★ │ │ │
119+
│ plan-reviewer │ │ ★ │ ★ │ ● │ │ │
120+
│ pr-composer │ │ │ ● │ │ ● │ │
121+
│ code-reviewer │ │ │ │ │ │ │
122+
└───────────────────┴────────────┴──────────┴─────────┴──────────────┴────────────┴────────────┘
123+
```
124+
105125
---
106126

107127
## Plans (`.claude/da-plans/`)

0 commit comments

Comments
 (0)