You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: common/src/templates/initial-agents-dir/README.md
+238-1Lines changed: 238 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,9 +10,26 @@ Create specialized agent workflows that coordinate multiple AI agents to tackle
10
10
11
11
## Need Help?
12
12
13
-
- For detailed documentation, see [agent-guide.md](./agent-guide.md).
14
13
- For examples, check the `examples/` directory.
15
14
- Join our [Discord community](https://codebuff.com/discord) and ask your questions!
15
+
- Check our [documentation](https://codebuff.com/docs) for more details
16
+
17
+
# What is Codebuff?
18
+
19
+
Codebuff is an **open-source AI coding assistant** that edits your codebase through natural language instructions. Instead of using one model for everything, it coordinates specialized agents that work together to understand your project and make precise changes.
20
+
21
+
Codebuff beats Claude Code at 61% vs 53% on [our evals](https://github.com/CodebuffAI/codebuff/tree/main/evals) across 175+ coding tasks over multiple open-source repos that simulate real-world tasks.
22
+
23
+
## How Codebuff Works
24
+
25
+
When you ask Codebuff to "add authentication to my API," it might invoke:
26
+
27
+
1. A **File Explorer Agent** to scan your codebase to understand the architecture and find relevant files
28
+
2. A **Planner Agent** to plan which files need changes and in what order
29
+
3. An **Editor Agent** to make precise edits
30
+
4. A **Reviewer Agent** to validate changes
31
+
32
+
This multi-agent approach gives you better context understanding, more accurate edits, and fewer errors compared to single-model tools.
16
33
17
34
## Context Window Management
18
35
@@ -54,3 +71,223 @@ export default {
54
71
```
55
72
56
73
This agent systematically analyzes changes, reads relevant files for context, then creates commits with clear, meaningful messages that explain the "why" behind changes.
74
+
75
+
# Agent Development Guide
76
+
77
+
This guide covers everything you need to know about building custom Codebuff agents.
78
+
79
+
## Agent Structure
80
+
81
+
Each agent is a TypeScript file that exports an `AgentDefinition` object:
-**`x-ai/grok-4-fast`**: Fast and cost-effective for simple or medium-complexity tasks
176
+
177
+
**Any model on OpenRouter**: Unlike Claude Code which locks you into Anthropic's models, Codebuff supports any model available on [OpenRouter](https://openrouter.ai/models) - from Claude and GPT to specialized models like Qwen, DeepSeek, and others. Switch models for different tasks or use the latest releases without waiting for platform updates.
178
+
179
+
See [OpenRouter](https://openrouter.ai/models) for all available models and pricing.
180
+
181
+
## Agent Coordination
182
+
183
+
Agents can spawn other agents to create sophisticated workflows:
184
+
185
+
```typescript
186
+
// Parent agent spawns specialists
187
+
async*handleSteps() {
188
+
yield { tool: 'spawn_agents', agents: [
189
+
'security-scanner',
190
+
'performance-analyzer',
191
+
'code-reviewer'
192
+
]}
193
+
yield'STEP_ALL'// Wait for all to complete
194
+
195
+
// Synthesize results
196
+
yield'STEP'
197
+
}
198
+
```
199
+
200
+
**Reuse any published agent**: Compose existing [published agents](https://www.codebuff.com/store) to get a leg up. Codebuff agents are the new MCP!
201
+
202
+
## Best Practices
203
+
204
+
### Instructions
205
+
206
+
- Be specific about the agent's role and expertise
207
+
- Include examples of good outputs
208
+
- Specify when the agent should ask for clarification
209
+
- Define the agent's limitations
210
+
211
+
### Tool Usage
212
+
213
+
- Start with file exploration tools (`read_files`, `code_search`)
214
+
- Use `str_replace` for targeted edits, `write_file` for major changes
215
+
- Always use `end_turn` to finish responses cleanly
216
+
217
+
### Error Handling
218
+
219
+
- Include error checking in programmatic flows
220
+
- Provide fallback strategies for failed operations
221
+
- Log important decisions for debugging
222
+
223
+
### Performance
224
+
225
+
- Choose appropriate models for the task complexity
**Deep customizability**: Create sophisticated agent workflows with TypeScript generators that mix AI generation with programmatic control. Define custom agents that spawn subagents, implement conditional logic, and orchestrate complex multi-step processes that adapt to your specific use cases.
280
+
281
+
**Fully customizable SDK**: Build Codebuff's capabilities directly into your applications with a complete TypeScript SDK. Create custom tools, integrate with your CI/CD pipeline, build AI-powered development environments, or embed intelligent coding assistance into your products.
282
+
283
+
Learn more about the SDK [here](https://www.npmjs.com/package/@codebuff/sdk).
284
+
285
+
## Community & Support
286
+
287
+
-**Discord**: [Join our community](https://codebuff.com/discord) for help and inspiration
288
+
-**Examples**: Study the `examples/` directory for patterns
289
+
-**Documentation**: [codebuff.com/docs](https://codebuff.com/docs) and check `types/` for detailed type information
290
+
-**Issues**: [Report bugs and request features on GitHub](https://github.com/CodebuffAI/codebuff/issues)
0 commit comments