Skip to content

Commit 8c702eb

Browse files
[chore] Update readmes (#255)
Co-authored-by: James Grugett <jahooma@gmail.com>
1 parent ae1b0e0 commit 8c702eb

File tree

7 files changed

+438
-178
lines changed

7 files changed

+438
-178
lines changed

README.md

Lines changed: 79 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -1,175 +1,115 @@
11
# Codebuff
22

3-
Codebuff is an AI-powered coding assistant that helps developers build apps faster and easier. It provides an interactive command-line interface for natural language interactions with your codebase.
3+
Codebuff is an 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.
44

5-
## Features
5+
Codebuff beats Claude Code at 61% vs 53% on [our internal evals](evals/README.md) across 200+ coding tasks over multiple open-source repos that simulate real-world tasks.
66

7-
- AI-powered code generation and modification
8-
- Real-time, interactive command-line interface
9-
- Support for multiple programming languages
10-
- File management and version control integration
11-
- Web scraping capabilities for gathering external information
12-
- Terminal command execution for various development tasks
13-
- Knowledge management system for project-specific information
7+
![Codebuff Demo](./assets/demo.gif)
148

15-
## How It Works
9+
## How it works
1610

17-
Codebuff uses advanced AI models to understand and generate code based on natural language instructions. Here's a brief overview of its operation:
11+
When you ask Codebuff to "add authentication to my API," it might invoke:
1812

19-
1. **Project Analysis**: Codebuff analyzes your project structure and files to gain context.
13+
1. A **File Explorer Agent** scans your codebase to understand the architecture and find relevant files
14+
2. An **Planner Agent** plans which files need changes and in what order
15+
3. An **Implementation Agents** make precise edits
16+
4. A **Review Agents** validate changes
2017

21-
2. **User Interaction**: You interact with Codebuff through a command-line interface, providing instructions or queries in natural language.
18+
<div align="center">
19+
<img src="./assets/multi-agents.png" alt="Codebuff Multi-Agents" width="600">
20+
</div>
2221

23-
3. **AI Processing**: Codebuff processes your input, considering the project context and your instructions.
22+
This multi-agent approach gives you better context understanding, more accurate edits, and fewer errors compared to single-model tools.
2423

25-
4. **Code Generation/Modification**: Based on its understanding, Codebuff generates new code or suggests modifications to existing files.
24+
## CLI: Install and start coding
2625

27-
5. **Real-time Feedback**: Changes are presented to you in real-time, allowing for immediate review and further refinement.
28-
29-
6. **Knowledge Accumulation**: Codebuff learns from interactions and stores project-specific knowledge for future use.
30-
31-
## How to Use Codebuff
32-
33-
To get started with Codebuff, follow these steps:
34-
35-
1. Install Codebuff globally using npm:
36-
37-
```
38-
npm install -g codebuff
39-
```
40-
41-
2. Navigate to your project directory in the terminal.
42-
43-
3. Run Codebuff:
44-
45-
```
46-
codebuff
47-
```
48-
49-
4. Interact with Codebuff using natural language commands. For example:
50-
51-
- "Add a new function to handle user authentication"
52-
- "Refactor the database connection code for better performance"
53-
- "Explain how the routing system works in this project"
54-
55-
5. Review the suggested changes and approve or modify them as needed.
56-
57-
6. Use the built-in commands for navigation and control:
58-
- Type "help" or "h" for a list of available commands
59-
- Use arrow keys to navigate through command history
60-
- Press Ctrl+U to undo changes and Ctrl+R to redo
61-
- Press Esc to toggle the menu or stop the current AI response
62-
63-
## Setting Up Locally
64-
65-
If you want to set up Codebuff for local development:
66-
67-
### Prerequisites
68-
69-
1. **Install Bun**: Follow the [Bun installation guide](https://bun.sh/docs/installation)
70-
71-
2. **Install direnv**: This manages environment variables automatically
72-
73-
- macOS: `brew install direnv`
74-
- Ubuntu/Debian: `sudo apt install direnv`
75-
- Other systems: See [direnv installation guide](https://direnv.net/docs/installation.html)
76-
77-
3. **Hook direnv into your shell**:
78-
- For zsh:
79-
```bash
80-
echo 'eval "$(direnv hook zsh)"' >> ~/.zshrc && source ~/.zshrc
81-
```
82-
- For bash:
83-
```bash
84-
echo 'eval "$(direnv hook bash)"' >> ~/.bashrc && source ~/.bashrc
85-
```
86-
- For fish:
87-
```bash
88-
echo 'direnv hook fish | source' >> ~/.config/fish/config.fish && source ~/.config/fish/config.fish
89-
```
90-
4. **Restart your shell**: Run `exec $SHELL` (or manually kill and re-open your terminal).
91-
92-
5. **Install Docker**: Required for the web server database
93-
94-
### Setup Steps
95-
96-
1. **Clone and navigate to the project**:
97-
98-
```bash
99-
git clone <repository-url>
100-
cd codebuff
101-
```
102-
103-
2. **Set up Infisical for secrets management**:
26+
```bash
27+
npm install -g codebuff
28+
cd your-project
29+
codebuff
30+
```
10431

105-
```bash
106-
npm install -g @infisical/cli
107-
infisical login
108-
```
32+
Then just tell Codebuff what you want and it handles the rest:
10933

110-
When prompted, select the "US" region, then verify setup:
34+
- "Fix the SQL injection vulnerability in user registration"
35+
- "Add rate limiting to all API endpoints"
36+
- "Refactor the database connection code for better performance"
11137

112-
```bash
113-
infisical secrets
114-
```
38+
Codebuff will find the right files, makes changes across your codebase, and runs tests to make sure nothing breaks.
11539

116-
3. **Configure direnv**:
40+
### Create custom agents
11741

118-
```bash
119-
direnv allow
120-
```
42+
You can create specialized agents for your workflows using TypeScript generators for more programmatic control.
12143

122-
This automatically manages your PATH and environment variables. The `.envrc` file is already committed to the repository and sets up the correct PATH to use the project's bundled version of Bun.
44+
For example, here's a `git-committer` agent that creates git commits based on the current git state. Notice that it runs `git diff` and `git log` to analyze changes, but then hands control over to the LLM to craft a meaningful commit messagea and perform the actual commit.
12345

124-
4. **Install dependencies**:
46+
```typescript
47+
export default {
48+
id: 'git-committer',
49+
displayName: 'Git Committer',
50+
model: 'openai/gpt-5-nano',
51+
toolNames: ['read_files', 'run_terminal_command', 'end_turn'],
12552

126-
```bash
127-
bun install
128-
```
53+
instructionsPrompt:
54+
'You create meaningful git commits by analyzing changes, reading relevant files for context, and crafting clear commit messages that explain the "why" behind changes.',
12955

130-
5. **Start the development services**:
56+
async *handleSteps() {
57+
// Analyze what changed
58+
yield { tool: 'run_terminal_command', command: 'git diff' }
59+
yield { tool: 'run_terminal_command', command: 'git log --oneline -5' }
13160

132-
**Terminal 1 - Backend server**:
61+
// Stage files and create commit with good message
62+
yield 'STEP_ALL'
63+
},
64+
}
65+
```
13366

134-
```bash
135-
bun run start-server
136-
```
67+
## SDK: Build custom AI coding tools
68+
69+
```typescript
70+
import { CodebuffClient } from 'codebuff'
71+
72+
// Initialize the client
73+
const client = new CodebuffClient({
74+
apiKey: 'your-api-key',
75+
cwd: '/path/to/your/project',
76+
onError: (error) => console.error('Codebuff error:', error.message),
77+
})
78+
79+
// Run a task, like adding error handling to all API endpoints
80+
const result = await client.run({
81+
prompt: 'Add comprehensive error handling to all API endpoints',
82+
agent: 'base',
83+
handleEvent: (event) => {
84+
console.log('Progress:', event)
85+
},
86+
})
87+
```
13788

138-
**Terminal 2 - Web server** (requires Docker):
89+
Learn more about the SDK [here](https://www.npmjs.com/package/@codebuff/sdk).
13990

140-
```bash
141-
bun run start-web
142-
```
91+
## Why choose Codebuff
14392

144-
**Terminal 3 - Client**:
93+
**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.
14594

146-
```bash
147-
bun run start-client
148-
```
95+
**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.
14996

150-
### Running Tests
97+
**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.
15198

152-
After direnv setup, you can run tests from any directory:
99+
## Get started
153100

154-
```bash
155-
bun test # Runs with secrets automatically
156-
bun test --watch # Watch mode
157-
bun test specific.test.ts # Run specific test file
158-
```
101+
### Install
159102

160-
## Troubleshooting
103+
**CLI**: `npm install -g codebuff`
161104

162-
### direnv Issues
105+
**SDK**: `npm install @codebuff/sdk`
163106

164-
If direnv isn't working:
107+
### Resources
165108

166-
1. Ensure it's properly hooked into your shell (see Prerequisites step 3)
167-
2. Run `direnv allow` in the project root
168-
3. Check that `.envrc` exists and has the correct content
169-
4. Restart your terminal if needed
109+
**Running Codebuff locally**: [local-development.md](./local-development.md)
170110

171-
## Licensing
111+
**Documentation**: [codebuff.com/docs](https://codebuff.com/docs)
172112

173-
1. NPM Package: The npm package contained in this project is licensed under the MIT License. See the LICENSE file in the npm package directory for details.
113+
**Community**: [Discord](https://codebuff.com/discord)
174114

175-
2. Other Project Components: All other parts of this project, including but not limited to server-side code and non-public client-side code, are proprietary and confidential. No license is granted for their use, modification, or distribution without explicit permission from the project owner.
115+
**Support**: [support@codebuff.com](mailto:support@codebuff.com)

assets/demo.gif

19.3 MB
Loading

assets/multi-agents.png

120 KB
Loading
Lines changed: 38 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,52 @@
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

5-
## Getting Started
5+
## Context Window Management
66

7-
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`
7+
### Why Agent Workflows?
118

12-
## File Structure
9+
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.
1310

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
11+
### The Solution: Focused Context Windows
1812

19-
## Agent Basics
13+
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.
2014

21-
Each agent file exports an `AgentDefinition` object with:
15+
### Why Not Just Mimic Human Roles?
2216

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
17+
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.
3018

31-
## Common Tools
19+
## Agent workflows in action
3220

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
21+
Here's an example of a `git-committer` agent that creates good commit messages:
4022

41-
See `types/tools.ts` for more information on each tool!
23+
```typescript
24+
export default {
25+
id: 'git-committer',
26+
displayName: 'Git Committer',
27+
model: 'openai/gpt-5-nano',
28+
toolNames: ['read_files', 'run_terminal_command', 'end_turn'],
4229

43-
## Need Help?
30+
instructionsPrompt:
31+
'You create meaningful git commits by analyzing changes, reading relevant files for context, and crafting clear commit messages that explain the "why" behind changes.',
4432

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)
33+
async *handleSteps() {
34+
// Analyze what changed
35+
yield { tool: 'run_terminal_command', command: 'git diff' }
36+
yield { tool: 'run_terminal_command', command: 'git log --oneline -5' }
4837

49-
Happy agent building! 🤖
38+
// Stage files and create commit with good message
39+
yield 'STEP_ALL'
40+
},
41+
}
42+
```
43+
44+
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)