Workflows

Capture repeatable step-by-step practices as a visual flowchart your AI agent can follow.

OrkAI Workflows capture repeatable step-by-step practices as a visual flowchart your AI agent can follow — coding rituals, debugging recipes, agent-reasoning playbooks. Each workflow is a graph of typed steps (instructions, runnable code, conditional branches) rendered as an n8n-style canvas in the OrkAI web UI.

Unlike standards and skills (which are prose documents), workflows are structured graphs. There are two ways to use one:

  • Follow it from your agent. Your assistant loads the workflow over MCP, walks the nodes, branches on conditions and runs code steps itself, in your session. The agent is the runtime.
  • Run it from the CLI. orkai workflow run <workflow-id> dir=<path> has the daemon start a coding harness (Claude Code or OpenCode) headless, with the workflow's run profile, and keep the answer and metrics. See Workflow run. orkai cycle run does the same for every step of a cycle: see Cycle run.
  • Run it on a task. orkai work runs pending tasks in the daemon, each on the harness and model set on the task, with the task's workflow as the prompt. See Run it on a task.

What is a workflow?

A workflow is a node/edge graph stored as structured JSON (raw) with a markdown description (text) for semantic search. Each node is a typed step; edges define the flow between them. Workflows are category-scoped and lazy-loaded in overview() — only the title and description appear until you explicitly load the full graph.

Workflows are MCP-first: you create and manage them through your AI assistant. The web UI provides a read-only visual canvas for inspection.

Step types

Type Purpose Example
Text Instructions the agent reads and follows "Read the task details from orkai. Use search_code to find related components."
Code Runnable code the agent executes itself npm run lint, make build-orkai
Conditional If/else branch — agent evaluates and follows the matching edge "Does the request have a task in OrkAI?" → true / false

Text and code nodes flow sequentially to the next step. Conditional nodes have two outgoing edges: true (emerald, animated) and false (red, animated).

Create a workflow

Workflows are created through the MCP workflow tool. You describe the steps semantically; the backend auto-converts them into the xyflow graph:

workflow(action: "create",
  name: "Bug Report",
  description: "Triage and fix bugs end-to-end",
  category_ids: ["4c5996d0b1dac020d931388e834d5fc8"],
  raw: {
    steps: [
      { id: "repro", type: "text", label: "Reproduce", content: "Reproduce the issue..." },
      { id: "search", type: "code", label: "Search Code", content: "search_code(...)", language: "typescript" },
      { id: "decide", type: "conditional", label: "Root cause found?", condition: "Is the root cause identified?" },
      { id: "fix", type: "code", label: "Fix", content: "Implement the fix", language: "typescript" },
      { id: "handoff", type: "text", label: "Hand off", content: "Create a task and hand off to the role workflow" }
    ]
  },
  text: "## Steps\n1. Reproduce the issue\n2. Search indexed code...")

The raw field holds the structured graph; text is the markdown description used for semantic search. Both are required on create.

The visual canvas

The OrkAI web UI renders workflows as a read-only n8n-style canvas with three node types and three edge types:

  • Text nodes — blue, with the instruction content inline
  • Code nodes — emerald, with syntax-highlighted code
  • Conditional nodes — amber diamond, with the condition text

Edges are color-coded: default edges are gray, true-branch edges are emerald and animated, false-branch edges are red and animated. Nodes auto-layout horizontally (350px spacing); false branches drop 200px below. The canvas supports pan, zoom, minimap, and controls.

Find and load workflows

overview() surfaces workflow names and descriptions only — the full graph is lazy-loaded. To find a specific workflow:

workflow(action: "search", query: "bug triage")
workflow(action: "list", category: "orkai")
workflow(action: "get", id: "2a7926ce-3aa9-48c5-8fc4-ff444f023fcf")

get returns the full node/edge graph in raw and the markdown description in text. The agent then walks the steps, branches on conditions, and executes code steps itself.

