The One-Command Fix: Debug Terminal Errors Without Copy-Pasting
TL;DR
- Run a failing command, capture its output, and have borg fix it with
borg "Fix this error: $(your-command 2>&1)".- borg is a single static Go binary, install it with one curl command and no runtime dependencies.
- After
borg learnstudies your repo, it can propose fixes or edit files directly, all within your terminal.
To fix a terminal error without copy-pasting across windows, run the error output directly as a borg task: borg "Fix this error: $(your-command 2>&1)". borg reads the error in the one-shot prompt, investigates your repository, and offers a fix or applies it to the code. This is the workflow we use on our own development boxes every day, and borg is the tool we built to handle it.
how do i use an ai agent to fix terminal errors without copy-pasting
You pass the command's stderr and stdout right into borg's prompt with a $() substitution. First, let borg learn your project by running borg learn once in the repository root; that creates a BORG.md file summarizing the codebase. Then, whenever a test fails, run:
borg "fix the failing test: $(npm test 2>&1)"
The 2>&1 redirects stderr, so the full failure message becomes part of the task. borg reads the error, cross-references the project context, and writes the fix, all without a browser window. borg is a single static Go binary, so there is no runtime to manage. Install it with:
curl -fsSL https://turborg.com/install.sh | sh
how to use an ai coding agent in the terminal
Start by installing borg, then log in if you want to use hosted models (borg auth login; add --device on a headless server). borg offers three interaction modes:
- REPL:
borgalone starts a session in the current directory. - One-shot:
borg "implement a health-check endpoint"runs a task and exits. - Resume:
borg --resumecontinues the most recent session.
You can bring your own model via Ollama, LM Studio, OpenAI, or OpenRouter, or pick from the 4 hosted models (Chuppa Flash, Chuppa Pro, Floko, Axiom). Configuration lives in ~/.config/borg/ and customisation uses BORG_* environment variables. As a single Go binary, borg works on any Linux, macOS, or Windows WSL machine without extra langauge runtimes.
can an ai agent fix my build errors automatically
Yes. Feed the build failure into a one-shot task and borg will analyse the source and apply changes. For example:
borg "fix this build error: $(make 2>&1)"
Because borg runs as an agent, not a static suggestion engine, it can recompile, read the new output, and iterate until the build passes, all inside one session. You can also chain commands for after the fix:
borg "verify the build now passes after your changes"
No copy-paste, no juggling windows. This works equally well for failing GitHub Actions logs, local compilation, or misbehaving unit-test suites.
borg ai agent tutorial
- Install:
curl -fsSL https://turborg.com/install.sh | sh. The binary installs asborg(it also aliases toturborg). - Authenticate (optional):
borg auth loginsigns you into the hosted model gateway; without it, borg uses any model key you set viaBORG_API_KEY. - Navigate:
cd your-project. - Learn the repo:
borg learn. This walks the codebase, writesBORG.mdwith key files and patterns, and gives all future tasks project-specific context. - Debug: run the error capture pattern:
borg "fix the failing test: $(pytest 2>&1)". borg reads the traceback, locates the relevant source, and edits it. - Resume: if you need to refine the fix, use
borg --resumeto continue the conversation.
how to pipe command output to an ai agent
borg’s one-shot prompt is a single string argument, so you embed output with command substitution. The canonical pattern is:
borg "resolve this error: $(your-command 2>&1)"
The $(your-command 2>&1) captures stdout and stderr inline, sending the full error text to the agent without any manual copy-paste. For repeated use, define a shell alias. In bash:
alias bfix='borg "Fix the error: $(eval "$@" 2>&1)"'
Then run bfix npm run build or bfix go test ./.... The alias passes the command’s output as part of the task string. borg then investigates the codebase, proposes the fix, and applies it directly, all within your terminal.
Frequently asked questions
Do I need an API key to use borg?
If you use a hosted model via borg auth login, no local key needed; the session handles billing. If you bring your own model (Ollama, OpenAI, etc.), set the corresponding BORG_API_KEY environment variable.
What models does borg support?
Borg ships with 4 hosted models (Chuppa Flash, Chuppa Pro, Floko, Axiom) optimised for coding tasks. You can also use any OpenAI-compatible provider, including Ollama for local models.
Can borg learn my project before debugging?
Yes. Run borg learn in the repository root. borg examines the codebase, dependencies, and structure, then writes a BORG.md file. Subsequent one-shot tasks reference this context to give more accurate fixes.