# Context recovery, v0.6

This version addresses a measured failure: after a shared supply shortage, the previous adaptive learner could carry damaged bed-response estimates into a fresh, healthy habitat. It preserves the normal calibration checkpoint, evaluates competing explanations, and lets the controller spend physical actions on discriminating tests. It is a bounded system-identification and control experiment, not a test of sentience.

## What the component test isolated

`experiments/recovery-components.mjs` reproduces the first evaluation case for each of five exposed v0.5 habitat seeds and four conditions. Four frozen, fresh-state 128-tick trials cross the earlier/later bed estimates and supply estimate. Physics, starting state and policy are identical within each case; only those retained components differ. The manifest was written before these post-hoc trials. Results preserve all crossed checkpoints.

| Previous condition | Earlier models | Later models | Restore supply only | Restore beds only |
| --- | ---: | ---: | ---: | ---: |
| Steady | 87.34% | 81.72% | 81.72% | 87.50% |
| Delivery fault | 87.34% | 82.66% | 82.66% | 87.34% |
| Faster drying | 87.34% | 76.88% | 76.88% | 87.50% |
| Supply shortage | 87.34% | 53.28% | 53.28% | 87.50% |

The bed-component swap restores performance in these cases. This supports protecting those estimates from confounded scarcity updates. It does not establish that supply estimation is unimportant in general or turn the exposed cases into an independent validation. The test uses 17,920 physical actions, including twenty reproduced full seasons; forecast computation is separate.

## Controller and observation boundary

`src/context.mjs`, `src/context-planner.mjs` and `src/context-study.mjs` add a new version without modifying the v0.5 scientific modules. The root page is `context.html`; `/adaptation.html` preserves v0.5.

- **Calibration:** one prescribed 160-action normal trajectory per habitat fits bed delivery, evaporation and lag using the existing observation-only fitter. Every control receives the same copied checkpoint. The prescribed route does not visit the tank; the normal refill starts and remains at the authored 0.0055 prior. Calibration is charged once, with its actual action list and checkpoint retained.
- **Six supplied explanations:** normal; impaired delivery at A or B; increased evaporation at A or B; restricted shared refill. Initial fault candidates are explicit multiples of the normal estimates. This is authored structure, not autonomous discovery of a new causal vocabulary.
- **Protected memory:** evaluation never fits the normal model. Delivery candidates fit only their designated gain, drying candidates only their designated evaporation, and the shared-supply candidate only refill. Estimated water-limited delivery intervals are excluded from bed fitting. Fitted candidates persist into the next browser season; spatial readings and ranking scores reset.
- **Selection:** each candidate predicts before the current reading is assimilated. All receive the same local observations. Exponentially weighted residual scores include a small complexity penalty; three consecutive advantages plus a cooldown are needed to switch. “Relative fit” is a softmax display of heuristic scores, not a calibrated posterior probability.
- **Unknown:** if even the best candidate exceeds the residual threshold, the display says “unexplained.” There is no learned compound model. Care still uses the current selected candidate; this may lag the lowest-error candidate because switching has hysteresis. The detector can fail to reject a compound disturbance.
- **Available information:** current position, time, weather, nearby equipment, local bed readings and the tank reading when nearby. Remote true moisture, hidden parameters, fault kind, start/end schedules and future weather never enter the ordinary policy. An observer-only display and the recorded evidence may reveal them.

The shared unconstrained v0.5 fitter is maintained as a shadow model for the single-model control. Its computation is counted in every arm; protected control never uses its evaluation-fitted bed parameters. Candidate update counts exclude these unused shadow updates.

## Physical investigations and scarcity

When residuals persist or ambiguous candidates fit poorly, the planner may compare a valve perturbation followed by ten observation ticks, a tank visit and six observation ticks, or closing both valves before measuring refill. Travel, operation, waiting, water consumption and postponed care all count. A 32-tick cooldown limits repeated tests. Three candidate predictions are recorded before a proposed test. Their separation earns a bounded heuristic information bonus; the planner may reject the test when predicted care costs outweigh it. This is a simple active model-discrimination heuristic, not a Bayes-optimal dual controller.

