Skip to content

Repository files navigation

opencode-workflows

An OpenCode V2 plugin that runs deterministic multi-agent workflows. A workflow is an ordered list of phases. A phase either prompts one child session or fans out to several in parallel and joins their results. Each phase writes an artifact, so a run is auditable and resumable.

Install

mkdir -p ~/.config/opencode/plugins
curl -fsSL \
  https://raw.githubusercontent.com/jadmadi/opencode-workflows/main/workflows.ts \
  -o ~/.config/opencode/plugins/workflows.ts

For one project, put it in .opencode/plugins/. Tested against OpenCode 0.0.0-beta-19425.

Use

Command Effect
/workflow or /workflow list List the built-in workflows
/workflow run <name> <task> Run a workflow for the task
/workflow run <name> <task> --resume=<runID> Resume an unfinished run

A resume may omit the task. The run directory stores it in 00-task.txt, and a taskless resume reads it back.

First built-in: deep-research, with the phases brief, plan, research, reflect, write, and review. It produces one Markdown report. fact-check is a follow-up.

How it runs

  • Each phase creates child sessions with ctx.session.create, selects an agent with ctx.session.switchAgent, sends the prompt with ctx.session.prompt, and waits with ctx.session.wait.
  • A fan-out phase runs several children in parallel, bounded by WORKFLOW_CONCURRENCY (default 3), and joins their replies.
  • A failed phase retries up to WORKFLOW_RETRIES (default 2) before the run stops and reports. An empty reply from a child counts as a failure.
  • Child sessions use the invoking session's model. WORKFLOW_MODEL overrides it with a provider/model ref.
  • Artifacts go under <data dir>/opencode/workflows/<runID>/. WORKFLOW_ROOT overrides the parent.

Tests

bun test

Attribution

Inspired by MiMoCode's workflows. See NOTICE.

License

MIT

About

OpenCode V2 plugin that runs deterministic multi-agent workflows

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages