← Harness Engineering From First Principles

Selecting Relevant History

Compare no history, relevant history and irrelevant history using independently checked outcomes.

Suppose a harness keeps every Project 01 run in an experience store, and a new run is asked T1: “Which file declares the function execute_with_retry?” The selector finds the most relevant prior record. It is a verified case from an earlier T1 run, with the answer worker, the citation for lines 12–16 and the digest. The new run copies it and scores VERIFIED_CORRECT.

The score does not demonstrate transferable learning. The harness retrieved the answer to the exam question from a previous sitting of the same exam. If T1 is part of an evaluation set, the score is now meaningless. Worse, the run may also have read no files at all, which is REVIEW-02’s zero-tool path (Chapter 14) arriving by a new route. The “experience” here was leakage: information that the evaluation assumes the agent does not have.

Experience retrieval can fail in the other direction too. Retrieve too little and the store adds nothing. Retrieve irrelevant records and they consume the context budget (Chapter 7) and may mislead. Retrieve a confident lesson that happens to be wrong and the agent follows it. This chapter builds the selection mechanism in the order in which those dangers must be excluded: eligibility first, then relevance, then the budget, then presentation. It then proposes Project 09’s test of whether any of it helps.

Evidence status. Draft manuscript. Formal Project 09 (Experience-Aware Agent) and the E22 live comparison have not started. The deterministic selection mechanism D22-RETRIEVAL-01 is implemented and executed (examples/pi-harness-lab/src/experience.ts selectFrom + auditRetrievals; test/retrieval.test.ts, 7/7 pass offline): the §22.6 six-record eligibility table with reasons, both packing rules with measured token budgets, the leakage audit with a seeded leaky retrieval and a clean negative control, contamination canaries with independent flags, and an integrated retrieve→tombstone→re-retrieve→audit scenario. No experience store existed before this batch; the store itself is D21-EXPERIENCE-01. Project 01 is REJECTED (REVIEW-02). Writer findings are OBSERVED by static inspection in R06 (not executed). The live H-arm comparison and the E22 statistical design remain PROPOSED and EXPERIMENT PENDING.

22.1 Three ways history leaks

Leakage is any path by which a run receives information that the evaluation design assumes it does not have. Three forms matter for experience retrieval. Chapter 23 develops their temporal side further.

Same-instance leakage. A record derived from the same task instance is retrieved, as in the opening. Exclude any record whose source-task dependency closure includes the current instance (Chapter 21 §21.3), including cases, validation outcomes, procedures and lessons derived from it. Different IDs on near-duplicates do not make them independent tasks; the split manifest must group their shared answer-generating dependencies.

Held-out leakage. A record derived from any task in the held-out evaluation set is retrieved during evaluation, or the selector itself was tuned on held-out outcomes. Even if the instance differs, held-out tasks must be unseen in every sense the design assumes. That includes the selection policy’s development. Chapter 18 required development and confirmation to be separated for harness changes. Selection policies are harness changes.

Future leakage. A record whose verdict did not exist at the time the run being simulated started is used anyway. This matters whenever experiments replay a history: “what would the agent have done on day 10, given what it knew on day 10?” A record created on day 8 whose outcome became known on day 12 was not available on day 10, however relevant it is. R06 found that a Writer lesson-retrieval query “has no as-of boundary” (R06-C09; OBSERVED, static inspection). That is the absence of exactly this check. Chapter 21 replaces one outcomeKnownAt with per-component knownAt, host acceptance and historical version resolution. A task test available on day 8 cannot make a review arriving on day 12 visible on day 10.

R06’s own registered recommendation states the bar plainly. Defer online learning for Project 01, and the recommendation is “falsified if registered history arms improve held-out outcomes at equal total cost” (R06-C12; PROPOSED). The test of experience is held-out improvement at matched cost. In-sample scores do not count.

22.2 Eligibility: a filter, not a ranking signal

Eligibility is a hard boundary before ranking. It protects the entire development process, not just the final run. The protocol is PROPOSED.

