Skip to content

Commit 171d5fe

Browse files
wishket-pjwJeremyDev87
authored andcommitted
feat: add parallel specialist agent execution guide
- Document parallel specialist agent execution guide for parse_mode's parallelAgentsRecommendation response close #152
1 parent 476bee6 commit 171d5fe

2 files changed

Lines changed: 191 additions & 0 deletions

File tree

.claude/rules/custom-instructions.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,31 @@ Failure to call `parse_mode` when these keywords are present will result in:
8383

8484
예시: `PLAN 인증 기능 설계`**즉시** parse_mode 호출 → PLAN 모드로 작업
8585

86+
## 🔴 MANDATORY: Parallel Specialist Agent Execution
87+
88+
<PARALLEL_EXECUTION_MANDATORY_RULE>
89+
90+
**When `parse_mode` returns `parallelAgentsRecommendation`, you MUST execute parallel specialists.**
91+
92+
**Quick Checklist:**
93+
- [ ] Call `prepare_parallel_agents` with recommended specialists
94+
- [ ] Execute each agent via Task tool (`subagent_type: "general-purpose"`, `run_in_background: true`)
95+
- [ ] Display activation status (🚀 Dispatching...)
96+
- [ ] Collect results with `TaskOutput`
97+
- [ ] Summarize all findings (📊 Specialist Analysis Complete)
98+
99+
**Mode-specific Specialists:**
100+
101+
| Mode | Specialists |
102+
|------|-------------|
103+
| **PLAN** | 🏛️ architecture, 🧪 test-strategy |
104+
| **ACT** | 📏 code-quality, 🧪 test-strategy |
105+
| **EVAL** | 🔒 security, ♿ accessibility, ⚡ performance, 📏 code-quality |
106+
107+
**📖 Full Guide:** [Parallel Specialist Agents Execution](../../packages/rules/.ai-rules/adapters/claude-code.md#parallel-specialist-agents-execution)
108+
109+
</PARALLEL_EXECUTION_MANDATORY_RULE>
110+
86111
## Claude Code Specific
87112

88113
- Always respond in **Korean (한국어)**

packages/rules/.ai-rules/adapters/claude-code.md

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,3 +284,169 @@ AI assistants should display the `activation_message.formatted` field at the sta
284284
285285
...
286286
```
287+
288+
## Parallel Specialist Agents Execution
289+
290+
CodingBuddy supports parallel execution of multiple specialist agents for comprehensive analysis.
291+
292+
### When to Use Parallel Execution
293+
294+
Parallel execution is recommended when `parse_mode` returns a `parallelAgentsRecommendation` field:
295+
296+
| Mode | Default Specialists | Use Case |
297+
|------|---------------------|----------|
298+
| **PLAN** | architecture-specialist, test-strategy-specialist | Validate architecture and test approach |
299+
| **ACT** | code-quality-specialist, test-strategy-specialist | Verify implementation quality |
300+
| **EVAL** | security-specialist, accessibility-specialist, performance-specialist, code-quality-specialist | Comprehensive multi-dimensional review |
301+
302+
### parallelAgentsRecommendation Response Field
303+
304+
The `parse_mode` MCP tool returns this field to recommend parallel specialist execution:
305+
306+
```json
307+
{
308+
"mode": "EVAL",
309+
"parallelAgentsRecommendation": {
310+
"specialists": [
311+
"security-specialist",
312+
"accessibility-specialist",
313+
"performance-specialist",
314+
"code-quality-specialist"
315+
],
316+
"hint": "Use Task tool with subagent_type=\"general-purpose\" and run_in_background=true for each specialist. Call prepare_parallel_agents MCP tool to get ready-to-use prompts."
317+
}
318+
}
319+
```
320+
321+
### Parallel Execution Workflow
322+
323+
```
324+
parse_mode 호출
325+
326+
parallelAgentsRecommendation 확인
327+
↓ (있으면)
328+
사용자에게 시작 메시지 표시
329+
330+
prepare_parallel_agents MCP 호출
331+
332+
반환된 각 agent.taskPrompt를 Task tool로 병렬 호출:
333+
- subagent_type: "general-purpose"
334+
- run_in_background: true
335+
- prompt: agent.taskPrompt
336+
337+
TaskOutput으로 결과 수집
338+
339+
사용자에게 결과 종합하여 표시
340+
```
341+
342+
### Code Example
343+
344+
```typescript
345+
// Step 1: Parse mode returns parallelAgentsRecommendation
346+
const parseModeResult = await parse_mode({ prompt: "EVAL review auth implementation" });
347+
348+
if (parseModeResult.parallelAgentsRecommendation) {
349+
// Step 2: Display start message to user
350+
console.log("🚀 Dispatching 4 specialist agents in parallel...");
351+
console.log(" → 🔒 security-specialist");
352+
console.log(" → ♿ accessibility-specialist");
353+
console.log(" → ⚡ performance-specialist");
354+
console.log(" → 📏 code-quality-specialist");
355+
356+
// Step 3: Prepare parallel agents
357+
const preparedAgents = await prepare_parallel_agents({
358+
mode: "EVAL",
359+
specialists: parseModeResult.parallelAgentsRecommendation.specialists,
360+
sharedContext: "Review authentication implementation",
361+
targetFiles: ["src/auth/login.tsx"]
362+
});
363+
364+
// Step 4: Execute in parallel using Task tool
365+
const agentTasks = preparedAgents.agents.map(agent =>
366+
Task({
367+
subagent_type: "general-purpose",
368+
prompt: agent.taskPrompt,
369+
description: agent.description,
370+
run_in_background: true,
371+
model: "haiku" // Use haiku for efficiency
372+
})
373+
);
374+
375+
// Step 5: Collect results
376+
const results = await Promise.all(agentTasks.map(task => TaskOutput(task.id)));
377+
378+
// Step 6: Display summary
379+
console.log("📊 Specialist Analysis Complete:");
380+
results.forEach(result => console.log(result.summary));
381+
}
382+
```
383+
384+
### Visibility Pattern
385+
386+
When executing parallel specialists, display clear status messages:
387+
388+
**Start Message:**
389+
```
390+
🚀 Dispatching N specialist agents in parallel...
391+
→ 🔒 security-specialist
392+
→ ♿ accessibility-specialist
393+
→ ⚡ performance-specialist
394+
→ 📏 code-quality-specialist
395+
```
396+
397+
**Completion Message:**
398+
```
399+
📊 Specialist Analysis Complete:
400+
401+
🔒 Security Specialist:
402+
[findings summary]
403+
404+
♿ Accessibility Specialist:
405+
[findings summary]
406+
407+
⚡ Performance Specialist:
408+
[findings summary]
409+
410+
📏 Code Quality Specialist:
411+
[findings summary]
412+
```
413+
414+
### Specialist Icons
415+
416+
| Icon | Specialist |
417+
|------|------------|
418+
| 🔒 | security-specialist |
419+
|| accessibility-specialist |
420+
|| performance-specialist |
421+
| 📏 | code-quality-specialist |
422+
| 🧪 | test-strategy-specialist |
423+
| 🏛️ | architecture-specialist |
424+
| 📚 | documentation-specialist |
425+
| 🔍 | seo-specialist |
426+
| 🎨 | design-system-specialist |
427+
428+
### Handling Failures
429+
430+
When `prepare_parallel_agents` returns `failedAgents`:
431+
432+
```
433+
⚠️ Some agents failed to load:
434+
✗ performance-specialist: Profile not found
435+
436+
Continuing with 3/4 agents...
437+
```
438+
439+
**Strategy:**
440+
- Continue with successfully loaded agents
441+
- Report failures clearly to user
442+
- Document which agents couldn't be loaded in final report
443+
444+
### Specialist Activation Scope
445+
446+
Each workflow mode activates different specialist agents:
447+
448+
- **PLAN mode**: Architecture and test strategy specialists validate design
449+
- **ACT mode**: Code quality and test strategy specialists verify implementation
450+
- **EVAL mode**: Security, accessibility, performance, and code quality specialists provide comprehensive review
451+
452+
**Important:** Specialists from one mode do NOT carry over to the next mode. Each mode has its own recommended specialist set.

0 commit comments

Comments
 (0)