Overview
This series explains how OpenCode turns a model into a project-scoped coding agent: Location supplies scope, Session preserves admitted work and history, and the runner coordinates provider turns and typed tools. It follows context, model, permission, client, and extension boundaries before evaluating trust, recovery, and deployment limits. The repository includes a broad legacy path and an evolving V2 core, so behavior varies by runtime surface.
Learning outcomes
- The repository presents OpenCode as a project-scoped orchestration runtime, not merely a chat interface or model client.
- One coding task can span provider turns because the Session persists input, tool results, history, and continuation state.
- Context sources, model adapters, tools, and extensions add capability through separate boundaries rather than one prompt.
- Permissions make managed actions legible, but they do not sandbox host access; V2 coverage and crash recovery remain bounded.
Keywords
Preview every chapter · Unlock full text, audio, and video from chapter 4
PlansFAQ
What is OpenCode, and how does it differ from a chatbot?
OpenCode is a local, open-source coding-agent runtime that coordinates project scope, sessions, models, context, tools, permissions, and clients around repository work; a chatbot mainly exchanges messages with a model.
How does OpenCode turn a prompt into repository work?
OpenCode associates the prompt with a project Location and Session, selects an agent and model, authorizes typed tool calls, records results, and continues with later provider turns when needed.
What does OpenCode preserve when a coding task runs long?
OpenCode preserves admitted input, durable events, projected history, and completed tool results; compaction creates a smaller active context, but process-local execution and ambiguous external side effects are not guaranteed to recover after a crash.
Do OpenCode permissions provide a security sandbox?
No. OpenCode permissions can allow, ask, or deny managed actions, but shell commands retain host-user filesystem, process, and network authority; true isolation requires a container or virtual machine.