First seal a versioned split manifest before store construction or tuning. Record its ID, digest, construction seed/procedure, fixture digests, task-instance membership, registered family definitions, repository groups and near-duplicate/answer-dependency groups. Group shared solutions before splitting; renaming a symbol is not a new independent family. The manifest distinguishes development (including separate procedure admission-validation tasks), seen-family confirmation on independent new instances, and novel-family confirmation with families absent from the development store. Cross-partition duplicates or shared answer templates must be removed or regrouped before freezing, not excused after scoring.

A custodian creates the sealed confirmation fixtures and oracles. Authors, extractors, selector developers and policy/model selection processes access development material only. Confirmation content, outcomes and any records derived from them are absent from their stores, indexes, prompts, logs and tuning interfaces. The custodian exposes tasks only to the frozen evaluation runner at confirmation time and outcomes only to the final evaluator. Access controls and access logs implement this separation; a human promise or ranking penalty is insufficient. If one operator has already seen the answers, record that exposure and obtain new confirmation material; it cannot be unseen. The frozen split digest can identify sealed material without exposing its content.

Grouping is a registered method, not a promise to deduplicate. The proposed first detector uses three complementary passes. First, compute byte hashes and canonical-task hashes over a declared schema containing task inputs, fixture identity and required output contract. Canonicalization sorts schema keys and normalizes declared transport encoding; it does not erase semantic constants or executable whitespace. The custodian separately compares solution/oracle artifacts, which developers cannot access.

Second, tokenize task descriptions and parsed source with a pinned tool, compute five-token-shingle Jaccard overlap, and compare structural signatures that normalize identifier names while preserving operators and control flow. Third, identify shared answer templates: common generator lineage, parameterized patch skeletons, solution derivations or source-to-answer mappings. Similar wording is neither necessary nor sufficient for a shared answer. A renamed retry task with the same solution generator is grouped even if its lexical score falls below threshold. Task families encode the registered problem mechanism and preconditions, not a model’s success rate.

Calibrate the lexical/structural thresholds and normalization rules only on a separate development grouping set, with labelled duplicates, paraphrases, renamed templates and genuinely different hard negatives. Register the chosen values, detector/parser versions, label protocol, coverage and precision/recall requirements before the custodian applies them to prospective confirmation material. No universal threshold is asserted here; concrete values and validation counts are pre-execution requirements. Neither confirmation outcomes nor candidate-model scores may calibrate the detector, family definitions or thresholds.

Create a candidate-pair edge when an exact match, a registered near-match rule or an adjudicated answer dependency fires. Assign entire connected components, together with repository/generator constraints, to one split. Transitive linkage can create large components; report that cost instead of cutting an inconvenient edge to improve sample size. Novel-family confirmation additionally excludes development family membership, not just individual duplicate IDs. Store the grouping manifest and its digest alongside the split manifest, including each edge’s reason.

Before seal, the custodian validates the fixed detector against seeded duplicate variants and hard negatives, audits missed-pair samples and reports detections, false positives and unresolved cases. Ambiguous pairs are reviewed by an adjudicator outside selector development, using task and solution dependencies but no treatment outcomes. Conservatively co-locate or quarantine unresolved groups. A failed validation blocks the split; changing the method requires development-only recalibration and fresh unexposed confirmation material, not repeated tuning on this pool.

The custodian may inspect prospective confirmation content solely for construction, grouping and audit; developers receive the method and development validation evidence, not held-out solutions or hints. Keep custodian judgments and sealed artifacts access-controlled. If an operator also performs candidate development, record that exposure and replace the affected confirmation material under a separate custodian. After any fixture/family change, rerun the frozen checks and version both manifests. If a cross-split near-duplicate is discovered after sealing, quarantine its full dependency group, stop affected confirmation claims, preserve the exposure record and produce a new sealed evaluation version. Do not silently delete a bad score or retune the preferred policy on the compromised set. These diagnostics cannot establish absence of opaque-model pretraining exposure; they address this study’s identifiable leakage paths.

