delegate-flow
Powerjackie/delegate-flow
A deterministic Workflow-engine runtime for delegate-kit subagent briefs: ownership-gated parallelism, schema-enforced returns, adversarial verification. Engine-first with a cross-tool prose fallback.
Instalação
npx convez-ai Powerjackie/delegate-flow1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.
Métricas
README
A tradução para o português deste README ainda está na fila.
delegate-flow
A deterministic, multi-tool runtime for delegated subagent work. delegate-flow takes a tool-agnostic protocol — self-contained briefs, file-ownership contracts, role output schemas (defined by our companion project delegate-kit) — and runs it two ways: a deterministic engine on Claude Code, and a portable mode on any other agent tool. Either way the rules are enforced by structure, not by hoping the main agent follows a convention by hand.
The protocol answers what to say to a subagent. delegate-flow answers how to run a fleet of them — deterministically where it can, portably everywhere else.
The two-layer model
| Layer | Owns | Where it lives | Failure it prevents |
|---|---|---|---|
| Protocol (from delegate-kit) | brief fields, file_ownership, role JSON schema, escalation rules | briefs/, schemas/ | context loss, output-shape ambiguity, write conflicts |
| Runtime (delegate-flow adds) | loops, parallel/pipeline fan-out, ownership gating, schema-enforced returns, resume, budget | flows/ | "soft" rules the model silently skips; unverifiable merges; wasted wall-clock |
Same briefs, two ways to execute them:
- Engine mode — Claude Code's
Workflowtool runs aflows/*.flow.jsscript. Control flow is JavaScript: the disjoint-ownership check refuses unsafe parallelism,agent({schema})enforces the return shape at the tool layer, and merges are code, not hand-parsing. - Portable mode — the same briefs and schemas drive any other tool (OpenCode, Codex,
a bare chat) via
prose/RUNBOOK.md. It trades the engine's determinism for universal portability; the protocol and contracts are identical.
Supported tools
| Tool | Mode | What you get |
|---|---|---|
| Claude Code | engine (Workflow) | full determinism — ownership gating, schema-enforced returns, resume, budget |
| OpenCode · Codex · any agent / bare chat | portable (prose/RUNBOOK.md) | the same briefs, schemas, and contracts, run by hand — portability over determinism |
Only the engine is Claude-Code-specific; the protocol layer (briefs/, schemas/) and
the contracts are tool-agnostic, so a brief written for one tool runs on the other.
Why this is more than either half
The protocol's rules are soft by design — enforced only by the model's compliance. In engine mode, delegate-flow makes three of them executable:
- Parallel safety. Protocol: "run in parallel only if
exclusive_writesets are disjoint." delegate-flow:lib/ownership.jscomputes disjointness andfanout-executethrows rather than dispatch an overlapping batch. - Output shape. Protocol: "every subagent MUST return this JSON." delegate-flow:
the schema is passed to
agent({schema}), so a wrong shape is retried by the engine — the main agent never parses a transcript. - Verification. Protocol: trust a returned research finding. delegate-flow:
research-verifyspawns an independent skeptic per finding and drops the unverified ones.
(In portable mode the same three rules hold, enforced by the operator following
prose/RUNBOOK.md rather than by the engine.)
Flows
| Flow | Shape | Use for |
|---|---|---|
fanout-execute | N executors in parallel, ownership-gated | apply several bounded, non-overlapping changes at once |
research-verify | research → adversarial verify pipeline | gather evidence you can actually trust |
review-panel | one reviewer per rubric dimension → merged scorecard | pre-merge audit with diverse coverage |
Quickstart (engine mode)
npm run build # = node tools/gen-schemas.mjs && node tools/build-flows.mjs
bash tools/check.sh # drift + sanity gate
Then, inside Claude Code, hand a bundled script to the Workflow tool:
Workflow({ scriptPath: "repos/delegate-flow/dist/fanout-execute.flow.js",
args: [ <executor brief object>, <executor brief object> ] })
Build the brief objects with the helpers in flows/lib/briefs.js
or fill the Markdown templates in briefs/. See
examples/ for a worked run.
Quickstart (portable mode — any other tool)
No build step, no Workflow tool. Open prose/RUNBOOK.md, fill a
template from briefs/, paste the matching contract from
schemas/ into the brief, and dispatch the subagent in OpenCode, Codex, or a
bare chat. You gate ownership and merge the returned JSON by hand, following the runbook —
same protocol, no engine required.
Layout
schemas/ role JSON Schemas — GENERATED from flows/lib/schemas.js (canonical)
briefs/ Markdown brief templates (protocol layer, human-fillable)
flows/ Workflow engine scripts (runtime layer)
lib/ schemas.js (source of truth) · briefs.js (brief→prompt) · ownership.js (parallel gate)
dist/ bundled, self-contained flows ready for the Workflow tool (generated)
prose/ RUNBOOK.md — run the same briefs on any tool, no engine
skills/ delegate-flow skill — picks engine vs prose, routes to a flow
tools/ build-flows.mjs · gen-schemas.mjs · check.sh
install/ per-platform installers
Two-layer toolchain
delegate-kit and delegate-flow are companion projects that split one job across two layers.
delegate-kit owns the tool-agnostic protocol — brief fields, file_ownership, role
schemas. delegate-flow owns execution — a deterministic engine on Claude Code plus a
portable mode for every other tool. They share one contract: when a brief field or the
output envelope changes in delegate-kit, mirror it in flows/lib/schemas.js /
flows/lib/briefs.js and run tools/check.sh to catch drift.
License
MIT — see LICENSE.