What is OpenCode?
OpenCode is an open-source AI coding agent built by the team at SST. It runs in your terminal with a text-based user interface (TUI), reads your codebase, proposes edits, runs shell commands, and works in an agentic loop where you approve what it does. The project lives at github.com/sst/opencode, with docs at opencode.ai.
Two design choices define it. First, it is model-agnostic: you point it at whichever model provider you already use, or at a local model through a compatible endpoint, rather than being locked to one vendor. Second, it is session-based: each run is a conversation tied to your project folder, so the agent works with real files and real context instead of pasted snippets.
How terminal coding agents differ from chat
If you have only used an AI chat window, the workflow is: copy code in, get an answer, paste it back. A terminal coding agent removes that loop. It can open your files directly, search the codebase, write changes to disk, and run commands like tests or builds to check its own work.
That shift matters because the agent stops being a Q&A box and starts acting like a junior pair programmer sitting at your machine. It also means the stakes are higher: the tool can modify files and execute commands, so understanding its approval and permission flow is part of learning to use it well.
Installing and starting your first session
The safest starting point is the official sources: follow the install instructions on opencode.ai or the GitHub repository rather than third-party scripts. After installing, you configure at least one model provider, typically by setting an API key as an environment variable or in the tool's configuration.
To start a session, open a terminal, navigate into a project folder, and launch OpenCode there. The agent treats that folder as its workspace, so pick a project you know well. A good habit is to make sure your project is under version control first, so every change the agent makes can be reviewed and reverted with `git diff` and `git checkout`.
Safe first tasks to try
Start with read-only or low-risk work so you can judge the agent's output without pressure. Ask it to explain how a module works, trace where a function is called, or summarize an unfamiliar part of the codebase. This shows you how well it reads your project before it ever touches a file.
Next, graduate to small writing tasks: adding unit tests for a function, renaming a confusing variable, or extracting a repeated block into a helper. Keep each request narrow, and review every diff before accepting it. If a change looks wrong, reject it, rephrase the request, or simply revert with git — you are always the final reviewer.
Permissions and approvals
OpenCode works in an agentic loop, but you stay in control through approvals. When the agent wants to edit a file or run a shell command, it asks for your permission, and you can allow or deny each action. Treat these prompts seriously instead of rubber-stamping them.
Two rules keep beginners safe. Run the agent only in folders you are comfortable changing, ideally clean git working trees. And read shell commands before approving them — a command you do not understand is a command you should deny and ask the agent to explain first.
Choosing a model, including local ones
Because OpenCode is model-agnostic, you can connect it to hosted providers with an API key or to a local model served through a compatible endpoint. Hosted frontier models generally give the strongest coding results, while local models offer privacy and no per-token cost at the price of weaker output and more setup.
A practical beginner path is to start with a hosted provider you already have access to, learn the tool's workflow, and then experiment with a local model later for sensitive codebases. Whichever you choose, test the setup on a trivial task first so you know the connection works before real work depends on it.
OpenCode vs a full harness like OpenClaw
OpenCode is a coding agent in your terminal: it excels at reading, editing, and testing code in one project at a time, with you supervising. A harness-style runner such as OpenClaw is a different category — a general agent control plane that orchestrates agents across channels, schedules, and tools, not just code edits in a shell.
If your goal is "help me write and maintain code in this repo," OpenCode is the right-sized tool. If your goal is "run an always-on agent that handles messages, workflows, and many tools autonomously," that is harness territory. Many practitioners use both: a terminal coding agent for development work and a harness for broader automation.
Where to go next
The best way to learn OpenCode is to install it, run it in a small project, and try the safe first tasks above. Keep the official docs at opencode.ai and the GitHub repository bookmarked for setup details and updates.
If you are new to the idea of agent harnesses in general, read our explainer at /blog/what-is-agent-harness/ to see where terminal coding agents fit in the bigger picture. When you are ready to compare tools, browse /discover/ for more open-source agent projects and guides.
Ready to see the full catalog?
Browse all 68 agent-ready business kits. Each includes pre-configured agent roles, prompts, workflows, install steps, and approval gates.
Shop all business kits