Quarantine is an enforcing state, not deletion. A protected exposure record names the full affected group/dependency closure, manifest version, cause and availability. Mark those IDs INELIGIBLE_QUARANTINED in the study’s admission registry and remove them from future arms in that evaluation version. Annotate affected claims WITHDRAWN_FOR_EXPOSURE with the exposure record ID; preserve original observations and analysis. Release is possible only under a newly sealed manifest/decision, never by selectively dropping an unfavourable score from the old analysis.

Register the scope predicate before confirmation: exact-case reliance requires matching task/fixture preconditions; successful procedure use requires its listed applicability predicates and permitted use IDs. Novel-family general-procedure advice is allowed only for an explicitly registered generic use whose preconditions match; it makes no prior verification claim for that novel family. Negative cases may warn within their registered failure-pattern scope. H−/Hx can present labelled irrelevant/inapplicable cases under their registered control-use IDs, but cannot execute them as certified applicable procedures. A failed or unknown use predicate refuses that use, without silently widening scope. Ambiguous cross-split dependency groups are co-located or quarantined; ambiguity about applicability is not positive eligibility.

An access-log reviewer outside selector development and custodian optimization audits authenticated access records at each construction/seal gate, before every confirmation batch and before releasing analysis. Record the exact cadence, reviewer identity, principal/role assignments, artifact/version access, audit coverage and decision receipts in the registration. Missing or tampered audit evidence blocks the affected gate. Exposure findings trigger the existing quarantine and fresh-material rule even when the exposed operator did not self-report.

For every development, tuning and confirmation retrieval, apply:

  1. Temporal. Freeze the run cutoff at admission (or simulated start). Resolve the lineage in Chapter 21’s historical registry prefix, with availableAt < cutoff for host acceptance and every required dependency and verdict. Unknown availability is ineligible. Later corrections do not enter earlier replay; a visible rejected head cannot fall back to an earlier successful version. Record the exact immutable version selected.
  2. Instance. No dependency derives from the current task instance or its registered duplicate/answer group.
  3. Split. All source-task dependencies belong to the permitted development partition. Exclude all confirmation-derived material throughout store admission, extraction, ranking, packing, prompt design, model selection and policy tuning, including indirect summaries. A record cannot become eligible by laundering its source through a lesson.
  4. Standing and scope. Apply the policy for this record kind and use, with Chapter 21’s scoped verification, structured independence and provenance. A negative case is advice within its failed scope, not a certified working solution; a procedure must have independent development-validation support. Mark scope mismatches explicitly.
  5. Integrity. Resolve immutable references and dependency closure, verify hashes, authenticated writers and host registry admission. A matching digest alone does not establish author identity or truth.

Confirmation runs start from identical frozen development-store snapshots. No arm’s outcomes or traces enter a later arm or repetition. Keep these in a separate embargoed result sink until the registered study and analysis are locked; later reuse requires a new study and a new sealed test set. Leakage discovered at any stage invalidates the affected confirmation claims. Record exposure and rerun only against newly sealed material after repair; do not tune on the compromised set and call it confirmation again.

Why a filter? R06-C09 observed that zero-overlap lesson records could survive and target type was a ranking signal. Highly relevant leaked answers would often rank first. Relevance cannot trade off the hard conditions above.

22.3 Relevance: what makes a past record useful now

Among eligible records, the selector ranks by expected usefulness. Three signals are commonly available, and each has a characteristic failure.

  • Task family. A record from the same registered family (Chapter 21’s taskFamily) is more likely to transfer. Failure: families too broad (“bug fix”) or too narrow (one per repository).
  • Feature similarity. Overlap in files, symbols, error messages or description text, measured lexically or by embedding. Failure: surface similarity without structural similarity. The fixture’s decoy file mentions “retry-policy” in two unrelated senses (Chapter 7), and a similarity ranker would score it highly.
  • Outcome quality. Prefer records whose verified outcomes were good on both dimensions. Failure: selecting only successes hides the negative history that tells an agent what not to do. Selecting by a scalar reward reproduces R06-C03’s “single maximum reward” pattern.

