Claude-Code-VS-OpenCode

agent
Security Audit
Warn
Health Warn
  • No license — Repository has no license file
  • Description — Repository has a description
  • Active repo — Last push 0 days ago
  • Low visibility — Only 5 GitHub stars
Code Pass
  • Code scan — Scanned 4 files during light audit, no dangerous patterns found
Permissions Pass
  • Permissions — No dangerous permissions requested
Purpose
This repository is a comprehensive, book-style analytical comparison of three AI coding agent systems: OpenCode, Oh-My-OpenCode, and Claude Code. It explores their architecture, design philosophies, and best practices for agent development from a source-code level.

Security Assessment
The overall security risk is Low. This project is essentially a collection of documentation and analytical markdown files rather than an executable software tool. The automated code scan verified that it contains no dangerous patterns, hardcoded secrets, or harmful scripts. Because it consists almost entirely of text rather than functional code, it does not access sensitive data, execute shell commands, or make hidden network requests.

Quality Assessment
The project is very new and currently has low visibility with only 5 GitHub stars, meaning it has not yet undergone widespread community review. It is actively maintained, with a recent push recorded just today. A notable concern is the complete absence of a license file, which means the repository falls under default copyright laws. This legally restricts how developers can use, modify, or distribute the material. However, as an informational resource, the quality of the content appears to be highly structured and comprehensive.

Verdict
Safe to use as a reference document, but be aware of the unlicense status if you intend to reuse or distribute the written material.
SUMMARY

Claude Code VS OpenCode, who is better (from source code)? 从源码级别对比 Claude Code 和 OpenCode。

README.md

Claude Code VS OpenCode: Architecture, Design & The Road Ahead — Table of Contents

Model: claude-opus-4-6 (anthropic/claude-opus-4-6)
Token Usage: ~45,000 input + ~8,000 output (TOC generation)
Tools: OpenCode + Oh-My-OpenCode
Generated: 2026-04-01
Subjects: OpenCode, Oh-My-OpenCode, Claude Code


Language

中文版本

Book Structure Overview

