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 build and plan modes

Installation Paths

PathCommandBest For
install script`curl -fsSL https://opencode.ai/installbash`
npmnpm i -g opencode-ai@latestNode-centric environments
Homebrewbrew install anomalyco/tap/opencodemacOS/Linux package-managed setup

First Run Checklist

  1. launch opencode
  2. confirm provider credentials are available
  3. run a simple repo analysis task
  4. switch between build and plan modes
  5. verify output and suggested edits are coherent

Early Failure Triage

SymptomLikely CauseFirst Fix
no model responsesmissing provider credentialsconfigure provider key and retry
unsafe command concernswrong agent mode for taskuse plan mode for analysis-first sessions
poor repo understandinginsufficient context scopeadd 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]