The book’s position is that relevance is an empirical property, not a design assertion. Whether family, similarity or outcome weighting predicts usefulness is what Project 09 measures. The selector should therefore be simple, deterministic and logged: every retrieval records its candidates, the scores, the eligibility exclusions and the reasons. That is Chapter 8’s selection record, applied to history. Without it, a failure caused by retrieved experience cannot be attributed.

Negative history deserves its own treatment. A failed case (“this patch retried permanent failures and was rejected”) can be as useful as a success, and the blueprint names it in Project 09’s mechanism list: “negative-history control” (blueprint, project table). Negative records must be presented as negative. A failed case shown without its outcome label is indistinguishable from a recommendation.

For E22’s H+ policy, reserve one negative-case slot within the 3,000-token allowance. Choose the highest-ranked relevant eligible negative case whose complete rendering fits the allowance, ties broken by recordId. Pack it first, then fill remaining capacity by the rule in §22.4. If none fits or none is relevant, log that reason, candidate sizes and zero coverage; do not invent a failure. Report negative records selected, shown, cited, and linked to a changed proposal or fallback. These are distinct endpoints: being shown is not proof of influence. H+noNeg in §22.7 tests the slot’s value. Its removal tests that policy change as a whole, including the replacement material, not the causal effect of one sentence in isolation.

A historical failure warns the model and may rank a matching case higher. It disqualifies an approach only if a current deterministic precondition or broker policy independently rules that approach out. Otherwise the model may propose a fallback or request review, still through normal gates. Out-of-scope failures can be ignored with a logged reason. One old failure is not a universal prohibition and cannot enlarge the selector’s authority.

22.4 Budget and presentation

Retrieved history enters the model’s context, so Chapters 7 and 8 apply in full.

Budget. History competes with the task’s own evidence for the context budget. A fixed history allowance, registered in the run contract, keeps history from displacing the current task’s sources. The presence test of Chapter 7 can then confirm, offline, that the current task’s critical locus is still present at decision time when history is added.

The chosen packing rule is negative-slot-first, then highest-ranked-first greedy packing: after the reserved negative, scan the remaining ranked list, add a whole rendered record if it fits, otherwise skip it and continue. Use recordId as a stable tie-break. Count labels, provenance, separators and every wrapper token; never truncate away a verdict. This is not globally optimal token utilization or utility maximization. The same frozen rule is used in H+ and its content/negative-history ablations; different packing algorithms are a later registered comparison, not a post-hoc switch.

Presentation. Each retrieved record carries its kind, its standing and its provenance into the context:

  • a case’s outcome on both dimensions;
  • whether a procedure was re-executed;
  • that a lesson is model-authored and unverified;
  • the record’s date and source run.

This is Chapter 8’s rule that provenance must travel with text. Presenting a lesson as “Lesson (model-written, unverified, from run R-214): read error classes before fixing retry logic” gives the model what it needs to weigh it. Presenting it as an instruction does not.

Authority. Retrieved procedures are proposals. A procedure that edits files passes Chapter 6’s preconditions and Chapter 12’s broker exactly as a newly generated edit would. Memory confers no authority.

22.5 Ownership

Stage Owner Requires May decide Must not
Eligibility Host policy (deterministic) Record times, instance and split IDs, standing, integrity Exclude records Downgrade exclusion to a ranking penalty
Relevance Selector (deterministic, logged) Family, features, outcomes Rank eligible records Use held-out outcomes to tune itself
Budget Host Registered history allowance Truncate the selected list Displace the current task’s evidence
Presentation Host context builder Record kind, standing, provenance Format with labels Strip standing labels
Use Model Presented records Consider them Treat them as authority

22.6 Worked example: selecting for a held-out retry task

Scripted records and dates; every eligibility decision below is executed (D22-RETRIEVAL-01), with token sizes standing in for the pinned tokenizer the study would register.

