← Harness Engineering From First Principles

Evidence Selection, Provenance, and Compaction

Compare full, selected and compacted context; check source support and detect missing or stale evidence.

Twenty turns into a research task, the harness compacts the conversation. The model’s earlier reads of three configuration files are replaced by a summary: “Retry behaviour is configured in the scheduler’s retry file; maximum attempts is 5; backoff is exponential.” Ten turns later, the model writes its technical note and cites that summary for the claim that the maximum is 5. The note reads well, and the claim happens to be true. But the note cannot say which file, which line, or which version of the file the claim came from. Meanwhile the configuration was edited to max_attempts = 7 between the original read and the end of the run.

That sentence fails in three different ways. Its provenance was lost when compaction replaced the evidence with prose. Its freshness was never checked, because nothing compared the evidence with the current source. Its support cannot be assessed, because the only thing it cites is another model’s paraphrase. Fluent writing hides all three. This chapter makes them separately detectable, and it sets up Project 03, the Evidence Researcher, to measure them.

Evidence status. Draft manuscript. Formal Project 03 has not started. The educational compaction-and-provenance demonstration D08-PROV-01 is implemented and executed (examples/pi-harness-lab/src/context.ts compact/evaluateClaim; test/context.test.ts D08 suite, 5/5 pass offline): reference-carrying vs plain-prose summaries, staleness detection and missing-provenance reporting all run. Project 01’s citation and evaluation code is cited from the working-tree candidate, which was independently re-reviewed with verdict REJECT (2026-11-23) and is not accepted. Pi compaction facts come from R02 source inspection (Established for the inspected 1.6.0 artifact; TEST NOT RUN). The content and format of Pi’s compaction summaries were not characterized by R02 and are UNKNOWN. The formal Project 03 study design is PROPOSED and remains EXPERIMENT PENDING.

8.1 Provenance as a chain

Provenance is a record of where a piece of information came from and how it was transformed on the way to where it is now. For a harness, the useful form is a chain of hops, each of which either preserves a reference to the previous hop or breaks the chain:

source bytes ──read──▶ excerpt ──select──▶ context ──summarize──▶ summary ──write──▶ claim
 (digest D)         (D, lines a–b)      (excerpt ref)          (refs?)            (citations?)

A claim’s provenance is intact only if every hop carries a reference forward. Reads that return a digest and a range preserve it. A selection policy that keeps whole excerpts preserves it. A summary preserves it only if the summarizer is required to carry references, and nothing about summarization makes that happen by default. A claim preserves it only if the output contract requires citations, and if the citations point back to source excerpts rather than to intermediate prose.

This is the evidence graph of Chapter 4 (§4.2) seen from the point of view of a single claim. For a single note, the graph is usually shallow enough to store as a list of claims, each with its citations. Whether an explicit graph representation earns its complexity when summaries are built from summaries, or claims depend on other claims, is part of the representation study registered in Chapter 3 (§3.10). This chapter does not settle it.

8.2 Project 01 already carries provenance by construction

Project 01’s interface was designed, for reasons of citation checking, so that provenance survives every hop it has. Each fixture_read result carries the file ID, the full content digest, the exact range and the fixture digest (Chapter 5). Each answer citation must carry the file ID, the content digest and an inclusive line range. The evaluator rejects a citation that names a file outside the admitted manifest, carries the wrong digest, or falls outside the acceptable locus. The first corrective re-review observed the original non-supporting subranges for T1, T3 and T4 returning INVALID_EVIDENCE_REF after correction (INDEPENDENT-REREVIEW.md; OBSERVED, within the frozen-task scope).

What Project 01 does not have is any hop that transforms evidence. Compaction is off. No summary sits between a read and an answer. The fixture is immutable, so nothing can go stale. Every provenance problem in this chapter appears the moment one of those three conditions is relaxed, and Project 03 is designed to relax them one at a time.

The Project 01 review also recorded a limitation that carries directly into this chapter. A citation whose range contains the right string does not prove that the cited text supports the claim (P01R-15, confirmed limitation). Project 01 avoids the problem by asking only exact, constructed fact questions. A research note cannot. That is why §8.4 keeps support separate from provenance.

