Skip to content
/

OpenCode Orchestrator

opencode-orchestrator · agnusdei1207/opencode-orchestrator · ★ 167 · last commit 2026-03-28

Hub-and-spoke hierarchical orchestration for OpenCode with Chase-Lev work-stealing, MVCC state sync, and evidence-based anti-hallucination mandates.

Best whenAgent correctness requires process-level concurrency primitives (MVCC, work-stealing) and absolute evidence-based verification rules — not just prompt engine…
Skip ifClaiming verification without reading files, Modifying code based on assumptions
vs seeds
claude-flow(Commander → workers hierarchy) but diverges sharply by targeting OpenCode only (single-tool, low portability), shipping…
Primitive shape 8 total
Commands 1 Subagents 4 Hooks 3
00

Summary

OpenCode Orchestrator — Summary

OpenCode Orchestrator is a production-grade multi-agent orchestration engine published as the npm package opencode-orchestrator (v1.2.69), designed specifically for the OpenCode CLI environment. It implements a hub-and-spoke architecture with four agent types (Commander, Planner, Worker, Reviewer) coordinated via work-stealing queues and MVCC session synchronization. The engine's philosophy is "Explore → Learn → Adapt → Act" — each agent phase is evidence-based, demanding direct file reads and command execution over memory or pattern-matching. Technically notable for its low-level concurrency primitives: MVCC state synchronization, Chase-Lev work-stealing deques, object/string/buffer memory pools, and a Rust-based connection pool, making it the most performance-engineering-focused framework in the batch. The modular prompt system composes agent system prompts from named constants (CORE_PHILOSOPHY, COMMANDER_ROLE, etc.) allowing fine-grained behavior control. Compared to seeds: closest to claude-flow in hierarchical multi-agent coordination with a primary "commander" role, but OpenCode Orchestrator is single-tool (OpenCode only), ships no MCP server of its own, and focuses on process-level performance engineering rather than swarm topologies or consensus protocols.

01

Overview

OpenCode Orchestrator — Overview

Origin

Created by agnusdei1207. GitHub: https://github.com/agnusdei1207/opencode-orchestrator. npm package: opencode-orchestrator. Version 1.2.69 at analysis time. Also ships a Rust binary and a Docker image for isolated execution.

Philosophy

