← Harness Engineering From First Principles

Predict, Test, Promote, or Revert

Register predictions, evaluate candidates on held-out tasks and rehearse rejection and rollback.

A policy adviser proposes a useful-sounding change: after a failed regression test, let the agent try one extra repair before asking for review. It predicts fewer unresolved tasks. The change is small enough to fit in a sentence and large enough to spend more money, modify more files and make the original failure harder to diagnose. Should the harness activate it?

The wrong answer is hidden inside the question if useful-sounding is treated as evidence. The candidate needs a precise prediction, an exact change, a comparison with the current policy and an independent decision. It must also be possible to reject it without losing the observation that generated it. A system that records only promoted strategies cannot learn honestly from the alternatives it discarded.

Evidence status. Provisional technical draft. Formal Project 10 (Adaptive Harness Lab) and the E26 confirmation study have not started. The controlled-adaptation demonstration D26-ADAPT-01 is implemented and executed (examples/pi-harness-lab/src/adaptation.ts; test/adaptation.test.ts, 10/10 pass offline): versioned policy store with active pointer, candidate lifecycle, frozen-case qualification, promotion gate with criteria + authority approval + baseline match, revert with compatibility check, and replay of policy versions. Existing Writer verification/promotion findings are OBSERVED static inspection via R06, not implementation of this protocol. No live-model comparison or cost measurement is claimed. Project 01 remains REJECTED; pending gates remain pending.

26.1 A candidate is a bounded change, not an aspiration

Begin with the simplest baseline: a versioned static policy approved for a declared task domain. A candidate names that baseline digest and the exact changed fields. In the opening example it might change the maximum repair attempts from one to two while preserving the total budget, required tests, edit scope and effect gates. It must not quietly bundle a stronger model, a larger context and a weaker verifier into the same claimed retry improvement.

The candidate’s scope includes what must remain fixed. Governance invariants are outside the learned change space: required independent evaluation, effect authorization, root resource limits and evidence preservation. A proposal to alter one of those is a separately authorized governance change, not an ordinary adaptive strategy candidate.

Record the expected mechanism as well as the expected metric. The extra attempt may repair transient mistakes, but it may also chase a flawed test, duplicate earlier work or spend all remaining reserve. A useful prediction names both the intended gain and the plausible adverse effect. This helps choose measurements without pretending the prediction is already an outcome.

Chapter 16’s bounded-repair logic applies to software policies too. The proposal needs a stopping condition and a route for unresolved disagreement. A policy change that can keep rewriting itself until it passes has no frozen candidate and no interpretable confirmation result.

26.2 Prediction precedes exposure to confirmation

Register the prediction before opening the held-out task outcomes. It identifies the primary contrast, task domain, cost target, expected direction, practical benefit margin and safety obligations. A statement such as improve reliability is too vague to fail. A statement such as increase verified completion over the current one-repair policy at the same total monetary ceiling, without violating edit preconditions, can be tested once sample and analysis details are frozen.

Predictions can be wrong without the experiment being defective. If the extra attempt increases latency and produces no completion gain, retain that negative result. If it improves completion only at greater realized cost, report a cost-quality tradeoff rather than rename it matched-cost success. If uncertainty remains broad, the correct recommendation is insufficient evidence, not a speculative promotion score.

Development outcomes may inform the candidate and numerical registration. Confirmation outcomes may assess the frozen candidate, but may not tune it and then assess it again under the same claim. The custodian boundary from Chapters 22–23 applies to prediction documents, model selection, thresholds and analysis choices as well as retrieved memory.

Multiple candidates create a selection problem even when each is small. Trying twenty retry/context combinations and reporting the best one uses confirmation for optimization unless a separate selection stage and fresh final test were registered. Candidate count, search budget and final selection rule belong in the experiment record.

26.3 A proposed lifecycle with honest terminal states

The host records candidate states separately from production run states:

State Owner / evidence Permitted next step
PROPOSED Proposer; baseline-bound diff and evidence references Admit to a bounded development test or reject malformed scope
FROZEN Experiment owner; immutable candidate and registration Execute registered qualification
TESTED Independent evaluator; complete result bundle Recommend retain, reject or insufficient evidence
AUTHORIZED Human or declared authority; exact activation approval Attempt version-bound activation
ACTIVE Policy owner; activation receipt and current pointer Admit new runs under this version
REVERTED Policy owner; restored pointer and reconciliation record Resume only qualified compatible policy
REJECTED / INCONCLUSIVE Decision record with reasons Archive; any revision becomes a new candidate

