# EXP-63: an outcome-keyed gate: hold out of the context key only the decisions the world answered as failures

- Date: 2026-10-15 | Cadence version: 0.83.0 (`6499e56`, `~/_cadence_study`, upstream head; the delta from EXP-57/59/60's `23dba71` is the opt-in surprise rule of #197, off here) | Program iter: none (memory track; the boundary question upstream #202 asks to be measured)
- Script: `exp/EXP-63_outcome_gate.py` (EXP-56's brain, signals, trace rule and readings; the observations of EXP-56/57, EXP-60 and EXP-59) | Evidence: `exp/EXP-63-check.out`, `exp/EXP-63-pilot.*`, `exp/EXP-63-full.*`

## Summary
- Question: EXP-57's rule (a decision whose next observation is unchanged never enters Cadence's temporal context, the key of its episodic records) took clean greedy passes of the hidden-progress chain from 4/96 to 38/96, did nothing where the inventory is visible (EXP-60), and broke where a correct action is invisible (EXP-59: stage-2 first try -.157, clean passes 9 vs 2 of 96), because "the observation did not change" is only a proxy for "the decision did nothing". Upstream #202 (Bernhard, 2026-10-15) proposes the observation rule as an opt-in gene and asks for the invisible-action boundary to be measured. Does a gate keyed on the outcome (hold only decisions the world answered as failures) keep the gain and remove the break?
- Setup: EXP-56 exactly (0.83 `Brain.compose(7, 5, modules=(48, 24), arousal=True, memory_choice=True)`, efference off, V5 chamber rules, 10 decisions per attempt, natural and corrective signals, readings in sequence on a saved copy). Arms: `ctx5` (the founder key, memory_context .5), `hold5` (EXP-57's observation gate), `out5` (outcome gate: before the next call, a decision the chamber answered as a failure is taken back out of the context; a correct decision always stays in, visible or not; never across done). The outcome is the chamber's own success flag for the decision: Cadence's `step()` does not receive it, and in this chamber neither the observation nor the per-step reward (0 for a miss and for an invisible success alike under the natural signal) can tell a miss from the invisible WOOD.
  - Invisible chain (EXP-59's A, A, B, C): ctx5 / hold5 / out5, 48 fresh seeds per signal (63_000 + i), horizon fixed by the pilot (below).
  - Hidden chain (EXP-56/57's A, B, A, B): ctx5 / out5, 24 fresh seeds per signal (63_000 + i), 120 attempts.
  - Visible chain (EXP-60's inventory): ctx5 / out5, 24 fresh seeds per signal (63_000 + i), 120 attempts.
  - On the hidden and visible chains a wrong action is the only decision that leaves the observation unchanged, so out5 holds exactly the decisions hold5 holds; there out5 is a fresh-seed replication of hold5 at the new head, not a new mechanism. The two gates differ only on the invisible chain.
- Check (mechanical, before the pilot; `MODE=check`): (a) four stored rows of EXP-57/59/60 (seed index 0) recomputed at `6499e56` must be identical to the `23dba71` rows (no version drift for these arms); (b) on one fresh seed (63_990) per signal, out5 rows must be identical to hold5 rows on the hidden and visible chains and differ on the invisible chain. A failed check stops the run.
- Pilot (exact run conditions: this script, 2 workers; seeds 63_500 + i, 6 per signal, never reused): invisible chain, all three arms, at 120 and 240 attempts. It decides one thing, the invisible chain's horizon: 120 (EXP-57/59/60's) unless at 120 both ctx5 and out5 have at most 1 clean greedy pass of 12, in which case 240. It cannot change arms, metrics, seeds counts, predictions or thresholds.
- RUN GATE: (1) predictions and decision rule below, written before the check, pilot and full run. (2) Window: the pilot above; hidden and visible windows known from EXP-57/60 (4 vs 38 and 75 vs 75 of 96 at 120). (3) Variance: arms paired by seed; exact two-sided McNemar on clean-pass discordant pairs, paired SEM on rates. (4) Metrics: first-try accuracy at stage 2 of the invisible chain (STONE at A, right after the invisible WOOD); clean greedy pass (four stages in four greedy decisions). (5) Chain: out5 keeps the successful WOOD in the context -> stage 2's key differs from stage 1's (as under ctx5) -> no EXP-59 break; and out5 holds the misses -> each stage's records land on its first-try key (EXP-57's mechanism) -> more clean passes than ctx5.
- Prediction (written before any run):
  - (P1, headline: the break is gone) Invisible chain, pooled (96 pairs): stage-2 first-try accuracy out5 - ctx5 > -.05 (EXP-59: hold5 - ctx5 = -.157).
  - (P2) Invisible chain, pooled: stage-2 first try out5 - hold5 >= +.10 and more than 2 SEM.
  - (P3, the gain carries over) Invisible chain, pooled: clean greedy passes out5 > ctx5, more out5-only than ctx5-only pairs, exact McNemar p < .05.
  - (P4) Hidden chain, pooled (48 pairs): more out5-only than ctx5-only clean-pass pairs, exact McNemar p < .05 (EXP-57's gain at the new head).
  - (P5) Visible chain, pooled (48 pairs): no harm: either out5-only >= ctx5-only pairs, or exact McNemar p >= .05.
- Decision rule (written before any run): P1 and P3 hold -> the outcome-keyed gate keeps the gain and removes the invisible-action break; the #202 comment says the gene should key on the outcome rather than the observation, and names what that needs: a failure signal from the world that `step()` does not take today. P1 holds, P3 fails -> the outcome gate removes the break but its gain does not carry onto the invisible chain at this horizon; the comment reports both. P1 fails -> holding misses alone still costs the invisible step, so the break is not only the erased WOOD; the comment says so and the observation gene keeps its boundary note. P4 failing contradicts EXP-57 at the new head and is reported; P5 failing is a cost on the visible chain and is reported. Verdict: SUPPORTIVE if P1, P2 and P3 hold; BOUNDARY if P1 holds and P3 fails; NULL if P1 fails (loop file: CONFIRMED / INCONCLUSIVE / REFUTED).
- Check (`exp/EXP-63-check.out`): PASS. The four stored EXP-57/59/60 rows recompute identically at `6499e56` (so those experiments stand at the new head), and out5 rows equal hold5 rows on the hidden and visible chains and differ on the invisible chain. The library's unsettled-free-phase warning on corrective lessons appears here as it did in EXP-57.
- Pilot (6 seeds per signal, `exp/EXP-63-pilot.*`), read before the full run: at 120 attempts clean greedy passes ctx5 1, hold5 0, out5 3 of 12, so the floor clause is not met and the horizon stays 120. Stage-2 first try ctx5 .56, hold5 .38, out5 .78 (12 pairs); at 240, 0 / 2 / 4 clean passes. Clean passes sit near the floor at both horizons (the stage-1 first try is low, .15 to .27, on this chain), so P3 has little room; the rule fixed the horizon and nothing else changes. The full run uses fresh seeds (63_000+), not the pilot rows.
- Result (fresh seeds 63_000+, 120 attempts, 2 workers, 50 min; `exp/EXP-63-full.*`):

  | chain, comparison | pairs | clean greedy passes | x-only / y-only (exact McNemar p) | stage-2 first try, diff (SEM) | all first tries, diff (SEM) | sampled success |
  |---|---|---|---|---|---|---|
  | invisible, out5 vs ctx5 | 96 | **19 vs 5** | **18 / 4 (p .004)** | **+.068 (.045)** | +.083 (.020) | .541 vs .456 |
  | invisible, out5 vs hold5 | 96 | 19 vs 1 | 19 / 1 (p < .0001) | **+.216 (.044)** | +.162 (.023) | .541 vs .289 |
  | invisible, hold5 vs ctx5 (EXP-59 again) | 96 | 1 vs 5 | 1 / 5 (p .22) | -.148 (.040) | -.080 (.022) | .289 vs .456 |
  | hidden, out5 vs ctx5 | 48 | **17 vs 4** | **14 / 1 (p .001)** | +.127 (.057) | +.116 (.038) | .642 vs .518 |
  | visible, out5 vs ctx5 | 48 | 37 vs 34 | 8 / 5 (p .58) | +.024 (.048) | +.009 (.028) | .922 vs .890 |

  Invisible chain, first try by stage (pooled): ctx5 .21 / .52 / .66 / .95, hold5 .22 / .37 / .69 / .89, out5 .32 / .59 / .76 / .95. By signal: every invisible-chain clean pass came from the corrective signal (natural: 0, 0, 0 of 48; corrective: ctx5 5, hold5 1, out5 19 of 48). Under reward alone the outcome gate still lifts first tries (all stages +.078, SEM .032; stage 2 +.141, SEM .069) and sampled success (+.069, .035), but no arm reaches a clean pass at 120 attempts (stage-1 first try about .1). Hidden chain by signal: natural 4 vs 2, corrective 13 vs 2 of 24 (EXP-57: 9 vs 2 and 29 vs 2 of 48). EXP-59's break replicates on fresh seeds at the new head (stage 2 -.148 vs -.157).
  P1 HELD (stage 2 out5 - ctx5 +.068, above -.05). P2 HELD (+.216, 4.9 SEM). P3 HELD (18 vs 4, p .004). P4 HELD (14 vs 1, p .001). P5 HELD (8 out5-only vs 5 ctx5-only).
  One reading nobody predicted: visible chain, corrective, stage-1 first try out5 - ctx5 = -.113 (SEM .038), one of 40 per-signal stage cells and the only out5 cell below -2.5 SEM. EXP-60 ran the identical rule (out5 holds the same decisions as hold5 there) on 48 other seeds and saw +.005 (.027) in that cell, and here clean passes and sampled success did not move (21 vs 23 of 24, .985 vs .980). Recorded, not claimed.
- Verdict: SUPPORTIVE, 5 of 5 (loop: CONFIRMED). Keyed on the outcome, the hold rule keeps EXP-57's gain where progress is hidden (17 vs 4 clean passes of 48; it holds the same decisions as the observation rule there), stays neutral where progress is visible (37 vs 34), and turns EXP-59's break into a gain on the invisible-action chain: clean passes 19 vs 5 of 96 against the plain context, and the step after the invisible action no longer drops (+.07 instead of -.15). Decision rule: P1 and P3 held, so the #202 comment says the gene should key on the outcome, and names what that needs: a failure signal that `step()` does not take today.

## Reflection
- What it means: the memory to keep out of the key is "a decision the world answered as a failure", and the observation was only a stand-in for it. With the real property as the trigger, the rule no longer has a boundary at invisible actions on these chains; with the stand-in, it does (EXP-59, replicated here). The catch is the signal: in this chamber nothing Cadence receives tells a miss from the invisible WOOD. The observation is identical and the per-step reward is 0 for both under the natural signal; only the chamber's own success flag separates them, and the gate here reads it as an oracle. So for #202 there are two honest versions: an outcome-keyed gene that needs a per-decision failure input from the world (an explicit flag, or a convention such as a negative reward marking a failed action), and the observation-keyed gene, which needs no new input but keeps EXP-59's boundary. Under corrective teaching there is a partial in-library signal (a teacher label arrives after a guided miss, 4 decisions in every 12), untested as a gate here.
- Process: pre-registered and pushed (514e510) before the check, pilot and full run. The check proved no version drift (stored EXP-57/59/60 rows recompute identically at `6499e56`, so those experiments stand at the new head) and that the two gates hold the same decisions on the hidden and visible chains. The pilot fixed the horizon (120) by its pre-written rule. Fresh seeds, 2 worker processes on a shared machine. The pilot had warned that clean passes sit near the floor on this chain; the full run found all of the clean-pass signal in the corrective arm. Limits: our rebuild of the chambers, one composed brain, 120 attempts, an instrument-level rule (not a library gene), an oracle outcome signal, one kind of invisible step (one invisible correct action, at stage 1), hidden and visible chains at 24 seeds per signal, and the unreplicated visible-chain cell above.
- Lesson: when a rule's trigger is a proxy for the property that matters, run the rule keyed on the property itself, even through an oracle. It separates "the idea is wrong" from "the proxy is wrong" and names the signal a real implementation would need. Here the idea held and the proxy broke.
- Next: comment on #202 (draft for Will: lead with this result and the signal it needs). Queued EXP-65: the same gate keyed on signals Cadence does have (the corrective teacher's label; the brain's own forecast error at the decision) on the invisible chain, with out5 as the oracle ceiling.