A held-out task H3 in the “retry-bug fix” family is admitted at 10:00 on day 20. Its fixture is a new versioned repository, not repo-scout-v1. The store holds six candidate records:

Record Kind Source tasks / split availableAt Standing Eligible? Reason
R1 Case (success, both dimensions) D2 / development day 14 Independent evaluators Yes All conditions hold
R2 Case (failure: over-broad retry) D5 / development day 16 Independent evaluators Yes Negative history, eligible
R3 Procedure “write permanent-failure test first” D2 and D5 / development day 18 Validated on independent D7 (development) Yes Re-executed (Chapter 21 rule 3)
R4 Case (success) H3 / held-out day 19 Independent No Same instance, and held-out split
R5 Lesson “the comment in worker misleads” D9 / development day 21 Model-authored No Outcome known after admission (future)
R6 Case (success) H1 / held-out day 12 Independent No Held-out split

Here availableAt is Chapter 21’s maximum over host acceptance and every required component/verdict; assume all earlier required times precede the displayed time and hashes/writers pass integrity. R3’s full source closure includes D7, so its development membership must also be checked. R4 and R6 are adversarial candidates supplied to the filter test; a properly sealed development store would never contain them.

The three exclusions illustrate the three leakage forms in §22.1. R4 is the opening’s exam answer. R5 did not exist yet at 10:00 on day 20. R6 is from another held-out task. Relevance ranking then orders R1, R2 and R3, and none of the excluded records can appear however relevant it is.

Budget arithmetic (executed with scripted token sizes). The registered history allowance is 3,000 tokens, and the rendered records with labels cost R1 1,400, R2 1,100 and R3 600, for a total of 3,100 — token counts are scripted stand-ins for the pinned tokenizer the study would register, and the packing below runs deterministically on them.

1,400 + 1,100 + 600 = 3,100 > 3,000.

The chosen policy takes negative R2 first (1,100), then ranked R1 (1,400), leaving 500: too few for R3’s 600. Total 2,500. A different smallest-first greedy packing takes R3 (600), then R2 (1,100), for 1,700, and cannot fit R1 (1,700 + 1,400 = 3,100 > 3,000). Both pack two records, but neither fact proves optimal usefulness. Smallest-first does not maximize token utilization: R1 + R2 uses 2,500 instead of 1,700. The executed comparison proves that the policy changes the material shown and must be frozen; it does not choose a globally best algorithm. Sizes and the 3,000-token allowance are registered inputs to the demonstration, not measurements. (The executed run reports 2,506 and 1,706: the difference is the measured wrapper overhead the rule above requires counting.)

22.7 Project 09 checkpoint: Experience-Aware Agent

Blueprint requirement: solve a recurring task using past runs. The new mechanisms are selective experience retrieval, action-policy preferences and negative-history control. The verification compares no history, relevant history and irrelevant history, with no leakage from future or held-out outcomes.

Status: formal study not started. The deterministic mechanism is executed: eligibility filters with named exclusions, both packing rules with measured token accounting, the leakage audit with seeded positive and negative controls, contamination canaries, a rebuild-safe projection check, and the tombstone-gated integrated scenario. Its prerequisites that now exist as demos are Chapter 21’s record contract and admission (D21-EXPERIENCE-01) and Chapter 18’s comparison discipline. Still missing: a corpus of verified runs to remember (requiring Projects 01–06, none accepted or started beyond Project 01’s rejected candidate) and the live H-arm comparison.

Proposed study. All of the following is PROPOSED; EXPERIMENT PENDING. This is the revised E22 protocol proposal; numerical sample size, resource ceilings and precision targets still require registration before execution. It reports no results.

Question and primary contrast. Does eligible experience improve verified completion at matched total cost? Register H+ versus H0 as the sole primary contrast, with completion requiring task PASS and execution ACCEPTED. Report both dimensions separately as well. The directional hypothesis is positive; a negative or imprecise result leaves benefit undemonstrated for these tasks/model. It does not prove no possible benefit. Practical equivalence requires a registered margin and precision.

