Package Exports
- opencode-orchestrator
Readme
OpenCode Orchestrator
Autonomous multi-agent plugin for OpenCode
Overview
Multi-agent system that autonomously executes complex tasks. Commander delegates work to specialized agents, manages parallel execution, and maintains shared context.
| Capability | Detail |
|---|---|
| Agents | 7 specialized (Architect, Builder, Inspector, Recorder, Librarian, Researcher) |
| Parallel Sessions | Up to 50 concurrent |
| Context Management | .opencode/ with adaptive summarization |
| Memory Safety | Auto GC, disk archiving |
| Error Handling | Pattern-based auto recovery |
ποΈ System Architecture
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β π€ USER REQUEST β
β OpenCode Terminal / UI β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β π ORCHESTRATOR PLUGIN β
β β
β βββββββββββββββββββ βββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Session State β β 7 AGENTS β β
β β Map<id,state> β β π― Commander (primary) β β
β βββββββββββββββββββ β β delegate_task / OpenCode Task tool β β
β β ποΈ Architect π¨ Builder π Inspector β β
β βββββββββββββββββββ β πΎ Recorder π Librarian π¬ Researcher β β
β β Plugin Hooks β β (subagents, hidden) β β
β β config β βββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β chat.message β β
β β tool.execute β βββββββββββββββββββββββββββββββββββββββββββββββββββ β
β βββββββββββββββββββ β 12 TOOLS β β
β β delegate_task get_task_result list_tasks β β
β β webfetch websearch codesearch β β
β β run_background grep_search mgrep β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β βοΈ PARALLEL AGENT MANAGER β
β β
β ββββββββββββββββ ββββββββββββββββ βββββββββββββββββββββββββββββββββββ β
β β TaskLauncher β β TaskPoller β β ConcurrencyController β β
β β launch() β β poll() β β MAX=50, PER_AGENT=10 β β
β ββββββββββββββββ ββββββββββββββββ βββββββββββββββββββββββββββββββββββ β
β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β TaskStore (MAX: 1000 tasks) β β
β β pending β running β completed/error β archived (disk) β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β π CHILD SESSIONS POOL (up to 50) β
β β
β Session 1 Session 2 Session 3 Session N β
β Builder π¨ Librarian π Inspector π ... β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β π SMART CONTEXT (.opencode/) β
β β
β .opencode/todo.md - Master TODO list (Recorder manages) β
β .opencode/context.md - Adaptive size based on project phase β
β .opencode/docs/ - Cached documentation (auto-cleanup) β
β .opencode/archive/ - Old context for reference β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββInstallation
npm install -g opencode-orchestratorRestart OpenCode after installation.
Usage
π Two Modes of Operation
| Mode | Trigger | Behavior |
|---|---|---|
| Commander Mode π― | /task "mission" |
Full autonomous execution until MISSION COMPLETE |
| Chat Mode π¬ | Regular conversation | Simple Q&A, no autonomous behavior |
π― Commander Mode - /task (Recommended for Real Work)
Use /task when you need the AI to complete a mission autonomously:
/task "Fix the login bug in the docker-compose environment"
/task "Add dark mode support to the entire app"
/task "Refactor the API to use TypeScript"What Commander Mode Does:
- βΎοΈ Runs until done β Never stops until "MISSION COMPLETE"
- π§ Anti-Hallucination β Researches docs before coding
- β‘ Parallel Execution β Up to 50 concurrent agents
- π Auto-Recovery β Handles errors automatically
- π Trriage System β Adapts strategy to complexity (L1/L2/L3)
/task "mission" triggers full Commander mode
π¬ Chat Mode - Regular Conversation (Simple Q&A)
Just type normally without /task for simple questions:
How do I add a loading spinner?
What's the difference between useState and useReducer?Chat Mode is just regular conversation β no autonomous execution, no parallel agents, no mission tracking.
π‘ Pro Tip: Use
/taskfor anything that requires multiple steps, file changes, or verification. Use Chat Mode for quick questions.
The 7 Agents
| Agent | Role | Responsibility |
|---|---|---|
| Commander π― | Orchestrator | Autonomous mission control |
| Architect ποΈ | Planner | Hierarchical task decomposition |
| Builder π¨ | Developer | Full-stack implementation |
| Inspector π | Quality | Audit, auto-fix & doc verification |
| Recorder πΎ | Context | Progress tracking |
| Librarian π | Research | Documentation & API research |
| Researcher π¬ | Investigation | Pre-task research & analysis |
π οΈ Available Tools
| Tool | Description |
|---|---|
delegate_task |
Delegate work to subagent (async/sync) |
get_task_result |
Get result from delegated task |
list_tasks |
List all running/completed tasks |
cancel_task |
Cancel a running task |
webfetch |
Fetch URL content as Markdown |
websearch |
Search web (SearXNG β Brave β DuckDuckGo) |
codesearch |
Search open source code patterns |
cache_docs |
Manage cached documentation |
run_background |
Run command in background |
check_background / list_background |
Monitor background jobs |
grep_search / glob_search / mgrep |
Fast file search |
π Resource Guarantees
| Resource | Limit | Safety Mechanism |
|---|---|---|
| Parallel Sessions | 50 | Queue overflow protection |
| Tasks in Memory | 1,000 | Auto GC + disk archive |
| Notifications | 100/parent | FIFO eviction |
| Event History | 100 | Ring buffer |
| Session TTL | 60 min | Auto cleanup |
| Poll Interval | 1 second | Fast completion detection |
π§ͺ Test Coverage
Test Files: 18 passed
Tests: 198 passed
Duration: ~4.3sUninstall
npm uninstall -g opencode-orchestratorπ§ Debugging
Log file location:
# Find log path (macOS uses /var/folders/...)
npm run log
# or:
tail -f "$(node -e 'console.log(require("os").tmpdir())')/opencode-orchestrator.log"
# Windows
# C:\Users\<username>\AppData\Local\Temp\opencode-orchestrator.logDocumentation
- System Architecture β Detailed technical docs
- OpenCode SDK Reference β API usage reference
- Release Notes β Version history
- Troubleshooting
License
MIT License. LICENSE