orkai cycle run — run a cycle
Run an SDLC cycle on a coding harness. The cycle profile, steps, a judge, parallel nodes and fix loops, human pauses and resume, status, list, limits, exit codes and fixes.
orkai cycle run runs one of your SDLC cycles. The daemon walks the cycle's graph:
each step runs a workflow as a headless run on a coding harness (Claude Code or OpenCode), a judge decides
each branch, and the run pauses where the cycle needs you. A node can also run on 2 to 4 harnesses at once and
loop back to fix what its check finds (see Parallel nodes and fix loops). The run belongs to the daemon, so it keeps going
when the command that started it exits. The daemon must be running (orkai start).
A cycle is the path: which workflows, in what order, with which decisions. To write or follow a cycle without running it, see Cycles. For one workflow on its own, see Workflow run.
Start
orkai cycle harnesses
orkai mcp cycle action=list
orkai cycle profile set <cycle-id> harness=claude-code model=sonnet
orkai cycle run <cycle-id> dir=. prompt="add retry to the sync job" --wait The full form:
orkai cycle run <cycle-id> dir=<path> [task=<task-id>] [prompt=<text> | prompt-file=<path|->]
[harness=<name> model=<id> [variant=<v>] [permission_mode=<m>]]
[--wait | --follow] [--timeout <dur>] [--json] <cycle-id>is the id of a cycle in the project.orkai mcp cycle action=listprints them; run it in the project folder.diris required. It must hold.orkai.yamlwithproject.category_id, and the cycle, its workflows and the task (if you pass one) must belong to that project category.- A run needs input:
task=<task-id>,prompt=<text>orprompt-file=<path|->(-reads stdin), or a task plus a prompt. The prompt is limited to 262144 bytes. harness=andmodel=go together and set the default for this run instead of the cycle profile (see The cycle profile). The judge uses the default, and so does every step whose workflow has no run profile of its own.variant=andpermission_mode=are optional. A workflow's own run profile (orkai workflow profile set) wins over the default for its step. Leave all four out to use the cycle profile.- No flag: prints the run id and returns.
--waitwaits until the run finishes or needs you and prints the answer.--followprints every event as one JSON line, then one last line with the result.--timeout 30mstops waiting, not the run, and needs--waitor--follow. - These combinations are usage errors (exit 2):
promptwithprompt-file,--waitwith--follow,--jsonwith--follow,--timeoutwithout--waitor--follow, andvariant=orpermission_mode=withoutharness=andmodel=. - Before anything starts, orkai checks every harness, model and permission mode the run will use, on this machine. A refusal names the step. The run prints each workflow's harness, model and mode on stderr before it waits, with where each came from (
profile,commandorcycle default);statusshows them again.
Every command answers --help:
orkai cycle --help
orkai cycle run --help
orkai cycle run resume --help The cycle profile
A cycle can carry a default run profile: a harness, a model and, optionally, a variant and a permission mode.
You set it once and every orkai cycle run of that cycle uses it. The judge uses it, and
so does every step whose workflow has no run profile.
orkai cycle harnesses [harness=<name>] [dir=<path>] [--json]
orkai cycle profile show <cycle-id> [--json]
orkai cycle profile set <cycle-id> harness=<name> model=<id> [variant=<v>] [permission_mode=<m>] [dir=<path>]
orkai cycle profile clear <cycle-id> [dir=<path>] orkai cycle harnessesprints whatorkai workflow harnessesprints: the installed harnesses and, withharness=<name>, the models and variants you can pick.profile setchecks that the harness is installed, the model is in its catalog, and the variant and the permission mode are valid, with the same refusals asorkai workflow profile set. It does not check sign-in; the run does. A refusedsetsaves nothing.profile showprints the profile orno run profile.profile clearremoves it.- The Dev Cycle page of the web UI sets the same profile: the Assign harness and Assign model icons on a cycle card, with badges for what is set.
orkai mcp cycle action=get id=<cycle-id>carries arunblock with the command to run it when the cycle has a profile.
Which profile a step or judge gets:
| Node | Uses, in this order | Source shown |
|---|---|---|
| Step | its workflow's run profile | profile |
| Step with no workflow profile | harness= and model= on the command, else the cycle profile | command, cycle default |
| Judge | harness= and model= on the command, else the cycle profile | command, cycle default |
| Parallel run of a node | the run= of the node settings | node |
| Join workflow of a node | its workflow's run profile, else the default | profile, command, cycle default |
| Built-in join of a node | the default | command, cycle default |
- Only the cycle you start counts. The profile of a child cycle is ignored inside a run.
harness=andmodel=on the command replace the whole stored default for that run. Itsvariantandpermission_modedo not carry over: withoutpermission_mode=the harness default applies (Claude Code:plan), even if the cycle profile namesdontAsk. Passpermission_mode=as well to keep a mode. The stored profile does not change.- The run keeps the default it started with. Changing or clearing the cycle profile later does not affect a run that is running or waiting.
- With no default anywhere, a step whose workflow has no run profile, or a judge, is refused (see Troubleshooting).
What the daemon runs
The daemon reads the cycle's graph (nodes and edges in its raw):
| Node | What the run does |
|---|---|
node-text with one workflow get line | Step. Runs that workflow as a workflow run, on the workflow's run profile or the default. |
node-text with one cycle get line | Child cycle. Walks that cycle, then continues after this node. A run can chain at most 3 cycles, the starting cycle included; a cycle cannot contain itself. |
node-text without a get line | Records its text and moves on. With no outgoing edge it ends that cycle: in the starting cycle the run ends, in a child cycle the run continues after the child node in its parent. |
node-conditional | Judge. The default harness answers true or false; the true or false edge is taken. |
node-conditional with data.human set to true | Gate. The run pauses and you answer true or false. |
Any node with no outgoing edge ends its cycle, a step or a child cycle as well as a text node: in the starting cycle the run ends, in a child cycle the run continues after the child node in its parent. A cycle whose last node is a step (like closeout) ends after that step.
A cycle can run only if its graph is sound: exactly one start node (a node with no incoming edge), at most one
get line and one outgoing edge on a node-text node, exactly one true and one false
edge and a condition text on a node-conditional node, every referenced workflow and
cycle in the project, and no other node types (node-code is not supported).
Otherwise the run is refused before it starts with cycle <name> cannot run: and
one problem per node.
A step
- The step is given the workflow's steps, the node's own text as step instructions, the task and the prompt, and the answers of the earlier steps in this run (each cut to 8192 bytes at a character boundary; the oldest are dropped to stay within 65536 bytes).
- It ends with a verdict,
passorfail. A reply without a verdict is asked once more for it on the same session, when there is a session and the harness can resume it (Claude Code and OpenCode can); if there is still none, the verdict isnone. The verdict is recorded and shown to later steps and judges. It does not stop the run, unless the node has on fail settings (see Parallel nodes and fix loops). - When the workflow run itself fails, is cancelled or cannot start, the run fails with
step_failed. Open it withorkai workflow run status <workflow-run-id>;orkai cycle run statuslists the workflow run ids of each step. - A step can ask you a question (see Pauses).
A judge
The judge runs on the default harness in the harness's most restrictive mode (Claude Code:
plan) and is told not to change any file. It reads the condition, the cycle input and
the steps so far, and answers true or false with one sentence of reason. If the answer cannot be read after 2
attempts the run fails with condition_unresolved. If the judge's workflow run itself fails, is cancelled or cannot start, the run fails with step_failed. A cycle with a judge needs
a default: the cycle profile, or harness= and model= on the
command. Without one the run is refused with
node <id> is a condition and needs a default harness and model; set one with orkai cycle profile set <cycle-id>, or pass harness= and model=.
Parallel nodes and fix loops
Node settings are run settings stored on the cycle, one entry per workflow node or cycle node (a
node-text with exactly one workflow get line or one cycle get line). A judge, a gate or
a text node takes none. You set them on the Dev Cycle page or with orkai cycle node; an
agent does not choose them, and the cycle MCP tool does not write them. A node without
settings runs as described above.
orkai cycle node show <cycle-id> [node=<id>] [--json]
orkai cycle node set <cycle-id> node=<id> [run=<harness>:<model>[#<variant>]]...
[join=builtin|<workflow-id>] [on_fail=continue|stop|loop]
[target=previous|<node-id>] [max_attempts=<n>] [dir=<path>]
orkai cycle node clear <cycle-id> node=<id> [dir=<path>] Review on two harnesses, and go back to the step before it when the join finds a real problem:
orkai cycle node set <cycle-id> node=code-review run=claude-code:sonnet run=opencode:<provider>/<model> on_fail=loop target=previous
orkai cycle run <cycle-id> dir=. task=<task-id> --wait node=<id>is the node id in the cycle's graph (raw).setreplaces the whole entry of that node;clearremoves it and printsnode <id>: no settings;showprints one block per node (parallel:,join:,on fail:), orno node settings.diris optional: the cycle's own project is used without it.run=<harness>:<model>[#<variant>], given 2 to 4 times, makes the node parallel, for exampleclaude-code:sonnetoropencode:ollama/glm-5.3:cloud#high. The first:ends the harness name and#starts the variant. Each run is checked like a run profile, and two identical runs are refused. Norun=means the node does not run in parallel.join=builtin(the default) orjoin=<workflow-id>, a workflow of the cycle's project. It needsrun=.on_fail=continue|stop|loop. Without it a fail continues.target=previous|<node-id>andmax_attempts=<n>apply only toloop.- A refused
setsaves nothing. The refusals (exit 3) name the problem:is not a workflow or cycle node of cycle,parallel needs 2 to 4 runs,repeats run,join workflow ... not found in project,a parallel cycle node cannot pause(the child cycle has a human gate),parallel nodes cannot nest,on_fail loop needs a target,a node cannot loop to itself,max_attempts must be 1 to 5,target and max_attempts apply only to loop. - The run copies the settings when it starts. Changing or clearing them later does not affect a run that is running or waiting.
A parallel node
- Every run works on the same node: a workflow node runs its workflow once per run, a cycle node walks its child cycle once per run (the steps and judges inside use that run's harness, model and variant). The runs are blind: each gets the task, the prompt and the answers of the steps before the node, never another run's answer. A run is told not to ask questions.
- Each run works in its own copy of the project: a git worktree of
diratHEADwith your tracked changes and the untracked files git does not ignore. Ignored folders (node_modules, build caches) are not copied, so a run installs what it needs. A run uses the harness's full access mode (Claude CodebypassPermissions; OpenCode has no modes), so it can build and test. Its edits stay in the copy and are deleted with it. The copy is a separate working folder, not a sandbox: orkai starts the run there and does not stop a full access run from writing elsewhere by absolute path. Use parallel nodes only where you accept running the harness in its full access mode. Every copy is deleted when the node ends, and after a cancel or a daemon stop. - A run that fails is recorded as failed and the join sees it. If every run fails, the run ends
step_failedwithevery parallel run failed. - The join decides which findings are real. The built-in join is a judge on the run's default harness, in its own copy of the project with the full access mode: it reads the check (the workflow text and the node's instructions, or the workflows of the child cycle) and every run's answer, may run commands to confirm a finding, adds no criteria the check does not state, and ends with
passorfail. A join workflow does the same on its own run profile, else the default, and ends with a verdict like a step. The join needs the default harness and model unless it is a workflow with its own profile. - The verdict of the node is the verdict of the join. The node's answer is the verdict, the confirmed findings and the join's reasoning.
On fail
on_fail applies when the verdict of the node is fail. A
pass, or a step that gave no verdict (none), moves on.
continue: the run moves on.stop: the run fails withnode_failed. Its answer is the confirmed findings andEnded at <path>..loop: the run goes back totarget, the previous step (the step that finished before this node in the same cycle) or a node of the cycle, with a## Fix requestsection in its prompt: the failed check, the attempt number and the confirmed findings. Then the cycle runs forward again and reaches the checking node again.max_attemptsis 1 to 5, default 2. It counts the loops back: with 2, the node runs at most 3 times, and the next fail ends the run withfix_limit(node <id> failed 3 times; the limit is 2) and an answer that lists the findings and each attempt. The count starts again when the node passes.- A single workflow node (no
run=) can takeon_failtoo: its own verdict is the check. A single cycle node withstoporloopis checked by the built-in join over the answers of the child cycle. - Every visit counts toward the 100 nodes a run may visit.
Stop codes of these settings, in the error: line of status:
| Code | When |
|---|---|
node_failed | A node with on_fail=stop failed its check. |
fix_limit | A node failed more often than max_attempts allows. |
no_fix_target | target=previous and no step finished before the node in its cycle. |
join_unresolved | The join did not answer pass or fail after 2 attempts. |
Refused before it starts
A run is refused (exit 3), with no run started, when:
- a node's settings are not valid for the cycle as it is now: the message starts
cycle <name> cannot run:and names the node; node <id> has a built-in join and needs a default harness and model: set the cycle profile or passharness=andmodel=;node <id> is parallel and needs dir to be inside a git repository with at least one commit;node <id> run <n>: permission_mode bypassPermissions is not available: ...(oris not allowed on this machine): the machine does not allow the full access mode for that Claude Code run or join; see Permissions.
Settings of a node that is no longer a workflow node or a cycle node are skipped, and
status lists them as unused settings: <node ids>.
In the status
While a node runs in parallel, orkai cycle run status shows
parallel <path> and one line per run
(run <n> <harness>/<model> <status> <verdict>); a run that ended at the node shows
stopped at parallel <path> with the error of each failed run. The trail has
parallel and join rows and
fix attempt <n> → <node> rows; the profiles block lists each run as
branch with source node. In the usage totals every parallel run
counts under steps and every join, a join workflow too, under judges.
events adds branch_finished and fix_requested.
On the Dev Cycle page
Open a cycle from its card (View). Each workflow or cycle node has a Settings button that opens
Node settings: Parallel runs (a checkbox, 2 to 4 runs each with a harness, model and variant, Add run,
Remove, and Join: Built-in or a workflow of the cycle's project) and On fail (Continue, Stop and report, Loop back,
with Target and Max attempts). Save, Clear and Cancel close it. The daemon's refusal shows under the section it
belongs to. Nodes with settings show ×n and one chip per run; a dashed line labeled
on fail ↺ <n> marks a loop. The graph itself stays read-only.
Pauses
A run waits for you at a gate, or when a step asks a question. The run then holds no process.
waiting for you: run <run-id> seq <n> (gate) at <path>
<question>
answer: orkai cycle run resume <run-id> seq=<n> answer=true|answer=false
For a question from a step the kind is (conversation) and the third line is
answer: orkai cycle run resume <run-id> seq=<n> text="...".
- Gate. The question is the node's condition. Answer with
answer=trueoranswer=false, and an optional note intext=. - Conversation. A step that cannot continue without an answer replies with only a question. Answer with
text=<reply>ortext-file=<path|->(at most 65536 bytes); the step continues on the same session. A step may ask at most 5 questions (ask_limit). A step can ask only when its harness can resume a session (Claude Code and OpenCode can); otherwise it is told not to ask. seqis the pause number the block shows. Answering any other number is refused, so an old answer cannot land on a new question.orkai cycle run resume <run-id> seq=<n> ... --wait(or--follow) continues and waits for the next finish or pause.- A waiting run survives a daemon restart and resumes from its state file. A run that was running when the daemon stopped becomes
interrupted. --wait,waitandresulton a waiting run print the block above and exit 7.
The answer
A finished run's answer is the answer of the last step that finished, then
Ended at <path>., then the instructions of the end node when it has any.
orkai cycle run result <run-id> prints it.
Check a run
orkai cycle run status <run-id> # status, folder, profiles, where it is, the trail of every step, judge and gate
orkai cycle run wait <run-id> [--timeout <dur>]
orkai cycle run events <run-id> [after=<seq>] [--no-follow]
orkai cycle run result <run-id>
orkai cycle run cancel <run-id> # a running or waiting run
orkai cycle run list [dir=<path>] [--waiting] [--running] statusshows the harness, model and permission mode of each workflow and of the judge, and under each step and judge its workflow run ids, mode, tokens and cost, then the totals. A waiting run also shows the question and the command that answers it.eventsprints JSON lines until the run finishes or waits for you;--no-followprints what exists. Event types:run_started,frame_entered,frame_exited,step_started,step_finished,condition_decided,paused,resumed,run_finished,fix_requested,branch_finished.listshows the runs of a folder, newest first:
RUN CYCLE STATUS SEQ AT
<run-id> closeout waiting_for_human 2 Closeout › n7
<run-id> implementation running - Code Review AT is where the run is: the pause path while it waits, the current path while it runs,
empty when it has ended. The question is in status, wait and
result. --waiting shows only runs that wait for you,
--running only running runs; both together show both. --json prints JSON.
A run is running, waiting_for_human, then
succeeded, failed, cancelled or
interrupted. A failed run's status has an
error: line with a code: step_failed,
condition_unresolved, ask_limit,
no_session, step_limit, node_failed, fix_limit, no_fix_target, join_unresolved or internal.
Limits
| What | Limit |
|---|---|
| Cycle runs running at once (a waiting run does not count; starting or resuming one needs a free slot) | 4 |
| Nodes one run may visit | 100 (a loop that does not end stops with step_limit) |
| Cycles in one chain, the starting cycle included | 3 |
| Questions one step may ask | 5 |
Reply (text, text-file) | 65536 bytes |
| Prompt | 262144 bytes |
| Runs of a parallel node | 2 to 4 |
Fix attempts of a node (max_attempts) | 1 to 5, default 2 |
Workflow runs active at once, all features together: cycle steps and judges, standalone orkai workflow run and orkai work steps (a run that cannot start waits for a free slot) | 8 |
Permissions
A run works alone, so the permission mode is chosen before it starts. Each step runs in its workflow's mode,
else in the permission mode of the default (permission_mode= on the command, else the cycle profile's); judges always run in the harness's most
restrictive mode. The runs and the join of a parallel node are the exception: they run in the harness's full access
mode in their own copy of the project (see Parallel nodes and fix loops). Reviews fit dontAsk and developer workflows
acceptEdits. List the tools a step may use in the run folder's
.claude/settings.json; with dontAsk everything else is denied:
{"permissions": {"allow": ["Bash(git diff:*)", "Bash(git status)", "Bash(git log:*)", "Bash(make test-short:*)", "mcp__orkai"]}} mcp__orkai allows every orkai MCP tool, reads and writes. That fits review steps;
narrow it for a cycle you do not trust.
Claude Code splits a command at &&, ||,
; and | and needs every part to be allowed, so a rule for
make test-short does not cover make test-short | tail. Run the
command without the pipe, or allow each part.
A mode this machine cannot use is refused before the run starts. Claude Code refuses
bypassPermissions when it runs as root, unless IS_SANDBOX=1 or
CLAUDE_CODE_BUBBLEWRAP is set. The harness runs as the daemon's user, so when the daemon
runs as root (common on a VM) orkai refuses that mode. Run the daemon as a non-root user, start it with
IS_SANDBOX=1 orkai start only on a machine you treat as a sandbox, or use
acceptEdits with the allow list. ~/.orkai/config.yaml can also
restrict the modes each harness may use on this machine; restart the daemon after editing:
harness:
permissionModes:
claude-code: [plan, dontAsk, acceptEdits]
orkai never changes a mode silently. Agents can load the Orkai Help document
doc-run-permissions for the same rules and the refusal messages.
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) |
7 | The run is waiting for you (answer it with resume) |
Troubleshooting
| Message contains | Fix |
|---|---|
no .orkai.yaml in that directory | Run it from the project folder or pass dir=<project folder>. |
not found in project | The cycle, a workflow it references or the task is not in the project category of dir. |
cannot run: | The cycle graph is not sound. The message lists each problem with its node; fix the cycle. |
references itself or nest deeper than | A cycle contains itself, or more than 3 cycles are chained (the starting cycle counts). |
a run needs task=<id> or prompt=<text> | Pass task=<task-id>, prompt=<text> or prompt-file=<path>. |
harness and model go together | Pass both harness= and model=, or neither. |
cannot be used together, cannot be used with, --timeout requires or need harness= and model= | Drop the conflicting argument; see Start. |
has no run profile and the cycle has no default | Set the cycle profile with orkai cycle profile set <cycle-id> harness=<name> model=<id>, or pass harness= and model= on the run, or orkai workflow profile set <workflow-id> .... |
is a condition and needs a default harness and model | The cycle has a judge: set the cycle profile (orkai cycle profile set <cycle-id> ...) or pass harness= and model=. |
cycle id required | orkai cycle profile show, set and clear take the cycle id first. |
is not available: | This machine cannot use that permission mode. Follow the reason in the message, 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. |
cycle runs are active; the limit is 4 | Wait for a run to finish, or orkai cycle run cancel <run-id>. |
is not waiting (status | The run is not at a pause; check orkai cycle run status <run-id>. |
is not waiting on seq | The pause moved on. The message names the current seq and kind; answer that one. |
is a gate; pass answer=true or answer=false | A gate takes answer=. A conversation takes text= or text-file=. |
workflow run ... failed (code step_failed) | Open the step's workflow run: orkai workflow run status <workflow-run-id>. |
the judge did not answer true or false (code condition_unresolved) | Make the condition a question that can be answered true or false from the steps so far. |
the step asked more than (code ask_limit) | One step asked more than 5 questions. Give the run a fuller task or prompt, or rewrite the step's workflow so it asks less. |
the run reached (code step_limit) | The run visited 100 nodes. A cycle whose judge or gate edge leads back to an earlier node can loop; check those edges. |
failed its check (code node_failed) | A node with on_fail=stop failed its check. orkai cycle run result <run-id> prints the confirmed findings; fix them and start a new run, or set the node to loop: orkai cycle node set <cycle-id> node=<id> ... on_fail=loop target=previous. |
times; the limit is (code fix_limit, for example node n1 failed 3 times; the limit is 2) | The node still failed after max_attempts fix loops. result lists the findings and each attempt. Fix the cause, or raise the limit with orkai cycle node set (repeat the node's other arguments; set replaces the whole entry). |
no earlier step in this cycle to loop back to (code no_fix_target) | target=previous has no step before the node. Name a node: target=<node-id>. |
the join did not answer pass or fail (code join_unresolved) | The join ended without a verdict twice. Use the built-in join (join=builtin), or make the join workflow end with a verdict. |
every parallel run failed (code step_failed) | Every run of a parallel node failed or could not start; status shows each run's error. Check orkai cycle harnesses and the sign-in of each harness. |
has a built-in join and needs a default harness and model | Set the cycle profile (orkai cycle profile set <cycle-id> ...) or pass harness= and model=. |
is parallel and needs dir to be inside a git repository with at least one commit | Run from a folder inside a git repository that has a commit; parallel runs work in git worktrees. |
is not a workflow or cycle node of cycle | node= must be a node with one workflow or cycle get line; read the node ids in the cycle's raw. |
a parallel cycle node cannot pause or parallel nodes cannot nest | The child cycle of a parallel cycle node has a human gate or a parallel node. |
daemon restarted during the run | The run was running when the daemon stopped. Start a new run. A waiting run is not affected. |
The running daemon is older than this orkai | orkai stop && orkai start |
Where results live
Each run is a cycle_run entity named Cycle run: <cycle name>
in the project category, with the answer as its text and the status in its metadata. Each step and judge is also a
normal workflow_run entity. The run's state and its events are under the daemon data
folder, in cycle-runs/<run-id>/ (state.json,
events.ndjson). They are kept. The worktrees of a parallel node are under
cycle-runs/<run-id>/worktrees/ and are deleted when the node ends.
After upgrading orkai, restart the daemon so it knows the new commands.
Daemon commands are on Daemon & MCP.