← Harness Engineering From First Principles

Experience: Traces, Outcomes, Skills, and Cases

Distinguish traces, verified outcomes, reusable procedures and cases before indexing history.

The author’s existing Writer ecosystem already contains machinery for learning from experience. The R06 research track inspected it statically and recorded what one of its strategy stores does. It “stores issue/pipeline/reward/time/metadata; retrieves the single maximum reward; prunes lowest rewards”. It has “no cross-run persistence, evidence gate, task-family filter, uncertainty estimate or time cutoff in this class”, and its metadata “does not enforce eligibility” (HARNESS-RESEARCH-01/R06-ECK.md R06-C03; OBSERVED, unqualified source inspection, not executed). Elsewhere in the same code base, R06 found that the critic that scores a pipeline also supplies the reward used to select it later. So “this is not an independent held-out evaluator” (R06-C06). And a lesson-retrieval query “has no as-of boundary” (R06-C09).

None of this means the code is poor. R06 is careful to scope its findings to the inspected paths and not to generalize them across Writer. The findings show a pattern that recurs wherever agents learn from history. Different kinds of record get stored together as “experience” and retrieved as if they had the same standing. A reward is a number from some evaluator, and nobody asks which. A stored pipeline is a procedure, and nobody records whether it was verified to work. A lesson is a sentence a model wrote about its own run. A trace is a record of what happened. Indexed together and retrieved by similarity, they become indistinguishable inputs to the next run.

This chapter separates them before anything is indexed. It defines five kinds of experience record and the evidence each must carry, and argues that a record’s verification status is part of its content, not optional metadata. Chapter 22 then deals with selecting among them.

Evidence status. Draft manuscript. The experience-store demonstration D21-EXPERIENCE-01 is implemented and executed (examples/pi-harness-lab/src/experience.ts; test/experience.test.ts, 10/10 pass offline): immutable versioned records with standing, admission gates (including the re-execution requirement for eligible procedures), supersession with head checks, exact-prefix reopening, and idempotent/conflicting-duplicate handling. Writer and Praxis findings are OBSERVED by static inspection in R06. Nothing there was executed, and the findings are scoped to the inspected paths. External research (Reflexion, Voyager, case-based reasoning) is DOCUMENTED (verified) and not replicated. Project 01 is REJECTED (REVIEW-02). The record contract below (§21.3) is the executed one; the E22 outcome study that would use it remains EXPERIMENT PENDING (Chapter 22).

21.1 What “experience” can mean

A finished run leaves behind several distinct things, and the earlier chapters have already named most of them.

  • A trace: the record of what happened. Raw events, normalized trace and lifecycle record (Chapter 4). It says what the agent did.
  • An outcome: the evaluation of what was produced, now on two dimensions, task evaluation and execution acceptance (Chapter 15). It says whether what the agent produced was right, and whether the execution was acceptable, according to named evaluators.
  • A procedure: the book’s operational record of a reusable skill. Steps, code or a workflow fragment say how something can be done, with preconditions and a tested domain. Book I covers authoring Pi skill resources; packaging instructions as a Pi skill does not itself establish transfer, verification or authority.
  • A case: a problem paired with its solution and its outcome, in enough context to judge similarity. It says what worked here, for this kind of problem.

The fifth kind needs the most care:

  • A lesson (or reflection): a statement about the run, usually written by a model. “Read the configuration before the code.” “The comment in worker is misleading.” It says what someone believes the run taught.

