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:
Basic Usage
Start using Codebuff in your project directory:
You can also start Codebuff with different cost/quality modes:
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
--max: Use higher quality models & fetch more files for more comprehensive responses: o1 for deep thinking, 3.5 Sonnet for picking files (also accepts --pro or --o1)
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, and o1 for deep thinking.
Codebuff also uses GPT-4o-mini as a fallback to rewrite files with an intended edit (using their fancy Predicted Outputs API), and GPT-4o to decided whether to read more files.
We have two new modes, which slightly changes the models we use:
--max: uses o1 for thinking through hard problems. Uses Sonnet for searching for files instead of the default Haiku, meaning it gets better context on your codebase.
--lite: uses Deepseek V3 for editing instead of Sonnet (1/20 the cost). It also pulls fewer files, meaning that the context cost will be much smaller.
You can use codebuff --max or codebuff --lite to set the mode 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 and GPT-4o-mini's lets us efficiently patch the code changes through.
Frequently Asked Questions
Do you store my data?
We don't store your codebase. Mostly our server is a thin client that passes data along to OpenAI and Anthropic. We store logs of your chats temporarily to help us debug. We also store portions of your chat history in our database. Soon, we plan to support a Privacy Mode where no data at all is stored.
Can I specify custom instructions for Codebuff?
Yes! We recommend you create knowledge.md files to give Codebuff more context about your codebase, like you're introducing it to another engineer. All file names ending in knowledge.md are loaded into context automatically, and you can use the files to do your own prompt engineering for Codebuff.
If you do not have a knowledge.md file, Codebuff typically will not create one, but it will update existing knowledge.md files autonomously. The Codebuff codebase currently has a knowledge.md in almost every directory.
Can I tell Codebuff to ignore certain files?
Codebuff by default will not read files that are specified in your .gitignore. You can also create a '.codebuffignore' file to specify additional files or folders to ignore.
Why is Codebuff so expensive?
We realize it costs a bit more than alternatives, but in exchange, Codebuff does more LLM calls using more examples from your codebase, leading to better code edits.