These are proposed application states, not exported ECK enum values. A positive test recommendation does not imply AUTHORIZED. An approval does not imply ACTIVE until the pointer update succeeds and is recorded. A REVERT recommendation does not establish that restoration occurred. Keeping those distinctions prevents optimistic UI labels from becoming the only evidence of system state.

The baseline pointer must still match when activation occurs. If another authorized change advanced it, refuse the stale candidate or rebase it as a new reviewed change. Policy activation has the same stale-base problem as file editing. An old successful experiment does not authorize overwriting a newer active policy.

26.4 The experiment separates quality from governance

The independent evaluator reads immutable artifacts, protected lifecycle receipts and resource observations. It does not accept the candidate’s self-reported improvement. For a repository task, task correctness may come from sealed tests and source checks; execution acceptance comes from required lifecycle, authority, precondition and evidence conditions. A correct patch produced by an unauthorized operation cannot earn joint accepted completion, even when task truth can be independently retained.

Governance checks are not an exchange rate. A quality improvement cannot pay for violating a required scope restriction. Conversely, passing every permission check does not show the patch fixes the defect. Project 10 must preserve the two dimensions and the evidence each depends on.

R06-C07 describes an existing Writer verification service returning KEEP/BRANCH/REVERT under its own policy arithmetic, while R06-C08 describes an internal rule-promotion service. Those source observations are useful integration questions. They do not establish a qualified independent holdout gate, human activation approval or real compensation in this harness. The proposed host must consume scoped recommendations, not reinterpret internal names as deployment receipts.

No empty baseline or missing metric may become a positive comparison by default. Missing required quality, cost or lifecycle evidence yields an insufficient-evidence or failed qualification decision under the frozen contract. Keep unknowns visible. A strategy library can store a record with an unknown outcome without being allowed to rank it as proven good.

26.5 Worked example: one extra repair attempt (executed)

This section is an executed educational demonstration, D26-ADAPT-01 (test/adaptation.test.ts, 10/10 pass offline). The candidate is a policy diff, not an aspiration: R2 changes maximum repair attempts from one to two while preserving the total budget, required tests, edit scope and effect gates — the same shape as the opening’s repair-policy example, with scripted frozen cases standing in for the qualification tasks. A malformed R2 that also removes the permanent-error test is refused at scope check: no retry prediction can justify weakening the oracle. The frozen schedule covers a correct second repair, a stale-base refusal, an unrepairable premise and unknown provider usage. The executed outcomes:

  • A candidate beating the margin across the schedule, within cost and with no violations, is TESTED, then — with a separate release-captain approval and a matching baseline pointer — becomes ACTIVE; the activation receipt records candidate, prior and new version, and epoch. Replay shows exactly which policy version each recorded decision used.
  • A candidate better on one case but below the margin across the schedule stays INCONCLUSIVE; the active policy is unchanged.
  • A candidate with a safety violation is REJECTED even with a quality gain; one above the cost ceiling is REJECTED; one without authority is REJECTED; one built on a superseded baseline is refused as stale.
  • Missing behaviour never qualifies: unrun cases count as zero measured quality, not assumed success.
  • Revert restores the prior version after a compatibility check; an incompatible restore is refused rather than forced; reversion is recorded separately and never rewrites the promotion record.

A positive point estimate with a wide interval is not in the executed scope — the demonstration uses fixed pass/fail criteria, not sampling statistics — so INCONCLUSIVE here means “below the frozen margin”, not “wide interval”. The interval logic of §26.10 remains a registered decision rule for a future statistical study, not an executed one. Every terminal state above (ACTIVE, REJECTED, INCONCLUSIVE, reverted) is reached in the suite with the active pointer asserting the expected version afterward.

Runs already admitted keep their pinned version: new admissions use the new active policy while in-flight runs finish under theirs, so history and evaluation never mix unrecorded rules. Versioned admission avoids that hidden treatment change.

26.6 Reversion has a narrow, testable meaning

Policy reversion restores a versioned active configuration for future admissions. It does not undo files already edited, emails already sent or provider charges already incurred. External effects require their own reconciliation and, where available, separately authorized compensation. Chapter 10’s cancellation-is-not-rollback argument applies unchanged.

