Borg: The One-Command AI Agent That Edits Your Code Right in the Terminal
TL;DR
- Borg is a single static Go binary you install with one curl command and run in any terminal.
- Give it a one-shot task like
borg "fix the failing test"and it reads, edits, and verifies your code right on disk.- You control the model: bring your own API key or use the four hosted models (Chuppa Flash, Chuppa Pro, Floko, Axiom).
To fix code directly in your terminal, run borg with a plain English instruction. Borg is a terminal AI agent that edits your local files. It reads the relevant source, applies the change, and optionally runs your test suite to verify the fix, all without opening a browser or IDE. We build and operate xShellz: the borg terminal agent, the Agent Shell boxes, and the hosted model gateway behind them. This is the setup we run in production ourselves.
how do i use an ai agent to fix code directly in my terminal?
Point borg at your project and describe what you need. For a one-shot fix, run borg "fix the failing test" from the repository root. Borg inspects your code, finds the offending test and the source, and applies the change. There is no chat UI, no copy-paste round trip. It writes the edit to the file on disk and reports what changed. Check the diff with git diff and commit when satisfied. The same command works for any bug: a null pointer, a misnamed variable, a missing import. Borg handles the scutwork while you stay in the terminal.
what is borg and how do i run it in my terminal?
Borg is a CLI AI coding agent, a single Go binary with no runtime dependencies. Install it with one command:
curl -fsSL https://turborg.com/install.sh | sh
That puts borg and turborg (the same binary) on your path. Then launch it from any directory:
borg # interactive REPL in the current project
borg "task" # one-shot agent, runs the task and exits
Configuration lives in ~/.config/borg/ and environment variables are prefixed BORG_. You can bring your own model through Ollama, LM Studio, OpenAI, or OpenRouter, or log into the hosted xShellz models with borg auth login. Borg works identically either way.
how do i tell borg to fix a specific bug in one of my files?
Be as specific as you would with a human. Borg understands natural language and file paths:
borg "fix the null pointer on line 42 of parser.go"
brog "resolve the import cycle in handlers/auth.go"
It reads only the files it needs, applies the change, and shows you the diff before returning control. If the fix needs to touch multiple files, borg will cross-reference them. There is no hidden chat loop. It does the work and hands you back your terminal.
can borg actually edit my code or does it just suggest changes?
Borg writes the edit directly to the file. It does not output a patch you have to apply by hand. Once the command finishes, the fix sits in your working tree. You can inspect it with git diff, run the test suite again, and commit if everything is green. If you prefer a safety net, commit before invoking borg so you can git checkout to undo anything. There is no magic; borg modifies the same files any editor would.
how do i make sure borg doesn't break my build while fixing things?
Include the test command in your instruction:
borg "fix the failing test and then run 'go test ./...' to confirm"
Borg will not only apply the fix but also validate it against your build pipeline. If the tests fail, it can iterate on the patch automatically or stop and let you inspect. Commit your working state before the task, and you get a clean rollback point. Borg respects your existing tooling; it just automates the edit-test loop you would run by hand.
Frequently asked questions
Can I use my own AI model with borg?
Yes. Point borg at any OpenAI-compatible API or a local model running in Ollama or LM Studio by setting BORG_API_BASE and BORG_API_KEY. You keep full control over your model, your data, and your API cost.
Do I need to pay to use borg?
The borg CLI is free and open source. When you bring your own model you pay only your provider. The hosted xShellz models (Chuppa Flash, Chuppa Pro, Floko, Axiom) require an account; see the pricing page for plan details.
How does borg compare to other terminal AI agents?
Borg is a single static Go binary with zero runtime dependencies, which makes it trivial to install. It can run as a one-shot command or a REPL. On the Agent Shell it is one of six preinstalled coding agents, purpose-built for fast, surgical edits directly in your local filesystem without extra tooling.