# Preregistration — LOCKED

- **Locked on:** 2026-10-25, before any locked run started
- **Code/config fingerprint:** SHA-256 of `protocol/lock_manifest.sha256`, recorded in `protocol/LOCK` (see §8)
- **Environment version:** DistinctionWorld `1.0.0`
- **Confirmatory master seed:** `20261026`. Fresh: every world and agent
  initialisation it generates is new. Piloting and tuning used master seed
  `20261025`, so this lock never touches a world seen before.

Everything run before this lock is pilot data, kept in `results/pilot/`. That
includes a full 30-seed × 300-episode matrix that used the test split of the
pilot master seed. It informed the sample size and training budget below and
is reported only as pilot.

## 1. Hypotheses and directional predictions

| ID | Prediction | Test (`eip.analysis.hypotheses`) | Source |
|---|---|---|---|
| **Primary** | Post-reversal regret A4 − A3 < 0 in each hidden-season reversal cell | `primary_endpoint` | confirmatory matrix |
| **S1** (key secondary, added at lock) | Post-reversal regret A4 − A3-rnn < 0 in each hidden-season reversal cell | `secondary_learned_memory` | confirmatory matrix |
| H1 | Relevant − irrelevant cue preservation > 0 (profile and A5 encoder) | `h1_task_relevant_distinctions` | E1 |
| H2 | (A3 − A2 \| hidden) − (A3 − A2 \| visible) < 0 on held-out regret | `h2_memory_interaction` | confirmatory matrix |
| H3 | After a goal switch, ARI with the new oracle partition rises during phase 2 | `h3_reorganisation` | E3 |
| H4 | J(equivalent merge) − J(inequivalent merge) > 0, immediate and recovered | `h4_consequential_merges` | E4 |
| H5 | Regret slope over budget bits < 0 for budget-using agents (A3, A5) | `h5_capacity_trend` | confirmatory matrix |
| H6 | The memory interaction of H2 has the same sign for tabular A3 and A3-rnn, and A3-rnn − A2 < 0 in hidden worlds | `h6_architecture_replication` | confirmatory matrix |

**Why S1 was added.** In the pilot, tabular A3 was limited by collisions
in its memory codebook: at 4 bits its regret did not fall with ten times the
training (`results/pilot/learning_curve_check.csv`). A4 − A3 therefore
partly measures that weakness. A3-rnn is a gradient-trained recurrent
network, model-free like A3, so A4 − A3-rnn asks whether explicit prediction
adds value beyond a memory that is itself learned. The primary endpoint is
kept unchanged from the protocol.

## 2. Endpoints

- **Primary / S1:** post-change normalised regret area, i.e. the mean
  per-object regret over the `H = 10` objects from the unannounced reversal.
  Regret is the Bayes-optimal oracle minus the agent, under the same
  observation constraints and paired on world seed. Evaluation uses frozen
  learned parameters on the test split (50 episodes per run); transient
  memory and belief continue to update.
- **H2, H5, H6:** mean held-out regret per object (`eval_regret`).
- **H1:** `profile_preserve_relevant − profile_preserve_irrelevant_mean`
  (and the `encoder_` version for A5) at the end of training.
- **H3:** change in `profile_ari` / `encoder_ari` from the start to the end
  of phase 2, trained agents.
- **H4:** held-out reward per object after equivalent vs inequivalent
  collisions (4 pairs each).

## 3. Design

| | Confirmatory matrix | E1 | E3 | E4 |
|---|---|---|---|---|
| Config | `confirmatory_matrix.yaml` | `e1_categories.yaml` | `e3_reversal.yaml` | `e4_ablations.yaml` |
| Cells | 24 (goal schedule × season × dynamics × budget 2/4/8) | switched goals, visible, stationary, budget 2/4/8 | 4 changes on visible stationary, budget 4 | hidden reversal, budget 4 |
| Agents | A0–A5, A3-rnn | A1–A5 | A2–A5, A3-rnn | A2–A5, A3-rnn |
| Seeds | **50** | 30 | 30 | 30 |
| Training | **1,000** episodes × 40 objects | 300 | 200 + 200 | 1,000 (+50 recovery) |