Ordinary candidate journeys use the selected model for a 64-tick forecast and a supplied feedback continuation policy. Other candidates are simulated for deliberate tests only. Remaining-season water need and supply are estimated with current weather held constant and both shades deployed; a terminal deficit incurs a quadratic penalty. This is an optimistic planning estimate, not a proof that the season is feasible, a formal safety certificate, or knowledge of future weather/faults. Local model identifiability and long-term water exhaustion remain separate obstacles.

The live page shows the current explanation, question and water estimate near the environment. The detailed cards show relative fits, alternatives, changes of explanation, protected parameters and each test's prior predictions beside the later measurement. Manual interventions interrupt and preserve an active investigation record. Browser exports include the calibration, initial knowledge, actions, decisions, learned contexts and probe records. A reload reconstructs and checks the action sequence rather than trusting a serialized simulator state.

## Frozen evaluation

`experiments/frozen/context-v6/manifest.json` contains the protocol, source copies, individual hashes, combined execution hash and freeze timestamp. It was written before the first evaluation of twelve new habitat seeds: 45101, 45119, 45131, 45137, 45161, 45179, 45191, 45233, 45247, 45259, 45281, 45289. Development used 7201, 7213 and 7237. Development exposed costs and poor diagnoses, and reduced unnecessary probing before the freeze.

Each habitat receives one shared calibration and a fresh 128-tick reference. Each of five conditions—steady, local delivery fault, local drying, shared shortage, and simultaneous delivery/supply fault—is evaluated for 480 ticks under seven controls. Disturbed conditions contain two normal → disturbed → normal cycles; the two windows may have different severity. All seven arms share the exact scenario and starting checkpoint. Compound faults are absent from the candidate bank.

| Control | Change from protected contexts |
| --- | --- |
| Protected contexts | Fitting, switching, costed investigations and reserve penalty enabled |
| Single adaptive model | One unconstrained v0.5 fitter updates the model; no context selection or deliberate context probes |
| Fixed fault candidates | Candidate parameter fitting disabled; selection and investigations remain |
| No context switching | Normal model always controls care; candidates may still be fitted in the background |
| No deliberate probes | Ordinary care and local readings remain, but no deliberate test options |
| No reserve cost | Removes the remaining-season deficit penalty; ordinary water cost remains |
| Full-state reference | Current true state and effective parameters supplied to the same planner; no future fault schedule; diagnostic reference, not an optimum |

Every season is followed by a fresh 128-tick normal trial with fitting, context switching and deliberate investigations disabled. This tests whether the retained **normal checkpoint** still works under the same fixed controller; it is intentionally zero-change by construction for protected checkpoints. It does not demonstrate that the live controller recognized the return to normal. The separate “after return” measure is both-bed viable time in the first 64 ticks after each disturbance ends.

The primary contrast is protected minus single-model both-bed viable time. Compute a mean across the five conditions within each independent habitat, then a paired 95% t interval over the twelve differences (df 11). The four component contrasts are exploratory and unadjusted for multiplicity. Windows, readings and repeated episodes are not independent replicates. A correct-family match counts any matching selection within a fault window; it is not sustained accuracy. For compound faults a match means “unexplained”; non-detections are retained as null delays. Recovery requires twelve consecutive viable ticks after a loss; failures remain censored.

Budget: 12 × [160 + 128 + 35 × (480 + 128)] = **258,816 physical actions**. Model transitions are counted separately, including planner continuations and candidate/shadow predictions. One service worker executes this job, with a 900,000 ms active limit. A leased chunk reserves 21,568 actions; interrupted work is charged conservatively and cannot be presented as completed observations. Runs persist in `data/lab.json` and the UI exposes pause/resume/stop/export. After completion the service is idle. Repeating the same suite is reproduction, not new validation.

## Results

Completed job `b69527c1-1f53-44fd-9270-fa7944156d1e`: 420 evaluation seasons, 420 post-evaluation retention trials, twelve calibrations and twelve common retention references. **258,816 physical actions**, **391,774,910 model transitions**, zero uncertain actions, **230.7 seconds** active worker time. All recorded evaluation actions were legal.

