Expand description
Which of a graded check’s applies to ask, to hand over free, to judge blindly as a placebo, or to
leave for later: the lesson selection policy. It replaces attention.rs, which stays one release as
the Attention sub-policy.
Policies (policy, the first that applies): BORG_SELECT=fixed the fixed rule;
BORG_STOP_ASK_CAP=N the fixed rule asking only the first N 3s (evaluation only);
BORG_STOP_ATTENTION=on attention.rs’s learned cut (evaluation only); otherwise the learned policy
(Learned, select/policy.rs), the default since its pre-registered checks passed under Rules v2
(docs/evidence.md#lesson-selection: P4 had failed its first run and the rerun under the v1 design).
The fixed rule (conscience.rs graded_without, no cap) asks every 3 and 2 and the 1s up to
conscience::CAP when a check has a 3, else hands over the 2s and 1s free, up to CAP; a lesson the
session already had delivered (Ctx::had) may still be asked but never takes a free slot, which its
delivery would drop as given before. It also draws up to PLACEBO_SLOTS of the applies it delivers
neither way for the placebo arm (draw_placebo): judged blindly where a free delivery would be, never
shown, so what not delivering is worth gets labels at no cost to quality. Those are the labels the
learned policy cannot get from the fixed rule’s history, which asks and hands over by grade alone.
The learned policy (select/policy.rs choose, policy v2) leaves the fixed rule only on evidence
from a fitted value model, and on live checks runs a randomised test of how many of the fixed
rule’s delivered lessons to ask rather than hand over (nothing withheld), both under a
conservative gate rationed by the collective’s tolerance (alpha); cold start (no fit, or a gate
that may risk nothing yet) is exactly the fixed rule, and so is a store the monitor reverted
(select/summary.rs REVERTED). It draws its placebos
among the applies it leaves for later, as the fixed rule does. The evaluation switches decide
exactly as the hook did before this module (0.5.0’s attention.rs graded) and draw no placebo.
What it reads. Only Ctx: the summary the hook loaded once (select/summary.rs load, beside
the lessons file), and for the Attention sub-policy the outcomes beside the lessons file
(outcome.rs path_beside), never the routed collective’s: an evaluation that points
BORG_CONSCIENCE at its own store reads that store’s outcomes, not the engineer’s.
Deterministic: a decision depends on the applies, the policy, the summary and the check id
(check_id, seed), all logged.
Modules§
- policy
- The learned policy’s core: a Bayesian model of what each route of a graded apply is worth, fitted from the outcome log, and the decision it drives at one check. Pure: no file, no clock, no environment (an engineer’s budget comes in as an argument).
- replay
borg debug select [--replay] [--rebuild] [--dir DIR | --file FILE] [--json] [--eval RUNS_DIR --qrels FILE]: the selection policy’s state and its pre-registered checks, replayed from the outcome log (0 tokens). Reports, never applies.- summary
- What a hook needs to decide, folded from the outcome log once and cached, so no check parses the whole log: every graded apply with its route and what became of it, the delivery tallies, the pool’s yield and latency, the gate’s ledger, the monitor, the checks whose learned decision fell back to the fixed rule, the randomised question-count test’s checks, and the fit (select/policy.rs).
Structs§
- Ctx
- The check a decision is made for.
- Log
- What a decision logs: the graded record’s
policyandfit, and the#borg-selectline. - Routed
- A graded check’s decision: what to ask (in the order to ask it), to hand over free (in the order
to deliver it), and to judge as placebo; per apply (aligned with the applies) its probability of
being asked (
p) and of being handed over free (pf) under the policy in force; and what to log. - Unit
- One graded apply as the policy sees it, aligned with the check’s applies.
Enums§
- Policy
- The policy in force for a graded check (module doc).
- Route
- What happens to one graded apply at its check.
Constants§
- ARMS
- The arms a graded apply can be delivered by (
Route::arm). Protocol: the length and order of every per-arm array (select/policy.rsmonitor, select/replay.rs). - CHECK_
HEX - Hex digits of a check id. Protocol: the length of the
@<check>tags hook.rs already writes (append_p_of), 48 bits, so two checks of one store collide with negligible chance. - PLACEBO_
SLOTS - Placebo slots per check: of the applies a check delivers neither way, at most this many are judged
blindly (
Routed::placebo). Guard: bounds the judge’s extra work per check. - REVERTED_
SOURCE Log::sourceof a learned check on a store the monitor reverted (select/summary.rsREVERTED). Protocol: logged as the graded record’ssource, whichborg debug selectP1 reads back as the revert the hook saw (select/replay.rs).
Functions§
- alpha
- The learned policy’s α for the store that holds
lessons: the collective’srisk(risk_of),policy::ALPHAunless it sets one. What the hook reads intoCtx::alphaat the check; a replay reads the record’s instead (alpha_of). - alpha_
of - The tolerance a graded record’s check was decided under, from its logged
alpha(logged_alpha):policy::ALPHAwhen none is logged, as on every record from beforerisk. - budget_
of - The engineer’s budget for the collective whose store holds
lessons: itsbudgetin collectives.json (collective.rsEntry::budget: pool tokens per session, a positive number), None when unset (the default) or the config does not load. - check_
id - A graded check’s id:
CHECK_HEXhex digits of blake3 over its session, channel (stop,live), start (epoch ms) and process id. Not a count of the session’s checks: a stop and a live check of one session can run at once and would count the same lines. Computed once per check and logged, never recomputed. - graded_
under - A graded check’s decision under
policy(the hook passes the policy in force,policy, through hook.rsdecide): replaces 0.5.0’s attention.rsgraded.FixedandCapdecide by the fixed rule (conscience.rsgraded_withoutwithctx.had,Capwith its cap), whose propensities are its choice (attention.rsfixed_p);Attentionon a check with a 3 by the learned cut on the outcomes besidectx.lessons, with the explore mixture’s propensities, and by the fixed rule otherwise;Learnedon every check by select/policy.rschoose(the fixed rule at cold start or while the store is reverted), with its exact propensities (learned).FixedandLearneddraw placebos among the applies they deliver neither way (draw_placebo); the asked and free lists never depend on that draw, so the fixed rule’s decision is the same with or without it (P0). - logged_
alpha Log::alphaof a check decided under the tolerancealpha: None atpolicy::ALPHA. What the hook logs andalpha_ofreads back, from one definition so the two never part.- nofree
- The applies the session already had (
Ctx::had), each once, in the applies’ order: what the graded record logs asnofree(outcome.rs), all a replay needs ofhadto decide as the hook did. - policy
- The policy this process runs under, from the environment (module doc).
- pool_
tokens - The pool budget in tokens for a check of
sessionunder the policy in force (policy,pool_tokens_under). - pool_
tokens_ under pool_tokensunderpolicy, never the environment’s: whole.rsTOKENSunless the pool is the learned policy’s (pool_active); then the budget its fit chooses (select/policy.rspool_tokens), never past the baseline without the harness’s stop budget for the model call (limit_ms) and the latency evidence to fit in it. Fixed for a session between fits, so its prompt prefix stays stable. What a replay calls for the policy it replays.- precedence
policyover its three switches:select(BORG_SELECT),cap(BORG_STOP_ASK_CAPas conscience.rsask_capreads it) andattention(BORG_STOP_ATTENTION=on).fixedwins over both evaluation switches, the cap over attention, both overlearned; any otherBORG_SELECT, or none, is the default, the learned policy: its pre-registered checks passed under Rules v2 (docs/evidence.md#lesson-selection, run v2 2026-10-29), andBORG_SELECT=fixedis the way back. Whatever evaluates the learned policy (select/replay.rs, the monitoring of what it would do) namesPolicy::Learnedand never reads this.- risk_of
- The engineer’s tolerance for learning in the collective whose store holds
lessons: itsriskin collectives.json (collective.rsEntry::risk: the share of the fixed rule’s value the randomised question-count test may risk, 0 to 1, 0 turning it off), None when unset (the default, under which the policy usespolicy::ALPHA), not a number in range, or the config does not load. - seed
- The seed of a check’s draws: the first 8 bytes of blake3 over its session, channel and id, so a replay of the logged check draws the same, and a stop and a live check of one session never share draws.
- shown_
tokens - The pool tokens of a check whose model call was shown
shown(hook.rsCall::order): whole.rscostsummed over them, saturating. What the graded record logs (outcome.rstokens) and the decision values (Ctx::tokens), from one definition so the two never part. - units
- The units of
applied, in its order.