gunk-dev/the-valley

ida-eac723e-outcome-dag.md

sourcedee3830391efmain's published tip history
9.6 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:
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
19the-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
21code to the VCS" is an outcome that is part of "deliver a feature users love to prod," which is part
22of something larger still. The substrate is general; the software development lifecycle is the v1
23reference implementation, not the definition.
24
25This sketch works out the scheduling consequence of taking that seriously: if outcomes are the unit
26of work, the graph of outcomes is a _production graph the system has pressure to complete_, and
27reading it generatively gives the system its scheduler for free.
28
29## The DAG is already latent in the knowledge graph
30
31Nothing new needs to be stored. The dependency structure is already in the typed-node knowledge
32graph (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
41The descriptive reading — "here is what blocks what" — is already supported. The new move is to read
42the same graph **generatively**: the open outcomes are not a record of intent, they are a worklist
43the system is under pressure to discharge. Every unfinished outcome is latent demand for an agent
44run.
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
60Root outcomes — the things a human or another system actually asked for — carry a **priority**.
61Priority is not a property of every node; it is set at the roots and **propagates down the DAG** to
62the outcomes that must complete for that root to complete (its transitive `blocked_by` closure — the
63ancestors-of-completion). A sub-outcome inherits the highest priority among the roots that depend on
64it.
65
66Under contention, the scheduler dispatches the **frontier**: the unblocked outcomes (no open
67blockers remaining) that lie on the critical path to the highest-priority root. Producing the nodes
68that finalize the DAG for a high-priority root _is_ the scheduling mechanism — there is no separate
69queue of "work to do," only the graph and the pressure to complete it.
70
71This is **dependency-aware, critical-path scheduling**, not an attention router. It answers "what
72should the system work on next," not "what should a human look at." Those are different problems,
73and conflating them was the mistake the feedback reframe
74([architecture.md § review is observability + feedback](../../design/architecture.md#bet-review-is-observability--feedback))
75left 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
87A **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
89and the propagated priorities, then dispatches agent runs against frontier nodes — highest effective
90priority 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
92scheduler dispatches again.
93
94Because recomputation is event-driven, bursts of node mutations can recompute the frontier many
95times in quick succession — so dispatch must be **idempotent per outcome**, never spawning a second
96agent for an outcome that already has one in flight. The controller tracks in-flight runs as state
97on the outcome itself: a dispatch flips the node to `status: in_progress` (carrying the run's id)
98before the agent starts, and only `open` frontier outcomes are eligible to dispatch. That status
99transition is the lock — it is itself a `node-status-changed` event, so the in-flight set is a
100derived query over the graph like every other projection, with no separate scheduler-private store
101to keep consistent. A run that dies without closing or releasing its outcome is caught by the same
102run-budget and loop-cap mechanisms below (an outcome stuck `in_progress` past a threshold is a
103staleness signal that returns it to the frontier).
104
105This is consistent with the note that _"events spawn new agent runs scoped to acting on them —
106klaus-shaped"_ (PR #1's `openquestions.md`, under work scheduling). The scheduler is one more
107controller reading the log; the frontier is a derived query over the graph, rebuildable from source
108like every other projection.
109
110The same run-budget and loop-cap mechanisms named in
111[user-scenarios.md](../../design/user-scenarios.md) (_Agent loops_) bound runaway dispatch: an
112outcome that keeps respawning agents without closing is itself a signal.
113
114## What this splits
115
116The single _"Priority layer architecture"_ open question conflated two problems. The generative DAG
117resolves 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
126resolved by this sketch; the attention-routing half stays open.
127
128## Outcome is the central node type — it does not collapse into bug
129
130An earlier open question floated collapsing `task` into `bug`. The generative reading flips that
131decision: the outcome/task node is the **central generative node type** — the unit of work
132production the whole scheduler runs on. A `bug` is merely one _kind of problem_, one reason an
133outcome exists. Collapsing the unit-of-work into one of its causes would erase the DAG.
134
135Accordingly the `task` node type is reframed as **`outcome`** (`oc-*`), which reads truer to its
136role.
137
138### Bugs motivate outcomes; the lifecycles stay separate
139
140The two link explicitly via the `motivates` / `motivated_by` edge: a `bug` `motivates` an `oc-*`,
141and the outcome is `motivated_by` the bug. They keep **separate lifecycles**, and `closes` always
142targets the outcome, never the bug directly. When an attestation lands carrying `closes: [oc-…]`,
143the 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
145its sole motivated-by, or leaving it open when other outcomes still reference it (one bug can
146motivate several fixes). This keeps the work unit (the outcome the DAG schedules on) and the problem
147record (the bug) from being conflated: a bug is not "done" because one of the outcomes it spawned
148landed, only when nothing it motivates remains open.
149
150## Generality
151
152The 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
154SDLC reference implementation populates the graph with code-shaped outcomes (a bug fixed, a feature
155shipped, a dependency bumped). A different reference implementation could populate it with anything
156attestable — `oc-concert-tickets-booked` blocked by `oc-budget-approved` is structurally identical.
157The 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))