The confirmatory budget moved from the planned 300 to 1,000 episodes after
the learning-curve review. A4 had not plateaued at 300 episodes (validation
regret 0.060 → 0.014 at 1,000), and tabular A3 with 8 bits was still
improving.

Hyperparameters are fixed in `configs/hyperparameters.yaml`. They were
selected on the validation split with pilot training seeds ≥ 1000, using the
same grid size for every learner, at 300 episodes. They were not re-tuned at
1,000 episodes. The A3-rnn learning rate (0.03) is at the edge of its grid.

## 4. Smallest effect of interest and power

- **Smallest effect of interest (primary, S1, H2):** 0.05 regret per object,
  i.e. one extra reward unit lost per 20 objects.
- **Pilot SD of paired differences (300 episodes, 30 seeds):** primary
  0.056–0.105 across cells; H2 0.022–0.166.
- **Seeds:** 50 gives 80% power to detect 0.05 at SD 0.105 with α = 0.05
  Holm-adjusted across the 6 primary cells (needed n ≈ 53 at Bonferroni
  level, so slightly below; the Holm step-down is less strict). For H2 at
  the largest SD (0.166), the minimum detectable effect at 50 seeds is about
  0.09.
- **E1, E3, E4:** 30 seeds. The pilot effects (H4 ≈ 0.25 reward per object,
  SD < 0.02) are far larger than these designs can miss.

## 5. Analysis

- **Unit:** the training seed. Architectures are paired because they share
  worlds within a seed.
- **Inference:** paired bootstrap 95% CI and sign-flip permutation p (10,000
  flips).
- **Multiplicity:** Holm correction within each hypothesis family, i.e.
  within each table produced by the named function.
- **Verdict rule:** "supported" if the 95% CI excludes 0 in the predicted
  direction and the Holm-adjusted p < 0.05. "Contradicted" if the CI
  excludes 0 in the opposite direction. Otherwise "inconclusive".
- **No-effect claims** use `tost_equivalence` with margin 0.05; a
  nonsignificant p is never read as no effect.
- **Robustness (not confirmatory):** `hierarchical_bootstrap` over seed and
  world.
- **H5:** tested only for agents whose mechanism uses the budget (A3, A5);
  the budget is a dummy factor for the others.

## 6. Exclusions and deviations

- **Exclusions:** none. Seed-level learning failures (for example A5 local
  optima at 2 bits) are data.
- **Deviations:** any departure from this document after the lock is listed
  here with date and reason.
  - **2026-10-26, analysis code (after all locked runs finished):**
    `adjust()` in `src/eip/analysis/hypotheses.py` did not apply the
    §5 condition p_holm < 0.05 to verdicts; it used the CI alone. It now
    applies the registered rule. No data, run or other analysis changed.
    Effect: H4 for A2 (immediate) goes from "supported" to "inconclusive"
    (p_holm 0.095). No other verdict changes. `hypotheses.py` therefore
    no longer matches `lock_manifest.sha256` (`shasum -c` reports exactly
    that one file), and this file no longer matches the hash in `LOCK`
    because of this deviation note.
  - **H3 and H5 have no p-values** (CI only), so for them the registered
    rule is applied to the CI alone. This was not stated at lock.

## 7. What the confirmatory results can and cannot establish

They can establish the predicted *relationships* in DistinctionWorld for
these agent implementations. They cannot establish substrate independence,
generality to other tasks, or a universal unit (protocol sections 6, 9.4
and 14).

## 8. Lock mechanism

No version control is available on this machine. The lock is
`protocol/lock_manifest.sha256`: one SHA-256 line per file under `src/`,
`configs/`, `scripts/` and `tests/`. Its own hash and the time are in
`protocol/LOCK`. To check that code is unchanged since the lock:

    shasum -a 256 -c protocol/lock_manifest.sha256
