CodebuffAI / codebuff
- суббота, 13 сентября 2025 г. в 00:00:03
Generate code from the terminal!
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.
Codebuff beats Claude Code at 61% vs 53% on our evals across 175+ coding tasks over multiple open-source repos that simulate real-world tasks.
When you ask Codebuff to "add authentication to my API," it might invoke:
This multi-agent approach gives you better context understanding, more accurate edits, and fewer errors compared to single-model tools.
Install:
npm install -g codebuff
Run:
cd your-project
codebuff
Then just tell Codebuff what you want and it handles the rest:
Codebuff will find the right files, makes changes across your codebase, and runs tests to make sure nothing breaks.
To get started building your own agents, run:
codebuff init-agents
You can write agent definition files that give you maximum control over agent behavior.
Implement your workflows by specifying tools, which agents can be spawned, and prompts. We even have TypeScript generators for more programmatic control.
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 message and perform the actual commit.
export default {
id: 'git-committer',
displayName: 'Git Committer',
model: 'openai/gpt-5-nano',
toolNames: ['read_files', 'run_terminal_command', 'end_turn'],
instructionsPrompt:
'You create meaningful git commits by analyzing changes, reading relevant files for context, and crafting clear commit messages that explain the "why" behind changes.',
async *handleSteps() {
// Analyze what changed
yield { tool: 'run_terminal_command', command: 'git diff' }
yield { tool: 'run_terminal_command', command: 'git log --oneline -5' }
// Stage files and create commit with good message
yield 'STEP_ALL'
},
}
Install the SDK package -- note this is different than the CLI codebuff package.
npm install @codebuff/sdk
Import the client and run agents!
import { CodebuffClient } from '@codebuff/sdk'
// 1. Initialize the client
const client = new CodebuffClient({
apiKey: 'your-api-key',
cwd: '/path/to/your/project',
onError: (error) => console.error('Codebuff error:', error.message),
})
// 2. Do a coding task...
const result = await client.run({
agent: 'base', // Codebuff's base coding agent
prompt: 'Add comprehensive error handling to all API endpoints',
handleEvent: (event) => {
console.log('Progress', event)
},
})
// 3. Or, run a custom agent!
const myCustomAgent: AgentDefinition = {
id: 'greeter',
displayName: 'Greeter',
model: 'openai/gpt-5',
instructionsPrompt: 'Say hello!',
}
await client.run({
agent: 'greeter',
agentDefinitions: [myCustomAgent],
prompt: 'My name is Bob.',
customToolDefinitions: [], // Add custom tools too!
handleEvent: (event) => {
console.log('Progress', event)
},
})
Learn more about the SDK here.
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.
Any model on OpenRouter: Unlike Claude Code which locks you into Anthropic's models, Codebuff supports any model available on OpenRouter - 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.
Reuse any published agent: Compose existing published agents to get a leg up. Codebuff agents are the new MCP!
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.
We ❤️ contributions from the community - whether you're fixing bugs, tweaking our agents, or improving documentation.
Want to contribute? Check out our Contributing Guide to get started.
Some ways you can help:
CLI: npm install -g codebuff
SDK: npm install @codebuff/sdk
Documentation: codebuff.com/docs
Community: Discord - Join our friendly community
Issues & Ideas: GitHub Issues
Contributing: CONTRIBUTING.md - Start here to contribute!
Support: support@codebuff.com