Arm Material shown Purpose and limits
H0 No history Baseline using the same total resource ceiling
H+ Eligible relevant history, negative slot and chosen packing Primary treatment: effect of the complete history policy
H− Eligible other-family irrelevant history, rendered to H+’s token allowance with a registered neutral padding rule Volume/presentation control; padding is labelled, not new evidence
Hx Eligible, genuinely verified cases from other development tasks whose solutions are plausible but inapplicable here Production-eligible hard-negative control; no forged verification or silent filter bypass
Hredacted The same selected record versions and slots as H+, with task-specific solutions/answers removed, preserving procedures, failure types, provenance and verdict labels Content ablation: challenge answer retrieval as the explanation
H+noNeg H+ with negative cases excluded, filling by the same ranked greedy rule Secondary negative-history ablation; count changed context and actual costs

H− and Hx pass the same eligibility checks, including temporal and split restrictions. Inapplicability is defined from development-registered precondition categories; it does not give a developer access to held-out answers to manufacture a damaging record. Hx’s label describes a control, not proof that it harms outcomes. A real failed case remains labelled failed. Malformed, fabricated or ineligible records belong to separate adversarial filter tests, never these effectiveness arms.

Content ablation. Freeze a development-only redaction algorithm before confirmation: replace source-specific answer strings, solution patches, exact target paths/symbol mappings and answer-bearing snippets in the rendered body with labelled neutral placeholders. Preserve general procedure and failure-condition text only after a development audit checks that it does not encode the source answer. Use length-matched placeholders and a sham-formatting transform for H+ to control rendering effects; keep immutable source hashes and log the projection digest. Never use the held-out oracle to decide what to redact. Audit sampled projections for residual answer content and loss of procedural meaning, without changing the frozen transform after seeing confirmation outcomes. If the transform cannot preserve procedure while removing answers, report that limitation and do not claim this contrast identifies the mechanism.

Hredacted versus H0 challenges whether answer-free guidance transfers; H+ versus Hredacted estimates dependence on answer-bearing content under that transform. A gain only for H+ suggests an answer-content contribution, not demonstrated reusable skill. A gain for Hredacted is consistent with useful procedure or failure advice; altered presentation and residual information remain competing explanations. Retrieval conditions context; it does not establish that model weights learned a skill.

Use the exact H+ selected IDs and order, selected using original rendered sizes, with matched lengths measured by the pinned tokenizer. No freed tokens buy extra records or work. The projection is explicitly labelled redacted; its digest does not certify altered content as a newly verified source. Keep the frozen original record reference alongside it.

Seen and novel families. Run the frozen arms on both sealed cohorts from §22.2, reporting them separately. The primary endpoint is an aggregate over a predeclared cohort mixture, with cohort-specific secondary estimates. Novel families have no prior family records; eligible general procedures may still transfer. If no relevant record is available, log an empty selection rather than importing confirmation material. Test novel private synthetic variants with fresh hidden random symbol/answer mappings, as well as structural novelty. Similar-family gains alone do not establish transfer across families. No finite cohort proves absence of pretraining exposure, and unknown model training provenance remains UNKNOWN.

Contamination and Hleak diagnostics. Keep deliberate leakage outside the effectiveness arms and their aggregate. The custodian seeds synthetic sealed records with unique canaries, logs access, and checks exact and near-duplicate answer dependencies across partitions before freezing. A positive ingress control offers a same-instance/future/held-out record: the production selector must reject it and the retrieval audit must flag a deliberately corrupted log. A negative control uses eligible development history and must not be flagged. Log intended, retrieved and actually rendered IDs/digests separately to verify delivery.

An optional isolated Hleak delivery probe deliberately renders a canary-bearing synthetic record to test exposure/use, with an explicitly instrumented diagnostic bypass in a disposable context. It never accesses real secrets or feeds the store or any treatment run. Record prompt delivery and output canary use separately. Canary emission supports exposure; non-emission does not prove no leak. Missing score inflation can mean ignored history, failed delivery or an already easy task, rather than a failed detector. Detector success is correct flag/refusal behaviour on known controls, not a required performance gain from contamination.

