OpenCode

OpenCode

The open coding agent for your terminal.

Agent · Skill · Plugin · MCP · Security

Definition

What is OpenCode?

Open coding agent

A terminal-based assistant that reads your repository, reasons about tasks, proposes plans, edits files, and runs commands — while keeping you in control of every consequential action.

It is not just autocomplete or a chatbot. It is a loop of observation, reasoning, action, and verification.

Mental model

The OpenCode loop

01

Understand

Parse the request and repository context.

02

Plan

Decide which files and tools to use.

03

Act

Edit files and run approved commands.

04

Verify

Run tests and explain the changes.

Each pass through the loop improves context and reduces uncertainty.

Compare

Autocomplete vs Chat vs Agent

Tool typeWhat it doesScope
AutocompletePredicts the next few tokens of codeSingle cursor location
ChatAnswers questions and explains codeConversation
AgentPlans, edits, runs commands, and verifiesWhole task across files

Agents are distinguished by tool use and iteration, not just model size.

Compare

Closed assistant vs OpenCode

DimensionClosed assistantOpenCode
Model choiceVendor-controlledYou choose the provider and model
EnvironmentWeb or IDE pluginTerminal-native, runs in your workspace
ExtensibilityLimited or closedPlugins, skills, and MCP servers
PrivacyCloud-only, opaqueCan use local or self-hosted models
ControlHidden defaultsExplicit permissions and project rules
01

The Agent

How OpenCode behaves as an autonomous worker inside your codebase.

Agent

What the agent does

Explore
Reads repository structure, relevant files, tests, and error output to build context.
Reason
Selects a plan, chooses tools, and decides which files to modify or commands to run.
Execute
Applies edits, runs tests, and reports results — only after approval when configured.
Explain
Summarizes what changed, why it changed, and what remains uncertain.
Agent

Subagents

Go @api-builder

Writes and reviews Go API services — handlers, validation, and tests.

> @api-builder add a POST
  /users handler with tests
.opencode/agents/api-builder.md
Frontend @ui-slicer

Builds and refactors Next.js pages, components, and API routes.

> @ui-slicer build a
  dashboard server component
.opencode/agents/ui-slicer.md
Mobile @widget-drawer

Creates Flutter screens and widgets with state and error handling.

> @widget-drawer add a
  projects list screen
.opencode/agents/widget-drawer.md

Define your own in .opencode/agents/<name>.md with mode: subagent, then summon with an @ mention.

Agent

ui-slicer.md

.opencode/agents/ui-slicer.md
---
description: Builds and refactors Next.js pages, components, and API routes
mode: subagent
permission:
  edit: allow
  bash: deny
---

You are a Next.js frontend specialist.
- Slice designs into reusable components
- Follow the existing folder structure
- Keep Server Components server-side
- Confirm before installing new packages

The file name becomes the agent name — summon it with @ui-slicer.

02

Skill

Reusable process knowledge encoded as instructions.

Skill

What is a skill?

Reusable workflow instruction

A skill tells the agent how to perform a repeatable task: what to check, what to avoid, and how to report results. It encodes team taste as process.

  • Release-check: inspect branch, run checks, summarize risks
  • Code-review: find risks without editing files
  • Migration-check: verify patterns before applying changes
03

Plugin

Executable extensions that change behavior and add capabilities.

Plugin

What is a plugin?

Behavior extension

A plugin hooks into OpenCode to add new commands, customize output, enforce rules, or integrate with internal systems. It changes what the agent can do.

  • Custom lint or format enforcement
  • Team-specific verification steps
  • Hook into CI/CD or documentation pipelines
04

MCP

A standard bridge to external tools and data sources.

MCP

What is MCP?

Model Context Protocol server

An MCP server exposes a typed, discoverable capability to the agent. It lets OpenCode query or act on external systems without hard-coding integrations.

01

User request

02

OpenCode

03

MCP server

04

External system

issue tracker, docs, API

Compare

Skill vs Plugin vs MCP

ConceptWhat it isChanges
SkillInstruction template for a repeatable workflowHow the agent thinks
PluginCode that extends OpenCode itselfWhat the agent can do locally
MCPExternal capability served over a protocolWhich external systems it can reach

Use skills for process, plugins for local behavior, and MCP for external integrations.

05

Security

Capability without boundaries becomes liability.

Security

Permission is a design decision

Read by default

Inspecting files and explaining behavior should require no special trust.

Ask before edit

File changes and consequential commands need explicit approval.

Stop on secrets

Never expose keys, tokens, or credentials to the model or external tools.

Workspace boundary

The agent should not escape the project directory without permission.

Security

Risk by capability

Read files
Inspect code, structure, and history
LOW
Edit files
Modify source, configuration, or tests
MEDIUM
Run shell commands
Execute tests, builds, or scripts
MEDIUM
External system access
MCP servers, APIs, issue trackers
HIGH
Production actions
Deploy, migrate data, or change infrastructure
HUMAN
Operating pattern

A safe default workflow

01

Start read-only

Ask the agent to inspect and explain before it changes anything.

02

Limit scope

Point to specific files, tests, or errors. Smaller context is safer context.

03

Require proof

Every change must be accompanied by a diff, a test, and an explanation.

Trust is built by verifying the work, not by disabling safeguards.

Summary

OpenCode

An open agent loop you can extend and constrain.

AGENT

Loop

Understand, plan, act, verify.

SKILL

Process

Reusable instructions.

PLUGIN

Behavior

Local extensibility.

MCP

Bridge

External capability.