explainx.ainewsletter3.5k
TrendingNewsPathwaysSkills
Pricing
explainx.ai

Upskill in AI — 16 free pathways, live workshops & bootcamps, and 50+ courses from practitioners. Plus the skills, tools, and MCP servers to practice on.

follow us

custom AI agents

[email protected]

get started

Find your pathTake Free Evaluation

learn

pathways — start freeworkshopsbootcampscoursescertificationsmock testsexplainx universitycorporate traininglearn skills & mcp

discover

skillsmcp serversexplainx mcptoolsagentsllmsdesignsagi trackerranks

company

aboutvisionmissionteaminstructorscommunityhackathonscareers

content

daily AI newsstate of AI — live resultsblogreleasespromptsgeneratorsresource librarydemofor LLMs

solutions

all solutionsdeveloper upskillingmarketing upskillingproduct manager upskillingleadership upskilling

More from us

InfloqInfluencer marketingBgBlurPrivacy-first blurOlly SocialSocial AI copilotCeptoryVideo intelligenceBgRemoverBackground removal

newsletter · weekly

Get AI news, tools, and insights in your inbox.

supportprivacytermsdata rightssubmission guidelines

© 2026 AISOLO Technologies Pvt Ltd

On this page

  • TL;DR
  • What OpenCode actually is
  • Install
  • First session: connect, init, build
  • Standout features
  • Running GLM-5.2 on OpenCode
  • Custom commands and MCP
  • Privacy and data
  • OpenCode vs other harnesses
  • Loop engineering on OpenCode
  • Recommended path (June 2026)
  • Configuration: opencode.json
  • Summary
  • Related Reading
← Back to blog

explainx / blog

OpenCode: The Open Source AI Coding Agent for Terminal, Desktop, and IDE (2026)

OpenCode is an open source coding agent with 160K GitHub stars — terminal TUI, desktop app, 75+ LLM providers, LSP, multi-session agents, and privacy-first design. Complete setup guide and harness comparison.

Jun 19, 2026·6 min read·Yash Thakker
OpenCodeAgent HarnessAI CodingTerminal AgentsOpen Source
go deep
OpenCode: The Open Source AI Coding Agent for Terminal, Desktop, and IDE (2026)

OpenCode is the open source AI coding agent Matt Pocock's GLM-5.2 thread kept naming alongside Pi and ZCode: "OpenCode is my preference. Honestly been having comparable results to Opus in my recent usage." With 160,000+ GitHub stars, 900 contributors, and marketing claiming 7.5M monthly developers, it has become the default model-agnostic harness for teams that refuse vendor lock-in.

Unlike a chat wrapper, OpenCode is a full agent harness — tool loop, LSP integration, session management, plan/build modes — shipped as terminal TUI, desktop app (beta on macOS, Windows, Linux), and IDE extension. You connect any model from any provider (Claude, GPT, Gemini, GLM-5.2, local Ollama) or use OpenCode Zen for a curated, benchmarked model list.

Update — July 20, 2026: Want to read the source behind product harnesses? Bojie Li's AI Agent Book chapter5/coding-agent — 17 pure-Python tools, multi-provider — is the pedagogical counterpart to OpenCode and Claude Code.

This guide covers what OpenCode is, how to install it, and when to choose it. For every slash command, see our OpenCode slash commands reference. For GLM-5.2 wiring across harnesses, see How to Run GLM 5.2. Update (July 1, 2026): Run open-source models locally in OpenCode — full stack: Ollama, llama.cpp, LM Studio → opencode.jsonc. Update (July 15, 2026): Desktop tabs — session-per-tab shell; worktrees not in new UI yet. Update (July 16, 2026): SpaceXAI open-sourced Grok Build — Apache 2.0, no external PRs; comparison and install: Grok Build open source.

Weekly digest3.5k readers

Catch up on AI

Curated AI updates on agents, skills, and MCP — delivered to your inbox. Unsubscribe anytime.

TL;DR