Cost, isolation and analysis. Register a common total monetary ceiling with dated tariff/conversions, plus model-call, tool, token and time limits and Chapter 17’s admission semantics. Count retrieval, indexing/record preparation (amortized by a declared rule), redaction, context, proposal, verification, retries and final validation. H0 can spend its ceiling on the current task; H+ pays retrieval from that same ceiling. Equal ceilings do not imply equal realized spend: report both quality and actual cost; claim equal-cost improvement only at a registered cost target or along predeclared cost-quality comparisons, never by hiding unpaid preparation.

Freeze model/tools, split, development-store snapshot, selector, prompts, redaction, packing, evaluator and analysis identities before unsealing. Each held-out task may have the registered number of repetitions per arm, with randomized/interleaved order, fresh contexts and the identical frozen store. Held-out outcomes are used only for confirmation, never development or iterative selection. No cross-arm conversation or history ingestion is permitted. Register sample size, repetitions, practical margin, interval method, budget stopping and arm-blind infrastructure exclusions. Stop on resource ceilings or a leakage breach; do not peek and stop when a contrast first looks favourable. Retain all attempted runs and costs.

The independent analysis unit is the sampled task or, where tasks share repository/answer dependencies, that cluster (Chapter 18). Repetitions estimate within-unit variation, not extra independent tasks. Compare paired outcomes with cluster-aware intervals. H−, Hx, Hredacted, H+noNeg, cohort comparisons and procedure proposal/admission rates are secondary; register Holm adjustment for any secondary hypothesis-test family and label other comparisons exploratory. Detector diagnostics have known expected counts and are not included in that effectiveness family.

Acceptance and falsification. Any confirmation information reaching development, a production eligibility breach, or cross-arm contamination invalidates affected confirmatory claims; retain and report the failure. Positive/negative detector-control errors fail the integrity gate. Support for the primary benefit requires the registered interval to exclude no improvement and meet the predeclared practical threshold at the matched-cost target. A wide interval is inconclusive, not equivalence. H− close to H+ challenges specificity only within the achieved precision; H+noNeg tests the marginal value of negative history. Failure to transfer on novel families limits the domain. A failed ablation audit prevents a mechanistic attribution even if H+ improves the score.

Dependencies and status. Verified development records, a compatible Writer/Praxis adapter, protected immutable storage, qualified evaluators and the selector do not exist here. P01 remains REJECTED. The E22 live H-arm comparison and live-model detector probes are EXPERIMENT PENDING; no live arm or live detector has been run. The deterministic eligibility, packing, audit and canary-ingress machinery above is executed (D22-RETRIEVAL-01) on scripted fixtures.

E22’s initial effectiveness protocol retrieves once at admission in all history arms. On-demand retrieval is a separately registered extension, with the same decision-mode eligibility and explicit call/time/token/cost limits; every attempt and rerender is charged, never free extra context. Freeze H−’s padding corpus/grammar digest, seed, tokenizer and wrapper version before confirmation and audit answer/strategy leakage on development only. Padding is a length-control proposal, not proof of semantic neutrality; report any residual content/format effect as a control limitation.

22.8 Alternatives to retrieval

Retrieval at run time is one way to make past runs influence future ones. It is worth comparing with its alternatives, because each answers the leakage and attribution questions differently.

Approach How history influences a run Leakage control Attribution and reversal Cost
No memory Not at all Trivial Trivial None. This is the H0 baseline
Curated static guidance (human-written skills or instructions, Book I) Through fixed text admitted to the prompt Good, if the curator respects held-out sets Clear: the text is versioned and can be reverted Human time; slow to change
Run-time retrieval (this chapter) Through selected records per run Strong, if eligibility is enforced and logged Good: every retrieval is logged per run Store, selector, context budget
Weight updates (fine-tuning on history) Through changed model parameters Hard: auditing which records influenced which behaviour is difficult, and excluding held-out influence must be done before training Poor: reversal means reverting to a previous model Training compute, model management

