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
| Feature | Claude Code | OpenCode | Status |
|---|---|---|---|
| Agents | ✅ 13 agents | ✅ 12 agents | Claude Code leads |
| Commands | ✅ 33 commands | ✅ 24 commands | Claude Code leads |
| Skills | ✅ 50+ skills | ✅ 37 skills | Claude Code leads |
| Hooks | ✅ 8 event types | ✅ 11 events | OpenCode has more! 🚀 |
| Rules | ✅ 29 rules | ✅ 13 instructions | Claude Code leads |
| MCP Servers | ✅ 14 servers | ✅ Full | Full parity |
| Custom Tools | ✅ Via hooks | ✅ 6 native tools | OpenCode is better 🚀 |
OpenCode Advantages: More hook events (20+ vs 8), native custom tools, richer plugin API
Installation
Option 1: Use Directly
.opencode/opencode.json configuration.
Option 2: Install as npm Package
opencode.json:
Prerequisites
Hook Support via Plugins
OpenCode’s plugin system is MORE sophisticated than Claude Code with 20+ event types.Event Mapping
| Claude Code Hook | OpenCode Plugin Event |
|---|---|
| PreToolUse | tool.execute.before |
| PostToolUse | tool.execute.after |
| Stop | session.idle |
| SessionStart | session.created |
| SessionEnd | session.deleted |
Additional OpenCode Events
OpenCode provides exclusive events not available in Claude Code:File Events (5)
File Events (5)
file.created— When a new file is createdfile.edited— After file modifications (like Cursor’s afterFileEdit)file.deleted— When a file is deletedfile.watcher.created— File system watcher detects new filefile.watcher.updated— File system watcher detects changes
Session Events (4)
Session Events (4)
session.created— Session startssession.deleted— Session endssession.idle— User inactivesession.restored— Session restored from save
Message Events (2)
Message Events (2)
message.created— New message sentmessage.updated— Message edited
LSP Events (2)
LSP Events (2)
lsp.client.diagnostics— Language server diagnostics (errors, warnings)lsp.client.connected— Language server connection established
UI Events (2)
UI Events (2)
tui.toast.show— Show toast notificationtui.modal.open— Open modal dialog
Tool Events (2)
Tool Events (2)
tool.execute.before— Before tool executiontool.execute.after— After tool execution
MCP Events (2)
MCP Events (2)
mcp.tool.before— Before MCP tool callmcp.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:- Core Workflow (8)
- Testing & Quality (4)
- Continuous Learning (7)
- Language-Specific (3)
- Utilities (2)
/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 CodePlugin README
.opencode/README.md — OpenCode plugin detailsConsolidated Rules
.opencode/instructions/INSTRUCTIONS.md — All rules in one fileLLM Documentation
llms.txt — Complete OpenCode docs for LLMsBest 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
File Watcher Events
File Watcher Events
OpenCode detects file changes via OS-level watchers, not just AI edits:
LSP Diagnostics
LSP Diagnostics
Real-time TypeScript/ESLint errors without running commands:
Native Custom Tools
Native Custom Tools
No need for hooks to add custom commands:
UI Events
UI Events
Programmatic UI control:
Troubleshooting
Plugin not loading
Plugin not loading
- Check
opencode.jsonexists in project root - Verify plugin is in
"plugin"array - Run
opencode --debugto see plugin loading logs - Check for syntax errors in opencode.json
Hooks not firing
Hooks not firing
- Verify hook scripts exist and are executable
- Check event names match OpenCode’s API
- Run
opencode --trace-hooksto debug - Ensure hook scripts don’t throw unhandled errors
Custom tools not working
Custom tools not working
- Check tool configuration in opencode.json
- Verify command is executable from terminal
- Test tool independently:
npm test - Check OpenCode logs for execution errors
LSP events not firing
LSP events not firing
- Ensure language server is installed and running
- Check
.opencode/lsp-config.jsonconfiguration - Verify file types are supported by LSP
- Run
opencode --lsp-debugfor 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