Published agent research has explored each of these as a basis for improvement. Reflexion’s agents “verbally reflect on task feedback signals, then maintain their own reflective text in an episodic memory buffer to induce better decision-making in subsequent trials” (Shinn et al., “Reflexion: Language Agents with Verbal Reinforcement Learning”, NeurIPS 2023, arXiv:2303.11366; DOCUMENTED). That is a lesson store. Voyager maintains “an ever-growing skill library of executable code for storing and retrieving complex behaviors” (Wang et al., “Voyager: An Open-Ended Embodied Agent with Large Language Models”, arXiv:2305.16291; DOCUMENTED). That is a procedure store. Case-based reasoning, a much older tradition, organizes problem solving around retrieving similar past cases, reusing their solutions, testing the solution and retaining the new case (Aamodt and Plaza, “Case-Based Reasoning: Foundational Issues, Methodological Variations, and System Approaches”, AI Communications 7(1):39–59, 1994, doi:10.3233/AIC-1994-7104; DOCUMENTED). The CBR literature had a revise step, testing the reused solution before it is trusted, decades before agent memory was a research topic. This book does not adopt any of these systems, and it does not import their reported gains. It takes from them the observation that the kind of record decides how it can be used.

These are five roles, not disjoint containers. A case references an outcome and trace; a procedure can be extracted from cases; a lesson can refer to all of them. Each record version has one declared role, with typed links to the others rather than borrowing their standing.

21.2 Standing: what each record kind can be used for

The key property of an experience record is its standing: what a later run may legitimately do with it. Standing follows from what the record contains and how it was verified.

Record Contains Verified by May be used as Must not be used as
Trace Raw events, normalized trace, lifecycle Integrity checks (Chapter 4) Evidence of what happened; input to analysis and replay Evidence that the result was right
Outcome Task evaluation and execution acceptance, evaluator identities, evidence references Independent evaluators (Chapter 15) A label on the run, and on the procedure or case it supports A label beyond its evaluator’s scope or independence
Procedure Steps or code, preconditions, the runs it was extracted from Re-execution on independent development-validation tasks in a declared scope A candidate action plan or tool, admitted through normal gates Authority: a stored procedure grants no permission
Case Problem features, solution, outcome, context Its outcome record An example: “a similar problem was solved like this” A guarantee that the solution transfers
Lesson A natural-language belief about a run Usually nothing, unless deliberately tested A hypothesis to test or to show a model as advice Evidence; and it must never override verified records

Two rows matter most. A lesson is a model-generated belief, the fourth row of Chapter 19’s information table. It may be useful as advice, but it has no evidential standing until someone tests it. Storing lessons alongside outcomes without that distinction gives them borrowed authority. And a procedure is not a permission. A stored script that once edited a file safely does not authorize the next run to edit files. Chapter 11’s rule applies to remembered actions as much as to new ones: capability is not authority.

21.3 The experience record contract

A content address identifies immutable content. Changing a verdict in place would change that address and leave old citations ambiguous. The executed contract therefore uses immutable record versions, each containing a frozen standing and verification snapshot. Later evidence produces a new version. There is no mutable standing overlay.

// Specified here; enforceable core implemented in src/experience.ts
// (D21-EXPERIENCE-01): content-hashed immutable versions, lineage with
// supersede-the-head rules, standing-gated admission, no in-place edits.
// Full component/independence modelling below remains specified, not built.
type RecordKind = "trace" | "outcome" | "procedure" | "case" | "lesson";
type Actor = { id: string; kind: "host" | "tool" | "evaluator" | "model" | "human";
               version: string };
