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

FeatureClaude CodeOpenCodeStatus
Agents✅ 13 agents✅ 12 agentsClaude Code leads
Commands✅ 33 commands✅ 24 commandsClaude Code leads
Skills✅ 50+ skills✅ 37 skillsClaude Code leads
Hooks✅ 8 event types11 eventsOpenCode has more! 🚀
Rules✅ 29 rules✅ 13 instructionsClaude Code leads
MCP Servers✅ 14 servers✅ FullFull parity
Custom Tools✅ Via hooks6 native toolsOpenCode is better 🚀
OpenCode Advantages: More hook events (20+ vs 8), native custom tools, richer plugin API

Installation

Option 1: Use Directly

cd everything-claude-code
opencode
OpenCode automatically detects .opencode/opencode.json configuration.

Option 2: Install as npm Package

npm install ecc-universal
Then add to your opencode.json:
{
  "plugin": ["ecc-universal"]
}

Prerequisites

# Install OpenCode
npm install -g opencode

# Verify installation
opencode --version

Hook Support via Plugins

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

Event Mapping

Claude Code HookOpenCode Plugin Event
PreToolUsetool.execute.before
PostToolUsetool.execute.after
Stopsession.idle
SessionStartsession.created
SessionEndsession.deleted

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

// Auto-format on file edit (like Cursor's afterFileEdit)
plugin.on('file.edited', async ({ path }) => {
  if (path.endsWith('.ts') || path.endsWith('.tsx')) {
    await exec(`npx prettier --write ${path}`);
    await exec(`npx tsc --noEmit`);
  }
});

6 Native Custom Tools

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

run-tests

Execute test suite with coverage reporting
/run-tests --coverage --watch

check-coverage

Verify code coverage meets threshold (80%+)
/check-coverage --threshold 80

security-audit

Run security audits (AgentShield, npm audit, etc.)
/security-audit --fix

format-code

Format code with Prettier/ESLint/etc.
/format-code --check

build-check

Run TypeScript/build checks without emitting
/build-check --strict

dependency-check

Check for outdated or vulnerable dependencies
/dependency-check --update

Tool Configuration

.opencode/opencode.json:
{
  "tools": [
    {
      "name": "run-tests",
      "command": "npm test",
      "args": ["--coverage"],
      "description": "Run test suite with coverage"
    },
    {
      "name": "security-audit",
      "command": "npx",
      "args": ["ecc-agentshield", "scan"],
      "description": "Run AgentShield security audit"
    }
  ]
}

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

{
  "plugin": ["ecc-universal"],
  "model": "claude-sonnet-4.6",
  "temperature": 0.7,
  "maxTokens": 10000
}

Usage Examples

Starting a Feature

opencode

> "Plan authentication with OAuth"
# → Uses planner agent via plugin

> "Implement with TDD"
# → Uses tdd-workflow skill

> "Run tests and check coverage"
# → Uses run-tests custom tool
> /check-coverage --threshold 80

Auto-Formatting Workflow

.opencode/hooks/file-edited.js
// Automatically triggered on file save
module.exports = async ({ path }) => {
  if (path.match(/\.(ts|tsx|js|jsx)$/)) {
    // Auto-format
    await exec(`npx prettier --write ${path}`);
    
    // Type check
    await exec(`npx tsc --noEmit`);
    
    // Lint
    await exec(`npx eslint ${path} --fix`);
  }
};

Security Audit on Commit

.opencode/hooks/session-end.js
// Run security audit before session ends
module.exports = async () => {
  console.log('Running security audit...');
  
  const result = await exec('npx ecc-agentshield scan --json');
  const audit = JSON.parse(result);
  
  if (audit.criticalIssues > 0) {
    throw new Error(`Security audit failed: ${audit.criticalIssues} critical issues`);
  }
};

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:
plugin.on('file.watcher.updated', ({ path }) => {
  console.log(`External change detected: ${path}`);
});
Real-time TypeScript/ESLint errors without running commands:
plugin.on('lsp.client.diagnostics', ({ diagnostics }) => {
  const errors = diagnostics.filter(d => d.severity === 'error');
  if (errors.length > 0) {
    showToast(`${errors.length} errors detected`);
  }
});
No need for hooks to add custom commands:
{
  "tools": [
    { "name": "deploy", "command": "npm run deploy" }
  ]
}
Programmatic UI control:
plugin.on('tui.toast.show', ({ message, level }) => {
  // Custom toast handling
});

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