8.3 Compaction: a transformation that writes claims

Compaction replaces part of the history the model sees with something shorter, typically a model-written summary. R02 records two facts about Pi 1.6.0 that frame the harness problem. Compaction is enabled by default (C13). Branch selection and compaction project the model-visible context without erasing raw history from the session (C07). Book I treats compaction as a runtime feature (Book I, Chapter 23). Here we look at it as a step in the provenance chain.

Two consequences follow from the projection model, and they cut in opposite directions.

For audit, nothing is lost. Because raw history survives in the session record, an evaluator or reviewer can recover exactly what the model read before compaction and compare it with what the summary says. A harness that preserves raw observations separately, as this book’s convention requires, can always reconstruct the evidence that was available.

For the model, the summary is the evidence. After compaction the model sees only the summary. Whatever the summary omits, the model no longer knows, unless it reads the source again. And whatever the summary asserts, the model will tend to treat as established. The summary is a model-written claim about earlier evidence. It has the epistemic status of an answer, not of a source.

The design consequence is that summaries must cite, and their citations must be checkable. A provenance-preserving summary carries, for each factual statement, a reference to the raw excerpt it came from: file ID, digest and range, or the identity of a raw session entry. The evaluator can then treat a claim citing a summary as citing the summary’s underlying references, and can check those against the raw record. A summary without references is a provenance break. Claims that depend on it should be marked unsupported, not accepted on trust. This is PROPOSED. Whether Pi’s compaction can be instructed or extended to produce such references, or whether a host-side summarizer is needed, depends on the summary format and extension seams, and R02 did not establish either (UNKNOWN; Pi does expose context-transform hooks, C12). Request-boundary capture constrains what any host-side summarizer can verify; the capture limits in Chapter 7 (§7.1, R02 C10) apply.

8.4 Missing, stale and unsupported evidence

Three distinct defects are often reported together as “hallucination.” Keeping them apart is what makes them detectable.

Defect Definition Mechanical detection What it needs
Missing A fact the task requires was never present in any request at decision time Presence test (Chapter 7) against sealed loci Known loci; request-boundary capture
Stale A cited excerpt’s digest no longer matches the current source Compare cited digests with source digests at evaluation time, or at a declared freshness point Digests on every excerpt; a defined “as of” time
Unsupported A claim cites real, current evidence that does not entail it Exact-fact oracle where possible; human adjudication or a calibrated judge otherwise A support standard; acknowledgement of P01R-15

Missing and stale evidence can be detected deterministically, given digests and sealed loci. Unsupported claims cannot, in general. Project 01 handles them only for constructed facts with exact expected values. A research note makes open-ended claims, and support then becomes a judgment. The blueprint’s requirement for Project 03 is phrased accordingly: “evaluate support not prose fluency.” The book’s conventions add a further rule. Programmatic checks, model-assisted judgments and human review are reported separately, together with their agreement and disagreement (REPORTING-CONVENTIONS.md §4). A model judge may assist the support assessment. It never overrides an exact check, and it never grades the note it helped to write.

Staleness needs a careful definition, because “the source changed” is not always a defect. A note that says “as of digest D, the maximum was 5” is accurate even after the file changes. A note that says “the maximum is 5” without an “as of” is stale the moment the file changes. A provenance record therefore needs a freshness point, the moment at which the claim is asserted to hold, so that staleness can be judged against it. A research note normally asserts its claims as of its completion time. That is why Project 03’s stale-evidence injection modifies sources during the run (§8.7).

8.5 Attributing an evidence failure

When a Project 03 note makes a wrong or unsupported claim, a harness with provenance and request-boundary capture can say where the failure entered. Combining Chapter 7’s presence test with this chapter’s provenance chain gives five attribution classes:

  1. Never selected. The critical source was never read or retrieved. This is a selection or navigation failure.
  2. Selected, then dropped. It was present earlier but absent at decision time, because of recency eviction or truncation.
  3. Compacted away or distorted. It was replaced by a summary that omits or misstates it. The raw record shows the original, and the summary shows the loss.
  4. Present but unused. The excerpt was in the deciding request and the claim still contradicts it or ignores it. This is a model-use failure, possibly positional (Chapter 7).
  5. Stale. The claim matched the evidence that was read, but the source changed before the freshness point.