Workflows vs skills vs standards

Workflow Skill Standard
Purpose Step-by-step practice Implementation pattern Engineering guideline
Structure Node/edge graph + markdown Prose document Prose document
Visual n8n-style canvas Text only Text only
Execution Agent walks nodes, branches, runs code Agent reads and applies Agent reads and enforces

Workflows are the only OrkAI knowledge type with a structured graph and branchable typed steps. Use them when the order of operations matters — skills and standards are better for reference material.

Typical workflow (from your agent)

  1. Agent sees a workflow in overview() (name + description).
  2. Agent loads the full graph with workflow(action: "get", id: ...).
  3. Agent walks the steps sequentially, reading text nodes and executing code nodes.
  4. At conditional nodes, the agent evaluates the condition and follows the matching branch.
  5. The agent runs code steps itself. orkai has no step engine of its own: when you run a workflow with orkai workflow run, the daemon starts a harness agent that does the same walk.

Run it on a task

orkai work picks up pending tasks in the daemon and works each one in its own git worktree. Every agent step (implementation, the gatekeeper review, a fix after the review, a commit retry and merge recovery) is a workflow run on a coding harness, Claude Code or OpenCode. The task's workflow is the prompt. The harness, model and variant come from the task, not from the workflow's run profile, and orkai never swaps one for another.

A task needs three keys before the worker picks it up. The rest are optional:

KeyMeaning
workflow_idThe workflow to run. Required.
harnessclaude-code or opencode. Required.
modelA model of that harness. Required.
variantA variant of that model. Empty or none means none.
review_harness, review_model, review_variantSettings for the review step. With none of them the review uses the implementation settings. With only review_model it keeps the implementation harness. review_harness needs review_model.

Take the harness, model and variant from orkai workflow harnesses (add harness=<name> for the models and variants), as on Workflow run. Set them on the Tasks page (the Assign harness and model dialog has an Implementation group and a Gatekeeper (review) group; "Review: same as implementation" clears the review keys), from the CLI, or with the tasks tool:

orkai update task --id <task-id> --workflow-id <workflow-id> --harness claude-code --model <model> \
  --review-harness opencode --review-model <provider/model>

tasks(action: "update", id: "<task-id>",
  metadata: { "workflow_id": "<workflow-id>", "harness": "claude-code", "model": "<model>" },
  category_ids: ["<project-category-id>"])

A task that has a model but no harness is skipped until a harness is set; orkai work dry-run says no workflow_id, no harness or no model, and orkai work doctor reports a pending task with a workflow_id and no harness as no_harness.

orkai work setup     # once: the task-evaluation LLM. Models are chosen per task
orkai work start     # needs an installed harness
orkai work dry-run   # what would run, and why a task is skipped
orkai work monitor   # live dashboard; the Agent tab shows the run
orkai work doctor    # health audit
orkai work stop
  • Every step runs in the harness's full-access mode, because nobody is there to answer a prompt. Claude Code uses bypassPermissions; OpenCode has no permission modes. A machine that does not allow the mode blocks the task (see Permissions).
  • worker.models in an older ~/.orkai/config.yaml still loads and is ignored.
  • Work runs share the limit of 8 active runs with workflow and cycle runs; a work step waits for a free slot. They do not show in the Office or in History, and orkai workflow stats counts them.

A task that cannot run is set to blocked with the reason:

MessageFix
task has no harness assignedSet harness.
task has review_harness ... but no review_modelSet review_model, or clear review_harness.
implementation settings rejected or review settings rejectedThe harness is not installed, the model or variant is not in its catalog, or the full-access mode is not available here. Check orkai workflow harnesses harness=<name> and fix the task.
workflow run ... failedThe run failed or was cancelled. Open the Agent tab of orkai work monitor for its events.
no harness is installed (when you start the worker)Install Claude Code or OpenCode.

See MCP for connecting your assistant, and Knowledge layer for how workflows fit into the broader knowledge graph.