type Relation = "separate" | "shared" | "unknown";
interface KnownComponent {
  ref: string;                         // immutable digest/receipt ID
  observedAt: string;                  // event time, not eligibility time
  knownAt: string | null;              // host-attested availability time
}
interface VerdictObservation {
  aspect: "task" | "execution" | "trace" | "effect" | "review";
  verdict: string;                     // aspect-specific validated enum
  evaluator: Actor;
  knownAt: string | null;
  scope: {
    subjectArtifactDigest: string;     // evaluated artifact; never self-hash
    claimOrTaskIds: string[];
    evidenceRefs: string[];
    procedureDigest: string;           // test/check/review protocol
    modelProvider: string; modelVersion: string;
    harnessCommit: string; piVersion: string; fixtureDigest: string;
    evaluatedAt: string; limitations: string[];
  };
  independence: {
    relativeToActorIds: string[];
    procedure: Relation; model: Relation; data: Relation; evaluator: Relation;
    humanAdjudication: "present" | "absent" | "unknown";
    evidenceRefs: string[];
  };
}
interface ExperienceRecord {
  logicalId: string;                    // stable conceptual lineage
  recordId: string;                     // hash of canonical payload, excluding itself
  supersedes: string | null;            // previous immutable recordId
  kind: RecordKind;
  sourceRunIds: string[];
  taskFamily: string;
  sourceTaskInstanceIds: string[];      // ALL contributing tasks, including validation
  createdAt: string;
  recordAuthor: Actor;                  // assembler, often deterministic host
  components: (KnownComponent & { role: string; authors: Actor[] })[];
  verification: VerdictObservation[];   // all relevant observations, not one score
  standing: { use: "proposed" | "eligible" | "rejected" | "withdrawn";
              eligibleScope: string[]; // registered use/claim/aspect IDs; rules below
              policyDigest: string; basisRefs: string[]; limitations: string[] };
  body: unknown;                       // kind-specific, schema-validated
}

This is a compact specification sketch: a schema must enforce each kind’s body and every aspect’s enum, rather than accept arbitrary strings. Task verdicts remain PASS/FAIL/REVIEW/UNKNOWN; execution acceptance remains ACCEPTED/REJECTED/INCOMPLETE (Chapter 15 §15.6). A task PASS does not erase a rejected execution. standing.use authorizes a use of the record under a named policy, never an external effect. A failed case can be eligible as negative evidence; an untested lesson can be eligible as labelled advice. Neither is thereby certified a successful procedure.

eligibleScope must be nonempty for eligible standing and empty for proposed, rejected or withdrawn standing. IDs resolve through the named use policy to specific claim/aspect and artifact scope. Selection checks the requested use against that list and the scoped observations and transitive dependency gate; the eligible label alone is insufficient. The worked v4 lists only its negative-case warning use, never successful procedure reuse. A model-supplied arbitrary scope label is not admitted.

Identity and lineage. Canonical serialization fixes key ordering, encoding and schema version before hashing; recordId is excluded from its own preimage. The host verifies the hash on admission. A new version keeps logicalId and kind, and points supersedes to the current admitted head of that lineage. An append-only host registry, outside model write authority, records (logicalId, recordId, acceptedAt, sequence) atomically with a compare-and-swap on the prior head. Parents must already exist and have smaller registry sequences. Self-links, cycles, cross-lineage links and changes of kind are refused; a new role gets a new logical lineage. Competing updates are rejected for reconciliation against the current head, not resolved by wall-clock timestamps. For the proposed single-writer fixture, use one authoritative embedded SQLite registry with head compare-and-swap, version insertion and registry sequence assignment in one BEGIN IMMEDIATE transaction. This is a design choice, not an implemented store. Use unique lineage/version keys and a validated expected-head predicate; a failed predicate commits no new head. Only the trusted host writer may open the write route; no replicated registry or distributed platform is assumed. Pin the SQLite build, WAL and synchronous configuration and qualify crash/partial-write recovery and writer exclusion before claiming atomicity or durability. A process kill test does not establish power-loss survival (R04-C07).

A contention loser receives CONFLICT, rereads the actual head and records an honest rejected-attempt audit with the requested predecessor and current revision. It never relabels its stale proposal as admitted. Any retry is bounded by registered limits and must revalidate a new proposal against the current head; it cannot silently replace another writer’s version.

Prior version IDs remain stable. Retained content resolves exactly; authorized removal instead resolves to a permitted tombstone with the reconstruction limits of Chapter 23 §23.6. Current lookup follows the admitted registry head; explicit recordId lookup returns exactly the old version. Superseded is a relation between versions, not a field changed in an old object. Rejection, withdrawal, correction or new verification produces another immutable version, preserving the prior observations and explaining the new policy decision. No in-place rewriting or reinterpretation of a historical verdict is allowed. Physical retention follows the authorized removal/tombstone policy in Chapter 23; missing content cannot keep its old evidential eligibility.

