AI in the Terminal: An Agent That Runs Commands and Fixes Errors Itself
How an AI agent works right in the terminal — runs code, builds a project, runs tests, and fixes errors itself in a loop, with confirmation for risky commands. Using the Doka desktop agent as the example.
Most assistants can write a command but not run it — you're the one copying it into the terminal. An agent with terminal access removes that gap: it runs commands itself, sees the output, and reacts to it. That changes what working with it feels like.
What this gets you
The classic example is a loop that used to be manual. The agent runs code, sees an error in the output, fixes the relevant file, and runs it again — and keeps going until it works. You're not shuttling between the model and the console at every step.
This is useful for more than debugging:
- Running scripts —
python script.py,node index.js, building a project. - Tests and builds —
npm run build,make, running tests and seeing what broke. - Working with git — history, diffs, commits.
- Any CLI tool already installed on the system.
How this works in Doka
Doka has a run_shell tool — it runs commands in the system shell (sh on
macOS, cmd.exe on Windows) right inside your working folder. The model decides on
its own when a command is needed and calls it, then factors the result into the next
step immediately.
This pairs with a local model: the model thinks, and the terminal gives it hands.
About safety
Running someone else's commands on your machine is a serious thing, and Doka treats
it that way. run_shell is marked as a risky tool: every call shows you the
command first and waits for confirmation. You can allow it once, or for the whole
session. Nothing runs until you click "allow."
The same principle applies to deleting files and to the browser. The agent can suggest actions on its own, but it only takes risky steps with your explicit approval.
Why it matters that this is local
The terminal is access to your system, and doing that through someone else's cloud would be strange. Doka runs commands on your machine, under your identity, in the folder you chose. Nothing goes elsewhere, and you can always see exactly what the agent is about to do.
Worth trying if
...you keep repeating the same "ran it — it failed — fixed it — ran it again" loop. That's exactly what an agent takes off your hands. Download Doka for free, and for how it's built overall, see the article on the desktop AI agent.