Appendix A - 24. Epic Definition-of-Done (Final-Opus trust-nothing re-run)
The Structure of Epic Definition-of-Done (Final-Opus trust-nothing re-run) — its shape at a glance:
The gate trusts nothing recorded: it re-runs the owned pins and lints against the substrate as it stands now and checks each cited commit is reachable, closing only when the re-derived verdict is green.
flowchart LR
Claims[/Phase markers, prior claims/] -.->|distrusted| Gate{DoD re-run at HEAD}
Pins[(Owned pins + lints)] -->|re-run now| Gate
Commits[(Cited commits)] -->|reachability / patch-id| Gate
Gate -->|all green| Close([Epic closes])
Gate -->|any red| Hold([Close refused])
Accessible description: the definition-of-done gate distrusts recorded phase markers, re-runs the Epic's owned pins and lints at HEAD, and checks each cited commit is reachable; the Epic closes only when the re-derived verdict is green and is held otherwise.
Projected from the catalogue entry governance-doc-controls / Epic Definition-of-Done (Final-Opus trust-nothing re-run).
On this page: Intent · Motivation · Applicability · Structure · Sample Code · Consequences · Example use within DocAble · Related Patterns
Intent
Intent — An Epic-close gate mandating a "trust nothing" Final-Opus review that re-runs every owned pin test and lint at HEAD, rather than trusting phase markers or prior claims, so an Epic cannot close on stale or rotted assertions.
Motivation
An Epic spanning many dispatches accumulates claims (phase markers, "lints pass," pin-test counts), and those claims rot as sibling Epic sweeps churn the substrate underneath them. Close on the stale claims and you ship an Epic whose defenses no longer actually hold (empirically: 7/7 back-catalogue Epics self-marked DONE had quality-of-defense gaps). The failure is a premature/false close, and it recurs at every Epic boundary.
Applicability
- A machine-checkable close (reachability / patch-id over the cited commits).
- A well-defined "owned" set of pin tests and lints per Epic to re-run.
- A Final-Opus reviewer with the judgment to re-verify rather than rubber-stamp.
- A follow-up routing mechanism so what the re-run surfaces becomes filed work, not a footnote.
Structure
The Structure diagram appears at the top of this page.
Sample Code
The gate re-derives the verdict from the substrate rather than reading it off markers. It re-runs every owned pin and lint at HEAD and verifies each cited commit is reachable; a missing commit forces a logged override, not a silent pass.
def close_epic(owned_pins, owned_lints, cited_commits, is_reachable, override_reason=None) -> int:
findings = []
for pin in owned_pins: # re-run at HEAD — do NOT trust the recorded "passed" marker
if pin.run() != "pass":
findings.append(f"owned pin {pin.name} is red at HEAD")
for lint in owned_lints:
if lint.run():
findings.append(f"owned lint {lint.name} finds violations at HEAD")
for sha in cited_commits:
if not is_reachable(sha) and not override_reason:
findings.append(f"cited commit {sha} is unreachable and no override was given")
if findings:
for f in findings:
print(f"DOD BLOCK: {f}")
return 1 # close refused
return 0 # atomically rewrite status, move to closed, regenerate the index
Consequences
- The re-run is expensive. Opus time plus a full pass of owned pins/lints at close, deliberately heavyweight, because a false close is worse.
--overrideis a hole. It exists for legitimately-unreachable commits, logged, but it is a way past the reachability check.- "Owned" must be accurate. An Epic that under-declares what it owns re-runs too little and can still close on a rotted-but-unlisted defense.
Example use within DocAble
epic_close.py close --commits …/--override(reachability-gated close).- The Epic template's multi-criterion Definition-of-Done; the Final-Opus "trust nothing" re-run.
- The tag routing-audit + design-doc follow-up filing at close.
Related Patterns
- Counterpart (audit) — claude-md-rule-index: the index's cap/conformance lints keep its form honest; this re-run keeps claims honest (presence ≠ obedience). Together they are the "keep the enforced documents honest" pair.
- Consumer — reads each Epic's owned pin tests and lints (and the repo meta-models behind them) to re-verify at HEAD.