orkai workflow — run a workflow
Run one of your workflows on Claude Code or OpenCode from the CLI. Harnesses, run profile, run, wait, follow, stats, exit codes and fixes.
orkai workflow runs one of your workflows as a headless expert on a coding harness
(Claude Code or OpenCode), in any folder, and keeps the result. The daemon owns the run, so it keeps going when
the command that started it exits. The daemon must be running (orkai start).
orkai work runs its agent steps on this same layer, with the harness, model and variant
set on each task. A workflow's run profile is not used by work. See
Workflows.
A workflow is the procedure (how). A task or a prompt is the input (what). To follow a workflow from your own agent instead, or to write one, see Workflows. To run a whole cycle of workflows, see Cycle run.
Start
orkai workflow harnesses # which harnesses are installed, with versions
orkai workflow harnesses harness=opencode # plus the models you can pick
orkai workflow profile set <workflow-id> harness=claude-code model=sonnet
orkai workflow run <workflow-id> dir=. prompt="review the uncommitted diff" --wait A workflow needs a run profile before it can run: the harness, the model, and optionally a variant and a permission mode. The profile is stored on the workflow, so every run of it uses the same settings.
Every command answers --help, -h and help without contacting the daemon:
orkai workflow --help
orkai workflow run --help
orkai workflow run status --help
orkai workflow profile set --help Project
dir is the folder the harness works in. It must hold .orkai.yaml,
and the workflow (and the task, if you pass one) must belong to that project. run needs
dir=<path>. For harnesses, profile set,
profile clear and stats it defaults to the current folder.
Profile
orkai workflow profile show <workflow-id> [--json]
orkai workflow profile set <workflow-id> harness=<name> model=<id> [variant=<v>] [permission_mode=<m>] [dir=<path>]
orkai workflow profile clear <workflow-id> [dir=<path>] profile setchecks that the harness is installed, that the model is in its catalog, and that the variant and the permission mode are valid. It does not check sign-in; the run does.- Harnesses:
claude-code(Claude Code 2.x) andopencode(OpenCode 1.x and 2.x).orkai workflow harnessesshows the version and where the binary was found. - Models: Claude Code takes
sonnet,opus,fableor a full model name. OpenCode takesprovider/modelfromorkai workflow harnesses harness=opencode. - Permission modes (Claude Code only):
acceptEdits,auto,bypassPermissions,dontAsk,manual,plan. Without one a run usesplan.bypassPermissionsis used only when you set it. OpenCode has no permission modes. profile clearremoves the profile; runs of the workflow are refused until a new one is set.- In the web UI, each card on the Workflows page has Assign harness and Assign model icons that save the same profile.
Run
orkai workflow run <workflow-id> dir=<path> [task=<task-id>] [prompt=<text> | prompt-file=<path|->]
[--wait | --follow] [--timeout <dur>] [--json] - A run needs input:
task=<task-id>,prompt=<text>orprompt-file=<path>(-reads stdin), or a task plus a prompt. With a task, its text is part of the request; a prompt next to it adds direction. promptandprompt-filecannot be combined. The whole prompt is limited to 262144 bytes.- No flag: prints the run id and returns.
--waitwaits and prints the answer.--followprints every event as one JSON line, then one last line with the result. --timeout 10mstops the waiting, not the run, and needs--waitor--follow.--waitand--followcannot be combined, and--jsoncannot be used with--follow.- At most 8 runs are active at once.
Check a run
orkai workflow run status <run-id> # workflow, status, harness, model, folder, times, session id, tokens, cost, tool calls
orkai workflow run wait <run-id> [--timeout <dur>]
orkai workflow run events <run-id> [after=<seq>] [--no-follow]
orkai workflow run result <run-id> # the answer
orkai workflow run cancel <run-id> # stops the run and its harness process
A run is running, then succeeded, failed,
cancelled or interrupted (the daemon stopped or restarted). The
harness session id is kept on every finished run, so you can open a failed run in the harness to see what happened.
A metric the harness did not report is shown as -, never 0.
Stats
orkai workflow stats [dir=<path>] [from=<date>] [to=<date>] [group_by=harness|model|workflow|day]
[workflow=<id>] [harness=<name>] [model=<id>] [status=<state>] [--json]
Every run stores metrics on its result: tokens, cost, tool calls and durations. stats
aggregates them. A metric the harness did not report is absent, never 0. Nothing leaves the daemon. The default
range is the 30 days before to (default: now); dates are YYYY-MM-DD
or RFC 3339.
orkai workflow stats group_by=model from=2026-11-01 Permissions
A run works alone: nobody can approve a tool while it runs, so Claude Code denies any action that would need
approval. Choose the permission mode in the profile before the run. Reviews fit dontAsk
and developer workflows acceptEdits, with the tools a run may use listed in the run
folder's .claude/settings.json. The mode is also checked against this machine, at
profile set and at every run; orkai workflow harnesses marks the
modes this machine cannot use. The allow list, root and the machine policy work the same way as for a cycle run:
see Cycle run, Permissions.
Output and exit codes
The answer or the data goes to stdout; the final status goes to stderr.
| Exit | Meaning |
|---|---|
0 | Done, or the run succeeded |
1 | Daemon not reachable, license, or an error without a refusal code |
2 | Usage error (bad arguments) |
3 | Refused (the message says why) |
4 | The run failed |
5 | The run was cancelled or interrupted |
6 | The run is still running (--timeout ended, or result on a running run) |
Troubleshooting
| Message contains | Fix |
|---|---|
no .orkai.yaml in that directory | Run it from the project folder or pass dir=<project folder>. Create the project with orkai init. |
not found in project | The workflow or task is not in the project of dir. |
a run needs task=<id> or prompt=<text> | Pass task=<task-id>, prompt=<text> or prompt-file=<path>. |
has no run profile | orkai workflow profile set <workflow-id> harness=<name> model=<model> |
not found on PATH or in known install locations | Install the harness, or fix its PATH. orkai workflow harnesses shows what was found. |
is not supported | The installed version is outside Claude Code 2.x or OpenCode 1.x and 2.x. |
is not signed in | Claude Code: claude auth login. |
cannot use provider | OpenCode: connect the provider with /connect, or pick another model. |
is not available in | Pick a model from orkai workflow harnesses harness=<name>. |
is not valid for model | Use one of the variants listed for that model. |
is not available: | This machine cannot use that permission mode (for example bypassPermissions as root). Follow the reason, or pick another mode. |
is not allowed on this machine (config harness.permissionModes | Pick a mode the config lists, or change ~/.orkai/config.yaml and restart the daemon. |
runs are active; the limit is 8 | Wait for a run to finish, or orkai workflow run cancel <run-id>. Workflow, cycle and orkai work runs share this limit; a work step waits for a free slot instead of failing. |
The running daemon is older than this orkai | orkai stop && orkai start |
Where results live
Each run is a workflow_run entity in the project, with the answer as its text and the
metrics in its metadata. The raw harness output and the event log are under the daemon data folder, in
runs/<run-id>/. They are kept.
Runs started by orkai work are stored the same way. They do not show in the Office or in
History, and orkai workflow stats counts them.
After upgrading orkai, restart the daemon so it knows the new commands.
Daemon commands are on Daemon & MCP.