From the AGENTS.md (in Korean — the repo's primary language):

"Actions must be evidence-based. Permitted evidence: directly reading files, executing commands and observing output, running tests and observing results. Not valid: memory, assumptions, pattern matching alone."

The four-phase core philosophy:

  • [EXPLORE]: Scan unknown territory — detect environment, never assume
  • [LEARN]: Document discoveries — record patterns for future use
  • [ADAPT]: Adjust to findings — match project's style and context
  • [ACT]: Execute with confidence — build, test, verify, conclude

Key design choices

  1. Work-stealing queues (Chase-Lev algorithm) — idle agents steal tasks from busy agents' queues, achieving natural load balancing without a central scheduler
  2. MVCC state synchronization — multiple agents read/write shared state atomically, modeled after database MVCC (multi-version concurrency control)
  3. Memory pools — object pool (200 slots), string intern pool, buffer pool (4KB chunks) to eliminate GC pressure during high-throughput agent runs
  4. Rust connection pool — 4 processes, 30s idle timeout, managed by Rust for connection management
  5. MSVP Monitor — Minimum Stable Value Polling — adaptive polling (500ms–5s) with stability detection before declaring a task complete

AGENTS.md mandates (absolute prohibitions)

  • Never claim verification without reading the file
  • Never modify code based on assumptions
  • Never reference unverified functions, files, variables, types
  • Never skip impact analysis or post-work verification
  • Never mix refactoring and feature work in same change
  • Never ignore potential conflicts with parallel agents working on same file
02

Architecture

OpenCode Orchestrator — Architecture

Distribution

  • npm package: opencode-orchestrator
  • Install: npm install -g opencode-orchestrator
  • Also available: Docker image via compose.yml; Rust binary in bin/
  • Required runtime: Node.js (TypeScript), Rust (connection pool), Docker (optional isolation)

Directory structure

src/
  agents/
    commander.ts      # Master orchestrator (main agent)
    subagents/
      planner.ts      # Architecture/roadmap/TODO.md generator
      worker.ts       # File coding, TDD, documentation implementation
      reviewer.ts     # Verification, stability checking
    prompts/
      01_philosophy/  # CORE_PHILOSOPHY, ANTI_HALLUCINATION, ENVIRONMENT_DISCOVERY
      02_discovery/   # SEARCH_TOOLS
      03_planning/    # COMMANDER_LOOP_CONTINUATION, PLANNER prompts
      04_execution/   # WORKER prompts
      05_verification/# REVIEWER prompts
      06_mission/     # MISSION_STATUS_FORMAT
      07_agents/      # COMMANDER_FORBIDDEN, COMMANDER_REQUIRED
      08_tools/       # SHARED_LSP_TOOLS, SHARED_AST_TOOLS
  core/               # Session pool, work-stealing queue, MVCC
  hooks/              # Lifecycle hooks
  shared/             # Constants, interfaces
  tools/              # Tool definitions
  utils/              # Helpers

crates/               # Rust connection pool and binary
scripts/              # Build scripts
user-prompt/          # Shared workspace prompt injection

Shared workspace pattern

Agents share a .opencode/ directory for inter-agent communication. The Commander reads this directory to detect loop state and coordinate with sub-agents on sync issues.

Config

  • opencode.jsonc — OpenCode configuration (hooks, plugin entry, CI detection)
  • AGENTS.md — agent operating rules (Korean, with English prohibition lists)

Target AI tools

OpenCode CLI exclusively. This is a single-tool framework.

03

Components

OpenCode Orchestrator — Components

Agent types (4)

Agent Role
Commander Master orchestrator — all four phases (EXPLORE/LEARN/ADAPT/ACT), manages parallel execution, loop state, sync issues
Planner EXPLORE → LEARN — dependency analysis, roadmap generation, writes TODO.md
Worker ADAPT → ACT — file coding, TDD workflow, documentation
Reviewer EXPLORE → LEARN → ACT — verification, stability detection, unit test verification

Prompt modules (8 directories, ~20+ named constants)

Key prompt fragments used in agent composition:

  • CORE_PHILOSOPHY — Explore/Learn/Adapt/Act table
  • COMMANDER_ROLE / COMMANDER_IDENTITY
  • COMMANDER_FORBIDDEN / COMMANDER_REQUIRED
  • ANTI_HALLUCINATION_CORE — evidence-based mandate
  • ENVIRONMENT_DISCOVERY — how to detect project environment
  • COMMANDER_EXECUTION / COMMANDER_PARALLEL — parallel delegation rules
  • COMMANDER_LOOP_CONTINUATION — how to resume from .opencode/ state
  • COMMANDER_SYNC_HANDLING / COMMANDER_RECOVERY
  • SHARED_LSP_TOOLS / SHARED_AST_TOOLS — language server and AST tool instructions
  • MISSION_STATUS_FORMAT — output reporting format

Hooks (custom feature hooks)

Hook directories: compatibility/, custom/, features/ Hook registry: src/hooks/registry.ts

Types:

  • compatibility — cross-version compatibility hooks
  • features — feature-specific lifecycle events
  • custom — user-defined hooks

Infrastructure layer (performance primitives)

  • Session pool: 5 sessions per agent, max 10 reuse
  • Work-stealing queue: Chase-Lev algorithm, LIFO/FIFO configurable
  • Memory pools: Object (200 slots), String (intern), Buffer (4KB)
  • MVCC state: atomic sync for shared state mutations
  • Circuit breaker: 5 failures → open, 2 success → close
  • Rust connection pool: 4 processes, 30s idle timeout

CLI entrypoint

/task "..." slash command via OpenCode CLI.

05

Prompts

OpenCode Orchestrator — Prompt Excerpts

Excerpt 1: Core Philosophy constant

Source: src/agents/prompts/01_philosophy/core.ts

## Core Philosophy: Explore → Learn → Adapt → Act

> "What you discover, you record for future use."

| Phase | Action | Key Behavior |
|:-----:|:-------|:-------------|
| [EXPLORE] **SURVEY** | Scan unknown territory | Detect environment, never assume |
| [LEARN] **LEARN** | Document discoveries | Record patterns for future use |
| [ADAPT] **ADAPT** | Adjust to findings | Match project's style and context |
| [ACT] **ACT** | Execute with confidence | Build, test, verify, conclude |

**Learn = Document. What you discover, you record for future use.**

### Agent Focus:
- [COMMANDER] **Commander**: All phases (orchestrate the full cycle)
- [PLANNER] **Planner**: SURVEY → LEARN (research and document)
- [WORKER] **Worker**: ADAPT → ACT (implement with fit)
- [REVIEWER] **Reviewer**: SURVEY → LEARN → ACT (verify with evidence)

Prompting technique: Table-driven phase assignment with persona-per-phase mapping. The [LABEL] **Name** pattern creates a visual identity anchor for each agent role.


Excerpt 2: Commander agent system prompt structure

Source: src/agents/commander.ts

The Commander prompt is assembled from 20+ named constants in order:

const systemPrompt = [
   CORE_PHILOSOPHY,
   COMMANDER_ROLE,
   COMMANDER_IDENTITY,
   COMMANDER_FORBIDDEN,
   COMMANDER_REQUIRED,
   ENVIRONMENT_DISCOVERY,
   SEARCH_TOOLS,
   COMMANDER_EXECUTION,
   COMMANDER_PARALLEL,
   DELEGATION_RULES,
   TODO_RULES,
   COMMANDER_TODO_FORMAT,
   COMMANDER_LOOP_CONTINUATION,
   COMMANDER_SYNC_HANDLING,
   COMMANDER_RECOVERY,
   SHARED_LSP_TOOLS,
   SHARED_AST_TOOLS,
   SHARED_WORKSPACE,
   ANTI_HALLUCINATION_CORE,
   COMPLETION_CONDITIONS,
   AUTONOMOUS_MANDATE,
   MISSION_STATUS_FORMAT,
].join("\n\n");

Prompting technique: Composable prompt assembly — each behavior dimension (loop continuation, sync handling, recovery, anti-hallucination) is a separate named constant that can be modified independently. The join("\n\n") ensures section separation. This modular approach allows per-subagent prompt customization by including only the relevant constants (Planner omits COMMANDER_PARALLEL; Worker omits CORE_PHILOSOPHY).

09

Uniqueness

OpenCode Orchestrator — Uniqueness & Positioning

Differs from seeds

Closest to claude-flow in using a hierarchical Commander → Workers pattern with explicit orchestration roles. Key differences:

  1. Single-tool target — OpenCode CLI only. Claude-flow targets Claude Code + Codex; aistack is multi-provider. This is the most narrowly targeted framework in the corpus.

  2. Process-level performance engineering — Chase-Lev work-stealing queues, MVCC state synchronization, Rust connection pools, and memory pools are novel; no other seed framework ships low-level concurrency primitives. This reads more like a high-throughput server than an AI coding assistant framework.

  3. Composable modular prompt assembly — system prompts are composed from 20+ named TypeScript constants joined at runtime, allowing per-agent inclusion/exclusion of behavior modules. No other framework in the batch takes this approach; most embed prompts as static strings.

  4. Evidence-based mandate (AGENTS.md) — the most rigorous anti-hallucination protocol in the corpus, written as absolute prohibitions with a Korean-language author voice that suggests internal tooling repurposed for public release.

  5. No MCP server — unlike claude-flow, aistack, or CAO, this framework operates entirely within the OpenCode tool execution loop. No external server.

Observable failure modes

  • Single-tool lock-in: moving to Claude Code or Codex requires a framework rewrite
  • MVCC and work-stealing complexity may introduce subtle concurrency bugs in edge cases
  • Korean-language documentation limits community adoption
  • No persistent memory means each /task starts from scratch

Competitive positioning

Targets teams running OpenCode who want production-grade concurrency patterns and strict evidence-based agent behavior. The performance engineering focus suggests it was built for high-volume task processing at scale, unusual for a single-developer framework at 167 stars.

04

Workflow

OpenCode Orchestrator — Workflow

Phase sequence

User: /task "..."
  → Commander: mission analysis, parallel delegation
  → Planner: dependency analysis, TODO.md, roadmap
  → Workers (parallel): file coding, TDD, docs
  → MSVP Monitor: stability polling (500ms–5s adaptive)
  → Reviewer: unit test verification, stability check
  → ✨ COMPLETED

Required workflow per AGENTS.md

Before any change:

  1. Open and read all directly related files top-to-bottom
  2. Identify: entry points, data flow, dependencies, dynamic wiring, public exports
  3. List affected files
  4. Declare: Target / Reason / Scope / Expected impact / Rollback plan
  5. Verify baseline stability (build passes, tests pass)

During work: SURVEY → PLAN → EXECUTE → TEST → VERIFY → DOCUMENT

Parallel delegation

Commander delegates to multiple Workers in parallel. Work-stealing queues balance load across idle workers. The Commander monitors .opencode/ shared workspace for loop continuation signals.

Phase artifacts

Phase Artifact
Planning TODO.md (dependency-ordered task list)
Implementation code files per task
Verification test results, stability report
Documentation inline docs, updated README

Approval gates

No explicit human approval gates. The MSVP Monitor provides automated stability gating (adaptive polling until output stabilizes before advancing).

TDD enforcement

Worker agents follow TDD workflow as part of their role definition. The Reviewer verifies unit tests pass. Stability detection prevents advancement until test output is stable.

06

Memory Context

OpenCode Orchestrator — Memory & Context

Primary state storage

In-memory (Task Store) — the session pool and task states live in process memory, not persisted to disk. MVCC ensures atomic reads/writes across concurrent agents.

Shared workspace

.opencode/ directory — agents write loop-state signals and intermediate artifacts here. Commander reads this directory to:

  • Detect whether it's in a continuation loop (vs fresh start)
  • Handle sync issues when workers conflict
  • Recovery from partial failures

Cross-agent communication

Work-stealing queues: tasks are pushed to per-agent queues; idle agents steal from busy agents. This is the coordination mechanism rather than explicit message passing.

Memory pools (performance)

Not semantic memory — these are engineering memory pools:

  • Object pool: 200 slots, reused across agent allocations
  • String intern pool: deduplicates repeated strings
  • Buffer pool: 4KB chunks reused for I/O operations

Persistence scope

session — state lives for the duration of the task execution. No cross-session handoff documented.

Rust connection pool

The Rust-based component manages 4 connection processes with 30s idle timeouts, providing a stable resource layer beneath the TypeScript session management.

MVCC state synchronization

Atomic state mutations for shared properties (task status, assignment state) using MVCC pattern — multiple agents can read safely; writes are serialized atomically with version numbers.

Context compaction

Not documented. The framework targets completing tasks within a single run rather than managing context window limits.

07

Orchestration

OpenCode Orchestrator — Orchestration

Pattern

Hierarchical with parallel fan-out — Commander dispatches to Planner and Workers simultaneously; Workers execute in parallel; Reviewer validates output.

The work-stealing queue provides dynamic load balancing: if one Worker finishes early, it steals from another Worker's queue without Commander involvement.

Subagent definition format

code-class — each agent is a TypeScript AgentDefinition object assembled from prompt constants. The id, systemPrompt, canWrite, and canBash properties define the agent contract.

export const commander: AgentDefinition = {
   id: AGENT_NAMES.COMMANDER,
   description: "Commander - orchestrator...",
   systemPrompt,
   canWrite: true,
   canBash: true,
};

Isolation mechanism

Process isolation — Docker is available via compose.yml; Rust binary provides native process boundaries. The default in-process option uses MVCC for state isolation.

Multi-model

No — single model per agent. The framework is designed for OpenCode only. No multi-provider routing documented.

Execution mode

one-shot per /task invocation, but with internal loop continuation: if the task is not complete, Commander re-enters the loop using state from .opencode/.

MSVP Monitor

Minimum Stable Value Polling — the reviewer polls output stability adaptively:

  • Polling interval: 500ms–5s (adaptive based on output change rate)
  • Stability detection: confirms output has not changed before marking complete
  • Unit test verification: confirms tests pass before completion

Crash recovery

Circuit breaker: 5 failures → open (exponential backoff recovery). RAII pattern: zero memory leaks. Shutdown Manager for graceful termination.

Max concurrent agents

Configurable via work-stealing queue concurrency. Session pool: 5 sessions per agent, max 10 reuse.

08

Ui Cli Surface

OpenCode Orchestrator — UI & CLI Surface

Entry point

/task "..." slash command inside OpenCode CLI session.

No standalone CLI binary is shipped — this is an OpenCode plugin.

Installation surface

npm install -g opencode-orchestrator

The install hook:

  • Detects OpenCode environment
  • Injects plugin entry into opencode.jsonc
  • Preserves existing sibling plugin entries
  • Skips auto-mutation in CI environments (CI=true)

Cleanup:

npm explore -g opencode-orchestrator -- npm run cleanup:plugin
npm uninstall -g opencode-orchestrator

Architecture visualization

The README contains detailed ASCII diagrams of the four-layer architecture:

  1. Presentation Layer — Task Toast Manager, Progress Notifier, Notification Manager, Mission Summary Display
  2. Business Logic Layer — Commander, Planner, Worker, Reviewer agents + Concurrency Controller
    • Task Store + Hook System
  3. Infrastructure Layer — Session Pool (5/10 reuse), Chase-Lev Work-Stealing Queue, Memory Pools, MVCC State, Circuit Breaker, Rust Connection Pool
  4. Safety Layer — RAII Pattern (zero leaks), Shutdown Manager, Auto-Recovery (exponential backoff)

Local UI

None. This is a CLI/OpenCode-only framework. No web dashboard.

Observability

The MSVP Monitor provides adaptive polling status internally. No external observability tooling documented.

Audit log

Not documented.

Related frameworks

same archetype · same primary tool · same memory type

Claude-Flow / Ruflo ★ 55k

Eliminates single-agent context limits and sequential bottlenecks by orchestrating fault-tolerant swarms of specialized AI agents…

Hermes Agent (NousResearch) ★ 168k

Self-improving personal AI agent with closed learning loop, 7 terminal backends, and messaging gateway — not tied to any AI…

OpenCode ★ 165k

Terminal-first AI coding agent with multi-model routing, native desktop app, and a typed .opencode/ configuration system for…

OpenHands ★ 75k

Open-source AI software development platform (open-source Devin alternative) with Docker sandbox isolation, 77.6% SWE-bench…

DeerFlow ★ 70k

Long-horizon superagent that researches, codes, and creates by orchestrating parallel sub-agents with isolated contexts in Docker…

oh-my-openagent (omo) ★ 60k

Multi-provider AI agent orchestration for OpenCode: escape vendor lock-in by routing Sisyphus (Claude/Kimi/GLM) and Hephaestus…