Run-time retrieval has one property that matters especially for this book’s evaluation discipline. Its influence is local, logged and reversible per run. Every result can be attributed to the records shown, and an arm can be rerun with any record removed. That is what makes the H+, H− and Hx comparison possible at all. Weight updates trade that property away. They are outside this book’s scope, which uses Pi with hosted or local models as given and does not train them. Curated static guidance is the strongest simple competitor. A plausible outcome of Project 09 is that a few human-written rules drawn from verified failures match H+ at a fraction of its cost, and the study should include that comparison if the budget allows.

Within retrieval, the main design alternative is when to retrieve.

  • Once at admission is simple and logged, but blind to what the run later discovers.
  • On demand through a tool lets the model ask for history mid-run. The model then chooses its own context, in Chapter 7’s S3 sense, and every retrieval passes the same eligibility filter.

The second is more flexible and harder to analyse, because retrieval becomes a model behaviour. That makes the number and kind of history requests something to measure, not assume.

22.9 Failure modes

  • Exam-answer retrieval. Same-instance records are retrieved. Defence: the instance filter.
  • Tuned on the test. The selector’s weights are chosen by held-out outcomes. Defence: split discipline for policies too.
  • Future leakage. No as-of check (R06-C09’s gap). Defence: dependency availability, host acceptance and historical-prefix resolution at the frozen run cutoff.
  • Isolation as ranking. An ineligible record is down-weighted rather than excluded. Defence: eligibility is a hard filter.
  • Success-only memory. Negative history is dropped. Defence: keep it, labelled, with the reserved negative slot and measured coverage.
  • Unlabelled presentation. Lessons are shown as instructions. Defence: kind, standing and provenance in the rendered record.
  • History displaces evidence. Defence: a registered allowance, plus the presence test.
  • Memory as authority. A retrieved procedure is executed without gates. Defence: procedures are proposals.

22.10 What you can build and test now

D22-RETRIEVAL-01 already implements the core loop: eligibility as a pure function over the Chapter 21 record schema, run against the §22.6 table with all three exclusions and their reasons; both packing rules with measured token accounting, confirming they select different records under the 3,000-token allowance; and a leakage audit that replays retrieval logs against the eligibility rules, seeded with a deliberately leaky retrieval plus contamination canaries and a clean negative control. Extend it with relevance-signal variants (family, similarity, outcome) and a rebuild-safe projection check against cached summaries.

22.11 What remains unverified

  • Formal Project 09 and the E22 live comparison: whether any relevance signal predicts usefulness, at matched cost on held-out tasks, with model families that may share pretraining exposure.
  • Whether Writer’s existing lesson and strategy services could supply eligible records through an adapter. That needs the owners and tests R06 did not run.
  • Temporal and contamination subtleties beyond the as-of check (Chapter 23).

EXPERIMENT PENDING. The live H-arm comparison has not run; D22-RETRIEVAL-01 executes the eligibility, packing, audit and probe machinery on scripted fixtures — including the contamination canaries — not the effectiveness comparison.

Capstone connection. The experience-aware and adaptive-harness capstone needs a positive or negative Project 09 result, at matched cost on held-out tasks, before any adaptive policy (Chapters 25–26) may rely on history. The context-and-memory capstone reuses the eligibility filter, the history allowance and the labelled presentation.

Eligibility now resolves immutable versions and every required component as of a frozen cutoff, while the split boundary governs development too. These rules still leave broader questions: fixture changes, provider drift, reused evaluation sets and public answers. Chapter 23 must extend this contract rather than reduce it to one creation or outcome timestamp; it examines temporal integrity and contamination further.

Previous: Chapter 21: Experience: Traces, Outcomes, Skills, and Cases.

Next: Chapter 23: Temporal Integrity and Contamination.