OpenCodeClaude CodePi
LicenseOpen sourceProprietaryOpen source (MIT)
SurfacesTerminal, desktop, IDETerminal, IDETerminal (+ SDK)
Models75+ via Models.devAnthropic-first15+ providers
LSPAuto-loaded for LLMVia IDE / toolsExtension-dependent
Sub-agentsBuilt-in (subtask: true)Built-inDIY (tmux / packages)
Memory fileAGENTS.md (/init)CLAUDE.mdAGENTS.md
PrivacyNo code/context stored by OpenCodeAnthropic policiesLocal sessions
Best forOSS + any provider + team share linksAnthropic ecosystemMinimal ownable harness

What OpenCode actually is

OpenCode's homepage frames it simply: the open source AI coding agent. In harness terms (our explainer), it implements:

  1. Task intake — natural language, @file references, custom slash commands
  2. Context manager — /compact, @ fuzzy file attach, AGENTS.md project memory
  3. Tool execution — file edits, shell (!command), MCP servers
  4. Loop controller — Plan mode (read-only planning) vs Build mode (Tab to toggle)
  5. Verification — Git-backed /undo and /redo (requires Git repo)
  6. Multi-agent — parallel sessions on the same project; subagents via command frontmatter

What makes OpenCode distinct in 2026 is surface area + openness: one harness, three UIs, 75+ providers, and a privacy story — OpenCode does not store your code or context data, so it can run in regulated environments (provider APIs still apply their own retention rules).

By the numbers (from opencode.ai, June 2026): 160K+ GitHub stars, 900+ contributors, 13K+ commits, and marketing citing 7.5M monthly developers — scale that matters because OSS harnesses live or die on issue velocity, provider adapters, and community command libraries in .opencode/commands/.


Install

From opencode.ai/docs:

bash
# Recommended
curl -fsSL https://opencode.ai/install | bash

# Node
npm install -g opencode-ai

# macOS / Linux
brew install anomalyco/tap/opencode

# Arch (AUR latest)
paru -S opencode-bin

Windows: Chocolatey, Scoop, or npm. Docker: docker run -it --rm ghcr.io/anomalyco/opencode.

Desktop app: opencode.ai/download — beta on macOS, Windows, Linux for developers who want GUI without giving up the same agent core.


First session: connect, init, build

bash
cd /path/to/your/project
opencode

Inside the TUI:

StepCommandWhat it does
1/connectAdd provider — Zen, Anthropic, OpenAI, Z.AI Coding Plan, Ollama, Copilot OAuth, etc.
2/modelsPick model (e.g. GLM-4.7, GLM-5.2 when available on your provider)
3/initAnalyze repo → create AGENTS.md (same filename as Codex)
4TabToggle Plan mode (suggest only) vs Build mode (edit files)

Example workflow from official docs: describe a feature in Plan mode, iterate on the plan, Tab back to Build mode, say "Go ahead and make the changes." For surgical edits, skip planning and reference files directly:

snippet
We need auth on /settings — mirror @packages/functions/src/notes.ts in @packages/functions/src/settings.ts

Full command surface: slash commands guide.


Standout features

LSP enabled

OpenCode automatically loads the right LSPs for the language context the LLM is working in — diagnostics, symbols, and navigation without manual server wiring. That puts it closer to IDE-integrated agents than bare terminal chat. oh-my-pi goes further on LSP-as-tools; OpenCode bakes baseline LSP into the default harness.

Multi-session parallelism

Start multiple agents in parallel on the same project — useful for "fix tests in thread A, update docs in thread B" without context bleed. Pair with explainx.ai agent loops by giving each session a different kickoff prompt and verification target.

Share links

/share creates a link to the current conversation for debugging or handoffs. /export for offline artifacts. Team review of agent runs without screen recordings.

Bring your existing subscriptions

OpenCode supports OAuth flows many harnesses omit:

  • GitHub Copilot — /connect → login with GitHub
  • ChatGPT Plus/Pro — /connect → OpenAI subscription auth

Plus standard API keys for Anthropic, Google, etc. Credentials land in ~/.local/share/opencode/auth.json per providers docs.

75+ providers and local models

