Artificial Intelligence

OpenCode: Open Source AI Coding Agent

OpenCode is a community-driven, open source AI coding agent that works in your terminal, IDE, or desktop. With 120K+ GitHub stars, 800+ contributors, and 5M+ monthly developers, it's one of the most widely-used AI coding tools.

OpenCode: Open Source AI Coding Agent

OpenCode is a community-driven, open source AI coding agent that works in your terminal, IDE, or desktop. With 120K+ GitHub stars, 800+ contributors, and 5M+ monthly developers, it's one of the most widely-used AI coding tools.

Key distinction from Cursor/Codex: OpenCode is fully open source and privacy-first by design. Your code and context never leave your machine unless you explicitly share it.


What OpenCode Does

Think of OpenCode as an AI pair programmer you run locally that can:

  • ✅ Explain code and architecture
  • ✅ Add new features with planning and iteration
  • ✅ Refactor and optimize code
  • ✅ Review and suggest changes
  • ✅ Undo/redo changes if needed
  • ✅ Share conversation links for collaboration

Availability: Terminal TUI, desktop app, IDE extension (VS Code, JetBrains)


Key Features

LSP Enabled (Smart Language Support)

Automatically loads the right Language Server Protocols for the code you're working on. No manual setup needed.

Multi-Session Support

Start multiple agents in parallel on the same project. Useful for exploring different approaches simultaneously.

Share a link to any session for reference, debugging, or collaboration. Great for code review or mentoring.

Flexible LLM Integration

Connect any model from any provider:

  • Claude (Anthropic)
  • GPT-4 (OpenAI, including ChatGPT Plus/Pro)
  • Gemini (Google)
  • 75+ providers through Models.dev
  • Local models (Ollama, etc.)

GitHub Copilot Support

Log in with GitHub to use your Copilot account directly.

Privacy-First Design

OpenCode does not store any code or context data. It operates in privacy-sensitive environments (compliance, finance, security teams) where data residency is critical.


How It Fits in Your Workflow

Comparison to Cursor/Codex/ChatGPT

FeatureOpenCodeCursorCodexChatGPT
Open Source
Privacy First✅ (local-only)⚠️ (cloud sync)⚠️
Terminal TUI
IDE Extension✅ (plugin)
Plan Mode
Local Models⚠️
Share Links
CostFree + provider fees$$ (subscription)$$Free/Plus

Where to Use OpenCode

Best for:

  • Privacy-sensitive work (healthcare, finance, security)
  • Local development (no cloud sync wanted)
  • Terminal-first developers (hardcore CLI users)
  • Open source projects (community values)
  • Custom LLM setups (self-hosted or fine-tuned models)
  • Air-gapped environments (can work offline)

Complementary to:

  • Linear: Still use Linear for planning and status tracking
  • GitHub: OpenCode creates commits; GitHub is still your merge point
  • Your editor: Use OpenCode terminal TUI alongside VS Code/JetBrains

Installation

Quick Install

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

Via Package Manager

macOS (Homebrew):

brew install anomalyco/tap/opencode

Linux (Arch):

sudo pacman -S opencode
# or latest from AUR
paru -S opencode-bin

Windows (Chocolatey):

choco install opencode

Windows (Scoop):

scoop install opencode

npm (Any platform):

npm install -g opencode-ai

Docker:

docker run -it --rm ghcr.io/anomalyco/opencode

Prerequisites

  • Modern terminal emulator: WezTerm, Alacritty, Ghostty, Kitty, or similar
  • API key for at least one LLM provider (or use OpenCode Zen for curated models)

Getting Started

1. Configure LLM Provider

Run OpenCode and connect your LLM:

opencode
/connect

Options:

  • OpenCode Zen: Pre-tested, curated models (recommended for new users)
  • Claude (Anthropic API)
  • OpenAI (ChatGPT Plus/Pro or API key)
  • GitHub Copilot (sign in with GitHub)
  • Any of 75+ providers via Models.dev

2. Initialize Your Project

cd /path/to/project
opencode
/init

This creates an AGENTS.md file in your project root that helps OpenCode understand your codebase structure and coding patterns.

3. Start Using It

Ask OpenCode anything:

How is authentication handled in @packages/functions/src/api/index.ts?

Workflow: Ask → Plan → Build → Verify