The host retains the previous qualified policy and the exact activation receipt. A revert operation names the current candidate digest, expected active pointer and target previous version. It must check compatibility: an old policy may depend on tools or schema versions no longer available. If safe restoration cannot be established, deny new admissions and escalate rather than claim recovery because a pointer write was attempted.

In-flight tasks require an explicit rule. Non-safety performance rollback can allow already admitted runs to finish under their pinned policies. A safety revocation may close new effect admissions, cancel running subtrees and retain unknown reservations pending reconciliation. Both choices need recorded owners, deadlines and failure exits. An adviser cannot decide that a revoked effect remains acceptable because its expected reward is high.

Test reversion before activation is considered ready. Inject failure before pointer update, after update but before acknowledgment, during receipt persistence and while a task is in flight. Recovery must resolve actual policy state from authoritative records, not repeat an activation because the client never saw its response. This is a configuration effect with the same ambiguous-acknowledgment problem as other effects.

Activation is an effect with an identity

Give each activation a unique operation ID bound to the candidate digest, baseline pointer, authorized principal, target environment and approval expiry. A retry with the same operation ID must query or complete the same operation, not create a second activation. A request that changes the candidate while reusing that ID is rejected. The operation’s idempotency scope and retention must be explicit, as in Chapter 10.

Within a single authoritative store, a proposed implementation can update the active pointer and its activation record in one tested transaction. Where activation crosses an external service boundary, that local transaction cannot make the external effect atomic. Record intent, submit once under a bound identity, retain unknown completion and reconcile through the authoritative service. A client-side success toast or a lost HTTP response is not enough to determine the active version.

Consider a crash after the pointer changes but before the caller receives acknowledgment. On restart, the host reads the operation record and current pointer. If they establish the intended activation, it reports that operation’s completion; it does not apply the candidate again. If the pointer is incompatible or the operation cannot be resolved, it blocks new runs whose policy identity is uncertain. Failing closed here protects both execution and the experiment’s treatment assignment.

The inverse schedule fails before pointer update. A durable intent record then proves only that activation was requested, not that it happened. Recovery can safely complete or reject it under the original approval and preconditions, or demand renewed authorization if those expired. This distinction is why the lifecycle table separates AUTHORIZED from ACTIVE and why receipt persistence is part of activation correctness.

Transaction boundary and fault oracles

For the proposed local fixture, one fenced host writer uses an embedded SQLite store at serializable write scope (BEGIN IMMEDIATE), with policy pointer, epoch/expected-base comparison, operation-ID payload binding and activation receipt in one transaction. A stale epoch or different payload under an existing ID is refused. Pin store build/configuration and qualify concurrency, crash and partial-write behavior; this is not a tested durability claim or atomicity across an external service.

Register idempotency-key retention at least through the study audit window and every unresolved/in-flight operation. Keep R1’s immutable policy and compatible readers while any task is pinned to R1, and while reversion or audit depends on it (§26.6 compatibility plan). After retention expiry, look up/reconcile authoritative state or refuse; never infer a safe new activation from an absent deduplication row.

These are proposed per-injection oracles for a SQLite-backed implementation, not observed test results. D26-ADAPT-01 executes the same decision logic against an in-memory authoritative store with a journal receipt: stale-epoch activation refused, duplicate decisions idempotent by unique receipt IDs, reversion gated on a compatibility flag, unknown versions refused. The serializable-transaction and crash-recovery properties of the store itself remain proposed (R4-09 scope), not demonstrated here — the demo’s durability claims stop at the journal.

Run every schedule with independent expected pointer, receipt, epoch and admission observations. For external activation, retain the intent/query protocol above; the local transaction cannot certify an external commit.

Injection Expected authoritative pointer / receipt New-run admission
Before transaction or rollback before commit R1 / no committed activation receipt; intent may remain R1 only if still qualified
After transaction commit, before client acknowledgment R2 / matching committed operation receipt R2 after authoritative reconciliation; duplicate request returns same operation
Receipt-write failure inside transaction Both roll back to R1/no committed receipt; never R2 without its receipt R1 after store consistency verified; otherwise blocked UNKNOWN
Ambiguous/corrupt store after crash Neither pointer nor restoration guessed Block until authoritative reconciliation
Reversion commits, acknowledgment lost R1 / matching committed reversion receipt R1 after compatibility/current-authority check; R2 tasks follow pinned-version/safety-stop rule
Reversion aborts before commit R2 / no committed reversion receipt R2 only if qualified and not revoked; otherwise blocked

