OpenCode: the open-source agent that runs on the command line
Have you ever tried to automate a piece of the terminal and watched the agent freeze, ask for permission on every command, or use the wrong model? OpenCode is an open-source agent that runs on the command line and aims to solve exactly that. But running the project is not the same as producing with it: to take advantage of the tool, you need habits. Here is a list of five tips.
The biggest AI newsletter in the World
Get AI articles in your inbox
Technical curation on models, agents and coding tools. No spam, unsubscribe anytime.
In the introduction, you will see how to install OpenCode with a single command or via a package manager, how to separate tasks, how to use the right agents, and how to retain security. The material is the project's own repository, with the latest version confirmed. See how Antigravity integrates with the terminal in VS Code
In this article you will see:
How to install OpenCode with a single command or via a package manager
How to choose the right agent for each task
How to break a large job into smaller parts
How to retain security and permissions
How to keep the workflow up to date
The problem: command-line agents overdo convenience
Terminal automation promises to render repetitive tasks fast. In practice, it is common for the agent to run a wrong command, ask for permission on every action, or get stuck on a default model. The cost is not just time: it is the anxiety of running the wrong command.
The solution is not to switch tools every project. It is to use an open-source agent with its own account, installed in a predictable way, and create rules for how it should behave.
How OpenCode helps
OpenCode is distributed via npm in the @opencode/cli package and has installation via brew, pacman, and Nix. The open repository (anomalyco/opencode) maintains the code and releases. Whoever installs it can run the agent in their own terminal, with the model it already uses.
Imagem: GitHub / OpenCode
The advantage is that the agent is not a closed block: it has predefined agents, permissions, and a workflow that can be adapted to your project. This is especially useful for those who have already run CLI agents and want to maintain consistency.
5 tips for using OpenCode in your workflow
1. Start with the plan agent to explore unfamiliar code
OpenCode includes predefined agents. The plan agent is the reader: it doesn't make file edits by default, asks for permission before running bash commands, and is ideal for navigating a repository you don't know. Use it to map things out without jumping straight into code. Editing comes later, with more context.
2. Break a large task into smaller pieces
Code agents work best when the goal is clear. Instead of sending one giant task, plan the outcome in steps and send them one at a time. OpenCode includes general subagents for searches and multi-step work; use them to gather information before editing. A practical example is comparing the workflow with Codex CLI: both run in the terminal, but each has its own way of fitting in. See how to use Codex CLI in your workflow
3. Reinforce permissions before running commands
The agent with full access can change files or run commands without checking. OpenCode asks for permission for bash commands and denies edits in certain agents by default. Configure project permissions before letting the agent run on its own, and review the action history weekly.
4. Install the recommended version of your package manager
To keep consistency across projects, install the recommended version. The simplest way is: npm i -g @opencode/cli@latest (or with bun/pnpm/yarn). For macOS and Linux, brew install anomalyco/tap/opencode-v2 is recommended. Avoid installing very old versions to prevent compatibility issues.
5. Verify commands before trusting the agent
OpenCode can get screenshots, file planning, or command names wrong. Tip: always answer the permission prompt carefully and validate the output after execution. The repository has an installation and documentation section with the commands and expected flow, read it before sending a voluntary task. For a playbook on testing an agent before trusting it, the post compares the cloud model testing method.
Frequently asked questions about OpenCode
What is OpenCode?
It's an open-source code agent that runs on the command line, with code in the anomalyco/opencode repository and distribution via npm, brew, pacman, and Nix. It includes predefined agents and a workflow that adapts to the project.
What's the difference between OpenCode agents?
The project includes predefined agents: plan (read-only, no edits and no bash command permission by default) and exec, with full access. There's also a general subagent for searches and multi-step tasks. Choose based on the task risk.
How to install OpenCode?
The current methods from the README itself are: npm i -g @opencode/cli@latest (or with bun/pnpm/yarn), brew install anomalyco/tap/opencode-v2 (macOS and Linux, recommended), sudo pacman -S opencode (Arch), nix run github:anomalyco/opencode. The npm package appears in the repository as @opencode/cli.
Is OpenCode open source?
Yes, with an MIT license. The code is on GitHub in the anomalyco/opencode repository.
Frequently asked questions about OpenCode
What is OpenCode?
+
It is an open-source agent that runs on the command line, with code in the anomalyco/opencode repository and distribution via npm, brew, pacman, and Nix. It includes predefined agents and a workflow that adapts to the project.
What is the difference between OpenCode agents?
+
The project includes predefined agents: the plan agent (read-only, no editing, and no permission for bash commands by default) and the exec agent, with full access. There is also a general subagent for searches and multiple tasks. Choose based on the task risk.
How to install OpenCode?
+
The current methods from the README itself are: npm i -g @opencode/cli@latest (or with bun/pnpm/yarn), brew install anomalyco/tap/opencode-v2 (macOS and Linux, recommended), sudo pacman -S opencode (Arch), nix run github:anomalyco/opencode. The npm package appears in the repository as @opencode/cli.
Is OpenCode open source?
+
Yes, with the MIT license. The code is on GitHub in the anomalyco/opencode repository, and installation is available via brew, npm, and other package managers.
What changes for developers using agents today
The pattern is shifting: the agent is no longer a button to click, but a process running in the terminal, with permissions, agents, and updates. OpenCode is an example of this: an open agent, running from scratch, without depending on a closed UI. This lets you decide the model, the agents, and the rules for each project.
For those already running CLI, the learning curve is smaller. For those just starting, the recommendation is very specific: install the recommended version, try the plan agent on a repository you know, then expand to more critical tasks. The deliverable isn't "run the agent", it's running it predictably.
To apply these tips with multiple agents, put OpenCode and other AI agents to work in parallel, each in its own isolated space. Build your squad on bridgecode.
Developer and creator of bridgecode, an agentic development environment for orchestrating squads of AI agents. Helps people going from vibe coding to professional development move from idea to shipped product.