| Control | Both viable | After return | Fresh retention | Tests / season |
| --- | ---: | ---: | ---: | ---: |
| Protected contexts | 80.95% | 64.68% | 98.31% | 1.00 |
| Single adaptive model | 79.70% | 59.72% | 84.19% | 0.00 |
| Fixed fault candidates | 82.89% | 66.44% | 98.31% | 0.70 |
| No context switching | 81.14% | 70.35% | 98.31% | 0.00 |
| No deliberate probes | 81.11% | 66.18% | 98.31% | 0.00 |
| No reserve cost | 80.13% | 64.08% | 98.31% | 0.95 |
| Full-state reference | 85.68% | 72.20% | 98.31% | 0.00 |

The original fresh normal reference averages 98.31%. Protected checkpoints preserve that result exactly by construction. The single adaptive model loses 14.11 percentage points on the same fresh-state test. That demonstrates the practical cost of allowing the normal checkpoint to drift; it does not establish successful live recognition of a restored habitat.

| Paired contrast | Mean difference, pp | 95% t interval, pp |
| --- | ---: | ---: |
| Protected minus single | +1.25 | -1.14 to +3.64 |
| Protected minus no-fit | -1.94 | -4.02 to +0.14 |
| Protected minus no-detect | -0.19 | -2.32 to +1.93 |
| Protected minus no-probe | -0.16 | -2.42 to +2.09 |
| Protected minus no-reserve | +0.82 | -0.58 to +2.21 |

The primary interval includes zero. There is no established overall care advantage. Fixed candidates have the higher descriptive average; the added fitting has not earned its place. Neither deliberate probes nor context switching shows a positive overall contribution. The reserve penalty has a small positive mean difference, also with an interval crossing zero. These component intervals are exploratory, not multiplicity-adjusted.

Protected control matched the supplied family at least once in **21/24 delivery windows**, **21/24 drying windows**, and **19/24 supply windows**. Among matched windows, mean delays were 35.1, 37.9 and 42.7 ticks respectively; unmatched windows are excluded from those conditional means and remain in the export. It rejected **0/24 compound windows** as unexplained, and never displayed unexplained in the formal suite. That is a failed novelty-rejection test, not evidence that its available explanations were adequate. Compound-condition viability was 69.24%. Correct-family matching does not measure the quality or duration of that diagnosis.

The next nursery experiment should calibrate rejection against ordinary model error, obtain direct normal-supply measurements, and require evidence before updating a fault candidate. Those changes need a new freeze and new evaluation seeds. Adding more machines or simply extending these runs would not resolve the measured identification failure.

Evidence: `experiments/results/context-study-b69527c1-1f53-44fd-9270-fa7944156d1e.json`, `recovery-components-v1.json`, and `v6-compute-audit.json`. The evidence total, including the component diagnosis, is **276,736 physical actions** and **435,601,495 model transitions**. Two retained development runs account for another 51,360 physical actions, including their calibrations, and are inventoried separately. Tests, manual browser journeys and debugging are outside that evidence total. `node experiments/audit-context.mjs` verifies all twelve execution-source hashes, the earlier v0.5 source, report accounting and protected retention invariants.

## Research relationship and limits

[RL-CD (da Silva et al., 2006)](https://people.cs.umass.edu/~bsilva/papers/nonstationary_icml2006.pdf) motivates retaining and selecting among contextual models rather than overwriting one model. Here the candidate families are finite and supplied, unlike unconstrained discovery of contexts. [Heirung et al. (2019)](https://www.sciencedirect.com/science/article/pii/S0098135418312730) motivates considering model discrimination while choosing control actions. Our bounded prediction-separation bonus is a heuristic; it does not reproduce their optimization or guarantees.

The [RFS reading](rfs-reading.md) supplies a useful framing of continuity and consequences, while the component experiment supplies the operational reason to preserve a checkpoint. The project still uses structured sensors, authored equations, a finite hypothesis bank and explicit planning rules. More computation does not itself establish sentience or AGI.

The next domain extension remains a distinct maze mechanism followed by a direct, bounded image-steering trial. This release completes the nursery diagnosis/recovery stage; it does not count nursery results as image-editing evidence. [Connection to the accreditation work](research-link.md).