Run every schedule with independent expected pointer, receipt, epoch and admission observations. For external activation, retain the intent/query protocol above; the local transaction cannot certify an external commit.

Reversion must account for incompatible state

Restoring an old configuration is simple only when that configuration can interpret current durable state. A candidate may change checkpoint schema, policy catalogue entries or evidence requirements. Reverting its active pointer without a compatible reader can strand in-flight tasks or misinterpret their records. The proposed candidate contract therefore includes a compatibility statement and a tested restoration plan, not just the name of an earlier commit.

Prefer changes that do not migrate durable schemas during the initial Adaptive Harness Lab study. If a schema change is essential, version records explicitly and keep old readers or an independently verified migration path. A successful migration must retain raw observations, identity and standing history; it cannot normalize away rejected outcomes to make the new policy look better. Separate the migration study from the claim about retry or selection quality when both mechanisms change.

An incompatible rollback can require a paused environment and human reconciliation rather than immediate continuation. That is a limitation to record in the activation approval. Describing every versioned policy as effortlessly reversible would hide the most consequential failure mode behind a reassuring verb.

26.7 Canary evidence is not a second tuning set

A limited canary phase can test operational compatibility before broader activation, but its role must be registered. Use synthetic or explicitly authorized low-impact work, fixed exposure limits, known stop conditions and protected evaluation. A canary that repeatedly tunes the candidate is development, not independent confirmation.

If the canary is a promotion gate, define whether its tasks are separate from the final statistical confirmation set and how the two decisions combine. Do not add favourable canary outcomes to a confirmation estimate while dropping failures as operational noise. Preserve all attempted work, refusals, unknown costs and human interventions.

The scope of a canary success is modest: the candidate operated under those conditions and met the registered checks. Rare failures and unseen task classes remain uncertain. A canary cannot establish a hard security boundary if the enforcement mechanism has not been independently qualified. That gate is a prerequisite, not an endpoint to trade against quality improvement.

If canary monitoring detects a dependency invalidation, treat it as a new adverse observation with availability and scope. It can trigger a declared safety stop; it cannot silently rewrite the earlier candidate record. Any revised candidate must receive a new identity and the appropriate new evaluation, with exposure to the prior test pool recorded.

26.8 Project 10 checkpoint: Adaptive Harness Lab

The approved checkpoint is to evolve harness strategies through ECK-informed proposals, registered predictions, independent canary/holdout evaluation, rollback and governance. The required result is at least one reproducible candidate evaluation, not at least one promotion. A rigorous rejection is a legitimate checkpoint artifact when its evidence and recovery are complete.

Engineering design: one shared host catalogue and journal; an optional bounded ECK adviser; candidate registration; independent experiment execution and evaluation; an authorized activation/reversion boundary; and immutable experience admission. Reuse Pi’s execution loop and the earlier projects’ observation, effect, state and verification contracts. Do not create a separate adaptive runtime that bypasses them.

Implementation specification: first obtain an accepted foundation, qualified effect/recovery boundaries and trustworthy experience records. Then implement or adapt the smallest candidate store, registration validator, experiment runner and active-pointer operation required by the study. Pin Writer/Praxis interfaces and test their actual data semantics. Required independent tests include authority escalation, stale policy base, missing metrics, source dependency rejection, late responses, duplicate activation, persistence failure and incompatible reversion.

Experimental qualification: compare the strongest frozen static policy with the complete governed adaptation process. Include proposer, retrieval, development/search, verification, canary and activation overhead under a declared amortization rule. An extra-budget exploratory arm may answer a separate question, but it cannot be reported as matched-cost adaptive improvement. Integration demonstration and causal improvement are distinct.

No prerequisite above is inferred from manuscript completion. The current Project 01 rejection, unimplemented later projects, adapter unknowns and pending security qualification keep Project 10 operationally blocked. This chapter specifies what future evidence would change that state.

26.9 E26: prediction, qualification and controlled activation

The research question is whether the governed candidate process produces better verified outcomes at matched lifecycle cost while refusing unsupported promotion and permitting honest restoration. The primary hypothesis is a practical gain over the development-selected static baseline on a newly sealed task/fixture corpus. The plausible alternative is that adaptation overfits development or costs more than the failures it avoids.