This book — Claude Code VS OpenCode — provides an in-depth multi-dimensional analysis comparing three AI coding agent systems — OpenCode (open-source foundation), Oh-My-OpenCode (multi-agent orchestration layer), and Claude Code (Anthropic's commercial agent) — from shared architectural patterns to distinctive innovations, culminating in best practices for agent design.

Part Chapter Range Core Topics Est. Word Count
Part I: The Landscape Chapters 1–2 Evolution, market, three systems overview ~8,000 words
Part II: Shared Architecture Chapters 3–8 ReAct loop, tools, sessions, LLM, MCP, config ~18,000 words
Part III: Distinctive Features Chapters 9–11 OpenCode innovations, OMO innovations, Claude Code commercial design ~15,000 words
Part IV: Deep Dive — OMO on OpenCode Chapter 12 Plugin entry, hook wiring, tool injection, agent system, config layering, compatibility ~12,000 words
Part V: Deep Comparison Chapters 13–17 Philosophy, tools, orchestration, extensibility, security ~20,000 words
Part VI: Agent Design Best Practices Chapters 18–23 Ideal architecture, tool design, context engineering, multi-agent, extensibility, safety ~24,000 words
Part VII: Future & Practice Chapters 24–26 What's next, building your own agent, designing Oh-My-Claude-Code ~15,000 words

Part I: The Landscape

Chapter 1: The Evolution of Coding Agents

Tracing the three eras of AI coding — from autocomplete to chat copilot to autonomous agent — and why scaffolding matters more than the model.


Chapter 2: The Three Systems at a Glance

A high-level overview of OpenCode, Oh-My-OpenCode, and Claude Code — tech stacks, core positioning, and a quick comparison matrix.


Part II: Shared Architecture (Commonalities)

Chapter 3: The Core Loop — The ReAct Paradigm

The foundational execution model shared by all three systems: think, act, observe, repeat.


Chapter 4: Tool System Design

Tools are the only way agents interact with the external world — how they're defined, registered, secured, and executed.


Chapter 5: Session & Context Management

How conversations are persisted, messages structured, context compacted, and sessions recovered across interruptions.


Chapter 6: LLM Provider Abstraction

From 20+ provider SDKs to a single streaming interface — how each system abstracts model access.


Chapter 7: MCP — The USB-C of AI

Model Context Protocol: why it changes everything, how each system implements it, and MCP vs A2A.


Chapter 8: Configuration & Customization

Multi-level config precedence, project memory systems, and instruction assembly pipelines.


Part III: Distinctive Features

Chapter 9: OpenCode's Unique Contributions

Multi-interface architecture, ACP protocol, namespace organization, SDK programmability, and plan mode.


Chapter 10: Oh-My-OpenCode's Innovations

Three-layer orchestration, semantic categories, Ultrawork mode, Ralph Loop, wisdom accumulation, 41-hook system, skill-embedded MCPs, and Tmux visual multi-agent.


Chapter 11: Claude Code's Commercial Design

ML permission classifier, cost control, enterprise readiness, custom Ink renderer, multi-strategy compaction, Bridge/Coordinator modes, and 100+ slash commands.


Part IV: Deep Dive — How Oh-My-OpenCode is Built on OpenCode

Chapter 12: Anatomy of a 130K-LOC Plugin

A source-code-level deep dive into how Oh-My-OpenCode leverages OpenCode's plugin system to build an entire multi-agent orchestration layer — without forking a single line of the host.

  • 12.1 Plugin Entry Point & Bootstrap Sequence

    • src/index.ts: The 8-hook handshake with OpenCode's plugin system
    • 6-phase initialization: provider → plugin-components → agents → tools → MCPs → commands
    • Lifecycle: how OMO boots before the first user message arrives
  • 12.2 The 8 OpenCode Hook Handlers

    • config: Injecting agents, tools, MCPs, commands into OpenCode's registry
    • tool: Registering 26 custom tools via OpenCode SDK
    • chat.message: First-message variant gate, session setup, keyword detection
    • chat.params: Anthropic effort level adjustment
    • event: Session lifecycle event handling
    • tool.execute.before / tool.execute.after: Pre/post tool interception
    • experimental.chat.messages.transform: Context injection and thinking block validation
  • 12.3 Tool Injection Architecture

    • How OMO's 26 tools are registered via plugin/tool-registry.ts
    • Tool wrapping pattern: OpenCode SDK tool → OMO tool with extra context
    • The delegate-task tool: spawning subagents through OpenCode's session system
    • Background task tools: concurrency management atop OpenCode's infrastructure
  • 12.4 Agent System Implementation

    • builtin-agents.ts: Factory functions for 11 agents with model resolution and fallback chains
    • Dynamic prompt building: dynamic-agent-prompt-builder.ts — tool tables, delegation guides, hard blocks
    • How agents map to OpenCode's native agent concept vs. OMO's orchestration layer
    • System prompt assembly: modular sections (identity, interview, plan generation, behavioral constraints)
  • 12.5 Hook System: 41 Hooks on 5 OpenCode Hook Points

    • How 41 OMO hooks are multiplexed onto OpenCode's 5 plugin hook points
    • Hook execution order and priority
    • The tool.execute.before pipeline: file guard → label truncator → rules injector
    • The experimental.chat.messages.transform pipeline: context injection → thinking validation → todo preservation
    • Hook enable/disable via configuration
  • 12.6 Configuration Layering

    • How OMO's 3-level config (project → user → defaults) coexists with OpenCode's 7-level config
    • 22 Zod v4 schema files: agents, categories, hooks, MCPs, skills, commands, experimental
    • JSONC support: why comments in config files matter for DX
    • Config validation and partial fallback strategy
  • 12.7 Claude Code Compatibility Layer

    • Loading Claude Code plugins from .opencode/plugins/
    • Loading Claude Code commands from .opencode/command/
    • Loading Claude Code agents from .opencode/agents/
    • Loading Claude Code MCPs from .mcp.json with ${VAR} env expansion
    • Why OMO maintains Claude Code compatibility: the migration path argument
  • 12.8 Background Agent Spawner & Session Management

    • How OMO creates new OpenCode sessions for background agents
    • Concurrency management: 5 concurrent per model/provider
    • Parent session notification mechanism
    • Session continuation via session_id — preserving full context across turns
    • The boulder state: tracking Sisyphus continuation across interruptions

Part V: Deep Comparative Analysis

Chapter 13: Architectural Philosophy Comparison

Open vs closed, simple vs complex, control vs autonomy, general vs specialized.


Chapter 14: Tool System Deep Comparison

Tool count vs coverage, unique tools, LSP integration depth, and tool composition patterns.


Chapter 15: Agent Orchestration Comparison

Single-agent vs multi-agent, specialization, background tasks, wisdom transfer vs context isolation.


Chapter 16: Extensibility Comparison

Plugin systems, skill systems, command systems, hook systems, and manifest-driven discovery.


Chapter 17: Security Model Comparison

Permission paradigms, sandboxing, supply chain security, and credential isolation.


Part VI: Agent Design Best Practices

Chapter 18: Architecture of the Ideal Coding Agent

The consensus architecture for 2026, the five defining tensions, and lessons from the three systems.


Chapter 19: The Art of Tool Design

ACI design principles, minimal tool sets, cognitive cost of tool output, and tool composition vs bloat.


Chapter 20: Context Engineering

The shift from prompt engineering to context engineering — four memory strategies and overflow recovery.


Chapter 21: The Art of Multi-Agent Orchestration

Five orchestration patterns, when to use multi-agent, specialization design, wisdom accumulation, and parallel execution challenges.


Chapter 22: Designing for Extensibility

Three content types, MCP as universal substrate, lifecycle hooks, and the simplicity spectrum.


Chapter 23: Balancing Safety & Autonomy

Threat models, sandboxing, capability declaration, and lessons from Claude Code's 84% permission reduction.


Part VII: Future & Practice

Chapter 24: What's Next for Coding Agents

From code generation to software engineering, vibe coding, convergence trends, and unsolved challenges.


Chapter 25: Building Your Own Coding Agent

The starting decision tree, minimum viable agent, pitfalls to avoid, and what to measure.


Chapter 26: Designing "Oh-My-Claude-Code" — A Multi-Agent Plugin for Claude Code

A thought experiment and architectural blueprint: if we were to build an OMO-equivalent orchestration layer for Claude Code, what would it look like? What's possible, what's missing, and what would need to change?

  • 26.1 Claude Code's Extension Surface: What's Available Today

    • Hooks (session_start, pre_compact, post_compact, post_sampling, file_changed)
    • Plugins (.claude/plugins/) with commands, tools, skills, hooks
    • Custom agents (.claude/agents/) with markdown definitions
    • MCP servers (.claude/mcp.json) for external tools
    • CLAUDE.md / memory system for persistent context
    • What's exposed vs. what's locked down
  • 26.2 Gap Analysis: OpenCode Plugin API vs Claude Code Extension API

    • OpenCode's 8 hook points (config, tool, chat.message, chat.params, event, tool.execute.before/after, experimental.chat.messages.transform) — full lifecycle control
    • Claude Code's hook points — more limited, focused on safety
    • What OMO features are possible on Claude Code today vs. what requires API changes
    • The "message transform" gap: why context injection is harder on Claude Code
  • 26.3 Architecture Blueprint: Oh-My-Claude-Code

    • Multi-agent orchestration via custom agents + AgentTool
    • Background task delegation via TaskCreate/TaskGet/TaskOutput
    • Skill system leveraging Claude Code's native skills + MCP
    • Configuration via CLAUDE.md + .claude/settings.json
    • The "Sisyphus prompt" approach: encoding orchestration logic in system prompts
    • Wisdom accumulation via memory system + structured notes
  • 26.4 What's Achievable Today: A Practical Implementation Plan

    • Phase 1: Custom agents with specialized prompts (Oracle, Explore, Librarian equivalents)
    • Phase 2: Hook-based continuation (post_sampling → todo enforcement)
    • Phase 3: MCP-based tool augmentation (AST-grep, session management, LSP extensions)
    • Phase 4: Plugin-based orchestration layer
    • Estimated effort and token cost implications
  • 26.5 What's Missing: An Open Letter to Claude Code's Extensibility

    • The chat.message hook: intercepting and transforming messages before LLM
    • The tool.execute.before/after hooks: pre/post tool interception
    • Plugin-level tool registration: adding tools beyond MCP
    • Agent-level model selection: choosing different models for different agents
    • Background agent spawning with session continuity
    • The case for a richer plugin SDK
  • 26.6 Convergence Forecast: Will OpenCode and Claude Code Plugin APIs Merge?

    • MCP as the common denominator
    • The trend toward richer hook systems
    • Open-source innovation driving commercial feature adoption
    • A unified agent extensibility standard: is it possible?

Appendices

Appendix A: Complete Tool Inventory of All Three Systems

  • Full tool list with parameters, permissions, and descriptions for OpenCode, OMO, and Claude Code

Appendix B: Complete Configuration Reference

  • Configuration schemas and options for all three systems

Appendix C: Key Source Code Path Mapping

  • Quick reference table mapping concepts to source files across all three codebases

Appendix D: MCP Server Ecosystem Overview

  • Transport types, community servers, official registry

Appendix E: Recommended Reading & References

  • Anthropic: Building Effective Agents (Dec 2024)
  • Anthropic: Effective Context Engineering (Sept 2025)
  • Anthropic: Claude Code Sandboxing (Oct 2025)
  • Anthropic: Multi-Agent Research System (June 2025)
  • MCP Official Documentation
  • Zylos: AI Coding Agents 2025–2026
  • Zylos: Plugin and Extension Architecture
  • GuruSup: Agent Orchestration Patterns
  • SWE-bench & SWE-bench Pro benchmarks

Appendix F: Glossary of Terms

  • LLM, Token, Context Window, Function Calling, ReAct, Agent, MCP, ACP, A2A, LSP, AST, SSE, Monorepo, TUI, Poka-yoke, ACI, JSONL, Zod, etc.

Source Code File Index

Quick reference for key source files covered in this book

Chapter OpenCode Files OMO Files Claude Code Files
Ch.3: ReAct Loop session/processor.ts, session/llm.ts (inherits OpenCode) QueryEngine.ts, query.ts, main.tsx
Ch.4: Tools tool/tool.ts, tool/registry.ts, tool/*.ts src/tools/index.ts, src/tools/* Tool.ts, tools.ts, tools/*
Ch.5: Sessions session/index.ts, session/message-v2.ts, session/compaction.ts src/features/claude-code-session-state/ utils/sessionStorage.ts, services/compact/*
Ch.6: LLM provider/provider.ts, provider/transform.ts, provider/models.ts src/tools/delegate-task/category-resolver.ts utils/model/model.ts, utils/model/providers.ts
Ch.7: MCP mcp/index.ts, mcp/auth.ts src/mcp/*, src/features/skill-mcp-manager/ services/mcp/client.ts, services/mcp/config.ts
Ch.8: Config config/config.ts, config/paths.ts src/config/schema/*, src/plugin-config.ts utils/config.ts, utils/settings/*
Ch.9: OpenCode cli/cmd/tui/app.tsx, acp/*, sdk/js/*
Ch.10: OMO src/agents/*, src/hooks/*, src/features/*
Ch.11: Claude Code utils/permissions/*, cost-tracker.ts, ink/*
Ch.12: OMO Deep Dive plugin/index.ts (host) src/index.ts, src/plugin/*, src/agents/builtin-agents.ts, src/hooks/index.ts, src/config/schema/*, src/features/background-agent/*, src/features/claude-code-*-loader/*
Ch.15: Orchestration agent/agent.ts src/agents/atlas/*, src/agents/prometheus/* tools/AgentTool/*, tasks/*
Ch.16: Extensibility plugin/index.ts, skill/skill.ts src/hooks/index.ts (41 hooks) utils/plugins/*, skills/*
Ch.17: Security permission/next.ts src/hooks/comment-checker/ utils/permissions/permissionSetup.ts, utils/permissions/yoloClassifier.ts
Ch.26: Oh-My-Claude-Code (reference architecture) utils/hooks/*, utils/plugins/*, tools/AgentTool/*, tasks/*, skills/*

Reviews (0)

No results found