Refer a friend, and earn 500 credits per month for both of you! Learn more

Codebuff LogoCodebuff

Getting Started with Codebuff

Welcome to Codebuff! This guide will help you get up and running quickly with our AI-powered coding assistant.

Installation

Install Codebuff globally using npm:

bash
npm install -g codebuff

Basic Usage

Start using Codebuff in your project directory:

bash
codebuff

You can also start Codebuff with different cost/quality modes:

bash

codebuff --lite # Budget mode for econonmical responses

codebuff --pro # Premium mode for higher quality responses

That's it! Codebuff is now ready to help you with your coding tasks.

Shortcuts

Special commands to get the most out of Codebuff

  • login to log into Codebuff
  • undo or u: Undo last change
  • redo or r : Redo change
  • diff or d to show changes from last assistant response
  • ESC or Ctrl/Cmd + C to stop generation

Command Line Flags

When starting Codebuff, you can use these flags to control the cost/quality tradeoff:

  • --lite: Use budget models & fetch fewer files for more economical responses
  • --pro: Use higher quality models and fetch more files for more comprehensive responses

Terminal commands

  • Enter terminal commands directly, like cd backend or npm test
  • /run <command>: run long terminal commands

What models do you use?

We primarily use Claude 3.5 Sonnet for the coding, and Claude 3.5 Haiku to find relevant files.

Codebuff also uses GPT-4o-mini as a fallback to rewrite files with an intended edit (using their fancy Predicted Outputs API).

We have two new modes, which slightly changes the models we use:

  • --pro: uses Sonnet for searching for files instead of Haiku, meaning it gets better context on your codebase. It also gets more files. It uses gpt4o instead gpt4o-mini to decide whether more files are needed.
  • --lite: uses Haiku for editing instead of Sonnet (1/3 cost). It also pulls way fewer files, meaning that the context cost will be much smaller

You can use --pro or --lite to switch between the two models at startup time!

How does Codebuff actually work?

Codebuff starts by running through the source files in that directory and subdirectories and parsing out all the function and class names (or equivalents in 11 languages) with the tree-sitter library.

Then, it fires off a request to Claude Haiku 3.5 to cache this codebase context so user inputs can be responded to with lower latency (Prompt caching is OP!).

We have a stateless server that passes messages along to Anthropic or OpenAI and websockets to ferry data back and forth to clients. It effectively acts as a proxy between the client and our LLM providers.

Claude 3.5 Haiku picks the relevant files, and we load them into context and Claude 3.5 Sonnet responds with the right edit.

We also use a combination of Claude 3.5 Sonnet and GPT-4o-mini to rewrite files with an intended edit – combining Sonnet's string replace tool and GPT-4o-mini's Predicted Outputs API lets us efficiently patch the code changes through.

Help & FAQ