Skip to content

Commit e8124b9

Browse files
committed
Tweak readme to give actionable info at top
1 parent ec84aab commit e8124b9

File tree

3 files changed

+55
-42
lines changed

3 files changed

+55
-42
lines changed

.agents/README.md

Lines changed: 40 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,56 @@
1-
# Codebuff Agents
1+
# Custom Agents
22

3-
This directory contains your custom Codebuff agents. Each agent is a TypeScript file that defines an AI agent with specific capabilities and behavior.
3+
Create specialized agent workflows that coordinate multiple AI agents to tackle complex engineering tasks. Instead of a single agent trying to handle everything, you can orchestrate teams of focused specialists that work together.
44

55
## Getting Started
66

77
1. **Edit an existing agent**: Start with `my-custom-agent.ts` and modify it for your needs
8-
2. **Check out the examples and types**: See the examples and types directories to draw inspiration and learn what's possible.
9-
3. **Test your agent**: Run `codebuff --agent your-agent-name`
10-
4. **Publish your agent**: Run `codebuff publish your-agent-name`
8+
2. **Test your agent**: Run `codebuff --agent your-agent-name`
9+
3. **Publish your agent**: Run `codebuff publish your-agent-name`
1110

12-
## File Structure
11+
## Need Help?
1312

14-
- `types/` - TypeScript type definitions
15-
- `examples/` - Example agents for reference
16-
- `my-custom-agent.ts` - Your first custom agent (edit this!)
17-
- Add any new agents you wish to the .agents directory
13+
- For detailed documentation, see [agent-guide.md](./agent-guide.md).
14+
- For examples, check the `examples/` directory.
15+
- Join our [Discord community](https://codebuff.com/discord) and ask your questions!
1816

19-
## Agent Basics
17+
## Context Window Management
2018

21-
Each agent file exports an `AgentDefinition` object with:
19+
### Why Agent Workflows?
2220

23-
- `id`: Unique identifier (lowercase, hyphens only)
24-
- `displayName`: Human-readable name
25-
- `model`: AI model to use (see OpenRouter for options)
26-
- `toolNames`: Tools the agent can use
27-
- `instructionsPrompt`: Instructions for the agent's behavior
28-
- `spawnerPrompt`: When other agents should spawn this one
29-
- `spawnableAgents`: Which agents *this* agent can spawn
21+
Modern software projects are complex ecosystems with thousands of files, multiple frameworks, intricate dependencies, and domain-specific requirements. A single AI agent trying to understand and modify such systems faces fundamental limitations—not just in knowledge, but in the sheer volume of information it can process at once.
3022

31-
## Common Tools
23+
### The Solution: Focused Context Windows
3224

33-
- `read_files` - Read file contents
34-
- `write_file` - Create or modify files
35-
- `str_replace` - Make targeted edits
36-
- `run_terminal_command` - Execute shell commands
37-
- `code_search` - Search for code patterns
38-
- `spawn_agents` - Delegate to other agents
39-
- `end_turn` - Finish the response
25+
Agent workflows elegantly solve this by breaking large tasks into focused sub-problems. When working with large codebases (100k+ lines), each specialist agent receives only the narrow context it needs—a security agent sees only auth code, not UI components—keeping the context for each agent manageable while ensuring comprehensive coverage.
4026

41-
See `types/tools.ts` for more information on each tool!
27+
### Why Not Just Mimic Human Roles?
4228

43-
## Need Help?
29+
This is about efficient AI context management, not recreating a human department. Simply creating a "frontend-developer" agent misses the point. AI agents don't have human constraints like context-switching or meetings. Their power comes from hyper-specialization, allowing them to process a narrow domain more deeply than a human could, then coordinating seamlessly with other specialists.
30+
31+
## Agent workflows in action
32+
33+
Here's an example of a `git-committer` agent that creates good commit messages:
34+
35+
```typescript
36+
export default {
37+
id: 'git-committer',
38+
displayName: 'Git Committer',
39+
model: 'openai/gpt-5-nano',
40+
toolNames: ['read_files', 'run_terminal_command', 'end_turn'],
41+
42+
instructionsPrompt:
43+
'You create meaningful git commits by analyzing changes, reading relevant files for context, and crafting clear commit messages that explain the "why" behind changes.',
44+
45+
async *handleSteps() {
46+
// Analyze what changed
47+
yield { tool: 'run_terminal_command', command: 'git diff' }
48+
yield { tool: 'run_terminal_command', command: 'git log --oneline -5' }
4449

45-
- Check the type definitions in `types/agent-definition.ts`
46-
- Look at examples in the `examples/` directory
47-
- Join the Codebuff Discord community (https://discord.com/invite/mcWTGjgTj3)
50+
// Stage files and create commit with good message
51+
yield 'STEP_ALL'
52+
},
53+
}
54+
```
4855

49-
Happy agent building! 🤖
56+
This agent systematically analyzes changes, reads relevant files for context, then creates commits with clear, meaningful messages that explain the "why" behind changes.

.agents/types/agent-definition.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616

1717
import type { Message } from './codebuff-message'
18+
import { ToolResultOutput } from './content-part'
1819
import type * as Tools from './tools'
1920
type ToolName = Tools.ToolName
2021

@@ -184,7 +185,7 @@ export interface AgentDefinition {
184185
void,
185186
{
186187
agentState: AgentState
187-
toolResult: string | undefined
188+
toolResult: ToolResultOutput[] | undefined
188189
stepsComplete: boolean
189190
}
190191
>
@@ -324,6 +325,7 @@ export type ModelName =
324325

325326
// X-AI
326327
| 'x-ai/grok-4-07-09'
328+
| 'x-ai/grok-code-fast-1'
327329

328330
// Qwen
329331
| 'qwen/qwen3-coder'

common/src/templates/initial-agents-dir/README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22

33
Create specialized agent workflows that coordinate multiple AI agents to tackle complex engineering tasks. Instead of a single agent trying to handle everything, you can orchestrate teams of focused specialists that work together.
44

5+
## Getting Started
6+
7+
1. **Edit an existing agent**: Start with `my-custom-agent.ts` and modify it for your needs
8+
2. **Test your agent**: Run `codebuff --agent your-agent-name`
9+
3. **Publish your agent**: Run `codebuff publish your-agent-name`
10+
11+
## Need Help?
12+
13+
- For detailed documentation, see [agent-guide.md](./agent-guide.md).
14+
- For examples, check the `examples/` directory.
15+
- Join our [Discord community](https://codebuff.com/discord) and ask your questions!
16+
517
## Context Window Management
618

719
### Why Agent Workflows?
@@ -42,11 +54,3 @@ export default {
4254
```
4355

4456
This agent systematically analyzes changes, reads relevant files for context, then creates commits with clear, meaningful messages that explain the "why" behind changes.
45-
46-
## Getting started
47-
48-
Edit `my-custom-agent.ts` with your team's patterns, then run `codebuff --agent my-custom-agent` to test it.
49-
50-
For detailed documentation, see [agent-guide.md](./agent-guide.md).
51-
For examples, check the `examples/` directory.
52-
For help, join our [Discord community](https://codebuff.com/discord).

0 commit comments

Comments
 (0)