# WO-03 — Dependency Graph and Working-Set Materializer

**Status:** in progress  
**Primary modules:** `packages/memory/src/memoryGraph.ts`, `temporalGraph.ts`,
`packages/orchestrator/src/evidenceLedger.ts`, `agenticRunner.ts`  
**Depends on:** WO-02

## Problem

Message-level retention can split an action from its tool result or retire a
source body still required by a pending edit or verifier.

## Contract

Represent active work as immutable graph nodes and edges:

```text
task ─requires→ claim ─supported-by→ artifact evidence
  └plans→ action ─invokes→ tool call ─produces→ result
                    └mutates→ artifact revision ─verified-by→ verifier outcome
```

The materializer takes active task/steering plus the projected memory graph and
returns the smallest evidence-closed working set. An action transaction is
atomic for retention unless its outcome is terminal and all dependants are
closed.

## Todos

- [x] Define node/edge types and graph invariants in schemas.
- [x] Emit graph transactions from tool calls, mutations, verifier results,
  canonical file evidence, and exact-request projections; todo/workboard
  backfill remains a separate migration task.
- [x] Add dependency closure and safe graph-cut algorithms.
- [ ] Implement a materializer that ranks open requirements, current action,
  unresolved claims, and verifier dependencies above recency.
- [x] Preserve exact evidence bodies once, referenced by stable IDs elsewhere.
- [x] Surface a graph explanation in context audit records.
- [x] Link an exact request projection back to matching active graph evidence
  before validation, so graph-cut safety protects the rendered copy too.

## Acceptance tests

- An assistant tool call and each matching tool result cannot be split.
- An exact file range remains materialized while an open edit or verifier cites
  it.
- A completed, unreferenced discovery transaction can archive without changing
  the active set.
- A failed verifier remains eligible for rerun after a dependent source revision
  changes; no verifier lock is introduced.

## Definition of done

Graph invariants, closure tests, and a MyActuator-derived fixture pass without
reintroducing historical controller recaps.