Availability and as-of resolution. A task verdict, execution judgment, trace receipt and independent review can become available at different times. Each dependency carries knownAt; event time observedAt and author-supplied createdAt are insufficient. The host attests availability when the evidence becomes accessible to this system. Unknown availability is ineligible. For a version, define availableAt as the maximum of its registry acceptedAt, all required component availability times, and all verdict availability times, recursively including referenced dependencies. Every reference must resolve; cycles in dependency availability are refused. A record without verdicts still requires its content components and host acceptance, so an old creation date never bypasses a late ingestion.

For cutoff t, first restrict the registry and dependency observations to those available strictly before t, then resolve the lineage head in that historical prefix. Do not resolve today’s head and filter afterward: that would hide an earlier eligible version or leak a later rejection. A late review remains invisible to earlier replay. Later discovery may invalidate the historical experiment in today’s report; it cannot make the simulated agent know the future. If the visible head is rejected, withdrawn or lacks the standing required for reuse, do not silently fall back to a superseded successful version. Audit access to old records is separate from selecting them as current advice.

Dependency standing propagates at selection, not by rewriting history. The proposed host distinguishes a reference kept to explain an observation from a dependency whose verdict is required for a particular use. Each required-use link names the dependency’s logicalId, pinned recordId, relied-on aspect/claim and scope. A citation retained merely as a rejected counterexample is not a successful-verdict dependency. Admission must declare these roles; an ambiguous link cannot support positive reuse by default.

For new use, resolve the candidate’s head and recursively traverse every required-use link. Resolve both the pinned version, for exact provenance, and that dependency lineage’s head in the applicable registry prefix. The head must still support the relied-on claim, artifact and scope with the standing required for this use. Supersession alone is not rejection, but a newer head about a different artifact cannot silently replace the pinned evidence. A rejected or withdrawn head, an unsupported changed scope, an unresolved reference, an unknown relation or a cycle makes the dependent ineligible for that use. Apply this check transitively. Never fall back to an older favourable head. Failure to complete resolution is UNKNOWN eligibility and refuses selection, not provisional permission.

Use one consistent registry revision for the check and record all resolved head IDs in the selection receipt. Admission must confirm that revision is still current or repeat the check; otherwise an adverse review racing selection could escape it. A material change during an operational run follows the host’s declared invalidation policy before further dependent actions. This does not roll back effects already committed.

Consider A → B → C, where the arrows mean “supports the next record’s required verification claim”. At day 10, A1 supports B1, which supports C1. At day 12, A2 supersedes A1 with an adverse review of that same claim. Current selection rejects B1’s required use and therefore C1’s required use, even if B and C have not yet received new versions. Their bytes and their historical observations remain valid records. A day-11 query resolves the day-11 prefix and can still explain their eligibility then; it must not import A2 into that earlier knowledge state. A present-day audit may mark the old experiment compromised without pretending the old agent knew.

The recursive gate enforces immediate refusal; a reverse-dependency index is an optimization for notification, not a substitute for the gate. The host also appends an invalidation decision naming affected records, uses, cause, registry revision and availability time. If a dependent’s recorded standing must change, append a new immutable version with that decision. Revalidation likewise creates a version with fresh scoped evidence. If the adverse finding does not affect a dependent claim, retaining that use requires an explicit, evidenced non-reliance decision; a cache entry or unchanged eligible label cannot establish it. This remains a proposed policy requirement, not an implemented invalidation service.

The proposed invalidation record makes that decision checkable:

// PROPOSED; not implemented; authenticated host registry record.
interface InvalidationDecision {
  decisionId: string; // idempotency key bound to canonical decision payload
  affected: { logicalId: string; recordId: string; useIds: string[] }[];
  causeRefs: string[];
  registryRevision: string;
  availableAt: string;
  issuer: Actor;
}

