Skip to content

LeXwDeX/OpenCode-DAG

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14,433 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

English · 简体中文 · 繁體中文 · العربية · Português (Brasil) · Bosanski · Dansk · Deutsch · Español · Français · Italiano · 日本語 · 한국어 · Norsk · Polski · Русский · ไทย · Türkçe · Українська · Tiếng Việt · Ελληνικά · বাংলা

OpenCode-DAG

An enhanced fork of opencode with a production-grade DAG workflow engine for multi-agent orchestration.

Built on top of the MIT-licensed opencode terminal AI agent. Not affiliated with or endorsed by the OpenCode team.


Branch Status

Branch Base Content Status
main v1.17.11 Hooks + Goal + Tools optimization Stable
dag-branch main + DAG DAG workflow engine (114 files) 🔧 In Development — adapting to v1.17.11 APIs

Important

The DAG workflow engine is currently being ported from v1.15.10 to the v1.17.11 codebase. It lives on the dag-branch and is not yet functional. The main branch is fully usable with Hooks, Goal auto-loop, and Tools exception exposure — all production-ready.


What makes this fork different

📌 Stable on main

Hooks API (22 events × 5 execution types)

Full Claude Code hooks protocol compatibility: command, mcp, http, prompt, agent hook types with 17 hook events including PreToolUse, PostToolUse, SessionStart, PermissionRequest, WorktreeCreate, and more.

See hooks reference.

Goal Auto-Loop

An autonomous agent loop that continuously drives an agent toward a user-defined goal. Uses an LLM judge to decide whether the goal is achieved or needs more turns. /goal <target> to set, /subgoal to add sub-goals.

Tools Exception Exposure

  • JSON repair: safeParseJson + fixJsonUnicodeEscapes — repairs broken multi-byte Unicode escapes in LLM-generated JSON
  • Question tool validation: structured error formatting with field-level hints and correct-call examples
  • Tool descriptions: expanded .txt docs for question, task, skill, webfetch, websearch with Parameters + Returns sections
  • Shell pipe fix: stdout/stderr: "pipe" on all ChildProcess.make calls + reader fiber grace drain

🔧 In Development on dag-branch

DAG Workflow Engine (AGPL-3.0)

A directed acyclic graph (DAG) workflow engine that lets LLM agents orchestrate complex multi-node parallel tasks within a single session.

⚠️ Status: Raw-copied from the v1.15.10 fork (114 files). 217 type errors pending API adaptation (sync Database.use → Effect-based Database.Service, BusEventV2Bridge, etc.). Not yet compilable.

Capability Description
Auto-scheduling Spawns child agents based on dependency order, parallel where possible
Dynamic replanning Add/remove/update nodes and adjust concurrency mid-run
State machine integrity Four iron laws: state machine bypass forbidden, terminal states irreversible, events must broadcast, persist before mutate
Terminal TUI Full DAG control panel with block-char topology map, tree view, node dialogs, real-time updates
Crash recovery Detects and resumes orphaned running workflows on restart
Conditional branching Nodes can conditionally execute or skip based on upstream output
Sub-DAG nesting Worker type dag spawns recursive sub-workflows (max depth 3)
Persistent audit 6-table SQLite schema, all state transitions traceable

CJK & localization fixes

Extensive fixes for Chinese/Japanese/Korean text handling: tokenization, full-width punctuation, file paths, IME input in the terminal UI. See fixes list.

Dual isolation: Sandbox + Worktree

  • Sandbox — ephemeral temp dirs with LSP diagnostics for safe code experiments
  • Worktreegit worktree per-workflow isolation for parallel multi-agent editing

Install

curl -fsSL https://opencode.ai/install | bash

# Package managers
npm i -g opencode-ai@latest
brew install anomalyco/tap/opencode
scoop install opencode
# ...and more — see upstream docs

Tip

Remove versions older than 0.1.x before installing.


Keep the upstream — plus more

All upstream MIT-licensed capabilities are fully preserved:

  • Desktop app (macOS / Windows / Linux) — download from releases
  • Build & Plan agentsTab to switch between full-access and read-only modes
  • Multi-provider — Claude, OpenAI, Google, local models via OpenCode Zen
  • Built-in LSP — real-time diagnostics from language servers
  • Client/server architecture — run locally, drive remotely from mobile

This fork adds the DAG engine, CJK fixes, sandbox coding workspace, and goal tracking on top — without breaking anything.


License

This repository uses a mixed license model:

Content License Location
Upstream opencode code (the vast majority) MIT LICENSE
Self-developed DAG workflow engine GNU AGPL v3 packages/opencode/src/dag/LICENSE

Full boundary details in NOTICE.

⚖️ Why AGPL? The DAG engine is the core differentiated work. AGPL ensures any derivative — including SaaS deployments — must contribute back.


Docs

Community

About

Extends the Hooks API with Goal-Oriented Instructions, TODO Pre-Hooks, Sandboxed Workspaces, and DAG (Directed Acyclic Graph) based Workflow Execution Engine(WIP).

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors