Skip to main content
Everything Claude Code provides full OpenCode support including plugins, hooks, and native custom tools. OpenCode’s plugin system is more sophisticated than Claude Code with 20+ event types.

Overview

OpenCode is a next-generation AI coding assistant with a powerful plugin system. ECC leverages OpenCode’s advanced capabilities to provide richer automation than Claude Code.

Feature Parity Table

OpenCode Advantages: More hook events (20+ vs 8), native custom tools, richer plugin API

Installation

Option 1: Use Directly

OpenCode automatically detects .opencode/opencode.json configuration.

Option 2: Install as npm Package

Then add to your opencode.json:

Prerequisites

Hook Support via Plugins

OpenCode’s plugin system is MORE sophisticated than Claude Code with 20+ event types.

Event Mapping

Additional OpenCode Events

OpenCode provides exclusive events not available in Claude Code:
  • file.created — When a new file is created
  • file.edited — After file modifications (like Cursor’s afterFileEdit)
  • file.deleted — When a file is deleted
  • file.watcher.created — File system watcher detects new file
  • file.watcher.updated — File system watcher detects changes
  • session.created — Session starts
  • session.deleted — Session ends
  • session.idle — User inactive
  • session.restored — Session restored from save
  • message.created — New message sent
  • message.updated — Message edited
  • lsp.client.diagnostics — Language server diagnostics (errors, warnings)
  • lsp.client.connected — Language server connection established
  • tui.toast.show — Show toast notification
  • tui.modal.open — Open modal dialog
  • tool.execute.before — Before tool execution
  • tool.execute.after — After tool execution
  • mcp.tool.before — Before MCP tool call
  • mcp.tool.after — After MCP tool call

Hook Examples

6 Native Custom Tools

OpenCode provides native custom tools that Claude Code only achieves via hooks:

run-tests

Execute test suite with coverage reporting

check-coverage

Verify code coverage meets threshold (80%+)

security-audit

Run security audits (AgentShield, npm audit, etc.)

format-code

Format code with Prettier/ESLint/etc.

build-check

Run TypeScript/build checks without emitting

dependency-check

Check for outdated or vulnerable dependencies

Tool Configuration

.opencode/opencode.json:

24 Available Commands

OpenCode supports a curated subset of ECC commands:
  • /plan — Create implementation plan
  • /tdd — Enforce TDD workflow
  • /code-review — Review code changes
  • /build-fix — Fix build errors
  • /e2e — Generate E2E tests
  • /refactor-clean — Remove dead code
  • /orchestrate — Multi-agent workflow
  • /verify — Run verification loop

Configuration

opencode.json Structure

Usage Examples

Starting a Feature

Auto-Formatting Workflow

.opencode/hooks/file-edited.js

Security Audit on Commit

.opencode/hooks/session-end.js

Documentation

ECC provides comprehensive OpenCode documentation:

Migration Guide

.opencode/MIGRATION.md — Migrate from Claude Code

Plugin README

.opencode/README.md — OpenCode plugin details

Consolidated Rules

.opencode/instructions/INSTRUCTIONS.md — All rules in one file

LLM Documentation

llms.txt — Complete OpenCode docs for LLMs

Best Practices

Leverage Events

Use OpenCode’s 20+ events for richer automation

Custom Tools

Define project-specific tools in opencode.json

Hook Chaining

Chain multiple hooks for complex workflows

LSP Integration

Use lsp.client.diagnostics for real-time feedback

Feature Comparison

OpenCode Exclusive Features

OpenCode detects file changes via OS-level watchers, not just AI edits:
Real-time TypeScript/ESLint errors without running commands:
No need for hooks to add custom commands:
Programmatic UI control:

Troubleshooting

  1. Check opencode.json exists in project root
  2. Verify plugin is in "plugin" array
  3. Run opencode --debug to see plugin loading logs
  4. Check for syntax errors in opencode.json
  1. Verify hook scripts exist and are executable
  2. Check event names match OpenCode’s API
  3. Run opencode --trace-hooks to debug
  4. Ensure hook scripts don’t throw unhandled errors
  1. Check tool configuration in opencode.json
  2. Verify command is executable from terminal
  3. Test tool independently: npm test
  4. Check OpenCode logs for execution errors
  1. Ensure language server is installed and running
  2. Check .opencode/lsp-config.json configuration
  3. Verify file types are supported by LSP
  4. Run opencode --lsp-debug for diagnostics

Roadmap

Features coming to OpenCode support:
  • More agents — Porting remaining 1 agent from Claude Code
  • More commands — Porting remaining 9 commands
  • More skills — Porting remaining 13 skills
  • Enhanced LSP integration — Code actions, refactoring support
  • GitHub Copilot interop — Use both tools simultaneously

Next Steps

Commands

Explore 24 available commands

Custom Tools

Learn to define custom tools

Hook Events

Browse 20+ hook events

Skills

See 37 ported skills