ADR 0014doc/{zh,en}/adr/0014-starlark-workflows.md
ADR 0014: Workflows in Starlark, Judged by the Host
Status: proposed, 2026-11-26.
Status: proposed, 2026-11-26.
Context
The workflow runtime (external-runtimes.md R4) runs a YAML list of five step kinds with a template language. It cannot branch: there is no early exit, no question to a person when reviewers disagree, and no fixing a failing check before reviewing again. Each new need becomes another template variable. It also keeps its own copy of a goal's state, beside the Host's goal, and decides on its own when the goal has ended, in order to write the summary.
Decision
- A workflow's control flow is a Starlark script (
go.starlark.net, pure Go). It runs in a sandbox: noload, no file, network, clock or randomness access, nowhileor recursion, and a step cap. The script reaches the Host only through keyed calls:run,parallel,check,shell,chat,ask,progress,attach,stop. A run that restarts replays the script, and each keyed call returns its stored outcome. The step language is removed. - The Host stays the judge (the owner's answer, 2026-11-26). A script with
round(ctx)runs as a goal, one round per run, and the Host judges each round from its own records: the last run of each check command in the tool ledger, and the replies of its reviewer children. A script cannot declare its goal met; it may onlystop(reason), which blocks the goal. - The Host owns the goal's plan and state:
goals.planfreezes the script and the call when the goal is set, andgoals.round_datakeeps what each round returns (plugin.Result.Data). The workflow's private goal files go. - A final run: when a goal on a workflow ends, the Host starts one more run on that workflow with the end state (
RunInput.Goal), for the script'sreport(ctx). - External runtimes' usage counts against the goal's budget, not only in the call audit.
Consequences
- ◆One new pure-Go dependency, BSD-3-Clause, with no other runtime and the same build on all three systems.
- ◆Old
steps:configurations are refused with a pointer to the shipped.starscripts. Only the owner's bot and the acceptance apps use them, and they move together. - ◆Sub-agents stay in the agent. A workflow can run an
agentinstance as a runtime. Moving sub-agents onto Host children is a later decision, made when a scenario needs it. - ◆Static and natural-language workflows share the engine: the assistant may write a script and start it with
run_workflow, after the person approves it on a card; the Host judges it like any other. The kernel gains one narrow port for it,plugin.SelfStarteron a tool host: a plugin that is also a runtime starts its own instance in the call's conversation, as a goal or one run, with the plan frozen (goals.plan,runs.plan). - ◆The step language is deleted with no compatibility path; every existing workflow moves in the same change.
- ◆Not decided here: per-call model, effort, tools or instructions; they have no scenario yet.
- ◆This is the fourteenth ADR, past the v1 guideline of about ten. The owner chose the Starlark direction on 2026-11-26.
Design: Workflows in Starlark.