| 1 | --- |
| 2 | type: idea |
| 3 | id: ida-eac723e |
| 4 | status: adopted |
| 5 | title: The outcome DAG as a generative scheduler — the full sketch |
| 6 | created: 2026-07-02 |
| 7 | source: PR #1 |
| 8 | --- |
| 9 | |
| 10 | # The outcome DAG as a generative scheduler |
| 11 | |
| 12 | > Thin form: |
| 13 | > [architecture.md § the knowledge graph read generatively — an outcome DAG](../../design/architecture.md#bet-the-knowledge-graph-read-generatively--an-outcome-dag). |
| 14 | > This node carries the full sketch from PR #1's `design/outcomes.md` (plus the outcome-vs-bug |
| 15 | > material from its `design/knowledge.md` changes), preserved at full fidelity; the mechanics below |
| 16 | > return as a design doc when rung S3+ of the [scenario ladder](../../design/user-scenarios.md) is |
| 17 | > the top priority. |
| 18 | |
| 19 | the-valley is a **recursive, transparent outcome-production engine**. The unit it works in is the |
| 20 | _outcome_: a thing someone wants to exist that does not yet. Outcomes chain and recurse — "add this |
| 21 | code to the VCS" is an outcome that is part of "deliver a feature users love to prod," which is part |
| 22 | of something larger still. The substrate is general; the software development lifecycle is the v1 |
| 23 | reference implementation, not the definition. |
| 24 | |
| 25 | This sketch works out the scheduling consequence of taking that seriously: if outcomes are the unit |
| 26 | of work, the graph of outcomes is a _production graph the system has pressure to complete_, and |
| 27 | reading it generatively gives the system its scheduler for free. |
| 28 | |
| 29 | ## The DAG is already latent in the knowledge graph |
| 30 | |
| 31 | Nothing new needs to be stored. The dependency structure is already in the typed-node knowledge |
| 32 | graph (PR #1's `knowledge.md`; thin form in |
| 33 | [architecture.md § project knowledge is a typed-node graph](../../design/architecture.md#bet-project-knowledge-is-a-typed-node-graph)): |
| 34 | |
| 35 | - `blocked_by` / `blocks` edges between outcome nodes **are** a dependency DAG. An outcome is |
| 36 | `blocked_by` the sub-outcomes that must complete before it can. |
| 37 | - `closes` + the attestation-success → `node-status-changed` event is exactly how an outcome |
| 38 | **finalizes** a node: a change lands carrying `closes: [oc-…]`, the integrator's success event |
| 39 | flips the node's status, and the edge that blocked its parent is gone. |
| 40 | |
| 41 | The descriptive reading — "here is what blocks what" — is already supported. The new move is to read |
| 42 | the same graph **generatively**: the open outcomes are not a record of intent, they are a worklist |
| 43 | the system is under pressure to discharge. Every unfinished outcome is latent demand for an agent |
| 44 | run. |
| 45 | |
| 46 | ``` |
| 47 | oc-feature-loved (root, priority: high) |
| 48 | │ │ |
| 49 | blocked_by blocked_by |
| 50 | ▼ ▼ |
| 51 | oc-code-in-vcs oc-docs-shipped |
| 52 | │ |
| 53 | blocked_by |
| 54 | ▼ |
| 55 | oc-auth-bug-fixed ← frontier (no open blockers) |
| 56 | ``` |
| 57 | |
| 58 | ## Priority propagates; the frontier gets scheduled |
| 59 | |
| 60 | Root outcomes — the things a human or another system actually asked for — carry a **priority**. |
| 61 | Priority is not a property of every node; it is set at the roots and **propagates down the DAG** to |
| 62 | the outcomes that must complete for that root to complete (its transitive `blocked_by` closure — the |
| 63 | ancestors-of-completion). A sub-outcome inherits the highest priority among the roots that depend on |
| 64 | it. |
| 65 | |
| 66 | Under contention, the scheduler dispatches the **frontier**: the unblocked outcomes (no open |
| 67 | blockers remaining) that lie on the critical path to the highest-priority root. Producing the nodes |
| 68 | that finalize the DAG for a high-priority root _is_ the scheduling mechanism — there is no separate |
| 69 | queue of "work to do," only the graph and the pressure to complete it. |
| 70 | |
| 71 | This is **dependency-aware, critical-path scheduling**, not an attention router. It answers "what |
| 72 | should the system work on next," not "what should a human look at." Those are different problems, |
| 73 | and conflating them was the mistake the feedback reframe |
| 74 | ([architecture.md § review is observability + feedback](../../design/architecture.md#bet-review-is-observability--feedback)) |
| 75 | left half-made — see _What this splits_ below. |
| 76 | |
| 77 | | Concept | Meaning | |
| 78 | | -------------------- | ------------------------------------------------------------------------------- | |
| 79 | | Root outcome | An outcome with no parent in the DAG; carries an explicit priority | |
| 80 | | Priority propagation | A root's priority flows along `blocked_by` to every ancestor-of-completion | |
| 81 | | Frontier | Unblocked outcomes whose blockers are all closed; eligible to dispatch | |
| 82 | | Critical path | The chain of frontier→…→root that gates a given root's completion | |
| 83 | | Finalization | `closes` + attestation-success → `node-status-changed`; removes a blocking edge | |
| 84 | |
| 85 | ## Dispatch is klaus-shaped |
| 86 | |
| 87 | A **scheduler controller** subscribes to the same node-mutation events the rest of the system emits |
| 88 | (`node-created`, `node-status-changed`, `node-linked`). On each change it recomputes the frontier |
| 89 | and the propagated priorities, then dispatches agent runs against frontier nodes — highest effective |
| 90 | priority first. When a dispatched run lands a change that `closes` its outcome, the resulting |
| 91 | `node-status-changed` event reopens the loop: the parent may now be on the frontier, and the |
| 92 | scheduler dispatches again. |
| 93 | |
| 94 | Because recomputation is event-driven, bursts of node mutations can recompute the frontier many |
| 95 | times in quick succession — so dispatch must be **idempotent per outcome**, never spawning a second |
| 96 | agent for an outcome that already has one in flight. The controller tracks in-flight runs as state |
| 97 | on the outcome itself: a dispatch flips the node to `status: in_progress` (carrying the run's id) |
| 98 | before the agent starts, and only `open` frontier outcomes are eligible to dispatch. That status |
| 99 | transition is the lock — it is itself a `node-status-changed` event, so the in-flight set is a |
| 100 | derived query over the graph like every other projection, with no separate scheduler-private store |
| 101 | to keep consistent. A run that dies without closing or releasing its outcome is caught by the same |
| 102 | run-budget and loop-cap mechanisms below (an outcome stuck `in_progress` past a threshold is a |
| 103 | staleness signal that returns it to the frontier). |
| 104 | |
| 105 | This is consistent with the note that _"events spawn new agent runs scoped to acting on them — |
| 106 | klaus-shaped"_ (PR #1's `openquestions.md`, under work scheduling). The scheduler is one more |
| 107 | controller reading the log; the frontier is a derived query over the graph, rebuildable from source |
| 108 | like every other projection. |
| 109 | |
| 110 | The same run-budget and loop-cap mechanisms named in |
| 111 | [user-scenarios.md](../../design/user-scenarios.md) (_Agent loops_) bound runaway dispatch: an |
| 112 | outcome that keeps respawning agents without closing is itself a signal. |
| 113 | |
| 114 | ## What this splits |
| 115 | |
| 116 | The single _"Priority layer architecture"_ open question conflated two problems. The generative DAG |
| 117 | resolves one of them: |
| 118 | |
| 119 | - **(a) Work scheduling** — _which outcome the system should produce next._ Answered here: DAG |
| 120 | priority-propagation + frontier dispatch. |
| 121 | - **(b) Attention routing** — _which finished or blocked outcomes a human must see._ Still open. |
| 122 | This is the firehose problem from the feedback reframe, and the generative DAG says nothing about |
| 123 | it. |
| 124 | |
| 125 | [openquestions.md](../../design/openquestions.md) reflects the split: the work-scheduling half is |
| 126 | resolved by this sketch; the attention-routing half stays open. |
| 127 | |
| 128 | ## Outcome is the central node type — it does not collapse into bug |
| 129 | |
| 130 | An earlier open question floated collapsing `task` into `bug`. The generative reading flips that |
| 131 | decision: the outcome/task node is the **central generative node type** — the unit of work |
| 132 | production the whole scheduler runs on. A `bug` is merely one _kind of problem_, one reason an |
| 133 | outcome exists. Collapsing the unit-of-work into one of its causes would erase the DAG. |
| 134 | |
| 135 | Accordingly the `task` node type is reframed as **`outcome`** (`oc-*`), which reads truer to its |
| 136 | role. |
| 137 | |
| 138 | ### Bugs motivate outcomes; the lifecycles stay separate |
| 139 | |
| 140 | The two link explicitly via the `motivates` / `motivated_by` edge: a `bug` `motivates` an `oc-*`, |
| 141 | and the outcome is `motivated_by` the bug. They keep **separate lifecycles**, and `closes` always |
| 142 | targets the outcome, never the bug directly. When an attestation lands carrying `closes: [oc-…]`, |
| 143 | the integrator's success event flips _only_ the outcome's status; a controller subscribed to that |
| 144 | `node-status-changed` then resolves the motivating bug — auto-closing it when the closed outcome was |
| 145 | its sole motivated-by, or leaving it open when other outcomes still reference it (one bug can |
| 146 | motivate several fixes). This keeps the work unit (the outcome the DAG schedules on) and the problem |
| 147 | record (the bug) from being conflated: a bug is not "done" because one of the outcomes it spawned |
| 148 | landed, only when nothing it motivates remains open. |
| 149 | |
| 150 | ## Generality |
| 151 | |
| 152 | The DAG mechanism knows nothing about code. An outcome is "a thing to be produced," a sub-outcome is |
| 153 | "a thing that must be produced first," and finalization is "the producing happened, attestably." The |
| 154 | SDLC reference implementation populates the graph with code-shaped outcomes (a bug fixed, a feature |
| 155 | shipped, a dependency bumped). A different reference implementation could populate it with anything |
| 156 | attestable — `oc-concert-tickets-booked` blocked by `oc-budget-approved` is structurally identical. |
| 157 | The scheduler does not care; it only completes graphs. |
| 158 | |
| 159 | ## Related |
| 160 | |
| 161 | - Disposition of this material: [[dcr-2113c52]] |
| 162 | ([decisions/dcr-2113c52-pr1-relanding.md](../decisions/dcr-2113c52-pr1-relanding.md)) |
| 163 | - The organizational layer the scheduler runs inside: [[ida-8482624]] |
| 164 | ([ida-8482624-federation-groups.md](./ida-8482624-federation-groups.md)) |