Each class implies a different repair. Class 1 points to the interface or retrieval. Class 2 points to the selection budget or policy. Class 3 points to the summary contract. Class 4 points to presentation or model choice. Class 5 points to freshness checks before finalization. Without attribution, every class looks the same in the final note, and the tempting response, “use a stronger model,” addresses only class 4.

Attribution needs a selection record: for each model request, which excerpts, summaries and their references were included, and which were evicted. This is a harness artifact, stored with the raw observations and separately from the normalized trace and evaluation (Chapter 4). It is PROPOSED. Nothing in Project 01 records selection, because nothing in Project 01 selects.

8.6 Retrieved text is data, not instruction

Selection puts text from sources the harness does not control into the model’s context. That text can contain instructions. The R04 dossier cites published demonstrations that retrieved attacker text can redirect LLM-integrated applications (Greshake et al., arXiv:2302.12173v2; R04-SECURITY-RECOVERY.md R04-C09; DOCUMENTED; no local reproduction, and no claim about current Pi susceptibility). R04’s proposed mitigations are to delimit repository material in prompts as evidence, never authority, and to deny capabilities independently of model compliance. R04 is explicit that the first of these “helps interpretation but is not an enforcement boundary” (R04-P02; PROPOSED).

For provenance, the consequence is simple. A provenance record marks where text came from, and that marking should travel with the text into context, for example as a structured header that the model sees. It cannot make the model ignore an instruction embedded in the text. A Project 03 researcher with only read tools has little to lose from obeying such an instruction. It might mislead itself, but it has no effects. Chapters 11–12 deal with the case where the reader can also act.

8.7 Worked example: a note with one compaction and one stale source

This section is an executed educational demonstration, D08-PROV-01 (compact and evaluateClaim in examples/pi-harness-lab/src/context.ts; test/context.test.ts D08 suite, 5/5 pass offline), using the Chapter 7 selection output as its input. A Project 03-style task asks for a short technical note: “Describe how the scheduler’s retry behaviour is configured and tested, citing sources.” The run reads three excerpts, compacts them under a reference-carrying or plain-prose contract, then faces a mid-run source update before the claim is evaluated at its freshness point (note completion).

  1. The model reads retry-config lines 1–4 at digest D1 (sees max_attempts = 5), tests/test_scheduler.py lines 1–6, and docs/api.md lines 1–5.
  2. History reaches the compaction trigger. A summarizer replaces the three reads with a summary. Under a provenance-preserving contract, each summary statement carries the reference it came from: “max_attempts = 5 [retry-config, D1, 3–3]”.
  3. The fault injector updates retry-config to max_attempts = 7. Its digest is now D1′.
  4. The model writes the note: “The maximum attempts is 5 [retry-config, D1, 3–3]. The retry path is exercised by test_schedule_job_retries [scheduler-tests, D3, 5–6].”
  5. Evaluation (executed). evaluateClaim resolves each citation against the retained excerpts, then compares cited digests with the sources at the freshness point (note completion). retry-config cites D1, the current digest is D1′, so the claim is STALE. The test claim cites a source that is unchanged, so it is current and SUPPORTED. A claim with no resolvable excerpt — the plain-prose case — returns UNSUPPORTED with a missing-provenance reason; the resolver never guesses. Compaction changes only the request projection (new projectionDigest); the retained excerpts and their digests are untouched, which the tests assert directly.

Under a plain-prose summary, step 2 produces “max attempts is 5, configured in the retry file” — recorded in provenanceBreaks. At step 4 the model cites the summary or nothing. At step 5 the provenance check fails, the claim is reported as unsupported by any checkable source, and the staleness of the underlying fact is undetectable, because nothing ties the claim to a digest. The two notes might read identically. Only the provenance-preserving one lets the harness tell the reader that its main number is out of date.

8.8 Project 03 checkpoint: Evidence Researcher

Blueprint requirement: produce a source-grounded technical note. The new mechanisms are retrieval selection, context budgeting, citations and compaction. The verification compares full context with selected context, detects missing and stale evidence, and evaluates support, not prose fluency.

