github

CodebuffAI / codebuff

  • суббота, 13 сентября 2025 г. в 00:00:03
https://github.com/CodebuffAI/codebuff

Generate code from the terminal!



Codebuff

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 vs Claude Code

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.

Codebuff Demo

How it works

When you ask Codebuff to "add authentication to my API," it might invoke:

  1. A File Explorer Agent to scan your codebase to understand the architecture and find relevant files
  2. A Planner Agent to plan which files need changes and in what order
  3. An Editor Agent to make precise edits
  4. A Reviewer Agent to validate changes
Codebuff Multi-Agents

This multi-agent approach gives you better context understanding, more accurate edits, and fewer errors compared to single-model tools.

CLI: Install and start coding

Install:

npm install -g codebuff

Run:

cd your-project
codebuff

Then just tell Codebuff what you want and it handles the rest:

  • "Fix the SQL injection vulnerability in user registration"
  • "Add rate limiting to all API endpoints"
  • "Refactor the database connection code for better performance"

Codebuff will find the right files, makes changes across your codebase, and runs tests to make sure nothing breaks.

Create custom agents

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'
  },
}

SDK: Run agents in production

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.

Why choose Codebuff

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.

Contributing to Codebuff

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:

  • 🐛 Fix bugs or add features
  • 🤖 Create specialized agents and publish them to the Agent Store
  • 📚 Improve documentation or write tutorials
  • 💡 Share ideas in our GitHub Issues

Get started

Install

CLI: npm install -g codebuff

SDK: npm install @codebuff/sdk

Resources

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