Key decisions uniquely by decisionId; reject the same key with different content. Index affected lineage/version/use IDs and cause references in the registry transaction, with issuer authentication outside agent control. Retain decisions for at least as long as any dependent record, study or admission receipt relies on them; retention/withdrawal is registered. If required evidence is removed, retain a permitted tombstone and block unresolvable use rather than erase the adverse decision. Head checks enforce refusal even while reverse-index notification is pending. Test partial writes, repeated decisions and competing updates with independent expected registry/audit states; none of these tests has been run here.

Verification is scoped. Every observation names the evaluated artifact, task or claim, evidence, evaluator, test/review procedure and execution identities and limitations. It does not certify every aspect of the record. An outcome verifies a named patch digest, not a version containing its own hash; an integrity check of a record targets an already existing version. This avoids circular hash definitions. A change of artifact needs new verification; copying an old verdict onto a different body is refused. Case and procedure admission require a complete verification scope; a missing provider identity is explicitly unknown, never silently equivalent.

Independence is evidence about relations. A new context can establish procedural separation while sharing the same model or data. A different model may still share sources and assumptions. Host admission validates the classification and its supporting receipts under a declared policy; an asserted separate label with no evidence is treated as unknown. Human adjudication is recorded with identity and scope, not as universal proof. The same-critic gap in R06-C06 cannot be fixed by renaming a reviewer.

Authorship is composite. recordAuthor identifies the assembler, while component authors distinguish model solutions, tool observations, evaluator judgments and human comments, with pinned versions. Deterministic host selection is not model authorship. All source tasks, including extraction and validation tasks, travel through the component graph; Chapter 22 checks the full dependency closure, not a convenient primary task ID. No scalar reward substitutes for these fields.

The host’s policy registry admits an immutable canonical policy payload and schema version under policyDigest. basisRefs name immutable evidence and decision versions, including their scope/availability; validate them against that exact policy-registry version. Changing policy creates a new digest and decision/version, not a reinterpretation of an old receipt.

21.4 Admission: what may enter the store

A store’s quality begins with admission; later review can correct standing through new versions. Rules 1–4 below are executed in ExperienceStore.admit (D21-EXPERIENCE-01): outcomes without evaluator identity are refused as rumours; procedures are refused eligible standing without independent cross-task validation; lessons are admitted only as labelled advice; unknown availability is ineligible; bodies that fail their digest and lineages that skip the current head are refused; identical payloads are idempotent.

  1. Traces are admitted as records, not as lessons. Every run’s trace may be kept, subject to retention and privacy rules, because traces are the raw material for audit. Keeping a trace asserts nothing about quality.
  2. Outcomes are admitted only with evaluator identity and evidence references. An outcome without them is a rumour.
  3. Reusable procedures require independent cross-task validation. Freeze the candidate steps, preconditions, target family and acceptance checks before testing. Same-task repetition supports repeatability only; retain it as a case or proposed procedure. Require at least one separate development-validation task not used to extract or tune that candidate, with task PASS, execution ACCEPTED and the required integrity/effect checks. Record all trials, failures and the narrow validated scope; one task is a minimum admission check, not a demonstrated transfer rate. A failed candidate remains available with negative standing, not as a successful reusable procedure. Broader reuse needs broader validation. These admission-validation tasks are inside the development partition, disjoint from Chapter 22’s sealed final confirmation set. Never use final held-out outcomes to promote or tune a procedure for that same study.
  4. Cases carry their outcome, including failures. A failed case is valuable. R06 found that the Writer code base mines negative trajectories, including “over-edit/stop” cases (R06-C10; OBSERVED, not shown to improve transfer). But a failed case must say that it failed, and on which dimension.
  5. Lessons are admitted as lessons. They retain their actual model or human authorship, are unverified unless tested, and link to the runs they comment on. A lesson supported by a later study gains a new immutable version containing the scoped observation and revised standing. Retrieval frequency cannot upgrade it. The old version and its unverified status remain intact.

Rule 3 is the expensive one, and it is worth asking whether it is necessary. The alternative, storing any procedure from a successful run, is cheaper and is what many systems do. The risk is that the procedure succeeded for reasons that do not transfer: luck, a particular fixture, or a decoy file that happened to be absent. Re-execution is the CBR revise step made mandatory. Whether it pays for its cost is an empirical question for Chapter 22’s study.

21.5 Ownership, and what not to build

Responsibility Owner May Must not
Writing traces and outcomes Recorder and evaluators Append records with provenance Edit or summarize away raw records
Extracting procedures and cases Host-side extractor (deterministic where possible) Propose records from verified runs Admit without re-execution (procedures)
Writing lessons A model, or a human Propose advice Label it verified
Admission Host policy Apply the §21.4 rules Accept records lacking evaluator or evidence fields
Retrieval Chapter 22’s selector Choose eligible, relevant records Treat retrieval frequency as verification

The blueprint is explicit that this book must not rebuild the ECK, Writer or Worker, and should integrate through small adapters once contracts stabilize (blueprint, hard constraints). R06’s recommendation for Project 01 is to take no ECK dependency, and to “reuse a narrow adapter after controlled history studies” (R06-C12; PROPOSED). The integrated summary adds: “do not create another generic experience engine to fill untested assumptions” (INTEGRATED-SUMMARY.md). This chapter’s record contract is therefore a specification of what a harness needs from an experience store. It is not a plan to build one. The first engineering question for Project 09 is whether Writer’s existing domain code can supply records satisfying this contract through an adapter, or can be extended to. That depends on the owners’ support and on tests R06 did not run.

21.6 Worked example: what one run leaves behind

Take a single Project 06-style run from Chapters 13–15. It fixed the transient-retry bug, after the human reviewer in Chapter 15 §15.7 rejected an over-broad first patch and a second candidate passed. What should the store admit? Each row below is an executed admission decision (D21-EXPERIENCE-01):

Candidate record Kind Admit? Standing on admission
Full trace of the run Trace Yes What happened. No quality claim
Outcome: final patch, task PASS (sealed tests plus human), execution ACCEPTED Outcome Yes Evaluators: deterministic tests, human reviewer (independent)
Outcome: first patch, task FAIL (human: retries permanent failures), execution ACCEPTED Outcome Yes A negative outcome on the task dimension
Procedure: “write a permanent-failure test before fixing retry logic” Procedure Not yet Extracted from one run. Must pass independent development-validation retry tasks first
Case: transient-retry bug → bounded retry on transient errors only → outcome records Case Yes An example, carrying both the failed and the successful attempt
Lesson: “the over-broad patch happened because the model didn’t read the error classes” Lesson Yes, as a lesson Model-authored hypothesis about why. Unverified

The table shows one run producing six candidate records of five kinds, each with a different standing. Note that the most useful-sounding item, the procedure, is the one that is not admitted yet. Its usefulness is what makes premature trust dangerous. A retrieved procedure is acted on. A retrieved case is compared. A retrieved lesson is read.

Worked lineage: a review that arrives later

All dates and IDs below are illustrative digest aliases, not measurements. The case lineage retry-case-7 refers throughout to patch artifact P1; each version hashes different frozen content. A corrected patch P2 would require fresh observations targeted at P2 before any positive use.

Version / supersedes Host acceptedAt New information available Standing for this case
v1 / null day 10, 09:00 Model proposal and tool receipts known by 08:59 proposed; no outcome certification
v2 / v1 day 10, 12:00 Task PASS known 10:00; execution ACCEPTED and trace check known 11:00 eligible as a case for P1 under the named checks
v3 / v2 day 12, 10:00 Separate review at 09:00 finds a missed permanent-error case in P1 rejected for positive reuse; retain the failure and earlier verdicts
v4 / v3 day 13, 10:00 Host classifies the rejected case as scoped negative advice eligible only for the negative-case use; no successful-procedure claim

