Skip to content

[Feature]: let an agent write a workflow script the runtime executes — phases, not an LLM loop #15012

Closed as not planned

Description

@Tauri-EPO

Problem or use case

Orca can already spawn workers. What it cannot do is: ask any agent “run this as a staged workflow,” have it write a script, and have a runtime execute that script so later stages open or skip from data — without an LLM sitting in the loop.

That is the useful part of Claude Code dynamic workflows: the plan lives in code. The conversation only sees the answer. You can watch phases. You can save the script and rerun it.

Today the glue is still an LLM turn (task-create → worker-start → check --wait → decide next). Automations are one prompt on a cron. A review that should be “audit; if findings, verify; else stop” is English in a coordinator prompt, or a hand-written CLI loop.

The missing product is the authoring loop. Ask once. The agent writes a small script. A non-LLM runtime runs it. Conditional stages are JavaScript.

Proposed solution

A bundled skill plus a small runtime. The user asks any Orca agent. That agent writes a JavaScript file and starts it. The runtime is not a coordinator LLM.

Skill (orca skills get workflow): on “staged / compartmentalized / use a workflow,” write the script, show the planned phases, then orca workflow run <name>.

Storage

  • project: .orca/workflows/<name>.js
  • personal: ~/.orca/workflows/<name>.js

Project wins on name clash. Folder workspaces are first-class.

Runtime executes the script. v1 globals:

  • export const meta = { name, description, phases }
  • phase(name) — observability
  • agent(prompt, options?) — one isolated LLM step; schema → structured JSON
  • parallel(thunks) — barrier
  • log(...), args

Control flow is plain JavaScript. Verify does not run when Review returned no findings.

agent() is a headless one-shot CLI, in the worktree or folder cwd — not a TUI tab. The step ends when the process exits. Stdout is the result (--output-format json / equivalent). Per vendor, reuse the non-interactive argv table Orca already keeps (claude --print / -p, codex exec, Cursor agent -p, …). Omit agent / model to inherit the session; pin with { agent: 'codex', model: '…', effort: 'high' }.

Provenance is a Run-scoped step record (prompt hash, exit, stdout, model) — not a Dispatch tied to a pane. Permission policy for the one-shot must be explicit (e.g. accept-edits, no extra MCP); related: #14999.

Step kind How it runs
LLM judgment (review, verify, refute) Headless CLI (default)
Mechanical (scan, git, test) spawn, zero LLM — v1 can wait
Long interactive implementation, or a vendor with no print mode Opt-in { interactive: true } → terminal

This is not coordinator-start. The script names every spawn. The runtime does not infer worktrees or conflicts.

Sketch:

export const meta = {
  name: 'pr-review',
  description: 'Review a PR; adversarial verify only if findings exist',
  phases: ['Review', 'Verify'],
}

const review = await agent('Review this PR. Return findings[].', {
  schema: {
    type: 'object',
    required: ['findings'],
    properties: { findings: { type: 'array' } },
  },
})

if (!review.findings.length) return { proceed: true, findings: [] }

phase('Verify')
const checks = await parallel(
  review.findings.map(
    (f) => () =>
      agent(`Try to refute: ${f.title}`, {
        schema: { type: 'object', required: ['refuted'] },
      })
  )
)
return { findings: review.findings, checks }

Visibility: a run view (CLI + a simple panel) listing phases: running / skipped / done, skip reason, drill-in to each agent() stdout. Not a canvas.

v1 bounds: single-digit concurrency. No auto-trigger on every prompt. First launch shows phases and asks. The script coordinates; it does not get a general filesystem/shell.

Compatibility: optional RPC fields only; no new stream opcode. Windows: no bash-only runner; one-shot CLIs must not flash a console. SSH: cwd + credentials on the host that owns the workspace; no new cross-host scheduler.

Alternatives or additional context

  • #11229 — YAML + visual builder + cron. Complementary. Agents write if, not a predicate DSL.
  • #11378 — fixed SDLC stages in orca.yaml, not a per-task script.
  • Skill-only, no runtime — the coordinator still emulates stages. That is today’s loop.
  • Always a TUI worker — isolation does not need a tab; completion should not depend on worker_done.

Activity

  1. added
    enhancement
    on Sep 19, 2026
  2. added theissue type on Sep 19, 2026
  3. Gabrielgvl commented on Oct 14, 2026

    @Gabrielgvl

    +1. We use Claude Code's Workflow tool for research fan-outs: parallel sweeps, then an adversarial verify step for each sweep, then a synthesis, 9 agents in total. We are now planning the same shape on Orca workers. Two needs drive that: routing per step (a cheap model where it is enough, a different provider for the verifiers) and acceptance checks beyond schema validation.

    Some notes from that planning, each checked against the v1.4.221 source:

    • If agent() maps to a Dispatch rather than a one-shot step record, the runtime can poll Task and Dispatch state without consuming the coordinator mailbox. worker_done settles both before the message is acknowledged, and task.result keeps the normalized report.
    • Native completed only means the worker reported success. A successful report promotes --deps dependents immediately. A runtime that gates later phases on results needs its own acceptance step before dependents start.
    • Resume: a positional prefix cache (Claude Code's approach) does not map cleanly onto Dispatches. Stable step keys, reconciled against task-list and worker-show, plus request-show for lost mutations, look safer.
    • Concurrency has to be explicit. worker-start has no cap. On our Linux host, one OOM kill inside the daemon's scope took down every session.

    One question: would the headless one-shot path let each step choose agent, model and effort for pi and devin as well? Today that is the case where we fall back to attaching our own terminals.

  4. Tauri-EPO commented on Oct 31, 2026

    @Tauri-EPO
    ContributorAuthor

    Closing as not planned. Orchestration v3 (#36137) moved the loop to Orca waking the coordinator when workers report, and its guide tells agents not to run watch scripts, because a script's plain check takes the coordinator's mail. A runtime-executed workflow script would work against that model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions