feat(goldtether): GREEN #18 bootstrap gates + principal-axis prune
Some checks failed
smoke / smoke (-m "not quarantine") (pull_request) Successful in 5m50s
lane-shas / verify pinned lane SHAs (pull_request) Failing after 32m56s

Implement promotion_eligible (closed ∧ drift≤ε), promote live
closure/drift refuse even when authorized, require_proof, and
prune(mode=principal_axes) keeping primals + highest principal-energy
non-primals (differs from FIFO). Proof fields never trusted as truth.
Ledger #18 flipped green; ADR-0092 reviewer service remains external.
This commit is contained in:
Shay 2026-07-13 21:42:05 -07:00
parent 11e7b71d57
commit f6fd50d9b9
2 changed files with 92 additions and 30 deletions

View file

@ -291,15 +291,16 @@ class GoldTetherMonitor:
return self.supervised_blend(v_self, v_constraint, alpha)
def promotion_eligible(self, F: np.ndarray) -> bool:
"""True iff F is closed and harmonized residual is at/below ε_drift.
"""True iff F is closed and unit-residual (drift) is at/below ε_drift.
Bootstrap gate (R&D §5): only audit-grade coherent states are candidates
for 𝓘_gold. Does not authorize promotion by itself.
Bootstrap gate (R&D §5): only coherent states are candidates for 𝓘_gold.
Uses the dual-checked *closure* residual (not geo distance to gold), so
novel closed states remain eligible for promotion. Does not authorize.
"""
# RED until #18 GREEN: live residual/closure check not yet wired as eligibility.
raise NotImplementedError(
"promotion_eligible: issue #18 bootstrap eligibility not implemented"
)
F_arr = _as_mv(F)
if float(versor_condition(F_arr)) >= _CLOSURE_TOL:
return False
return float(coherence_residual(F_arr)) <= float(self.epsilon_drift)
def promote_gold_invariant(
self,
@ -312,21 +313,29 @@ class GoldTetherMonitor:
"""Add a state versor to 𝓘_gold. CALLER-GATED (ADR-0092).
- Without ``authorized=True``: refuse (proposal-only; proof alone is insufficient).
- With authorize: refuse non-closed or high-residual F (live check, not proof trust).
- With authorize: refuse non-closed or high *drift* residual (live check
never trusts proof.closed / proof.residual as truth).
- ``require_proof=True``: refuse if ``proof`` is missing.
- Physics never self-signs reviews; ``proof`` is caller-supplied audit pin.
Partial (#24): authorize-only append. Full residual/proof gates are #18 GREEN.
"""
if not authorized:
raise ValueError(
"promote_gold_invariant requires explicit authorization (ADR-0092 gate)"
)
# Intentionally incomplete for RED: does not yet refuse dirty F / require proof.
if require_proof and proof is None:
# Minimal stub so require_proof tests can go red on residual/close paths first.
raise ValueError("promote_gold_invariant requires proof when require_proof=True")
self.gold_invariants.append(_as_mv(F).copy())
F_arr = _as_mv(F)
cond = float(versor_condition(F_arr))
# Closure residual only (geo distance to 𝓘_gold is expected for new axes).
drift = float(coherence_residual(F_arr))
if cond >= _CLOSURE_TOL or drift > float(self.epsilon_drift):
raise ValueError(
"promote_gold_invariant refused: not a closed versor "
f"(versor_condition={cond:.3e}) or residual/drift {drift:.3e} "
f"exceeds epsilon_drift={float(self.epsilon_drift)}"
)
self.gold_invariants.append(F_arr.copy())
def prune_gold_invariants(
self,
@ -337,21 +346,72 @@ class GoldTetherMonitor:
"""Bound 𝓘_gold, always retaining the three primal seeds.
Modes:
* ``fifo`` keep primals + most recent (landed #24).
* ``principal_axes`` R&D §5 principal-axis decay (#18; RED until GREEN).
* ``fifo`` keep primals + most recent (#24).
* ``principal_axes`` keep primals + highest principal-energy non-primals
(R&D §5 decay; coefficient PCA on the non-primal stack).
``max_size < 3`` is clamped to 3 so primals are never stripped.
"""
mode_s = str(mode)
if mode_s not in ("fifo", "principal_axes"):
raise ValueError(f"prune_gold_invariants unknown mode: {mode_s!r}")
if mode_s == "principal_axes":
raise NotImplementedError(
"prune_gold_invariants(mode='principal_axes'): issue #18 not implemented"
)
max_size = max(3, int(max_size))
if len(self.gold_invariants) > max_size:
if len(self.gold_invariants) <= max_size:
return
if mode_s == "fifo":
primal = self.gold_invariants[:3]
recent = self.gold_invariants[3:][-(max_size - 3):]
recent = self.gold_invariants[3:][-(max_size - 3) :]
self.gold_invariants = primal + recent
return
self._prune_principal_axes(max_size)
def _prune_principal_axes(self, max_size: int) -> None:
"""R&D §5: retain primals + non-primals with highest principal-subspace energy.
Stack non-primal 32-vectors as columns, take top eigen-directions of
``XXᵀ/m``, score each member by squared projection onto that subspace,
keep the top ``max_size - 3`` (stable by original index on ties).
Differs from FIFO (last-N) whenever early high-energy axes outrank recent
near-identity members.
"""
primal = list(self.gold_invariants[:3])
rest = [
np.asarray(v, dtype=np.float64).copy() for v in self.gold_invariants[3:]
]
n_keep = int(max_size) - 3
if n_keep <= 0 or not rest:
self.gold_invariants = primal
return
if len(rest) <= n_keep:
self.gold_invariants = primal + rest
return
X = np.column_stack(rest) # (32, m)
m = X.shape[1]
# Gram on ambient 32-space (deterministic; no external deps).
C = (X @ X.T) / float(max(m, 1))
evals, evecs = np.linalg.eigh(C)
# Leading subspace dimension: enough to distinguish members, ≤ n_keep.
k = max(1, min(n_keep, m, N_COMPONENTS))
order = np.argsort(evals)[::-1]
basis = evecs[:, order[:k]] # (32, k)
scored: list[tuple[float, int]] = []
for i, v in enumerate(rest):
coeff = basis.T @ v
energy = float(coeff @ coeff)
scored.append((energy, i))
# Highest energy first; lower index wins ties (stable, anti-FIFO bias).
scored.sort(key=lambda t: (-t[0], t[1]))
keep_idx = sorted(i for _e, i in scored[:n_keep])
kept = [rest[i] for i in keep_idx]
# Non-primal retained members should stay closed when they entered as versors.
for i, inv in enumerate(kept):
cond = float(versor_condition(inv))
if cond >= _CLOSURE_TOL:
raise ValueError(
f"prune principal_axes retained non-closed member[{i}]: "
f"versor_condition={cond:.3e}"
)
self.gold_invariants = primal + kept
def measure(self, F: np.ndarray, reference: Optional[np.ndarray] = None) -> CoherenceResidual:
"""Structured residual (primary + optional geometric distance to reference)."""

View file

@ -32,7 +32,7 @@
| 1 | Signature-aware PCA | Super §2.1 / R&D §2.1 | 🟢 faithful (one untested add-on) | — |
| 2 | CartanIwasawa decomposition | Super §2.2 | 🟢 faithful (null-point peel + Spin remainder) | #16 |
| 3 | Conformal Procrustes | Super §3.1 | 🟢 faithful (Kabsch + field conjugacy) | #17 |
| 4 | GoldTether residual + α law | Super §2.3, R&D §2.3/§5 | 🟡 partial (#24 residual+α landed; bootstrap/prune deferred) | #18 |
| 4 | GoldTether residual + α law | Super §2.3, R&D §2.3/§5 | 🟢 residual+α + bootstrap gates + principal-axis prune (#24+#18) | #18 |
| 5 | Grade-5 pseudoscalar invariant | Super §3.3 | ⚪ RETIRED — vacuous in odd-dim Cl(4,1) | #19 (closed) |
| 6 | Surprise residual operator | Super §3.2 | 🟢 math + DiscoveryCandidate wiring landed (#26 + #31) | #20 |
| 7 | Trajectory invariants + zero-fabrication | R&D §2.2 | ⚫ absent | #21 |
@ -106,13 +106,15 @@ Two fields `F_A`, `F_B` are structurally analogous iff a single versor `V` maps
- `supervised_transition` / `supervised_blend` on the Spin geodesic (`word_transition_rotor` + `rotor_power`).
- `promote_gold_invariant(..., authorized=True)` is **caller-gated** (no self-authorize); `prune_gold_invariants` is a size bound retaining the three primals — **not** full principal-axis decay.
### Remaining gap (#18 follow-up — deferred while wave GoldTether lands)
- Full ADR-0092 / replay-verified promotion pipeline into `𝓘_gold`.
- Principal-axis decay/pruning of the gold set (R&D §5).
- ADR-0241 upgrade: unitary amplitude residual on \(\psi\) + optional chiral spinor charge (does not replace SERVE-never-autonomous).
### Bootstrap / prune (#18 — landed)
- `GoldPromotionProof` + `promote_gold_invariant(..., proof=, require_proof=)`: proposal-only without `authorized=True`; live **closure drift** gate (not geo-to-gold); refuses non-closed / high-drift even when authorized; never trusts proof fields as truth.
- `promotion_eligible(F)`: closed ∧ drift ≤ ε_drift (does not self-authorize).
- `prune_gold_invariants(mode="fifo"|"principal_axes")`: primals immovable; PCA ranks non-primals by principal-subspace energy (differs from last-N FIFO); `max_size < 3` clamped.
- Unitary residual path still via wave (`measure_unitary_residual`); SERVE never autonomous.
### Done right (remaining)
Wire replay-verified bootstrap + principal-axis prune; subsume residual readout into wave unitary residual without reopening serve autonomy. Preserve fail-closed + serve-never-autonomous.
### Explicit non-goals still open
- Full signed ADR-0092 *reviewer service* wiring (physics stays caller-gated only).
- Durable vault-backed gold set (session monitor field only).
---
@ -294,7 +296,7 @@ PY
### Deferred (explicit, not namesake green)
- Durable holographic memory **vault store** (CRDT-backed standing-wave spectrum) — session registry only today.
- Rust/MLX acceleration of exp-map / cross-spectral (ADR-0235 later).
- #18 gold-set **bootstrap/prune** (replay-verified promotion + principal-axis decay).
- Full ADR-0092 reviewer-service integration (promote remains caller-gated).
- R&D #21 trajectory invariants + ADR-DAG embedding.
---
@ -305,7 +307,7 @@ PY
|---|---|
| Real CartanIwasawa via `n_o`/`n∞` — 🟢 done (null-point peel + Spin remainder) | #16 (closed via #29) |
| Kabsch-conformal Procrustes on point sets — 🟢 done | #17 (closed via #29) |
| GoldTether gold-set + harmonized residual + α=Φ(R) — 🟡 partial (#24); bootstrap/prune remain | #18 |
| GoldTether gold-set + harmonized residual + α=Φ(R) + bootstrap/prune — 🟢 | #18 |
| Grade-5 pseudoscalar preservation gate — ⚪ RETIRED (vacuous; see §5) | #19 (closed) |
| Surprise: metric projection + productivity polarity + DiscoveryCandidate wiring — 🟢 done | #20 (math #26; wiring #31) |
| Absent proposals: sensorimotor + ADR-DAG | #21 |