At day 10, 11:30, v1 is the visible head: the later v2 admission is not yet available, even if one test result already exists. At day 11, v2 is visible. At day 12, 11:00, v3 is visible and positive reuse is refused; the selector cannot revive v2. At day 14, v4 may warn a new task, labelled with its failed scope. An explicit reference to v2 still resolves to v2 and explains the historical decision. No hash changed, no old verdict was overwritten, and no day-11 replay sees day-12 knowledge.

21.7 Study: experience-store integrity

This chapter’s experiment is a deterministic integrity test, not a performance study. The performance question belongs to Chapter 22. The design is PROPOSED; EXPERIMENT PENDING.

  • Research question. Does the admission policy keep record standing intact under realistic and adversarial inputs?
  • Hypothesis. No record is admitted with a standing it lacks: no unverified procedure stored as verified; no lesson without its actual authorship label; no outcome without evaluator identity; no procedure from a REJECTED execution stored as a good procedure.
  • Alternative hypothesis. At least one route admits a record with borrowed standing.
  • Independent variable. Candidate records: correctly formed records of each kind, and adversarial ones (missing evaluator, scalar-only reward, PASS with REJECTED, procedure without re-execution, lesson claiming verification, evidence references that do not resolve, in-place mutation, forged authorship, supersession cycles, concurrent head updates, a future review attached to an old creation date, unknown availability, an artifact changed under an old verdict, and same-task-only procedures). Add required-use A → B → C invalidation, an unrelated adverse claim, missing dependency resolution and a registry change racing admission; register expected current and historical decisions separately.
  • Dependent variables. Admission decision and assigned standing per record, against expected values authored in advance; historical head and eligibility at each cutoff in §21.6; stable resolution of old references; refusal of cycles, unsupported independence and mismatched scopes.
  • Controls. Well-formed records must be admitted. A “permissive” admission variant, which accepts anything with a reward, must fail the adversarial set. That confirms the test can detect the failure it targets.
  • Fixture. Records derived from scripted runs on the synthetic fixture, plus the hand-built adversarial set.
  • Evaluation. Deterministic comparison.
  • Failure criteria. Any adversarial record admitted with borrowed standing.
  • Threats. The test checks the policy, not whether the policy’s categories are the right ones. That is a design question, tested indirectly by Chapter 22’s outcome study.
  • Status. The deterministic core is executed: well-formed records admitted, adversarial records (missing evaluator, unverified procedure, unverified lesson claiming scope, unknown availability, digest mismatch, conflicting lineage, stale heads) refused with named reasons, and the §21.6 admission table run as a test. The permissive-variant control, historical-cutoff eligibility checks and invalidation-dependency traversal remain proposed; the policy-category question belongs to Chapter 22’s outcome study.

21.8 The simplest meaningful store, and its alternatives

What is the least machinery that satisfies §21.3 and §21.4? For the proposed single-writer fixture, keep immutable canonical JSON payloads, version metadata and the small lineage/decision registry in the embedded store specified in §21.3. Validate and content-address payloads on admission; commit their registry membership/head updates in that same transaction. This avoids implying atomicity across a separate JSON log and database. Derived indexes by task family and source task IDs can be rebuilt; no embeddings or learned components are required. Every admission records reasons. This is sufficient in principle for the §21.7 policy tests only once writer identity, transaction/recovery behavior, dependency resolution and as-of lookup are qualified. Similarity search remains an optional relevance index, not a change to immutable record semantics.

Three richer designs are common. Each adds something real and brings a new risk.

Design Adds New risk What would justify it
Unified vector store (all kinds embedded together) Similarity retrieval across kinds Kinds blur: a lesson and an outcome with similar text rank together. Standing travels only if every consumer reads the kind field Chapter 22 showing that similarity predicts usefulness and that standing labels survive presentation
Separate stores per kind Kind-specific retention and access rules Cases lose their link to the outcomes and traces they summarize Evidence that kinds need different retention or authority
Linked records (records reference each other: a case → its outcome → its trace; a procedure → its re-execution outcomes) Traceability from advice back to evidence Link integrity must be maintained, and a broken link silently weakens standing Chapter 22’s attribution needs. This is an evidence graph (Chapter 4 §4.2), and a candidate for the representation question of Chapters 13–14