Arms are static baseline, governed frozen candidate and a registered ablation omitting advisory experience while preserving every safety gate. A separate diagnostic attempts unauthorized or stale activation; it is never an effectiveness arm. Independent variables are candidate/selector condition and predeclared fault schedule. Primary dependent variable is jointly verified completion at the cost target. Secondary variables include prediction error, separate verdicts, total realized cost, review minutes, reversion correctness and harmful-transfer rate.

Freeze baseline/candidate digests, generation/search budget, model and tools, corpus/grouping manifests, evaluator identities, tariff and analysis. Register independent repository/task groups, repetitions, practical margin, uncertainty method, multiplicity and stopping conditions. All calibration uses development only. The final test estimates the frozen process; no confirmation outcome feeds its own policy selection.

Deterministic activation/reversion cases have exact expected receipts and policy pointers. One unauthorized activation or falsely reported restoration fails its stated safety predicate. Statistical benefit requires the predeclared interval and margin criterion. Missing required evidence prevents promotion; a wide interval is inconclusive. Rejection or no improvement is retained as a result within the tested domain.

Threats include correlated proposer/evaluator models, optimizer exposure to test tasks, candidate multiplicity, censored failures, uncertain provider billing and temporal dependency changes. Report every deviation and affected claim. The E26 confirmation study is EXPERIMENT PENDING; D26-ADAPT-01 executes the lifecycle, gate and replay mechanics on scripted fixtures, not the statistical comparison — no live-model commands or cost measurements are asserted.

A complete evaluation bundle includes the rejected candidate

Project 10’s reproducible artifact should retain the baseline and candidate identities, prediction registration, search/development exposure, split/grouping manifests, effective runtime settings, attempted run list, raw observations, normalized traces and independent evaluations. Include the exact activation or rejection decision and any reversion evidence. A reader should be able to tell whether the candidate was never tested, tested and inconclusive, rejected, authorized but not activated, or active.

Reproducibility does not require the final decision to be positive. A rejected candidate with a complete cost account and a correctly restored baseline may be the most valuable result. It shows that the adaptation process can fail safely and learn a scoped negative lesson. An attractive graph of successful runs with omitted failed attempts would demonstrate less, even if its headline completion rate is higher.

Before promoting the lesson itself into reusable experience, apply Chapters 21–23. The failed candidate’s observation remains historically valid, but its general explanation may be only a hypothesis. Preserve which task family, model, policy version and evaluator produced the result. A negative outcome can warn future proposals without becoming a universal ban on extra repairs or ECK advice.

26.10 What promotion may honestly mean

Suppose the registered practical improvement margin is delta, expressed as a difference in jointly verified completion rates. The confirmation analysis should report the estimated difference and an interval under the registered cluster model. An estimate above delta with an interval still crossing zero is not a demonstrated practical gain. If the entire interval exceeds delta, the declared criterion may be met, subject to the safety and cost gates. These are logical decision conditions, not claimed numerical outcomes or a universal choice of confidence level.

The criterion must say whether delta applies to the population mixture, each critical task stratum or both. An overall gain can hide a regression on a small but important class. A predeclared nonregression guard for that class may require additional precision or prevent promotion. Do not add such a guard only after seeing an inconvenient result, and do not discard the class because its sample is small.

A confirmation budget too small to establish the required precision can still produce useful observations. It cannot justify lowering the promotion threshold afterward. The decision remains insufficient evidence unless a separately registered study supplies more information without reusing exposed tasks as fresh confirmation.

The final record should say exactly what was promoted, by whom, against which evidence and for which scope. It should also say what remains unproved: other repositories, different models, rare faults or external effects beyond the qualified broker. A versioned policy can be accepted for a narrow domain without becoming a universal harness improvement.

This process makes adaptation reversible in the sense that policy state can be restored under tested conditions. It does not make every consequence reversible. That distinction is why effect authority remains outside the adviser and why independent observation survives both promotion and rejection. The goal is an accountable change process, not a system that finds a reason to promote every proposal.

One important policy dimension remains: which model should perform which admitted step? Different models change capability, cost, latency and verification needs. Selecting among them is another candidate policy, with the same temptation to optimize on the benchmark. Chapter 27 develops model routing under those constraints.

Previous: Chapter 25: The ECK: Policy Selection Above the Agent Loop.

Next: Chapter 27: Multi-Model Routing Without Benchmark Leakage.