Files
Aura/docs/design/contracts/c05-freshness-gating.md
T
claude 8688a60ded docs(ledger): split the design ledger into an INDEX map, per-contract live files, and history sidecars
The single-file ledger had grown to 2968 lines / ~42k tokens, mixing
current design law with accreted history: 59 cycle-stamped realization
blocks, 18 [HISTORY] passages, 22 supersession markers, and the C10 /
C22 / C24 reframe sagas layered several supersessions deep. A
code-grounding audit (31 agents, adversarially verified) confirmed 11
defects stated as current truth: stale crate homes from the C28 #288
roster split (cost nodes, PositionManagement, PositionEvent, Session),
the renamed InputSpec->PortSpec, the pre-#241 project model in C16 and
the open-threads section, a stale HarnessKind retirement deferral in
C24, and three C28-internal inconsistencies.

New shape, per the ailang precedent:

- INDEX.md stays the sole addressable entry point: foundation, external
  components, a C-id-keyed contract map (one line per contract), and
  only the genuinely open architectural threads.
- contracts/cNN-<slug>.md carries each contract's current truth only:
  Guarantee / Forbids / Why with ratified refinements integrated, plus
  a code-anchored Current state. All confirmed defects are fixed here;
  crate anchors were re-verified against the tree.
- contracts/cNN-<slug>.history.md (18 sidecars) and INDEX.history.md
  preserve every superseded block verbatim, stamps and issue refs
  intact, under a frozen-record banner. Nothing was deleted: superseded
  design intent remains an addressable working-tree artifact, off the
  per-cycle audit walk.
- Ledger discipline is now stated in INDEX.md: live files are edited in
  place at cycle close, superseded text moves verbatim to the sidecar,
  and a supersession marker in a live file is itself an audit finding.

Every contract file was verified against its old text by an independent
zero-loss pass (statement-by-statement) plus a code-accuracy spot check;
C-ids and contract titles are unchanged, so existing C-id citations in
code, tests, and issues resolve as before.
2026-07-21 16:40:36 +02:00

36 lines
1.6 KiB
Markdown

# C5 — Freshness-gated recompute and sample-and-hold
**Guarantee.** The `cycle_id` advances everywhere (a cheap counter), but a node
re-evaluates only when ≥1 of its own inputs is fresh this cycle (detected by
run-count); otherwise it holds its last output. Stale inputs contribute their
last (held) value.
**Forbids.** Recomputing every node every cycle ("push all" is true for the
*clock*, not for *recompute*); treating a held value as missing.
**Why.** Total recompute does not scale to many sparse high-frequency sources;
freshness-gating is the performance discipline that keeps the synchronous model
fast.
## Current state
Freshness is a run-count epoch. Each input slot carries `SlotState { fresh_at,
last_ts }` (`crates/aura-engine/src/harness.rs`); a slot is fresh this cycle iff
`fresh_at == cycle_id`. The firing predicate `fires` re-evaluates a node when any
`Firing::Any` input is fresh this cycle, or when a barrier group completes (≥1
member fresh this cycle and every member carrying `last_ts == ts`) — the barrier
/ co-freshness machinery itself is C6.
A node that does not fire pushes nothing, so downstream consumers keep reading the
last value via `window[0]`: sample-and-hold falls out of the push model rather
than being a separate mechanism. A held value is a real past value, never treated
as missing.
## See also
- [C6](c06-firing-policy.md) — the firing predicate and the barrier /
co-freshness rule this gating builds on.
- [C1](c01-determinism.md) — freshness is a deterministic function of `cycle_id`,
so gating never perturbs the bit-identical run.
- [C2](c02-causality.md) — a held value is past data, not look-ahead.