# EXP-56: on an ambiguous chain, does Cadence's fixed temporal context fail because misses push the one memory that matters out of the key?

- Date: 2026-10-14 | Cadence version: 0.83.0 (`23dba71`, `~/_cadence_study`) | Program iter: none (teaching / memory track; answers the group thread of 2026-10-13/14: Bernhard "Cadence needs to be able to learn what memories are important in what context", Huncho's V7.2 ambiguous chain, place 1.97% vs context 10.04% strict)
- Script: `exp/EXP-56_ambiguous_chain_trace.py` | Evidence: `exp/EXP-56-pilot.*`, `exp/EXP-56-full.json/.jsonl/.out`

## Summary
- Question: Huncho made the Stone Age chain ambiguous (`A->WOOD, B->STONE, A->FIRE, B->WARM`, the two A's and the two B's byte-identical) and found 0.83's temporal context helps over place-only memory, but weakly and unstably. The only past event that tells the two A's apart is the decision that changed the observation (at the second A it is B then STONE; at the first, nothing). Cadence's context key is a fixed fading trace over (observation, own action) with `memory_context` the share the past keeps per decision (`generic.py` `_episode_key`, and line 2021 where the issued action joins the trace). A wrong action leaves the observation unchanged but still enters the trace, so after r misses at a stage the deciding event weighs 0.5^(r+1) and the misses just made sit on top of it. Hypothesis: that erosion is why the context arm is weak. Note that upstream's replay path already drops "a decision taken on the observations of the stream's previous decision" (`_extend_paths`); the key does not.
- Setup: EXP-45's V5 chamber (5 actions, strict order, a wrong action changes nothing, 10 decisions per attempt, +2 success / -1 timeout, V5 event order) with Huncho's ambiguity: two 7-input observations, A for stages 1 and 3, B for stages 2 and 4. Brain: 0.83 `Brain.compose(7, 5, modules=(48, 24), arousal=True, memory_choice=True)`, efference off (the 0.83 composed default here, matching V7.2). Arms, paired by seed:
  - `place`: `memory_context=0.0` (Huncho's PLACE_ONLY).
  - `ctx5`: `memory_context=0.5` (Huncho's TEMPORAL_CONTEXT, the founder value).
  - `ctx8`: `memory_context=0.8` (a slower fade; the misses still enter).
  - `hold5`: `memory_context=0.5`, and when the next observation equals the last one (the last decision left the situation as it was), the instrument restores the stream's temporal context to its value before that decision, so misses never enter the key. The brain can see that its observation did not change, so this uses no knowledge of the answer; it is the instrument-level form of an event-based trace (cf. #195's hold for the working trace). Never applied across `done`.
  Signals (EXP-45/46): `natural` (world reward only) and `corrective` (V5's corrective teacher: the right action as a label after an executed mistake in a guided window, 4 of every 12 decisions). 120 training attempts (V7.2's horizon). Readings on a saved copy, the same trace rule applied: sampled success over 100 attempts; greedy exact pass (all four stages in four decisions); greedy stages completed; in-sequence first-try accuracy per stage from the sampled attempts; P(right | r misses already made at this stage in this attempt) for r = 0, 1, 2+. Per-stage readings from a reset are meaningless here (a reset brain at A cannot know it is at stage 3), so every reading is in sequence.
- Chance (same mechanics as EXP-45's chamber, exact): uniform random sampled success .121; never-repeat-a-failure searcher .304; uniform P(right | r) = .2.
- RUN GATE: (1) prediction below, written before the pilot. (2) Window: a pilot of 2 seeds per arm and signal at exact run conditions; if it projects the SEM of the paired hold5 - ctx5 difference above .05 at 24 seeds, the full run uses 48 seeds instead; no other change. (3) Variance: arms share each seed (same brain draws and world); paired differences. (4) Metric: sampled success (primary), P(right | r) for the mechanism. (5) Chain: misses enter the key -> the deciding transition fades -> the two visits of A (or B) share keys and split records -> wrong stage answers; hold removes the first link only.
- Prediction (written before the pilot):
  - (P1) Replicates V7.2's direction: ctx5 beats place on sampled success, pooled over both signals, by more than 2 SEM (paired).
  - (P2, headline) Holding the trace on misses helps: hold5 - ctx5 on sampled success is >= .10, pooled over both signals, and more than 2 SEM.
  - (P3, where it acts) The hold gain is larger after misses than before them: (hold5 - ctx5) on P(right | r >= 1) exceeds (hold5 - ctx5) on P(right | r = 0), pooled.
  - (P4) A slower fade is a partial lever: ctx5 < ctx8 < hold5 on pooled sampled success (paired means).
- Decision rule (written before the pilot): P2 holds -> part of why the fixed context is weak on ambiguous sequences is that it is moved by moments that changed nothing, and a trace that moves only when the observation changes is a non-learned fix and a concrete target for "learn which memories matter" (the reply to the group carries the numbers and the rule). P2 fails -> erosion by misses is not the bottleneck at this horizon; report that, with P(right | r) and the place/ctx gap, and look at record splitting or the cortex next.
- Check (`exp/EXP-56-check.out`): with hold, a retry's decision key equals the first try's; without, it differs; the place arm has no context store. PASS.
- Pilot (2 seeds per arm and signal, `exp/EXP-56-pilot.out`), read before the full run: ctx5 well above place (sampled .90 vs .37 pooled; first-try P(right) .63 vs .36), so V7.2's direction reproduces, more strongly than V7.2's strict metric. Hold did NOT help in the pilot (hold5 - ctx5 sampled -.16, SEM .16; after misses -.10), and ctx8 was worse than ctx5 (-.41). One ceiling cell (ctx5 natural sampled .97). Seed rule: projected pooled SEM of hold5 - ctx5 at 24 seeds about .048, so 24 seeds. No design change to arms, signals or predictions. One reading added after the pilot as a post-hoc diagnostic, not a prediction: how often a retry repeats the action that just missed (`repeat`), to test the pilot-suggested alternative that misses entering the trace act as in-attempt "already tried that" memory. Because the log format changed, the full run reran all 24 seeds (seeded; seed 0's training reproduced exactly in a smoke run).
- Result (24 seeds per arm and signal, paired; sampled success over 100 attempts; P(right | r) in sequence; `exp/EXP-56-full.*`):

  | pooled (48 per arm) | sampled success | greedy exact pass | P(right), first try (r = 0) | P(right), after misses (r >= 1) | retry repeats the miss |
  |---|---|---|---|---|---|
  | place (context 0) | .329 | 0/48 | .36 | .22 | .65 |
  | ctx5 (context .5) | .632 | 5/48 | .49 | .38 | .45 |
  | ctx8 (context .8) | .546 | 6/48 | .48 | .32 | .45 |
  | hold5 (context .5, misses held out) | .651 | 17/48 | .58 | .39 | .46 |

  Paired differences, pooled (SEM): ctx5 - place sampled +.303 (.067), first try +.126 (.035), after misses +.158 (.036). hold5 - ctx5 sampled +.019 (.073), first try +.097 (.043), after misses +.009 (.039). ctx8 - ctx5 sampled -.085 (.075). By signal, ctx5 - place sampled +.233 natural, +.373 corrective; hold5 - ctx5 sampled +.088 natural, -.050 corrective.
  P1 HELD (ctx5 beats place by 4.5 SEM; our greedy exact rates, place 0/48 and ctx5 5/48, sit on V7.2's 0/100 and 11/100). P2 FAILED (hold adds +.019 sampled). P3 FAILED, in the opposite direction (hold's gain is at the first try, +.097, not after misses, +.009). P4 FAILED (the slower fade is worse than .5, not between). The post-hoc repeat reading does not support the pilot's alternative either: hold repeats a miss no more often than ctx5 (.46 vs .45); place repeats most (.65).
- Secondary reading, NOT a prediction: greedy exact pass, hold5 17/48 vs ctx5 5/48; paired McNemar 14 hold-only vs 2 ctx5-only, exact p = .004 pooled (natural 4 vs 0, corrective 10 vs 2). Greedy success within 10 decisions barely differs (20 vs 18), so hold makes the greedy chain right the first time at each stage, not more often solved. This is one contrast among several readings and needs a confirmatory run on fresh seeds before it is claimed (EXP-57).
- Verdict: NULL for the hypothesis (1 of 4: the replication held, the mechanism did not). Misses entering the temporal context are not what holds the context arm back after a miss; holding them out changes first-try answers, not recovery. Decision rule: P2 failed, so report the erosion idea as refuted with these numbers.

## Reflection
- CORRECTION (2026-10-14, after EXP-57): on fresh seeds, holding misses out also raised accuracy after a miss (+.130, 5 SEM at 120 attempts), less than at the first try (+.174). The flat recovery here (+.009) belonged to this seed set. What this run refutes is narrower than first written: the gain is not concentrated after misses, as P3 predicted; it is larger at the first try.
- What it means: the fixed .5 context does real work on Huncho's ambiguous chain (place 0 of 48 clean greedy passes, context 5), and the mechanism is not the one I proposed in the form I proposed it. I expected the gain to sit after misses, where the deciding step has faded; it sits mostly at the first try. Where hold did change something is the first try, and the greedy clean pass tripled, which fits a different mechanism the episodic guide already names: the context key splits one situation's records over every path that reaches it. Without hold, every different run of misses at a stage is a different path, so that stage's rewards and corrections are spread over many keys; with hold, they all land on the first-try key. That is post-hoc and is what EXP-57 tests.
- Process: pre-registered with a mechanical check before the pilot; the pilot was read before the full run (it pointed the other way, toward hold hurting, and shrank to noise at n=24, as EXP-53's pilot did); one post-hoc reading added after the pilot and declared; the full run reran all seeds because the log format changed. Limits: our rebuild of the chamber, not Huncho's code; 120 attempts; one composed brain; efference off.
- Lesson: a mechanism story built from the math of the trace (0.5^(r+1)) can be right about the arithmetic and wrong about what limits behaviour; the paired arm that removes only that link is what tells you, and it found a different lever.
- Next: EXP-57, a confirmatory run on fresh seeds with greedy clean pass as the pre-registered primary; then the reply to the group carries the confirmed (or failed) number.