Status: formal study not started; educational demonstration D08-PROV-01 executed (see §8.7). Its prerequisites include an accepted Project 01 evidence pipeline (re-review complete, REJECT — not accepted). The selection record (§8.5) exists in demo form: every select call returns included excerpts, excluded excerpts with reasons, and a projection digest. A fixture format with controlled source updates is demonstrated in-memory; a versioned on-disk fixture is future work.

Proposed study. All of the following is PROPOSED; EXPERIMENT PENDING.

Arm Context condition Purpose
F Full context: all sources fit (small fixture) Ceiling where selection is unnecessary
Sel Selection under a registered budget (best Chapter 7 policy) Effect of selection alone
Sel+C Selection plus compaction with a provenance-preserving summary contract Effect of compaction when references survive
Sel+C− Selection plus plain-prose compaction Ablation. Same compaction, references removed
Filler Selection budget padded with equal-length irrelevant text Volume control (Chapter 7)

Faults are injected on a fixed schedule. They include sources updated mid-run (staleness), questions whose required evidence is absent from the fixture (correct output is a scoped abstention), and decoy sources (R03-H03). Endpoints are claim-level: supported, unsupported, missing-evidence and stale-evidence counts per note; correct abstentions; the attribution class of every defective claim (§8.5); and tokens and calls at a matched total budget. Fluency is not an endpoint. Programmatic, model-assisted and human assessments are reported separately, with their agreement.

The registered predictions are these. Sel+C and Sel+C− produce similar prose quality. Sel+C− produces more unsupported claims and makes staleness undetectable, while Sel+C detects staleness at the injected rate. F shows the fewest missing-evidence defects but the highest spend. The falsifier for the mechanism is Sel+C failing to detect injected staleness, or Sel+C− matching Sel+C on detectable stale claims, which would show that the references were not doing the work.

8.9 Failure modes

  • Summary treated as source. A claim cites a summary, and the evaluator accepts it. Defence: resolve citations through summaries to raw excerpts; unresolved means unsupported.
  • No freshness point. Staleness cannot be judged, so it is never reported. Defence: every note declares the time as of which its claims hold.
  • Fluency scored as support. A judge rewards a coherent note. Defence: claim-level support checks; fluency excluded from endpoints.
  • Unrecorded selection. A missing-evidence failure cannot be attributed. Defence: a per-request selection record.
  • Hidden compaction. Default compaction fires in some arms (Chapter 7). Defence: compaction off, or the declared treatment.
  • Provenance mistaken for trust. Marking text as retrieved is treated as neutralizing instructions inside it. Defence: enforcement is separate (R04-P02).

8.10 What you can build and test now

D08-PROV-01 already implements the core loop: a claim record with citations[] and freshnessPoint, a resolver that follows citations to retained excerpts and fails on any unresolved hop, a staleness checker against current source digests, and the reference-carrying vs plain-prose summary pair showing the resolver accepting one and marking the other’s dependent claims unsupported. Extend it with a versioned on-disk fixture with controlled source updates and the equal-length filler control from §8.8.

8.11 What remains unverified

  • Formal Project 03 acceptance (the §8.8 arm comparison with injected staleness, absent evidence and decoys at a matched total budget).
  • Pi 1.6.0 compaction policy and summary format, and whether its hooks can enforce a reference-carrying summary (UNKNOWN beyond R02 C07, C12 and C13).
  • Whether reference-carrying summaries cost more tokens or degrade summary quality, and by how much (§8.8).
  • A support standard for open research claims that does not reduce to string presence (P01R-15). It needs human adjudication rules and judge calibration (Chapters 15–16).

EXPERIMENT PENDING. The formal Project 03 study has not run; D08-PROV-01 is an executed educational demonstration of its core mechanism, not that study.

Everything in this chapter has concerned the conversation: what the model read, what was summarized, and what was claimed. But a conversation is not a task. When a process dies halfway through a job, the conversation records what was said about the work, and that is not the same as what was done. Chapter 9 separates those two kinds of state.

Previous: Chapter 7: Context as a Bounded Resource.

Next: Chapter 9: Sessions Versus Durable Task State.