# OpenFlow **OpenFlow is a visual builder for multi-agent AI workflows.** Drag role cards onto a canvas, wire a pipeline (planner → architect → coder), save it, and run it with real parallel agents.  OpenFlow is its own project. It is built on — and ships as a fork of — [opencode](https://github.com/anomalyco/opencode), whose headless engine (`opencode serve`) drives the agents underneath. All of OpenFlow's own code lives in [`packages/flow`](packages/flow); no upstream package is modified, so the OpenCode engine stays current and upstream merges stay clean. The original OpenCode README follows below. ### Install **Prerequisites** - [Bun](https://bun.sh) 1.3 or newer — the only runtime OpenFlow needs (it runs the engine, the build, and the canvas). `bun --version` to check. - [Git](https://git-scm.com). **Get the code** ```bash git clone https://github.com/SeeRay11/OpenFlow.git cd OpenFlow bun install ``` `bun install` pulls the whole workspace — the OpenCode engine plus OpenFlow's own code in [`packages/flow`](packages/flow). First install is large; it downloads the engine's native deps and runs a `postinstall` that marks the engine's prebuilt `node-pty` helpers executable — a no-op on Windows. ### Stop anything already running OpenFlow uses two ports: **4096** for the engine and **5174** for the canvas. If a previous run is still holding them, starting the engine by hand fails with `Error: Unexpected error` / `ServeError` — that is a port already bound, not a broken install. `bun openflow.ts` handles this for you: it reuses a port that is already serving and frees one a dead run left bound. Kill the old processes yourself only when you want a genuinely fresh engine — after editing `opencode.json`, for example, since the engine caches project config at boot and never re-reads it. **Windows (PowerShell)** ```powershell Get-NetTCPConnection -LocalPort 4096,5174 -State Listen -ErrorAction SilentlyContinue | Select-Object -ExpandProperty OwningProcess -Unique | ForEach-Object { taskkill /pid $_ /T /F } ``` **macOS / Linux** ```bash lsof -t -i :4096 -i :5174 | xargs kill -9 ``` Both are safe to run when nothing is listening — they simply match no process. They kill *any* process on those ports, so check first if you run something else there: ```powershell Get-NetTCPConnection -LocalPort 4096,5174 -State Listen | Select-Object LocalPort,OwningProcess ``` ```bash lsof -i :4096 -i :5174 ``` **If the engine fails with `database is locked`,** another opencode engine is already running somewhere else — a second copy of OpenFlow, or one a previous launcher left behind. Every engine shares a single database in your opencode data directory, so the second one to start cannot open it. Freeing the ports does not help here, because that engine need not be holding them. Stop it by what it is running instead: ```powershell Get-CimInstance Win32_Process -Filter "Name='bun.exe'" | Where-Object { $_.CommandLine -match 'openflow\.ts|src/index\.ts serve|packages/flow dev' } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force } ``` ```bash pkill -f 'openflow\.ts|src/index\.ts serve|packages/flow dev' ``` Then start OpenFlow again. If it happens every time, you most likely have OpenFlow cloned in two places and both are being started — keep one. ### Run it One command starts both processes. Setting the variable is the only part that differs per shell, so pick the line for the terminal you are in. PowerShell (the Windows default): ```powershell $env:FLOW_MANAGE_SERVER=1; bun openflow.ts ``` bash, zsh, Git Bash, WSL, macOS, Linux: ```bash FLOW_MANAGE_SERVER=1 bun openflow.ts ``` Windows `cmd.exe`: ```bash set FLOW_MANAGE_SERVER=1 && bun openflow.ts ``` fish: ```bash env FLOW_MANAGE_SERVER=1 bun openflow.ts ``` It starts the engine, waits until it answers, then opens the canvas on http://localhost:5174; Ctrl+C stops both. A port a dead run left bound is freed first, and a port that is already serving is reused rather than started twice. `FLOW_MANAGE_SERVER=1` hands the engine to the canvas, so its restart button works — one click stops `opencode serve`, starts it again, and re-reads agents, models and MCP status. This is the easy way to apply a merged agent, a new skill or an MCP change without leaving the app. It is opt-in and never adopts a running engine; drop it (`bun openflow.ts`, on every shell) to start the engine unmanaged. Two shims wrap that same file for people who prefer their platform's own launcher. They hold no logic of their own — they translate flags into the environment variables `openflow.ts` already reads. ```powershell .\openflow.ps1 ``` ```bash ./openflow.sh ``` **On Windows the shim may refuse to start:** PowerShell does not run unsigned local scripts by default, so `.\openflow.ps1` can fail with *"openflow.ps1 cannot be loaded because running scripts is disabled on this system"*. A repo downloaded as a ZIP rather than cloned is also marked as coming from the internet, which blocks it a second way. `bun openflow.ts` is subject to neither and is the shortest way past both. To use the shim instead, allow local scripts for your own account, and unblock the file if it came from a ZIP: ```powershell Set-ExecutionPolicy -Scope CurrentUser RemoteSigned Unblock-File .\openflow.ps1 ``` Flags are optional, and the three surfaces resolve to the same plan: | PowerShell | shell | environment | what it does | |---|---|---|---| | `-Project
The open source AI coding agent.
OpenFlow is an independent fork. It is not affiliated with, sponsored by, or endorsed by the OpenCode team.
English | 简体中文 | 繁體中文 | 한국어 | Deutsch | Español | Français | Italiano | Dansk | 日本語 | Polski | Русский | Bosanski | العربية | Norsk | Português (Brasil) | ไทย | Türkçe | Українська | বাংলা | Ελληνικά | Tiếng Việt
[](https://opencode.ai) --- ### Installation ```bash # YOLO curl -fsSL https://opencode.ai/install | bash # Package managers npm i -g opencode-ai@latest # or bun/pnpm/yarn scoop install opencode # Windows choco install opencode # Windows brew install anomalyco/tap/opencode # macOS and Linux (recommended, always up to date) brew install opencode # macOS and Linux (official brew formula, updated less) sudo pacman -S opencode # Arch Linux (Stable) paru -S opencode-bin # Arch Linux (Latest from AUR) mise use -g opencode # Any OS nix run nixpkgs#opencode # or github:anomalyco/opencode for latest dev branch ``` > [!TIP] > Remove versions older than 0.1.x before installing. ### Desktop App (BETA) OpenCode is also available as a desktop application. Download directly from the [releases page](https://github.com/anomalyco/opencode/releases) or [opencode.ai/download](https://opencode.ai/download). | Platform | Download | | --------------------- | ---------------------------------- | | macOS (Apple Silicon) | `opencode-desktop-mac-arm64.dmg` | | macOS (Intel) | `opencode-desktop-mac-x64.dmg` | | Windows | `opencode-desktop-windows-x64.exe` | | Linux | `.deb`, `.rpm`, or `.AppImage` | ```bash # macOS (Homebrew) brew install --cask opencode-desktop # Windows (Scoop) scoop bucket add extras; scoop install extras/opencode-desktop ``` #### Installation Directory The install script respects the following priority order for the installation path: 1. `$OPENCODE_INSTALL_DIR` - Custom installation directory 2. `$XDG_BIN_DIR` - XDG Base Directory Specification compliant path 3. `$HOME/bin` - Standard user binary directory (if it exists or can be created) 4. `$HOME/.opencode/bin` - Default fallback ```bash # Examples OPENCODE_INSTALL_DIR=/usr/local/bin curl -fsSL https://opencode.ai/install | bash XDG_BIN_DIR=$HOME/.local/bin curl -fsSL https://opencode.ai/install | bash ``` ### Agents OpenCode includes two built-in agents you can switch between with the `Tab` key. - **build** - Default, full-access agent for development work - **plan** - Read-only agent for analysis and code exploration - Denies file edits by default - Asks permission before running bash commands - Ideal for exploring unfamiliar codebases or planning changes Also included is a **general** subagent for complex searches and multistep tasks. This is used internally and can be invoked using `@general` in messages. Learn more about [agents](https://opencode.ai/docs/agents). ### Documentation For more info on how to configure OpenCode, [**head over to our docs**](https://opencode.ai/docs). ### Contributing If you're interested in contributing to OpenCode, please read our [contributing docs](./CONTRIBUTING.md) before submitting a pull request. ### Building on OpenCode If you are working on a project that's related to OpenCode and is using "opencode" as part of its name, for example "opencode-dashboard" or "opencode-mobile", please add a note to your README to clarify that it is not built by the OpenCode team and is not affiliated with us in any way. --- **Join our community** [Discord](https://discord.gg/opencode) | [X.com](https://x.com/opencode)