Chapter 1: Getting Started
April 13, 2026 ยท View on GitHub
Welcome to Chapter 1: Getting Started. In this part of OpenCode Tutorial: Open-Source Terminal Coding Agent at Scale, you will build an intuitive mental model first, then move into concrete implementation details and practical production tradeoffs.
This chapter gets OpenCode running and establishes a clean baseline for deeper customization.
Learning Goals
- install OpenCode using your preferred package path
- validate local model/provider connectivity
- run first tasks in terminal agent mode
- understand the difference between
buildandplanmodes
Installation Paths
| Path | Command | Best For |
|---|---|---|
| install script | `curl -fsSL https://opencode.ai/install | bash` |
| npm | npm i -g opencode-ai@latest | Node-centric environments |
| Homebrew | brew install anomalyco/tap/opencode | macOS/Linux package-managed setup |
First Run Checklist
- launch
opencode - confirm provider credentials are available
- run a simple repo analysis task
- switch between
buildandplanmodes - verify output and suggested edits are coherent
Early Failure Triage
| Symptom | Likely Cause | First Fix |
|---|---|---|
| no model responses | missing provider credentials | configure provider key and retry |
| unsafe command concerns | wrong agent mode for task | use plan mode for analysis-first sessions |
| poor repo understanding | insufficient context scope | add clearer task framing and target files |
Source References
Summary
You now have OpenCode installed and validated for day-to-day terminal workflows.
Next: Chapter 2: Architecture and Agent Loop
How These Components Connect
flowchart LR
A[opencode CLI] --> B{Mode}
B -->|build| C[Agent Loop]
B -->|plan| D[Analysis Only]
C --> E[File Tools]
C --> F[Shell Tools]
C --> G[Model Provider]
G --> H[Response / Patch]