OpenCode uses the AI SDK and Models.dev registry. Local paths documented include Ollama, LM Studio, llama.cpp, Atomic Chat, and NVIDIA NIM. Custom baseURL in opencode.json supports proxies and Z.ai-style endpoints.

OpenCode Zen

OpenCode Zen is a curated model list OpenCode benchmarks for coding agents — transparent pay-as-you-go ($20 balance, auto top-up), usable with any agent (not locked to OpenCode). Solves "which model/provider combo actually works?" without testing 40 combinations yourself. Zero markup on inference; spend limits available.


Running GLM-5.2 on OpenCode

OpenCode is on Z.ai's official Coding Plan tool list. Setup:

  1. /connect → search Z.AI → select Z.AI Coding Plan if subscribed
  2. Enter Coding Plan API key (z.ai/manage-apikey)
  3. /models → select GLM-5.2 (or GLM-4.7 for quota-friendly routine work)

For endpoints, effort levels (high / max), 1M context variant, and comparison to Pi/ZCode/Claude Code, read How to Run GLM 5.2 with Every Harness — model context lives in GLM-5.2 explainer.


Custom commands and MCP

OpenCode's extensibility sweet spot is markdown slash commands in .opencode/commands/:

markdown
---
description: Run tests until green
agent: build
model: provider/model-id
subtask: false
---