Example: Add a Feature

1. Ask in Plan Mode (Tab key to toggle)

When a user deletes a note, we'd like to flag it as deleted in the database.
Then create a screen that shows all the recently deleted notes.
From this screen, the user can undelete a note or permanently delete it.

2. Review the Plan OpenCode suggests an implementation approach. Ask follow-up questions:

Take a look at this design image and use it as a reference for the UI.

(Drag/drop images directly into the terminal)

3. Build It (Switch back to Build mode)

Sounds good! Go ahead and make the changes.

4. Review & Iterate If something's not right:

/undo

Then ask again with feedback. Use /redo to restore the previous attempt.

5. Share for Collaboration

/share

Creates a shareable link to your conversation.


Key Commands

CommandPurpose
/initInitialize project (create AGENTS.md)
/undoRevert the last set of changes
/redoRestore undone changes
/shareGenerate shareable link to conversation
/connectSet up LLM provider
TabToggle between Plan Mode and Build Mode

AGENTS.md Pattern

When you run /init, OpenCode creates an AGENTS.md file like this:

# OpenCode Agent Config

## Project Overview
[Auto-generated summary of your codebase]

## Coding Standards
- TypeScript with strict mode
- Functional components with hooks
- Error handling with try/catch

## Dependencies
- React 18+
- Next.js 13+
- Prisma for ORM

## Testing
Run `npm test` to verify changes

## Build & Deploy
- `npm run build` to compile
- `npm run deploy` to production

OpenCode reads this every conversation, so it always understands your project context.


Privacy & Security

Why OpenCode is Privacy-First

  1. No cloud storage of code or conversation context
  2. Local-only operation possible with self-hosted LLMs
  3. Audit trail is your git history, not a third-party log
  4. HIPAA/FedRAMP/SOC 2 compatible workflows

Suitable For

  • Financial/trading teams
  • Healthcare applications
  • Government/defense contractors
  • Compliance-heavy industries
  • Air-gapped deployments

Limitations

  • No conversation history sync across machines (by design)
  • Terminal-only (no cloud IDE integration)
  • Depends on your LLM provider's privacy policy

Customization

Themes

/theme

Pick from built-in themes or create your own.

Keybinds

Create a custom .opencoderc file to remap keys (vim, emacs, etc.)

Code Formatters

Configure Prettier, rustfmt, go fmt, etc. in your AGENTS.md.

Custom Commands

Add project-specific commands in config.


Integration with Your Workflow

Linear + OpenCode

  1. Linear: Decide what to build (issue with acceptance criteria)
  2. OpenCode: Ask it to implement the issue
  3. GitHub: Open PR, merge after review
  4. Linear: GitHub integration auto-updates issue status

Example OpenCode prompt:

Implement RFX-40: Phase 2 multi-tenancy account scoping
Context:
- accounts table has an id field
- All queries should filter by account_id
- See the Linear issue for acceptance criteria

GitHub + OpenCode

OpenCode naturally integrates with Git:

  • Commits are your audit trail
  • PR descriptions can reference OpenCode share links
  • Code review happens in GitHub (human verifies before merge)

When to Use OpenCode vs Cursor vs Codex

Use OpenCode When:

  • ✅ Privacy/compliance is non-negotiable
  • ✅ You prefer terminal-first development
  • ✅ You want open source tooling
  • ✅ You need to self-host your LLM
  • ✅ You're working in air-gapped environments

Use Cursor When:

  • ✅ You want interactive editor integration
  • ✅ You prefer GUI over terminal
  • ✅ You want tight IDE coupling (VS Code-like)
  • ✅ You're comfortable with cloud sync

Use Codex When:

  • ✅ You need explicit agent workflows across IDE/CLI/cloud
  • ✅ You want standardized prompts with AGENTS.md
  • ✅ You want tight OpenClaw/MCP integration
  • ✅ You're building sophisticated agent automation

Resources


Takeaway

OpenCode = Open source, privacy-first, terminal-native AI coding agent

It's perfect if you value open source software, need privacy guarantees, or prefer command-line workflows. Pair it with Linear for planning and GitHub for code review, and you have a complete AI-assisted development workflow.

Unlike proprietary tools, OpenCode's code is public, its community is large, and you're never locked in to a platform's architecture decisions.