Skip to main content
<DelegationChain> is the composite behind the delegation-chain workflow: a <Sequence> of seven phases in <Parallel> with a live-edit signal listener. Each phase re-derives its slice of the delegation tree from the dc* output rows on every render, so fan-out materializes level by level, and edits or probe findings replan the affected subtree without a restart.
Register delegationSchemas in createSmithers and pass the matching outputs subset. Tiers are labels only: missing ones fall back to the nearest configured tier in tierOrder. Setting budget.maxMinutes wraps the chain in <Aspects> with a wall-clock latencySlo; dollar budgets are enforced by per-leaf guard tasks over rolled-up dcExec actuals (hard error over the limit, warning row at 80%).

Phase composites

Each phase is exported separately for standalone use and takes DelegationSharedProps plus the extras noted:

Output tables

delegationSchemas (from smthrs) registers every table; DelegationOutputs is the matching prop shape. dcApproval needs an approvalPolicy, dcBudget needs a budget, and dcScore needs run-level scorers.

Physical node ids

Every task id follows dc:<logicalId>:<phase> (idPrefix defaults to dc). Logical ids are /-separated paths (root/core/reducer); physical ids encode the / as : because node ids only allow [a-zA-Z0-9:_-]. Row logicalId fields keep the / form. Phases:
  • Goal: dc:goal:forecast, dc:goal:forms:question-<seq>, dc:goal:question-<seq> (the durable human answer), dc:goal:goal, dc:goal:approve
  • Planning: dc:<logicalId>:plan, replan versions dc:<logicalId>:plan-<k>
  • Previews: dc:<logicalId>:preview
  • Gates: dc:<logicalId>:gates
  • Derisk: dc:<logicalId>:probe-<n>, dc:<logicalId>:replan-<k>
  • Execution: dc:<logicalId>:exec, dc:<logicalId>:review-<i> (reviews then checks, in declared order), dc:<logicalId>:approval-<i>, dc:<logicalId>:dev-preview (then dev-preview-2, …), dc:<logicalId>:budget
  • Scoring: dc:root:score, dc:root:poll

Signals

Two fixed durable signal names (exported as DC_EDIT_SIGNAL and DC_SKIP_PREVIEW_SIGNAL):
  • dc-edit with payload { editId, logicalId, editedOutput, note? }. Each delivered edit writes a dcEdit row that the derisk loop treats like a plan-changing probe finding.
  • dc-skip-preview with payload { skipped: true }. Once a dcSkip row exists, no further preview tasks mount.

Gates

A dcGates row declares an ordered list of gates:
Review gates receive the node’s output and dcExec.commitRange, with instructions to inspect the commits themselves; chunk-level reviews get the union of their subtree’s ranges (exec agents wrap with the exported withCommitRange, measuring the working-copy commit before and after the attempt: jj first, git fallback). preview gates build a developer preview after execution; builtOk: false fails the attempt like a failed review. The gates prompt requires the root node to declare a slideshow preview, so a run always ends showable.

UI side

smthrs/gateway-react exports the matching read model: useDelegationChain folds a run’s dc* rows into a DelegationGraph (nodes with status, versions, attention rollups, budget rollup, phase) and returns submitEdit, skipPreviews, answerHuman, and submitPoll. The pure reducer foldDelegation is exported for tests and non-React use.

Notes

  • Approval gates require outputs.dcApproval; <DelegationExecution> throws INVALID_INPUT if the policy produced approval gates without it.
  • dcPlan.orchestration ("tasks" | "workflow") is reserved for higher-order orchestration (a node authoring its own workflow as its execution strategy); accepted but ignored today. The fold store behind useDelegationChain runs on Effect.ts behind the frozen hook signature.
  • Scoring wiring: scorers.exec / scorers.review ride the exec and review tasks; scorers.run rides the digest task. The delegation scorers live in smthrs/scorers (see scorer reference).