The ECK: Policy Selection Above the Agent Loop
Specify ECK inputs, permitted policy outputs and independent checks; keep effect authority outside its control.
A harness has three admitted ways to investigate a maintenance issue. One supplies a compact source projection, one follows a gated reproduction workflow, and one launches two read-only investigators. Each already has its own resource and authority limits. The new problem is choosing among them. Always choosing the richest workflow may waste money. Always choosing the cheapest may produce expensive failures. Asking the model to invent a workflow on every task makes the decision difficult to audit.
The existing Executable Cognitive Kernel offers a possible source of procedural experience and policy advice. It does not follow that the kernel should own the whole harness. Selection, execution, effect authority and evaluation are different responsibilities, even when one application hosts several of them. This chapter derives a narrow integration boundary from the question: what may experience influence without being allowed to certify itself or expand its own permissions?
Evidence status. Draft manuscript. R06 inspected existing Writer/Praxis code at recorded revisions; those findings are OBSERVED source text, not executed integration. The responsibility record is DOCUMENTED at its pinned revision. The advisory contract below is partially executed: demonstration D25-ECK-01 runs the real Writer
StrategyLibrary(pinned SHA-2560505709c…, matching the R06 recording) out-of-process over eligible harness records, with host gates admitting, falling back, or refusing the recommendation (examples/pi-harness-lab/src/eck-advisor.ts+src/eck_bridge.py;test/eck-adapter.test.ts, 9/9 pass offline). Only the standalone strategy-library seam is executed; kernel, promotion, verification and retrieval services needwriter_coreand were not imported. The E25 comparative study and owner-supported deployment remain PROPOSED and EXPERIMENT PENDING. Project 01 remains REJECTED; Project 10 has not started.
25.1 What the name denotes, and what it does not settle
ECK means Executable Cognitive Kernel in the existing Writer ecosystem. R06-C01 records source wiring from Writer’s runtime domain to its kernel service. R06-C02 records a narrower Praxis adapter loading Writer’s real strategy-library class. These are concrete ownership and source observations. They do not establish that every ECK component is independently portable, that the book’s proposed record schema already exists there, or that using the kernel improves repository tasks.
The pinned Praxis responsibility record assigns Writer/ECK procedural
experience within its domain, Praxis cross-domain effectiveness experiments
and advisory comparison, and Mission Control authoritative execution and
governance. It explicitly rejects a wholesale merger and copying the
kernel into Praxis (HARNESS-RESEARCH-01/R06-ECK.md, P8, revision
9cbc59038d38bc37d1093c4f236497fdb3f22715; DOCUMENTED ownership
decision). This is an intended boundary, not independent proof of every
server-side enforcement path.
For this book, place the optional advisory component above the agent episode, where the host chooses an admitted policy. Pi retains the model/tool execution loop. The host retains task transitions, budget admission and durable state. The broker retains effect authority. An independent evaluator judges the resulting artifact and execution. These roles can live in a compact application; naming the boundaries does not require five services or a new distributed platform.
Book I covers configuring and driving Pi. The question here is what the surrounding program may safely choose before it invokes that runtime. An ECK recommendation is another proposal to that program. It is neither a replacement Pi loop nor an approval token.
25.2 Start with a finite policy catalogue
The simplest useful selector is a static rule over a small catalogue. For example, read-only questions use a bounded source-inspection policy; patch requests use reproduction before editing; unresolved effect status forces reconciliation. Such a selector is deterministic, reviewable and often sufficient. Experience must beat this baseline before its additional dependencies become justified.
A catalogue entry is a versioned recipe with declared preconditions, tool surfaces, context policy, retry bounds, verification obligations and resource envelope. It does not contain unrestricted code supplied by a model. The host knows how each recipe maps to existing workflow states and which qualified mechanisms it requires. Unknown recipe IDs are refused rather than interpreted as instructions to construct a new runtime.
Separate policy parameters from governance invariants. The allowed history allowance might vary within an approved range. A retry limit might choose zero or one retry inside a fixed ceiling. Team size might select one of the qualified A1/A2 policies. The policy cannot remove required independent evaluation, grant a filesystem capability, enlarge the root budget or accept its own missing evidence. Those fields are outside the advisory action space.
This finite boundary makes learning interpretable. A recommendation to choose focused context can be compared with the same task under static context. A recommendation to run arbitrary code, change judges and widen permissions simultaneously cannot be attributed to strategy selection. It is a different system with a much larger review obligation.
25.3 Selection, proposal and activation are three operations
Selection chooses an already admitted catalogue entry for one task. It must satisfy current preconditions, standing and budget availability. The selected recipe is pinned in the run manifest. Within that run, the policy does not drift because a later reward changed a shared cache.
Proposal creates a candidate change to the catalogue or its selector. The proposal may come from ECK, a model, a deterministic analysis or a human. It carries source evidence, predicted effect, scope and a bounded diff against a known baseline. It has no right to become active merely because its proposer is named a kernel.
Activation changes the host’s admitted active policy under the authorized owner’s decision. It follows independent testing and the promotion protocol of Chapter 26. An internal Writer rule-store update, a Praxis retain recommendation and a Mission Control deployment are not interchangeable events. Each has a different owner and authority boundary.
Keeping these operations distinct prevents a familiar circularity. A component selects a recipe, scores its own output, stores a high reward and then cites that reward to justify selecting it again. The loop may be useful as a search heuristic. It is not independent evidence that the recipe generalizes. The book needs an evaluator outside the adaptive component’s optimization path and a sealed confirmation process it cannot inspect while choosing the policy.
25.4 The smallest advisory interface
The input should be a bounded, immutable projection, not an ambient connection to the host’s entire database. It includes registered task features, eligible strategy IDs, a prior-only experience snapshot, the current budget envelope and the policy-catalogue digest. It excludes confirmation solutions, secret credentials and authority to modify the catalogue. Features must be available before the decision they inform.
// Host contract; the input/output shape is executed in D25-ECK-01 against
// the real Writer StrategyLibrary (ranking half) with host-side admission.
// Not an ECK or Pi export; catalogue deployment remains host-owned.
interface PolicyAdvice {
requestId: string;
catalogueDigest: string;
experienceSnapshotDigest: string;
proposedPolicyId: string | null;
evidenceVersionIds: string[];
predictedEffect: { metric: string; direction: "up" | "down";
scope: string } | null;
abstentionReason: string | null;
}
The output selects an ID, cites evidence and may abstain. Free-text rationale can explain the recommendation but cannot grant another action. The host validates schema, catalogue identity, policy preconditions, required-use dependency standing and available resources. Advice becomes a recorded admission decision only after these checks. A malformed or stale response falls back to a separately admitted static policy or returns a refusal, according to a frozen rule.
Pin the adviser implementation and its configuration. The pinned Praxis adapter records a source hash and can enforce a configured expected hash (R06-C02). Optional hash enforcement in that inspected adapter is not the book’s proposed trust policy. The book would require an approved pin outside model-controlled configuration. Loading a Python source file executes code; hashing it does not sandbox it. Packaging and isolation need an owner-supported boundary and their own qualification.
25.5 Ownership across the existing systems
| Producer | Consumer | Proposed contract | Authority and failure boundary |
|---|---|---|---|
| Host feature extractor | Advisory adapter | Frozen task-feature projection and allowed policy IDs | No hidden oracle labels; missing features remain unknown |
| Experience admission layer | Advisory adapter | Eligible immutable snapshot with complete source closure | No direct retrieval bypass; invalid dependency blocks use |
| ECK-backed adviser | Host selector | PolicyAdvice | Proposal only; timeout or malformed advice cannot widen rights |
| Host | Pi episode adapter | Admitted run/context/tool configuration | Pi executes its existing loop within declared control |
| Broker and supervisor | Independent evaluator | Authenticated effect/lifecycle receipts plus artifacts | No self-authored success certificate |
| Evaluator | Experience admission/proposal process | Scoped outcome observations | Later availability and split restrictions preserved |
This table is an integration specification, not a claim that these interfaces already exist. A narrow adapter should preserve existing ownership rather than copy Writer services into the book. If Writer’s supported interface cannot supply a required field, record the gap and defer that arm. A fabricated compatibility layer filled with guessed defaults would make the experiment appear more complete while weakening its evidence.
State ownership follows the same rule. Pi owns conversation execution state; the host owns the task journal and active catalogue binding; Writer owns its native strategy representation; the evidence layer owns the immutable observations used in the book’s study. Derived indexes can be rebuilt. Neither a top-reward cache nor a UI list is the sole archive of failed and rejected attempts.
25.6 What can be reused from the inspected library
At Writer revision bb8dc3feeb73e1e3bad9000e6fbf30eb23f9c7ca, the
inspected StrategyLibrary stores issue and pipeline signatures, reward,
time and metadata. Its get_best_strategy returns the pipeline with
maximum stored reward; pruning keeps high-reward entries. This statement
is OBSERVED source behavior, re-inspected without executing the class,
and matches R06-C03. It establishes a possible adapter seam, not a
governed experience system.
The host can reuse such a class for the narrow operation it provides while placing eligibility outside it. Give it only the frozen eligible candidate data for this decision; do not assume metadata creates a temporal or split filter. Keep the complete negative archive elsewhere. If the class cannot preserve the desired mapping or return evidence IDs, that is an adapter question requiring tests, not a reason to rewrite the ECK under a different package name.
R06-C06 found richer task/pipeline/output policy and critic scoring in Writer’s kernel service. R06-C07/C08 found verification and rule-promotion services. The dossier also records gaps: same-critic reward, permissive empty defaults in an inspected path, and no established human/holdout gate in the particular promotion service. Those scoped static findings are reasons to test a proposed integration. They are not grounds for calling all Writer learning unsafe or claiming those paths are active in the book’s harness.
The first reuse decision is therefore modest: preserve vocabulary, ownership and a narrow advisory seam. The first experiment asks whether that seam improves selection over a strong static policy. Only a positive, independently qualified result would justify deeper coupling.
25.7 Worked example: the attractive strategy with the wrong evidence
Suppose three catalogue entries exist: S0 bounded source inspection, S1 reproduction-first repair and S2 a two-investigator workflow. The following invented records are illustrative, not Writer measurements. One prior S2 run has reward 0.99, ten S1 runs have verified completion on eight tasks, and twenty S0 runs have completion on nine tasks. Their costs, task difficulty and evaluation scope differ.
Selecting the maximum reward chooses S2. Selecting the largest number of successes chooses S0 because nine exceeds eight. Neither calculation supports a fair effectiveness comparison. The raw rates are 8/10 = 0.80 and 9/20 = 0.45, but those too are not a causal estimate when task mixes and costs differ. R06-C05 motivates exactly this caution about unequal denominators; the numbers here merely make it concrete.
Now add eligibility. S2’s sole high-reward run came from a confirmation task and must be excluded from development advice. Two S1 outcomes depend on a validation record whose current head is rejected. Their required uses become ineligible through Chapter 21’s transitive check. S0’s records are earlier and valid but concern read-only questions, while the current task requires a patch. None can be promoted to a universal winner by sorting a scalar.
For the current patch task, the static admitted fallback is S1 because its workflow fits the task and its mechanism qualification is assumed for this hypothetical example. The adviser may recommend S1 with a limited rationale or abstain for insufficient comparative evidence. The host records both the advice and its own admission result. It does not convert abstention into a missing-data reward of zero, nor does it infer that a rejected historical validation forbids every possible S1 implementation forever.
If the recipe itself is not qualified, the host cannot rescue the example by pretending it is. The proper result is blocked admission or a separately authorized development test. A selection algorithm does not create the tested implementation it wants to choose.
Choosing among eligible recipes still needs a declared objective
Eligibility removes invalid options; it does not determine the best remaining choice. A proposed baseline can use a small lookup table keyed by registered task features. A richer adviser can estimate verified completion probability and total cost for each eligible recipe. Keep these estimates distinct from observed outcomes and identify the development data and model version that produced them.
One illustrative decision rule maximizes
predictedCompletion − lambda × predictedCost over admissible recipes.
Here completion is dimensionless, cost has a declared currency/unit,
and lambda has reciprocal cost units. Lambda is a registered preference,
not a quantity the adviser may lower after an expensive failure.
Alternatively, minimize predicted cost subject to a required reliability
threshold. The two objectives answer different user questions and can
choose different recipes. Neither is meaningful if the estimates are
uncalibrated or if unknown costs are silently replaced by zero.
Do not infer reliable probabilities from a library reward. A development calibration study can compare predicted joint completion with independently verified binary outcomes. For a hypothetical prediction p=0.8, squared error is (1−0.8)²=0.04 when completion succeeds and (0−0.8)²=0.64 when it fails. This arithmetic illustrates a measurable prediction loss; it does not establish a calibrated adviser or prescribe the final scoring method. Register the calibration metric and stratification before use.
When the task’s features fall outside calibrated support, the adviser should abstain or use the admitted static fallback. It must not convert distance from known cases into confidence because an embedding query always returns a nearest neighbour. Nearest is a relative property; it does not establish relevance, scope or adequate evidence. Log the absence of support so future development can distinguish deliberate abstention from an adapter outage.
A small boundary can be tested without importing a whole platform
Before calling existing Writer code, test the proposed contract against a
scripted adviser. D25-ECK-01 executes this step and the next one together:
eligible harness records are mapped to the real class’s input shape, the
genuine StrategyLibrary ranks them in a subprocess, and the host admits
the recommendation only when it names an admitted catalogue policy with
matching digest and eligible evidence. It can return each allowed ID, a
missing ID, a stale catalogue digest, duplicated evidence references and
an intentional timeout. This isolates host admission semantics from
packaging problems. The owner-supported adapter step below maps the pinned
existing strategy interface to that same contract in a controlled
development environment.
It must report what information the original class cannot supply.
For example, a returned pipeline signature with no scoped verification
cannot become an eligible proven recipe just because the adapter can
serialize it. Missing standing requires an external verified mapping or
abstention, with that additional dependency recorded.
Avoid an adapter that fabricates compliance by copying a static
independent=true field onto every result. A conformance test should
trace each output field back to its real producer: source hash from
the loader, task family from the registered task, verdict from an
independent evaluator and authority from the host/broker. If two fields
come from the same model’s statement, label that shared provenance.
Schema completeness without truthful field provenance is another form
of the self-consistent evidence forgery discussed in Chapter 4.
Finally compare the scripted and existing-code adapters on the same finite cases. Differences may reveal a missing ownership contract rather than an algorithmic defect. Resolve those differences before running an effectiveness study. Otherwise a poor result may be caused by an adapter that silently drops negative cases, while an apparent good result may come from a bypassed eligibility check.
25.8 Adaptation must preserve what its reward omits
A reward is a projection of several observations into one objective. It can be useful for ordering candidates, but omissions remain omissions. A completion reward may ignore unauthorized effects; a latency reward may encourage premature stopping; a low-token reward may favour answers that skip evidence collection. The adaptive component should not define its own safety exceptions to improve that number.
Use hard admissibility constraints before optimization. The proposed selector first excludes policies violating authority, evidence or resource requirements, then compares eligible options on registered objectives. If no option is admissible, it abstains. Turning an unacceptable policy into an acceptable one by assigning a large enough quality score is not constrained selection; it is a change to governance.
Preserve vector observations alongside any scalar reward: task evaluation, execution acceptance, actual/unknown spend, review effort and scoped failure reasons. A later analysis may discover that the scalar preferred the wrong tradeoff. Raw evidence must survive that correction. Reward updates create new versions of advice or policy candidates, not silent rewrites of the evidence that produced them.
Exploration also needs authorization. Trying an uncertain recipe on a synthetic development task is different from deploying it on a user repository. The kernel may propose an exploration allocation inside an approved study budget, but cannot borrow production effect grants or final confirmation tasks as convenient learning opportunities. The host and experiment custodian retain those decisions.
Host support and snapshot gates are mandatory
Host admission checks a versioned support-coverage predicate over the pre-decision feature snapshot: required features are known, extraction versions match, categories/ranges satisfy the frozen calibrated-domain digest and the proposed recipe’s preconditions hold. A high confidence number cannot bypass this predicate. Unsupported/unknown inputs require advice abstention or a separately admitted static fallback; record the adviser’s recommendation separately from host resource/policy refusal.
experienceSnapshotDigest must resolve to an authenticated admission-layer
attestation naming registry revision/digest, split and grouping manifests,
eligibility-policy digest, cutoff, selected immutable versions and a
dependency-closure receipt. Recompute closure/head/use checks under the
applicable decision mode; a self-authored hash is not proof. Missing,
untrusted or mismatched attestations refuse experience-backed advice.
On separately labelled development calibration tasks, register a matrix of supported/unsupported/unknown domain versus recommendation/abstention and host admit/refuse. False confidence is recommendation admitted outside qualified support; unnecessary abstention is abstention on a labelled feasible supported case where the frozen rule calls for advice. Do not count legitimate uncertainty or host budget refusal as that error. Freeze units, expected labels, thresholds, coverage and re-calibration triggers; report these rates with uncertainty before any effectiveness claim.
Add an E25 negative control where two claimed independent fields derive
from one model source. Their provenance must be classified shared,
not independent; include an actually separate-source positive control.
Source IDs/receipts determine the relation, not the number of output
fields or an adapter’s asserted boolean.
25.9 E25: qualify advice before claiming adaptive value
The first question is contractual: can an advisory adapter emit only permitted choices while preserving evidence and failure behavior? Use a deterministic catalogue with valid advice, unknown policy IDs, stale digests, rejected transitive dependencies, missing features, malformed outputs and timeouts. A positive control must select a valid eligible recipe. Each invalid advice case must refuse or follow the registered static fallback without widening authority. Pre-author expected decisions independently of the adapter implementation. D25-ECK-01 executes this phase against the real class for valid advice, unknown policy IDs, stale digests, cross-task records, rumours, lessons-as-evidence and non-evidence verdicts; malformed outputs, timeouts, rejected transitive dependencies, missing features and the concurrent-advice fault remain proposed.
This phase uses zero model calls and a finite registered case catalogue. Its units are fault cases, not independent performance tasks. Measure expected and actual decisions per class, false alarms, evidence references and fallbacks. One admitted unauthorized policy fails the stated safety predicate. Passing the catalogue establishes its tested behavior only. It does not demonstrate that experience selection is beneficial.
The second question is comparative: does governed advice improve verified completion at matched total cost over a development-selected static policy? Arms are that strongest reasonable static policy, a frozen eligible maximum-reward advisory baseline, and the governed ECK-backed adviser. The maximum-reward arm never bypasses split or authority checks; an intentionally permissive variant belongs only in diagnostics. Independent variables are selector arm and registered task stratum.
Primary outcome is task PASS with execution ACCEPTED at a predeclared
cost target. Record separate dimensions, advice abstentions, retrieval
and selection overhead, human review and harmful-transfer cases. Freeze
task/fixture groups, model, catalogue, history snapshot, tariffs and
evaluators. Register sample size, repetitions, cluster-aware paired
analysis, practical margin and stopping rules before confirmation.
Every advisory request and failed fallback counts toward cost.
The plausible alternative is no useful gain because eligible experience is sparse or the static rules already capture the relevant distinctions. A wide interval is inconclusive; a precise negative effect argues for the static default in this domain. Threats include scalar reward bias, feature leakage, same-critic feedback, changing source dependencies and unequal task mixes. All tests and comparisons remain EXPERIMENT PENDING.
E25 adds a concurrent-advice fault: two valid recommendations compete for one remaining resource share; the atomic host ledger admits at most one, records the other’s refusal and does not credit its unexecuted recipe. Catalogue/tool/checkpoint/evaluator compatibility uses exact qualified schema/configuration digests in the first study, not inferred semver ranges. A stale catalogue requires fresh validation; an incompatible entry refuses that entry. A static fallback is allowed only if independently compatible and admitted under the current catalogue and budget, with its actual ID recorded. These are pending conformance cases, not passing results.
25.10 The boundary before policy change
An admitted policy can still be incompatible with the current host. Version the catalogue’s required tool schema, checkpoint schema and evaluator contract alongside its recipe. If a host upgrade removes a required tool or changes what a completion receipt means, reject the incompatible entry rather than approximate its semantics from a similar name. This is ordinary compatibility checking applied to cognitive work.
Concurrent decisions also share real resources. Two advisory calls may independently recommend the same expensive recipe; neither response reserves the resources to execute it. The host must atomically reserve capacity at admission under Chapter 17 and record any refusal after advice. This produces a useful distinction between adviser preference and executed policy. Evaluating only the former would hide resource contention and fallback costs that the user actually experiences.
Keep that distinction in later learning records. A recipe proposed but not admitted did not fail its task; it was not executed. A recipe executed after fallback must be credited or blamed under its actual identity. Otherwise resource refusals contaminate the reward history and the adviser learns from a policy that never ran.
This chapter’s engineering design supplies a catalogue, bounded advice and a host admission decision. The contract half of its implementation specification is executed (D25-ECK-01: real class, pinned source, temporal/standing eligibility at the input, protected observations, refusal tests); owner-supported deployment, mandatory configuration pins outside test control and the remaining failure tests are still required. Its experimental qualification asks whether selection is better than the static alternative. Those are three separate deliverables; none can stand in for the others.
The remaining research questions are deliberately concrete. Can the existing interface expose immutable evidence references? Can rejected attempts be retained independently of pruning? What does an unavailable dependency do to advice latency and fallback frequency? How much of a gain, if any, comes from better context rather than policy choice? These questions justify controlled integration work, not a new generic kernel.
Eventually the adviser may suggest a policy absent from the admitted catalogue. That request crosses from selection to change. It needs a prediction, a frozen candidate, independent evaluation and an authorized activation or rejection decision. Chapter 26 builds that process while keeping the kernel’s recommendation separate from the authority to promote.