codingbuddy-rules 1.2.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.ai-rules/adapters/opencode-skills.md +263 -0
- package/.ai-rules/adapters/opencode.md +517 -0
- package/.ai-rules/agents/README.md +114 -5
- package/.ai-rules/agents/act-mode.json +158 -0
- package/.ai-rules/agents/eval-mode.json +175 -0
- package/.ai-rules/agents/plan-mode.json +103 -0
- package/.ai-rules/keyword-modes.json +9 -3
- package/package.json +1 -1
|
@@ -0,0 +1,517 @@
|
|
|
1
|
+
# OpenCode Integration Guide
|
|
2
|
+
|
|
3
|
+
This guide explains how to use the common AI rules (`.ai-rules/`) in OpenCode and its successor Crush.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
OpenCode (now evolved as "Crush" by Charm Bracelet) uses JSON configuration files to define agents, context paths, and tool permissions. This guide helps integrate the `.ai-rules/` system with OpenCode's agent-based workflow.
|
|
8
|
+
|
|
9
|
+
## Project Status
|
|
10
|
+
|
|
11
|
+
⚠️ **Important**: The original OpenCode project has been archived (September 2025) and continued as **"Crush"** by Charm Bracelet with 16.7k+ stars. This guide supports both versions.
|
|
12
|
+
|
|
13
|
+
- **OpenCode**: Uses `.opencode.json` configuration
|
|
14
|
+
- **Crush**: Uses `crush.json` or `~/.config/crush/crush.json` configuration
|
|
15
|
+
|
|
16
|
+
## Integration Method
|
|
17
|
+
|
|
18
|
+
### 1. Configure OpenCode/Crush Settings
|
|
19
|
+
|
|
20
|
+
Update your configuration file (`.opencode.json` or `crush.json`):
|
|
21
|
+
|
|
22
|
+
```json
|
|
23
|
+
{
|
|
24
|
+
"$schema": "https://opencode.ai/config.json",
|
|
25
|
+
"model": "anthropic/claude-sonnet-4-20250514",
|
|
26
|
+
"default_agent": "plan-mode",
|
|
27
|
+
|
|
28
|
+
"instructions": [
|
|
29
|
+
"packages/rules/.ai-rules/rules/core.md",
|
|
30
|
+
"packages/rules/.ai-rules/rules/augmented-coding.md",
|
|
31
|
+
"packages/rules/.ai-rules/rules/project.md",
|
|
32
|
+
"packages/rules/.ai-rules/adapters/opencode.md",
|
|
33
|
+
"CLAUDE.md"
|
|
34
|
+
],
|
|
35
|
+
|
|
36
|
+
"agent": {
|
|
37
|
+
"plan-mode": {
|
|
38
|
+
"description": "PLAN mode - Analysis and planning without changes",
|
|
39
|
+
"mode": "primary",
|
|
40
|
+
"prompt": "{file:packages/rules/.ai-rules/agents/plan-mode.json}\n\n[OpenCode Override]\nMode: PLAN only. Always respond in Korean. Do NOT make any file changes. Focus on analysis and planning.",
|
|
41
|
+
"permission": {
|
|
42
|
+
"edit": "deny",
|
|
43
|
+
"bash": {
|
|
44
|
+
"git status": "allow",
|
|
45
|
+
"git diff*": "allow",
|
|
46
|
+
"git log*": "allow",
|
|
47
|
+
"*": "ask"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"act-mode": {
|
|
52
|
+
"description": "ACT mode - Full development with all tools",
|
|
53
|
+
"mode": "primary",
|
|
54
|
+
"prompt": "{file:packages/rules/.ai-rules/agents/act-mode.json}\n\n[OpenCode Override]\nMode: ACT. Always respond in Korean. Follow TDD workflow and code quality standards.",
|
|
55
|
+
"permission": {
|
|
56
|
+
"edit": "allow",
|
|
57
|
+
"bash": "allow"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"eval-mode": {
|
|
61
|
+
"description": "EVAL mode - Code quality evaluation",
|
|
62
|
+
"mode": "primary",
|
|
63
|
+
"prompt": "{file:packages/rules/.ai-rules/agents/eval-mode.json}\n\n[OpenCode Override]\nMode: EVAL. Always respond in Korean. Provide evidence-based evaluation.",
|
|
64
|
+
"permission": {
|
|
65
|
+
"edit": "deny",
|
|
66
|
+
"bash": {
|
|
67
|
+
"git status": "allow",
|
|
68
|
+
"git diff*": "allow",
|
|
69
|
+
"git log*": "allow",
|
|
70
|
+
"*": "ask"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"backend": {
|
|
75
|
+
"description": "Backend development - Node.js, Python, Go, Java, Rust",
|
|
76
|
+
"mode": "subagent",
|
|
77
|
+
"prompt": "{file:packages/rules/.ai-rules/agents/backend-developer.json}\n\n[OpenCode Override]\nAlways respond in Korean. Follow TDD workflow and clean architecture.",
|
|
78
|
+
"permission": {
|
|
79
|
+
"edit": "allow",
|
|
80
|
+
"bash": "allow"
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"architect": {
|
|
84
|
+
"description": "Architecture and design patterns specialist",
|
|
85
|
+
"mode": "subagent",
|
|
86
|
+
"prompt": "{file:packages/rules/.ai-rules/agents/architecture-specialist.json}\n\n[OpenCode Override]\nAlways respond in Korean. Focus on layer boundaries and dependency direction.",
|
|
87
|
+
"permission": {
|
|
88
|
+
"edit": "deny",
|
|
89
|
+
"bash": "ask"
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"tester": {
|
|
93
|
+
"description": "Test strategy and TDD specialist",
|
|
94
|
+
"mode": "subagent",
|
|
95
|
+
"prompt": "{file:packages/rules/.ai-rules/agents/test-strategy-specialist.json}\n\n[OpenCode Override]\nAlways respond in Korean. Enforce 90%+ coverage and no-mocking principle.",
|
|
96
|
+
"permission": {
|
|
97
|
+
"edit": "allow",
|
|
98
|
+
"bash": "allow"
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"security": {
|
|
102
|
+
"description": "Security audit - OAuth, JWT, XSS/CSRF protection",
|
|
103
|
+
"mode": "subagent",
|
|
104
|
+
"prompt": "{file:packages/rules/.ai-rules/agents/security-specialist.json}\n\n[OpenCode Override]\nAlways respond in Korean. Follow OWASP guidelines.",
|
|
105
|
+
"permission": {
|
|
106
|
+
"edit": "deny",
|
|
107
|
+
"bash": "ask"
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
"a11y": {
|
|
111
|
+
"description": "Accessibility - WCAG 2.1 AA compliance",
|
|
112
|
+
"mode": "subagent",
|
|
113
|
+
"prompt": "{file:packages/rules/.ai-rules/agents/accessibility-specialist.json}\n\n[OpenCode Override]\nAlways respond in Korean. Verify ARIA and keyboard navigation.",
|
|
114
|
+
"permission": {
|
|
115
|
+
"edit": "deny",
|
|
116
|
+
"bash": "ask"
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
"performance": {
|
|
120
|
+
"description": "Performance optimization specialist",
|
|
121
|
+
"mode": "subagent",
|
|
122
|
+
"prompt": "{file:packages/rules/.ai-rules/agents/performance-specialist.json}\n\n[OpenCode Override]\nAlways respond in Korean. Focus on bundle size and runtime optimization.",
|
|
123
|
+
"permission": {
|
|
124
|
+
"edit": "deny",
|
|
125
|
+
"bash": "ask"
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
|
|
130
|
+
"mcp": {
|
|
131
|
+
"codingbuddy": {
|
|
132
|
+
"type": "local",
|
|
133
|
+
"command": ["npx", "codingbuddy@latest", "mcp"]
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### 2. Agent System Mapping
|
|
140
|
+
|
|
141
|
+
| Codingbuddy Agent | OpenCode Agent | Purpose |
|
|
142
|
+
|------------------|----------------|---------|
|
|
143
|
+
| **plan-mode.json** | `plan-mode` | PLAN mode workflow (delegates to frontend-developer) |
|
|
144
|
+
| **act-mode.json** | `act-mode` | ACT mode workflow (delegates to frontend-developer) |
|
|
145
|
+
| **eval-mode.json** | `eval-mode` | EVAL mode workflow (delegates to code-reviewer) |
|
|
146
|
+
| **frontend-developer.json** | N/A (delegate) | Primary development implementation |
|
|
147
|
+
| **backend-developer.json** | `backend` | Backend development (Node.js, Python, Go, Java, Rust) |
|
|
148
|
+
| **code-reviewer.json** | N/A (delegate) | Code quality evaluation implementation |
|
|
149
|
+
| **architecture-specialist.json** | `architect` | Architecture and design patterns |
|
|
150
|
+
| **test-strategy-specialist.json** | `tester` | Test strategy and TDD |
|
|
151
|
+
| **security-specialist.json** | `security` | Security audit |
|
|
152
|
+
| **accessibility-specialist.json** | `a11y` | WCAG compliance |
|
|
153
|
+
| **performance-specialist.json** | `performance` | Performance optimization |
|
|
154
|
+
|
|
155
|
+
#### Mode Agent vs Specialist Agent
|
|
156
|
+
|
|
157
|
+
- **Mode Agents** (`plan-mode`, `act-mode`, `eval-mode`): Workflow orchestrators that delegate to appropriate implementation agents
|
|
158
|
+
- **Specialist Agents** (`architect`, `security`, etc.): Domain-specific expertise for specialized tasks
|
|
159
|
+
- **Delegate Agents** (`frontend-developer`, `code-reviewer`): Implementation agents that Mode Agents delegate to
|
|
160
|
+
|
|
161
|
+
### 3. MCP Server Integration
|
|
162
|
+
|
|
163
|
+
#### Codingbuddy MCP Server
|
|
164
|
+
|
|
165
|
+
Add to your MCP configuration:
|
|
166
|
+
|
|
167
|
+
```json
|
|
168
|
+
{
|
|
169
|
+
"mcp": {
|
|
170
|
+
"codingbuddy": {
|
|
171
|
+
"type": "local",
|
|
172
|
+
"command": ["npx", "codingbuddy@latest", "mcp"],
|
|
173
|
+
"env": ["NODE_ENV=production"]
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
#### Available MCP Tools
|
|
180
|
+
|
|
181
|
+
Once connected, you can use:
|
|
182
|
+
- `search_rules`: Query AI rules and guidelines
|
|
183
|
+
- `get_agent_details`: Get specialist agent information
|
|
184
|
+
- `recommend_skills`: Get skill recommendations based on prompt
|
|
185
|
+
- `parse_mode`: Parse PLAN/ACT/EVAL workflow mode (now returns Mode Agent information)
|
|
186
|
+
|
|
187
|
+
#### Enhanced parse_mode Response
|
|
188
|
+
|
|
189
|
+
The `parse_mode` tool now returns additional Mode Agent information:
|
|
190
|
+
|
|
191
|
+
```json
|
|
192
|
+
{
|
|
193
|
+
"mode": "PLAN",
|
|
194
|
+
"originalPrompt": "새로운 사용자 등록 기능을 만들어줘",
|
|
195
|
+
"instructions": "설계 우선 접근. TDD 관점에서...",
|
|
196
|
+
"rules": [...],
|
|
197
|
+
"agent": "plan-mode",
|
|
198
|
+
"delegates_to": "frontend-developer",
|
|
199
|
+
"delegate_agent_info": {
|
|
200
|
+
"name": "Frontend Developer",
|
|
201
|
+
"description": "React/Next.js 전문가, TDD 및 디자인 시스템 경험",
|
|
202
|
+
"expertise": ["React", "Next.js", "TDD", "TypeScript"]
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
**New Fields:**
|
|
208
|
+
- `agent`: Mode Agent name (plan-mode, act-mode, eval-mode)
|
|
209
|
+
- `delegates_to`: Which specialist agent the Mode Agent delegates to
|
|
210
|
+
- `delegate_agent_info`: Detailed information about the delegate agent (optional)
|
|
211
|
+
|
|
212
|
+
**Backward Compatibility:** All new fields are optional. Existing clients continue to work unchanged.
|
|
213
|
+
|
|
214
|
+
## Usage Workflows
|
|
215
|
+
|
|
216
|
+
### PLAN → ACT → EVAL Workflow
|
|
217
|
+
|
|
218
|
+
#### 1. Start with PLAN Mode
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
# In OpenCode CLI
|
|
222
|
+
/agent plan-mode
|
|
223
|
+
|
|
224
|
+
# Then in chat
|
|
225
|
+
새로운 사용자 등록 기능을 만들어줘
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
**Plan-mode agent will:**
|
|
229
|
+
- Analyze requirements (Korean response)
|
|
230
|
+
- Create structured implementation plan
|
|
231
|
+
- Generate todo list using todo_write tool
|
|
232
|
+
- Reference .ai-rules for consistent standards
|
|
233
|
+
|
|
234
|
+
#### 2. Execute with ACT Mode
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
# Switch to act agent
|
|
238
|
+
/agent act-mode
|
|
239
|
+
|
|
240
|
+
# Continue implementation
|
|
241
|
+
ACT
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
**Act-mode agent will:**
|
|
245
|
+
- Execute TDD workflow (Red → Green → Refactor)
|
|
246
|
+
- Implement code following .ai-rules standards
|
|
247
|
+
- Maintain 90%+ test coverage
|
|
248
|
+
- Use TypeScript strict mode (no `any`)
|
|
249
|
+
|
|
250
|
+
#### 3. Evaluate with EVAL Mode
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
# Switch to eval agent
|
|
254
|
+
/agent eval-mode
|
|
255
|
+
|
|
256
|
+
# Request evaluation
|
|
257
|
+
EVAL
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
**Eval-mode agent will:**
|
|
261
|
+
- Provide evidence-based code review
|
|
262
|
+
- Check SOLID principles compliance
|
|
263
|
+
- Verify security and accessibility standards
|
|
264
|
+
- Reference specialist frameworks
|
|
265
|
+
|
|
266
|
+
### Direct Agent Usage
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
# Use specific specialist agents
|
|
270
|
+
/agent architect # Architecture review
|
|
271
|
+
/agent security # Security audit
|
|
272
|
+
/agent a11y # Accessibility check
|
|
273
|
+
/agent performance # Performance optimization
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
## Custom Commands
|
|
277
|
+
|
|
278
|
+
Create workflow commands in `~/.config/opencode/commands/` or `~/.config/crush/commands/`:
|
|
279
|
+
|
|
280
|
+
### PLAN Command (`plan-feature.md`)
|
|
281
|
+
```markdown
|
|
282
|
+
READ {file:packages/rules/.ai-rules/rules/core.md}
|
|
283
|
+
READ {file:packages/rules/.ai-rules/rules/project.md}
|
|
284
|
+
ANALYZE $FEATURE_REQUIREMENTS
|
|
285
|
+
CREATE implementation plan following TDD principles
|
|
286
|
+
GENERATE todo list with priorities
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### ACT Command (`implement-tdd.md`)
|
|
290
|
+
```markdown
|
|
291
|
+
READ {file:packages/rules/.ai-rules/rules/augmented-coding.md}
|
|
292
|
+
FOLLOW Red → Green → Refactor cycle
|
|
293
|
+
MAINTAIN 90%+ test coverage
|
|
294
|
+
USE TypeScript strict mode
|
|
295
|
+
COMMIT after each green phase
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### EVAL Command (`code-review.md`)
|
|
299
|
+
```markdown
|
|
300
|
+
READ {file:packages/rules/.ai-rules/agents/code-reviewer.json}
|
|
301
|
+
ANALYZE code quality with evidence
|
|
302
|
+
CHECK SOLID principles
|
|
303
|
+
VERIFY security and accessibility
|
|
304
|
+
PROVIDE improvement recommendations
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
## Directory Structure
|
|
308
|
+
|
|
309
|
+
```
|
|
310
|
+
project/
|
|
311
|
+
├── .opencode.json # OpenCode configuration
|
|
312
|
+
├── crush.json # Crush configuration (alternative)
|
|
313
|
+
├── packages/rules/.ai-rules/
|
|
314
|
+
│ ├── adapters/
|
|
315
|
+
│ │ └── opencode.md # This guide
|
|
316
|
+
│ ├── agents/
|
|
317
|
+
│ │ ├── frontend-developer.json
|
|
318
|
+
│ │ ├── code-reviewer.json
|
|
319
|
+
│ │ └── *.json
|
|
320
|
+
│ ├── rules/
|
|
321
|
+
│ │ ├── core.md
|
|
322
|
+
│ │ ├── project.md
|
|
323
|
+
│ │ └── augmented-coding.md
|
|
324
|
+
│ └── skills/
|
|
325
|
+
│ └── */SKILL.md
|
|
326
|
+
└── ~/.config/opencode/ # User-specific settings
|
|
327
|
+
└── commands/ # Custom workflow commands
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
## Crush-Specific Features
|
|
331
|
+
|
|
332
|
+
For Crush users, additional features available:
|
|
333
|
+
|
|
334
|
+
### Multi-Model Support
|
|
335
|
+
```json
|
|
336
|
+
{
|
|
337
|
+
"agents": {
|
|
338
|
+
"coder": { "model": "claude-3.7-sonnet", "maxTokens": 5000 },
|
|
339
|
+
"task": { "model": "gpt-4o", "maxTokens": 3000 },
|
|
340
|
+
"title": { "model": "claude-3.7-sonnet", "maxTokens": 80 }
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
### LSP Integration
|
|
346
|
+
```json
|
|
347
|
+
{
|
|
348
|
+
"lsp": {
|
|
349
|
+
"typescript": {
|
|
350
|
+
"command": "typescript-language-server",
|
|
351
|
+
"args": ["--stdio"]
|
|
352
|
+
},
|
|
353
|
+
"go": { "command": "gopls" }
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
### Skills System
|
|
359
|
+
```json
|
|
360
|
+
{
|
|
361
|
+
"options": {
|
|
362
|
+
"skills_paths": [
|
|
363
|
+
"packages/rules/.ai-rules/skills",
|
|
364
|
+
"~/.config/crush/skills"
|
|
365
|
+
]
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
## Benefits
|
|
371
|
+
|
|
372
|
+
### ✅ Advantages
|
|
373
|
+
|
|
374
|
+
- **Terminal-native**: Developer-friendly TUI interface
|
|
375
|
+
- **Multi-session Management**: Project-specific context isolation
|
|
376
|
+
- **Agent-based Workflow**: Clear separation of concerns
|
|
377
|
+
- **Consistent Standards**: Same rules across all AI tools
|
|
378
|
+
- **MCP Integration**: Access to specialized tools and knowledge
|
|
379
|
+
- **Korean Language Support**: Full Korean responses configured
|
|
380
|
+
|
|
381
|
+
### ✅ Key Features
|
|
382
|
+
|
|
383
|
+
- **Dynamic Model Switching**: Change AI models during session
|
|
384
|
+
- **Advanced Permissions**: Fine-grained tool access control
|
|
385
|
+
- **Auto-initialization**: Project-specific context loading
|
|
386
|
+
- **File Reference System**: `{file:path}` syntax for instructions
|
|
387
|
+
|
|
388
|
+
## Troubleshooting
|
|
389
|
+
|
|
390
|
+
### Common Issues
|
|
391
|
+
|
|
392
|
+
**1. Permission Denied**
|
|
393
|
+
```bash
|
|
394
|
+
# Check current agent permissions
|
|
395
|
+
/agent info
|
|
396
|
+
|
|
397
|
+
# Switch to appropriate agent
|
|
398
|
+
/agent act-mode # For file editing
|
|
399
|
+
/agent plan-mode # For read-only analysis
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
**2. MCP Connection Failed**
|
|
403
|
+
```bash
|
|
404
|
+
# Verify codingbuddy installation
|
|
405
|
+
npx codingbuddy@latest --version
|
|
406
|
+
|
|
407
|
+
# Test MCP connection
|
|
408
|
+
npx codingbuddy@latest mcp
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
**3. Agent Not Responding in Korean**
|
|
412
|
+
- Verify `[OpenCode Override]` includes Korean language setting
|
|
413
|
+
- Check agent prompt includes language instruction
|
|
414
|
+
|
|
415
|
+
### Migration from OpenCode to Crush
|
|
416
|
+
|
|
417
|
+
1. **Rename configuration file**: `.opencode.json` → `crush.json`
|
|
418
|
+
2. **Update schema reference**: Use Crush schema URL
|
|
419
|
+
3. **Install Crush**: `brew install charmbracelet/tap/crush`
|
|
420
|
+
4. **Migrate sessions**: Export/import session data
|
|
421
|
+
|
|
422
|
+
## Maintenance
|
|
423
|
+
|
|
424
|
+
### Updating Rules
|
|
425
|
+
|
|
426
|
+
**For universal changes:**
|
|
427
|
+
1. Edit files in `packages/rules/.ai-rules/`
|
|
428
|
+
2. Changes automatically apply to all agents
|
|
429
|
+
|
|
430
|
+
**For OpenCode-specific changes:**
|
|
431
|
+
1. Update agent prompts in configuration file
|
|
432
|
+
2. Modify custom commands in commands directory
|
|
433
|
+
|
|
434
|
+
### Version Compatibility
|
|
435
|
+
|
|
436
|
+
- **OpenCode 0.x**: Use `.opencode.json`
|
|
437
|
+
- **Crush 1.x+**: Use `crush.json` or global config
|
|
438
|
+
- **Both**: Maintain separate config files
|
|
439
|
+
|
|
440
|
+
## Advanced Usage
|
|
441
|
+
|
|
442
|
+
### Parallel Agent Workflows
|
|
443
|
+
|
|
444
|
+
```bash
|
|
445
|
+
# Terminal 1: Planning
|
|
446
|
+
opencode --agent plan-mode
|
|
447
|
+
계획을 세워줘
|
|
448
|
+
|
|
449
|
+
# Terminal 2: Implementation
|
|
450
|
+
opencode --agent act-mode
|
|
451
|
+
ACT
|
|
452
|
+
|
|
453
|
+
# Terminal 3: Review
|
|
454
|
+
opencode --agent eval-mode
|
|
455
|
+
EVAL
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
### Custom Agent Creation
|
|
459
|
+
|
|
460
|
+
```json
|
|
461
|
+
{
|
|
462
|
+
"agent": {
|
|
463
|
+
"custom": {
|
|
464
|
+
"description": "Custom specialist agent",
|
|
465
|
+
"mode": "subagent",
|
|
466
|
+
"prompt": "{file:packages/rules/.ai-rules/agents/custom-specialist.json}",
|
|
467
|
+
"tools": {
|
|
468
|
+
"write": true,
|
|
469
|
+
"edit": true,
|
|
470
|
+
"bash": false
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
## Examples
|
|
478
|
+
|
|
479
|
+
### Frontend Development Session
|
|
480
|
+
|
|
481
|
+
```bash
|
|
482
|
+
# 1. Start planning
|
|
483
|
+
/agent plan-mode
|
|
484
|
+
React 컴포넌트 라이브러리를 만들어줘
|
|
485
|
+
|
|
486
|
+
# 2. Implement
|
|
487
|
+
/agent act-mode
|
|
488
|
+
ACT
|
|
489
|
+
|
|
490
|
+
# 3. Review
|
|
491
|
+
/agent eval-mode
|
|
492
|
+
EVAL
|
|
493
|
+
|
|
494
|
+
# 4. Optimize
|
|
495
|
+
/agent performance
|
|
496
|
+
성능 최적화 제안해줘
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
### Full-Stack Development
|
|
500
|
+
|
|
501
|
+
```bash
|
|
502
|
+
# Frontend work
|
|
503
|
+
/agent plan-mode
|
|
504
|
+
사용자 대시보드 UI 계획
|
|
505
|
+
|
|
506
|
+
# Backend work
|
|
507
|
+
/agent backend
|
|
508
|
+
API 엔드포인트 구현
|
|
509
|
+
|
|
510
|
+
# Security review
|
|
511
|
+
/agent security
|
|
512
|
+
보안 취약점 검사
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
---
|
|
516
|
+
|
|
517
|
+
This guide ensures consistent, high-quality AI-assisted development using OpenCode/Crush with the `.ai-rules` system. All agents follow the same standards while leveraging OpenCode's powerful terminal-based interface.
|
|
@@ -8,7 +8,7 @@ AI Agent definitions for specialized development roles.
|
|
|
8
8
|
|
|
9
9
|
- [Quick Reference: Which Agent?](#quick-reference-which-agent)
|
|
10
10
|
- [Available Agents](#available-agents)
|
|
11
|
-
- [Core Agents](#core-agents-auto-activated)
|
|
11
|
+
- [Core Agents](#core-agents-auto-activated-via-delegation)
|
|
12
12
|
- [Domain Specialists](#domain-specialists)
|
|
13
13
|
- [Utility Agents](#utility-agents)
|
|
14
14
|
- [Agent Details](#agent-details)
|
|
@@ -58,16 +58,125 @@ AI Agent definitions for specialized development roles.
|
|
|
58
58
|
|
|
59
59
|
---
|
|
60
60
|
|
|
61
|
+
## Mode Agents
|
|
62
|
+
|
|
63
|
+
**New Agent Hierarchy**: Mode Agents → Delegate Agents → Specialist Agents
|
|
64
|
+
|
|
65
|
+
Mode Agents are workflow orchestrators that provide seamless integration with OpenCode and other agent-based AI tools. They automatically delegate to appropriate specialist agents based on the workflow mode.
|
|
66
|
+
|
|
67
|
+
### Mode Agent Hierarchy
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
Mode Agents (Workflow Orchestrators)
|
|
71
|
+
├── plan-mode → delegates to → frontend-developer (or project-specific)
|
|
72
|
+
├── act-mode → delegates to → frontend-developer (or project-specific)
|
|
73
|
+
└── eval-mode → delegates to → code-reviewer
|
|
74
|
+
|
|
75
|
+
Delegate Agents (Implementation Experts)
|
|
76
|
+
├── frontend-developer # React/Next.js expertise
|
|
77
|
+
├── backend-developer # Multi-language backend expertise
|
|
78
|
+
└── code-reviewer # Quality evaluation expertise
|
|
79
|
+
|
|
80
|
+
Specialist Agents (Domain Experts)
|
|
81
|
+
├── architecture-specialist
|
|
82
|
+
├── security-specialist
|
|
83
|
+
├── accessibility-specialist
|
|
84
|
+
└── ... (other specialists)
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Mode Agent Details
|
|
88
|
+
|
|
89
|
+
| Mode Agent | Workflow | Delegates To | Purpose |
|
|
90
|
+
|------------|----------|--------------|---------|
|
|
91
|
+
| **plan-mode** | PLAN | frontend-developer (configurable) | Analysis and planning without changes |
|
|
92
|
+
| **act-mode** | ACT | frontend-developer (configurable) | Full development with all tools |
|
|
93
|
+
| **eval-mode** | EVAL | code-reviewer | Code quality evaluation |
|
|
94
|
+
|
|
95
|
+
**Key Features:**
|
|
96
|
+
- **Seamless Integration**: Works with OpenCode agent system
|
|
97
|
+
- **Automatic Delegation**: Mode Agents handle workflow, Delegates handle implementation
|
|
98
|
+
- **Flexible Configuration**: Delegate target configurable per project
|
|
99
|
+
- **Backward Compatible**: Existing usage patterns continue to work
|
|
100
|
+
|
|
101
|
+
### Usage with Mode Agents
|
|
102
|
+
|
|
103
|
+
#### OpenCode/Agent-Based Tools
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
# OpenCode CLI example
|
|
107
|
+
/agent plan-mode
|
|
108
|
+
새로운 기능을 만들어줘
|
|
109
|
+
|
|
110
|
+
/agent act-mode
|
|
111
|
+
ACT
|
|
112
|
+
|
|
113
|
+
/agent eval-mode
|
|
114
|
+
EVAL
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
#### MCP Integration
|
|
118
|
+
|
|
119
|
+
When using the `parse_mode` MCP tool, you receive enhanced response with Mode Agent information:
|
|
120
|
+
|
|
121
|
+
```json
|
|
122
|
+
{
|
|
123
|
+
"mode": "PLAN",
|
|
124
|
+
"originalPrompt": "새로운 기능을 만들어줘",
|
|
125
|
+
"instructions": "설계 우선 접근...",
|
|
126
|
+
"rules": [{"name": "rules/core.md", "content": "..."}],
|
|
127
|
+
"warnings": ["No keyword found, defaulting to PLAN"],
|
|
128
|
+
"agent": "plan-mode",
|
|
129
|
+
"delegates_to": "frontend-developer",
|
|
130
|
+
"delegate_agent_info": {
|
|
131
|
+
"name": "Frontend Developer",
|
|
132
|
+
"description": "React/Next.js 전문가, TDD 및 디자인 시스템 경험",
|
|
133
|
+
"expertise": ["React", "Next.js", "TDD", "TypeScript"]
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**Response Fields:**
|
|
139
|
+
|
|
140
|
+
| Field | Type | Required | Description |
|
|
141
|
+
|-------|------|----------|-------------|
|
|
142
|
+
| `mode` | string | Yes | Detected mode: "PLAN", "ACT", or "EVAL" |
|
|
143
|
+
| `originalPrompt` | string | Yes | User prompt with keyword removed |
|
|
144
|
+
| `instructions` | string | Yes | Mode-specific instructions |
|
|
145
|
+
| `rules` | array | Yes | Applicable rule files with content |
|
|
146
|
+
| `warnings` | array | No | Parsing warnings (e.g., missing keyword) |
|
|
147
|
+
| `agent` | string | No | Mode Agent name (e.g., "plan-mode") |
|
|
148
|
+
| `delegates_to` | string | No | Delegate agent name (e.g., "frontend-developer") |
|
|
149
|
+
| `delegate_agent_info` | object | No | Delegate agent details (name, description, expertise) |
|
|
150
|
+
|
|
151
|
+
### Agent Priority System
|
|
152
|
+
|
|
153
|
+
Agents are listed in priority order:
|
|
154
|
+
1. **Mode Agents** (plan-mode, act-mode, eval-mode)
|
|
155
|
+
2. **Delegate Agents** (alphabetical)
|
|
156
|
+
3. **Specialist Agents** (alphabetical)
|
|
157
|
+
|
|
158
|
+
This ensures Mode Agents appear first in agent selection interfaces.
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
61
162
|
## Available Agents
|
|
62
163
|
|
|
63
|
-
###
|
|
164
|
+
### Mode Agents (Workflow Orchestrators)
|
|
165
|
+
|
|
166
|
+
Mode Agents handle workflow orchestration and delegate to implementation experts:
|
|
167
|
+
|
|
168
|
+
- **Plan Mode** (`plan-mode.json`): Analysis and planning (delegates to primary developer)
|
|
169
|
+
- **Act Mode** (`act-mode.json`): Implementation execution (delegates to primary developer)
|
|
170
|
+
- **Eval Mode** (`eval-mode.json`): Quality evaluation (delegates to code reviewer)
|
|
171
|
+
|
|
172
|
+
### Core Agents (Auto-activated via delegation)
|
|
64
173
|
|
|
65
|
-
These agents are automatically activated
|
|
174
|
+
These agents are automatically activated via Mode Agent delegation:
|
|
66
175
|
|
|
67
|
-
- **Primary Developer Agent**:
|
|
176
|
+
- **Primary Developer Agent**: Activated by plan-mode/act-mode
|
|
68
177
|
- Example: `frontend-developer.json` (React/Next.js projects)
|
|
69
178
|
- Customize per project: `backend-developer.json`, `mobile-developer.json`, etc.
|
|
70
|
-
- **Code Reviewer** (`code-reviewer.json`):
|
|
179
|
+
- **Code Reviewer** (`code-reviewer.json`): Activated by eval-mode
|
|
71
180
|
|
|
72
181
|
### Domain Specialists
|
|
73
182
|
|