OpenCode

Overview

OpenCode is a terminal-native agentic coding assistant, currently (July 2026) on its V2 line maintained under anomalyco/opencode with docs at dev.opencode.ai and opencode.ai/v2. It is the direct counterpart to claude-code-system-prompt, cursor-system-prompt, cline-system-prompt, and grok-build: an interactive CLI agent that edits code, runs tools, and manages long sessions.

⚠️ Naming collision verified 2026-10-18: the Go project opencode-ai/opencode (13,817★) last pushed 2025-09-18 and is archived/frozen; its continuation is charmbracelet/crush (28,687★, active 2026-10). This page documents the separate V2 product under anomalyco/opencode (docs at dev.opencode.ai). 1

Interface (CLI) (confidence: high)

The CLI defaults to the TUI when run bare, and also accepts subcommands for programmatic use:

  • opencode run "…" — non-interactive mode for scripting/automation; --attach to a headless serve to avoid MCP cold-boot per run.
  • opencode serve / web — headless HTTP server (basic auth via OPENCODE_SERVER_PASSWORD); attach reconnects a TUI to it.
  • opencode agent create — interactive or flag-driven (--path, --description, --mode, --permissions, --model) agent generation.
  • opencode mcp add|list|auth|logout|debug — MCP server management incl. OAuth.
  • opencode session list|delete, export (--sanitize), import, stats (tokens/cost), models --refresh, pr, plugin, db, acp (Agent Client Protocol server).2

Permission model: agent create --permissions is an allow-list — anything omitted is denied. Available: bash, read, edit, glob, grep, webfetch, task, todowrite, websearch, lsp, skill.

Relevant env vars: OPENCODE_DISABLE_AUTOCOMPACT, OPENCODE_DISABLE_CLAUDE_CODE (disables reading .claude prompt + skills), OPENCODE_CONFIG_CONTENT (inline JSON config), OPENCODE_PERMISSION (inline JSON permissions), OPENCODE_SERVER_PASSWORD.

Configuration (V2) (confidence: high)

  • Format JSON/JSONC with $schema: opencode.ai/config.json; load order: global ~/.config/opencode/opencode.json(c) → project opencode.json(c) → .opencode/opencode.json(c) (a .opencode config overrides direct configs even when closer).3
  • Key sections: permissions (ordered allow/deny/ask rules on action+resource), agents (override built-ins; mode: subagent, system prompt, per-agent permissions), compaction, warming (4-min idle interval / 30-min window), skills (dirs/URLs), commands (slash prompt templates), references, plugins, providers (custom models + limits).
  • Accepted but not yet implemented in V2: share, username, formatter, lsp, instructions (“use AGENTS.md for active instructions”).

Compaction (confidence: high)

Compaction replaces older model context with a generated checkpoint (structured summary + serialized recent tail). Lossy, but earlier durable messages are not deleted. Analyzed in depth at context-compaction.4

Implications

OpenCode V2 consolidates the agentic-coding-CLI pattern (terminal TUI + headless serve + web + ACP server) under one product, with a whitelist-first permission model and checkpoint-based context management. Its OPENCODE_DISABLE_CLAUDE_CODE switch makes explicit that .claude prompt/skill files are shared conventions across competing agents — a cross-tool portability signal consistent with skill-authoring-best-practices. The name collision with the archived Go project is a real-world documentation hazard: link targets must be verified against the anomalyco org.

Relationships

Open Questions

  • Whether the V2 permission/whitelist model is exported as a reusable pattern worth a dedicated concept page (vs staying tool-specific).
  • Which of the accepted-but-inert V2 config fields (lsp, formatter, instructions) ship first — affects guidance that says “use AGENTS.md”.

Sources

  • raw/external/dev-opencode-ai-cli-b01a850a.md
  • raw/external/opencode-ai-config-85d6db47.md
  • raw/external/opencode-ai-compaction-d433d7dd.md
  • raw/external/github-com-opencode-104f4b54.md

Footnotes

  1. raw/repositories/vibecoding-tool-repos-refresh-2026-10-18.md ↩

  2. raw/external/dev-opencode-ai-cli-b01a850a.md ↩

  3. raw/external/opencode-ai-config-85d6db47.md ↩

  4. raw/external/opencode-ai-compaction-d433d7dd.md ↩