gunk-dev/the-valley

ida-eac723e-outcome-dag.md

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