The third row deserves a comment, because it is where this book’s graph hypothesis reappears. Experience records with evidence references form a graph whether or not anyone stores them as one. Case to outcome to trace to evidence excerpt is a provenance chain (Chapter 8). The question, exactly as in Chapter 13, is not whether the structure is a graph but whether representing and querying it as one gives a measurable benefit over a flat store with reference fields and joins. That is answerable with the same discipline as the E14 representation study: identical records, identical eligibility rules, and two storage representations compared on retrieval correctness, attribution completeness and implementation cost. It is registered as an open question, not assumed.

Observability needs are the same whichever design is chosen. Log every admission decision with reasons. Log every retrieval with candidates and eligibility exclusions (Chapter 22). And append a new version for every change of standing, such as a lesson confirmed by a later study, with the evidence that justified it. A store whose contents cannot be explained from its logs cannot be audited, and an experience store that cannot be audited cannot be trusted to teach.

21.9 Failure modes

  • One store, one score. All record kinds share a scalar reward. Defence: the typed contract, with two-dimensional verification and evaluator identity.
  • Lessons as facts. Model-written reflections are retrieved as guidance with no provenance. Defence: component authorship and an unverified label that never upgrades through use.
  • Procedure as permission. A stored action is executed without the normal gates. Defence: procedures are candidate plans, and they pass admission and the broker like any other proposal.
  • Same-critic loop. The evaluator that scored a run also selects its procedure for reuse (R06-C06). Defence: record independence, and prefer held-out verification.
  • No time fields. Outcomes become usable before they existed (R06-C09). Defence: per-component knownAt, host acceptance and historical-prefix resolution, enforced in Chapter 22.
  • Generic engine. A new experience system is built where an existing one could be adapted. Defence: a contract first, then an adapter feasibility check against existing owners.

21.10 What you can build and test now

D21-EXPERIENCE-01 already implements the core loop: the ExperienceRecord schema and the §21.4 admission policy as executable checks, the §21.7 adversarial set (missing evaluator, unverified procedure, lesson claiming scope, unknown availability, digest mismatch, conflicting lineage, stale heads), the §21.6 admission table, and exact-prefix reopening. Extend it with scripted Project 01 bundles (trace/outcome derivation, including a zero-tool PASS/REJECTED run that must not yield an admitted “good procedure”), the permissive-admission negative control, historical-cutoff eligibility, and the Writer adapter questions (which §21.3 fields their records carry).

21.11 What remains unverified

  • Whether the §21.4 admission categories are the right ones (a design question for Chapter 22’s outcome study), the permissive-variant control, and historical-cutoff eligibility (§21.7 remainder).
  • The behaviour of Writer and Praxis code beyond R06’s static inspection (UNKNOWN). R06 ran no imports, runtime or tests.
  • Whether re-execution before admitting procedures (§21.4 rule 3) improves later outcomes enough to pay for itself (Chapter 22).
  • Whether lessons, as advice, help or harm. Reflexion’s reported results are its own, on its tasks and models.

EXPERIMENT PENDING. The §21.7 integrity study is partially executed (admission decisions on frozen fixtures); the permissive control, historical decisions and policy-category questions are not run.

Capstone connection. The experience-aware and adaptive-harness capstone (with ECK) depends on this contract, the admission policy and the §21.7 integrity result, and on an adapter decision about existing Writer code, not on a new engine. The context-and-memory capstone reuses the record kinds and the standing rules.

Separating record kinds settles what may be kept and what standing each record has. It does not settle which records a new run should see. Too few, and experience is wasted. Too many, irrelevant or leaked from the future, and experience misleads. Chapter 22 turns to selection, and to Project 09’s test of whether history helps at all.

Previous: Chapter 20: Merging Parallel Work and Resolving Disagreement.

Next: Chapter 22: Selecting Relevant History.