Run the test suite. Fix failures. Stop when all tests pass.
Arguments: $ARGUMENTS
  • $ARGUMENTS, $1/$2, @path, !shell` — same patterns as our commands reference
  • subtask: true — force subagent isolation for heavy tasks
  • MCP servers — configure in OpenCode config for web search, docs, internal tools; browse explainx.ai/mcp-servers for ideas

Kilo Code rebuilt its VS Code extension on OpenCode as the portable server — evidence the harness is becoming shared infrastructure across CLIs and IDEs.


Privacy and data

OpenCode's pitch: privacy first — the product does not store code or context on OpenCode infrastructure. Your prompts still go to whichever model provider you connect (Anthropic, Z.ai, OpenCode Zen hosts in the US with zero-retention policies per their FAQ). For enterprise evals, that split matters: harness local, inference remote.

Contrast with cloud-only agents that sync sessions by default. OpenCode + local Ollama is the air-gapped path; OpenCode + Zen is the "we tested these models" path.


OpenCode vs other harnesses

vs Claude Code

Claude Code wins on Anthropic-native /loop, /background, and Opus integration out of the box. OpenCode wins when you need GLM-5.2 today, Copilot subscription reuse, or open-source auditability. Many teams run both — Claude Code for daily Anthropic work, OpenCode for multi-model experiments.

vs Pi

Pi is minimal — you add MCP, sub-agents, and plan mode yourself. OpenCode ships plan/build modes, subagents, LSP, and 75 providers as defaults. Choose Pi to own every line of harness behavior; choose OpenCode to start coding in ten minutes without sacrificing provider choice.

vs Codex

Codex is OpenAI's harness with /goal and OSS mode via Ollama. OpenCode is vendor-neutral with similar AGENTS.md memory and undo semantics. Codex OSS + GLM: Codex Ollama guide.

vs Cursor

Cursor optimizes IDE-native flow. OpenCode optimizes terminal-first + optional desktop with explicit share links and multi-session. Cursor CLI users: compare Cursor slash commands to OpenCode commands.


Loop engineering on OpenCode

OpenCode does not market "loop engineering" the way Pi and Claude Code do, but the same patterns apply:

  • Deterministic exit — custom /test-until-green command + CI script
  • Plan before build — Tab to Plan mode for spec-first work
  • /compact — context engineering when sessions run long
  • Parallel sessions — one loop per worktree or concern

Wire top agent loops as custom commands; add verification gates from loop engineering guide.


Recommended path (June 2026)

New to agent coding:

  1. curl -fsSL https://opencode.ai/install | bash
  2. opencode → /connect → OpenCode Zen (easiest) or existing API key
  3. /init → ask a question about your repo with @ file refs

Already on GLM Coding Plan:

  1. /connect → Z.AI Coding Plan
  2. /models → GLM-5.2 for hard tasks, GLM-4.7 for routine
  3. Read GLM harness guide for quota rules

Building team workflows:

  1. Commit .opencode/commands/ for /review, /test, /ship
  2. Standardize on AGENTS.md via /init
  3. Use /share for async review of agent sessions

Configuration: opencode.json

OpenCode behavior lives in project or global config (opencode.json with schema at opencode.ai/config.json):

  • provider — per-provider baseURL, model lists, options (critical for Z.ai Coding Plan endpoints and corporate proxies)
  • Themes and keybinds — customize TUI without forking
  • Formatters — wire Prettier, rustfmt, etc. so agent edits match team style
  • MCP server definitions — attach tools once, reuse across sessions

Credentials from /connect stay in ~/.local/share/opencode/auth.json — separate from repo config so keys never land in Git. For teams, document which providers are approved (Zen only vs BYOK Anthropic vs GLM Coding Plan) in internal runbooks alongside AGENTS.md.

OpenCode Go and Enterprise tiers (listed on opencode.ai) target teams needing managed rollout — check current docs if you are standardizing across hundreds of developers. Individual developers rarely need more than /connect + /init on day one. Power users graduate to custom commands, MCP servers, and Zen spend limits once a single model/provider combo proves stable on real repos.


Summary

OpenCode is the open source, multi-surface coding agent that won 2026 mindshare by combining terminal + desktop + IDE, 75+ LLM providers, auto LSP, parallel sessions, Copilot/ChatGPT OAuth, optional Zen curated models, and a privacy-first local-harness story. It is a complete agent harness — not a thin client — and the harness Matt Pocock's audience keeps picking for GLM-5.2 and Opus-comparable daily driving.

Go deeper:

  • OpenCode slash commands — complete reference
  • How to Run GLM 5.2 with Pi, OpenCode, Claude Code & More
  • What Is an Agent Harness?
  • Official docs · GitHub

Related Reading

  • Using an open model feels surprisingly good — OpenCode + Kimi on Modal
  • Top 10 closed-source and open-source agent harnesses (2026)
  • Grok Build open source — SpaceXAI harness vs OpenCode (Jul 2026)
  • Inkling self-finetuning demo — Tinker + OpenCode (Jul 2026)
  • Thoughtworks zero-cost fallacy — OSS in the agentic era (Jul 2026)
  • Claude Code vs OpenCode token overhead — Systima July 2026
  • OpenCode Slash Commands: Complete TUI Reference
  • How to Run GLM 5.2 with Every Agent Harness
  • Pi: Minimal Agent Harness by Mario Zechner
  • Kilo Code: Built on OpenCode Server
  • Claude Code Commands Reference
  • Top 10 AI Agent Loops for Coding Workflows

Star counts, provider list, and Zen pricing are accurate as of June 19, 2026 per opencode.ai. Verify on GitHub and docs before production rollout.

Yash Thakker

Written by

Yash Thakker

Yash is an AI expert with over 300K learners. Join his workshops →

Related posts

Jul 22, 2026

Poolside Laguna S 2.1: A 118B Open-Weight Coding Model That Beats DeepSeek-V4-Pro-Max

118B total parameters, only 8B active per token, trained in under nine weeks on 30 trillion tokens — and it beats DeepSeek-V4-Pro-Max on Terminal-Bench 2.1. Here's what Poolside's Laguna S 2.1 actually offers and where to run it today.

Jul 22, 2026

Top 10 Closed-Source and Open-Source Agent Harnesses (2026)

The model gets the headline; the harness decides whether the agent actually finishes the task. Here are the top 10 closed-source and top 10 open-source agent harnesses builders are running in 2026 — what each one does differently, what it costs, and who should pick it.

Jul 24, 2026

Block Buzz: Self-Hosted Nostr Workspace for Humans and Agents

Buzz is Block’s open-source hive: one community, one signed event log, agents as members with their own keys — not chat bots glued to Slack. explainx.ai maps what works today, the Rust relay stack, and when to self-host vs wait.