How to control an AI that reads and fixes code in your terminal
Open a terminal window and run opencode to watch an AI analyze your project structure and modify files in real time. When exploring an unfamiliar codebase or planning changes, you can review and approve which files the AI reads and how it modifies them. This tool is open source and allows developers to directly configure how they collaborate with AI in a terminal environment.
Two agents for different task types
The tool provides two built-in agents that you can switch between using the Tab key. The default 'build' agent is a development mode with full permissions for file modifications and command execution. In contrast, the 'plan' agent operates in read-only mode, refusing file edits and requiring user permission before executing any bash commands. This mode is useful for preventing mistakes when exploring unfamiliar codebases or planning changes. It also includes a 'general' subagent internally for handling complex searches or multi-step tasks, which you can invoke directly by typing @general in a message.
Installation paths and desktop app
To install directly from the terminal, run the curl -fsSL https://opencode.ai/v2/install | bash command. You can customize the installation path via the $OPENCODE_INSTALL_DIR environment variable; if not specified, it installs to a default path like $HOME/.opencode/bin. It is recommended to remove any remaining 0.1.x versions before installing. A desktop app is also available in beta, with installers for macOS, Windows, and Linux downloadable from the official site.
Things to know before using it
This tool is an open-source project that evolves through community contributions. The desktop app is still in beta, so stability is not fully guaranteed. As a terminal-based tool, managing permissions for bash commands and file modifications executed by the AI is important; using 'plan' mode to review sensitive operations beforehand is safer. If you create derivative works with 'opencode' in the project name, regulations require stating in the README that it is unrelated to the official team, so be mindful of this. It is advisable to adjust settings by referring to the official documentation and contribution guidelines, and to check for the latest information via the community Discord or X.com.