Skip to content

feat(adr-001 #3): coherence-gated event filter — skip-on-small-delta - #34

Merged
ruvnet merged 1 commit into
mainfrom
adr/coherence-skip-gate
May 19, 2026
Merged

ruvnet merged 1 commit into
mainfrom
adr/coherence-skip-gate

Conversation

@ruvnet

@ruvnet ruvnet commented May 19, 2026

Copy link
Copy Markdown
Owner

Summary

ADR-001 thesis: intelligence is sparse, event-driven, sub-linear, coherence-gated activation. This PR lands the coherence-gated part — the "no event, no work" path enriched with magnitude awareness.

Math

For strict-DD `A = D - O` with coherence margin

`c = min_i (|A[i,i]| - Σ_{j≠i}|A[i,j]|) / |A[i,i]|`

the Neumann-series envelope gives

`‖A⁻¹ δ‖_∞ ≤ ‖δ‖_∞ / (min_i |A[i,i]| · c)`.

If that bound is below the caller's tolerance, the solve cannot produce a meaningful change in `x` — and the caller can skip it in `O(|δ|)`. Independent of `n`, independent of `nnz(A)`.

API

  • `delta_inf_bound(matrix, delta_values) -> Option` — one-shot bound computation. Linear cost. Returns `None` on non-strict-DD input.
  • `delta_below_solve_threshold(coherence, min_diag, delta, tolerance) -> bool` — cached-input fast path. `O(|δ|)` per call. Cache `(coherence_score, min_diag)` once at matrix-build time, probe on every event.

Refuses to skip on:

  • `tolerance <= 0` (gate disabled)
  • `coherence <= 0` (non-strict-DD; bound doesn't hold)
  • `min_diag <= 0`
  • bound exceeds tolerance (meaningful change may have happened)

Composition

Composes naturally with `solve_on_change_sublinear` and `contrastive_solve_on_change_sublinear` shipped in #29 / #27. An agent's inner loop probes `delta_below_solve_threshold` first; only on a meaningful event does it pay the closure + per-entry-Neumann cost.

Test plan

  • 7 new `coherence::tests` cover strict-DD fast path, non-DD rejection, tiny-delta skip, above-threshold no-skip, disabled tolerance, empty delta
  • `cargo test --lib -- coherence::` → 23/23 pass
  • Full CI

🤖 Generated with claude-flow

…gate

ADR-001 thesis: "intelligence is sparse, event-driven, sub-linear,
coherence-gated activation." This lands the coherence-gated part of
the activation gate — the "no event, no work" path enriched with
magnitude awareness.

Math: for strict-DD A = D - O with coherence margin
  c = min_i (|A[i,i]| - Σ_{j≠i}|A[i,j]|) / |A[i,i]|,
the Neumann-series envelope gives
  ‖A⁻¹ δ‖_∞ ≤ ‖δ‖_∞ / (min_i |A[i,i]| · c).

If that bound is below the caller's tolerance, the solve cannot
produce a meaningful change in x — and the caller can skip it
entirely, in O(|δ|) time. Independent of n, independent of nnz(A).

Lands:

  src/coherence.rs (+108 LOC)
    delta_inf_bound(matrix, delta_values) -> Option<Precision>
      Computes the bound directly from a matrix + delta. Linear cost,
      meant for the "one-shot" call site. Returns None on non-strict-DD
      input (envelope doesn't hold).

    delta_below_solve_threshold(coherence, min_diag, delta, tolerance) -> bool
      Cached-input fast path. O(|δ|) per call — independent of n + nnz.
      Callers cache (coherence_score, min_diag) once at matrix-build
      time and probe this on every event.

      Returns false (refuse to skip) on:
        - tolerance <= 0 (gate disabled)
        - coherence <= 0 (non-strict-DD; bound doesn't hold)
        - min_diag <= 0
        - bound exceeds tolerance (meaningful change may have happened)

  src/lib.rs
    Re-exports delta_inf_bound + delta_below_solve_threshold.

Tests: 7 new coherence::tests covering the strict-DD fast path,
non-DD rejection, tiny-delta skip, above-threshold no-skip, disabled
tolerance, and empty-delta edge case.

This composes naturally with solve_on_change_sublinear: an agent's
inner loop probes delta_below_solve_threshold first; only if the
check fails does it pay the closure + per-entry-Neumann cost.

Co-Authored-By: claude-flow <ruv@ruv.net>
@ruvnet
ruvnet merged commit c5f16a5 into main May 19, 2026
11 of 12 checks passed
@ruvnet
ruvnet deleted the adr/coherence-skip-gate branch May 19, 2026 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant