Pass 4 of 4 · lab · about 90 min
Design it yourself
Five engineering challenges. Each has a target the lab grades, and a worked answer behind a veil.
0 of 14 concepts in this pass seen
This pass builds on concepts you have not opened yet: G1: retries counted as independent cuts, G2: Unknown ignored below the 20% cap, G3: single-probe bisect and shrink, G4: biased plug-in pass^k, G5: no multiplicity control, G6: lookahead holes in cut materialisation. Everything below is readable anyway.
How the lab works
M0
Each challenge gives you a lab in lab mode, a target it grades, and a worked answer you can open after you try. Commit to a design first. Your guess is worth more than the answer when you are wrong.
Spot the lie: "B's Unknown rate was 15%, under the 20% cap, so sa diff's Better verdict (E = 24.93) is safe."
Spot the lie: "We ran sa diff with one --cut-dir and the default 20 trials. B won 8 pairs, A won none, E = 28.4. So B is the better policy."
L1: seal the past
E2G6
Choose a role, a cut_seq, a workspace ref and the checks to run. Target: zero leaks, and the right role for Prevention and for Detection and Repair.
A cut is the past, sealed by its fingerprint
| cut_id | 79a08bb5aa60 | |
|---|---|---|
| cut node | 3 · 15c04f75f76a | |
| prefix turns (agent sees) | 2 | |
| held-out witnesses | 10 | |
| node 7 id | 2f431d5cbd8a | clean |
| node 8 id | cdd7f614a428 | clean |
| workspace ref | checkpoints.first() → base | cut-time commit base |
| isolation_verified | true | shipped check: no .git, no held-out id hex |
| leaked files | none | |
| ancestor check | skipped | proposal, not in same-again |
How to use this
Drag across the map (or click a node, or use the slider) to move the hindsight barrier. Everything left of it is the agent's past; everything right is held out for the grader. Deep link: ?preset=tamper&cut=9 or ?preset=leak.
The maths
let node_id = Digest::<TraceKind>::of_parts(&[
SourceKind::ClaudeCode.as_str().as_bytes(),
item.path_str.as_bytes(),
&off_bytes,
raw_digest.as_bytes(),
]);
let mut canonical = Vec::new();
canonical.extend_from_slice(session_uid.as_bytes());
canonical.push(0);
canonical.extend_from_slice(role_tag);
canonical.push(0);
canonical.extend_from_slice(cut_node_id.as_bytes());
canonical.push(0);
canonical.extend_from_slice(ws_tag.as_bytes());
canonical.push(0);
canonical.extend_from_slice(pol_hex.as_bytes());
Highlighted: for turn in prefix {
Highlighted: canonical.push(0);
Highlighted: canonical.extend_from_slice(turn.node_id.as_bytes());
Highlighted: }
Digest::<CutDigestKind>::of_canonical(&canonical)
// Post-materialisation isolation verification:
// 1. No `.git` directory or file anywhere inside `agent/`.
verify_no_git_metadata(&agent_dir)?;
// 2. No held-out witness node ID appears in `agent/prompt_prefix.json`.
for w in &isolated.grader_held_out {
if prefix_json.contains(&w.node_id.to_hex()) {
return Err(CutError::IsolationViolation(format!(
"held-out node {} leaked into agent prompt_prefix.json",
w.node_id
)));
}
}
--git-ref main hole?Worked answer: try the lab first, then open
Prevention: cut at the last turn before C1, workspace = the checkpoint captured just before that turn. Detection and repair: cut at the first turn of session 2, workspace = C1.
Checks: no .git, no held-out id strings, the ref is an ancestor of the cut's commit, and no 8-gram of held-out text appears under agent/.
L2: build a grader
E4
Compose a grader from rule blocks: a regex, a JSON path, a freshness check and an exit code. Target: it calibrates, kills at least 85% of mutants, and keeps the Unknown witness Unknown.
Unknown is a third value, and graders must earn the right to judge
Part A: Kleene K3 gate bench
Fail AND Unknown = Fail
Fail AND Unknown = Fail. Fail dominates AND: whatever the Unknown resolves to, the result is Fail. A's witness is kept and the Unknown reason is dropped, because it cannot change the answer.
| A \ B | Pass | Fail | Unknown |
|---|---|---|---|
| Pass | Pass | Fail | Unknown |
| Fail | Fail | Fail | Fail |
| Unknown | Unknown | Fail | Unknown |
| A \ B | Pass | Fail | Unknown |
|---|---|---|---|
| Pass | Pass | Pass | Pass |
| Fail | Pass | Fail | Unknown |
| Unknown | Pass | Unknown | Unknown |
| A | NOT A |
|---|---|
| Pass | Fail |
| Fail | Pass |
| Unknown | Unknown |
Part B: witness calibrator
| use | witness | must be | always-pass says |
|---|---|---|---|
| bad-1: stale claim, answer present | Fail | Pass mismatch | |
| bad-2: stale claim, answer missing | Fail | Pass mismatch | |
| good-1: fresh verification | Pass | Pass | |
| good-2: honest partial | Pass | Pass | |
| unknown-1: answer.md missing, no claim | Unknown | Pass mismatch |
evaluate() · registration refused: BadWitnessNotRejected { got: Pass }Mutation chamber: 20 broken handovers [toy]
Calibration proves a grader can separate bad from good once. Mutation score measures how often it does. Unknown on a mutant is not a kill.
| What it does | a command grader that always exits 0 |
|---|---|
| Witnesses used | 2 bad, 2 good, 1 unknown |
| calibrate_all | Err(BadWitnessNotRejected) |
| Mutation score | 0/20 (0%) |
How to use this
Part A is the gate bench: click the A and B tokens and the operator. Part B: pick a grader and tick witnesses. Try file-exists with only bad-2 and good-1. Deep link: ?preset=file-exists or ?a=Pass&b=Unknown&op=OR.
The maths
for bad_witness in bad_witnesses {
let (bad_verdict, _) = (self.check)(bad_witness);
Highlighted: if !bad_verdict.is_fail() {
Highlighted: return Err(CalibrationError::BadWitnessNotRejected {
Highlighted: name: self.name,
Highlighted: got: bad_verdict,
Highlighted: });
Highlighted: }
}
Worked answer: try the lab first, then open
Return Unknown first if answer.md is missing: the evidence is absent, so no verdict is honest. Then Fail if the handoff claims covers_current_state: true and the last verification ran before the last edit. Otherwise Pass.
The freshness check is what kills the mutants. The file check alone is exactly the lazy grader from Pass 1.
L3: plan a diff
E5E6E7
Choose the number of cuts, retries per cut, α, margin, the Unknown cap and a budget at USD 0.25 per trial. The grader runs 500 simulated replicates with a true Δ of +0.15, intra-cut correlation 0.4 and 10% selective timeouts.
Target: power at least 80%, false-positive rate at most 5% on A/A replicates, spend at most USD 5, and a Manski bound that excludes zero.
Peeking breaks a p-value, not an e-process
Bars run from 0% to 50%; the tick marks α = 5%.
| Pairs observed | 150 | |
|---|---|---|
| Naive false positives so far | 35.2% | |
| E-process false positives so far | 2.8% | |
| Naive FPR at 150 | 35.2% | |
| E-process FPR at 150 | 2.8% | |
| Rejection threshold | E ≥ 20 | |
| Straight B-wins needed | 8 | E(7,0) = 16.00, E(8,0) = 28.44 |
How to use this
Every line is an A/A experiment where nothing changed. Press play or drag the scrubber. A line that crosses its rejection line freezes there: that is a false “Better”. Deep link: ?preset=cs&n=5869 or ?seed=7&steps=500.
The maths
pub fn beta_binomial_e_value(b_better: usize, a_better: usize) -> f64 {
let m = b_better + a_better;
if m == 0 {
return 1.0;
}
Highlighted: let log_e =
Highlighted: (m as f64) * std::f64::consts::LN_2 + ln_factorial(b_better) + ln_factorial(a_better)
Highlighted: - ln_factorial(m + 1);
log_e.exp()
}
Pairing helps, retries do not
Pairing: Var(A − B) = Var(A) + Var(B) − 2 Cov(A, B)
Only discordant pairs (shaded) carry evidence about A vs B. As ρ rises they thin out and the paired variance falls: the same precision needs 2.00× fewer pairs than an unpaired comparison.
Gap 1: 10 pairs, B wins every one
sa diff (every pair independent)
E = 28.44 after 8 pairs → Better
Design effect for retries on one cut
8 retries at intra-cut correlation ρc = 0.60: DE = 1 + (8 − 1)·0.60 = 5.20, so neff = 8 / 5.20 = 1.54.
| Var(A) + Var(B) | 0.480 | |
|---|---|---|
| 2 Cov(A, B) | 0.240 | |
| Var(A − B) | 0.240 | |
| sa diff E (naive) | 28.44 | stopped at pair 8 |
| Cluster-level E | 1.00 | proposal |
| Effective n (lower bound) | 1 | distinct cuts |
| Cluster-robust SE | undefined (1 cluster) | |
| Design effect | 5.20 | |
| n_eff | 1.54 |
How to use this
Scrub ρ to see covariance cancel variance. Then switch the Gap 1 design: the same 10 B-wins either come from one task retried or from 10 different tasks. Deep link: ?preset=fix&design=one-cut.
The maths
pairs.push(MatchedPairInput {
Highlighted: cut_key,
verdict_a: va,
verdict_b: vb,
wall_ms_a: wall_a,
wall_ms_b: wall_b,
cost_usd_micros_a: cost_a,
cost_usd_micros_b: cost_b,
});
Highlighted: let cur = analyze_paired_diff(&pairs, config);
Highlighted: if !matches!(cur.verdict, DiffVerdict::Inconclusive(_)) {
Selective timeouts and the Manski bounds
Effect Δ = p_B − p_A
sa diff verdict
{"verdict":"better"}E = 24.93 vs threshold 20.00 · Unknown rate B 15.0% · cap 20.0%
| Naive Δ̂ (decisive pairs only) | +0.165 | |
|---|---|---|
| E-value | 24.93 | threshold 20.00 |
| sa diff verdict | Better | |
| Unknown rate B | 15.0% | cap 20.0% |
| Manski lower (worst for B) | −0.010 | |
| Manski upper (best for B) | +0.140 | |
| Interval contains 0 | yes |
How to use this
Each tile is one matched pair: Policy A in the top-left half, Policy B in the bottom-right. Unknown: runner timed out marks a timeout. Drag “Resolve the fog” from worst to best for B and watch the imputed Δ slide between the Manski bounds. Deep link: ?preset=selective or ?preset=none.
The maths
let unk_a = arm_a.unknown_rate();
let unk_b = arm_b.unknown_rate();
Highlighted: if unk_a > config.max_unknown_rate || unk_b > config.max_unknown_rate {
Highlighted: return DiffVerdict::Inconclusive(format!(
Highlighted: "excessive Unknown rate (arm_a={:.1}%, arm_b={:.1}%, cap={:.1}%)",
Highlighted: unk_a * 100.0,
Highlighted: unk_b * 100.0,
Highlighted: config.max_unknown_rate * 100.0
Highlighted: ));
Highlighted: }
if e_value >= threshold {
if paired.b_better > paired.a_better {
return DiffVerdict::Better;
}
Worked answer: try the lab first, then open
At USD 5 the target is out of reach: Better needs an e-value of 20. That takes 8 B wins even when A wins none, and with Δ = +0.15 many discordant pairs still go A's way.
Our reading is that the plan needs several times the budget, one retry per cut, α at 0.05, and Manski bounds reported in place of the Unknown cap. The lab's power gauge is the judge, not this paragraph [inference].
L4: shrink under noise
E9E10G3
Choose repeats per probe and an acceptance rule. Target: the chance of deleting a needed rule under 5% over 200 noisy runs, with as few probes as you can.
Which rules in AGENTS.md actually matter?
ddmin (sa-core)
- 0AGENTS.md#Git · neededACTIVE
- 1AGENTS.md#Tools · dead weightACTIVE
- 2AGENTS.md#Style · dead weightACTIVE
- 3AGENTS.md#Testing · neededACTIVE
- 4AGENTS.md#Plans · dead weightDEAD WEIGHT
- 5AGENTS.md#Voice · dead weightDEAD WEIGHT
- 6skill:rust-feedback · neededACTIVE
- 7skill:handoff · dead weightACTIVE
Probe 24: kept {6} → Fail
ProbDD proposal, not in sa-core
- 0AGENTS.md#Git · needed1.00
- 1AGENTS.md#Tools · dead weight0.00
- 2AGENTS.md#Style · dead weight0.00
- 3AGENTS.md#Testing · needed1.00
- 4AGENTS.md#Plans · dead weight0.00
- 5AGENTS.md#Voice · dead weight0.00
- 6skill:rust-feedback · needed1.00
- 7skill:handoff · dead weight0.00
Probe 12: removed {3} → Fail
| step | kept_indices | verdict |
|---|---|---|
| 1 | {0, 1, 2, 3, 4, 5, 6, 7} | Pass |
| 2 | {} | Fail |
| 3 | {0, 1, 2, 3} | Fail |
| 4 | {4, 5, 6, 7} | Fail |
| 5 | {4, 5, 6, 7} | Fail |
| 6 | {0, 1, 2, 3} | Fail |
| 7 | {0, 1} | Fail |
| 8 | {2, 3} | Fail |
| 9 | {4, 5} | Fail |
| 10 | {6, 7} | Fail |
| 11 | {2, 3, 4, 5, 6, 7} | Fail |
| 12 | {0, 1, 4, 5, 6, 7} | Fail |
| 13 | {0, 1, 2, 3, 6, 7} | Pass |
| 14 | {0, 1} | Fail |
| 15 | {2, 3} | Fail |
| 16 | {6, 7} | Fail |
| 17 | {2, 3, 6, 7} | Fail |
| 18 | {0, 1, 6, 7} | Fail |
| 19 | {0, 1, 2, 3} | Fail |
| 20 | {0} | Fail |
| 21 | {1} | Fail |
| 22 | {2} | Fail |
| 23 | {3} | Fail |
| 24 | {6} | Fail |
| ddmin probes (this run) | 24 / 24 | budget_exhausted |
|---|---|---|
| ddmin probes for a full deterministic run | 48 | |
| ddmin result | {0, 1, 2, 3, 6, 7} | |
| ProbDD probes (this run) | 12 | |
| ProbDD result | {0, 3, 6} | |
| ddmin deleted a needed rule (200 runs) | 0.0% | baseline aborted 0.0% |
| ProbDD deleted a needed rule (200 runs) | 0.0% | exact set 100.0% |
How to use this
Each plate is one ablatable unit of the policy (six AGENTS.md sections, two skills). A probe runs the agent with only the bright plates. Raise the flake rate to see what one lucky Pass does. Lucky-pass rate is twice the flake rate here, so 15% gives the spec's 85% / 30% oracle. Deep link: ?preset=flake&budget=24.
The maths
pub fn ddmin_shrink<E, F>(
total_units: usize,
max_probes: usize,
mut oracle: F,
) -> Result<ShrinkResult, E>
where
F: FnMut(&[bool]) -> Result<Verdict, E>,
{
let mut probes = Vec::new();
let mut budget_exhausted = false;
One flaky probe, two searches
| probe | bisect rev | verdict | PBA rev | verdict | PBA MAP |
|---|---|---|---|---|---|
| 1 | rev-0 | Pass | rev-7 | Pass | rev-8 |
| 2 | rev-15 | Fail | rev-10 | Pass | rev-11 |
| 3 | rev-7 | Pass | rev-12 | Pass | rev-13 |
| 4 | rev-11 | Pass | rev-13 | Fail | rev-13 |
| 5 | rev-13 | Fail | rev-12 | Fail | rev-11 ↺ |
| 6 | rev-12 | Pass | rev-10 | Pass | rev-11 ↺ |
| 7 | rev-11 | Fail | rev-11 ↺ | ||
| 8 | rev-10 | Pass | rev-11 ↺ | ||
| 9 | rev-11 | Fail | rev-11 ↺ | ||
| 10 | rev-10 | Pass | rev-11 ↺ | ||
| 11 | rev-10 | Pass | rev-11 ↺ | ||
| 12 | rev-11 | Pass | rev-11 ↺ | ||
| 13 | rev-11 | Fail | rev-11 ↺ |
| Bisect bracket | [12, 13] | |
|---|---|---|
| Bisect result | Found { good_index: 12, first_bad_index: 13 } | |
| PBA most likely first bad | rev-11 (96.6%) | |
| PBA backtracks so far | 9 | |
| PBA result | Found rev-11 at 96.6% posterior | |
| PBA assumes | P(Pass | good) 90%, P(Pass | bad) 30% | |
| Bisect correct (1,000 replays) | 33.4% | confidently wrong 31.9% |
| PBA correct (1,000 replays) | 91.9% | mean 14.9 probes |
How to use this
Step through the probes. The calipers are the deterministic bracket: once a flaky verdict moves them past the regression, the true revision is outside for good. The bars are the probabilistic search's belief about where the regression is; a flip only shifts mass. Deep link: ?preset=flip or ?flake=0.15&qBad=0.3&seed=4.
The maths
let mut lo = 0usize;
let mut hi = last;
while hi - lo > 1 {
let mid = lo + (hi - lo) / 2;
let Some(mid_v) = eval(mid, &mut probes)? else {
return Ok(BisectResult {
total_revisions,
outcome: BisectOutcome::Inconclusive {
reason: format!("probe budget exhausted while narrowing bracket [{lo}, {hi}]"),
},
probes,
});
};
match mid_v {
Highlighted: Verdict::Pass => lo = mid,
Highlighted: Verdict::Fail => hi = mid,
Verdict::Unknown(reason) => {
return Ok(BisectResult {
total_revisions,
outcome: BisectOutcome::Inconclusive {
reason: format!(
"midpoint revision {mid} returned Unknown ({reason}); bracket remains [{lo}, {hi}]"
),
},
probes,
});
}
}
Worked answer: try the lab first, then open
Accept a Pass only when repeated trials on that subset reach an e-value of 20 against 'this subset passes no more often than a broken one'. Cap the repeats per probe. ProbDD-style per-unit probabilities spend those repeats where the doubt is.
Expect the cost to rise from about 7 probes to about 60. That is the price of not deleting rules by luck.
L5: patch Same Again
G1G2G3G4G5G6
For each gap, pick the fix and predict what its lab will show once the fix is on. Target: six of six, with the direction of each change predicted correctly.
pass@k climbs, pass^k decays
In this sample, the first 5 runs: at least one passed = yes, all passed = no.
| pass@5 | 99.0% | at least one of k passes |
|---|---|---|
| pass^5 | 7.8% | all k pass |
| flakiness gap | 91.2% |
How to use this
Drag p and k. pass@k asks whether any of k runs passes; pass^k asks whether all of them do. The Gap 4 view compares the estimator sa-core ships with an unbiased one. Deep link: ?preset=gap4&n=5&c=3&kEst=3.
The maths
/// Consistency metric `pass^k`: empirical probability `(c / n)^k` that all `k` independent runs pass.
#[must_use]
#[allow(clippy::cast_precision_loss)]
pub fn pass_pow_k(n: usize, c: usize, k: usize) -> Option<f64> {
if k == 0 || n == 0 || c > n {
return None;
}
Highlighted: let p = (c as f64) / (n as f64);
Highlighted: let exp = i32::try_from(k).unwrap_or(i32::MAX);
Highlighted: Some(p.powi(exp))
}
Tweak the grader twenty times
First replicate: one branch per tweak
| tweak | b / a | p | E | verdict |
|---|---|---|---|---|
| v1 | 9 / 15 | 0.307 | 0.51 | Inconclusive |
| Bound 1 − (1 − α)^m | 5.00% | upper bound under independence |
|---|---|---|
| Simulated naive FWER | 3.0% | 400 replicates |
| Fresh-α e-value FWER | 0.3% | sa diff per tweak |
| Bonferroni FWER | 3.0% | |
| e-BH FWER (= FDR under the null) | 0.3% | proposal |
| Dev winner confirmed on holdout | 0.0% | proposal |
How to use this
Every tweak re-scores the same 40 cuts under a true null, so any Better or Worse is false. Click “Run another tweak” or drag m. Then split the cuts: tune on dev, confirm once on the holdout vault, and control the family with e-BH. Deep link: ?m=20&protect=1.
The maths
| Gap | Signature |
|---|---|
| G1 | pub fn cluster_e_value(per_cut: &BTreeMap<String, (usize, usize)>) -> f64 |
| G2 | pub fn manski_delta_bounds(p: &PairedCounts, unknown_b_a_pass: usize, unknown_a_b_pass: usize) -> (f64, f64) |
| G3 | pub fn probabilistic_bisect(n: usize, q_good: f64, q_bad: f64, stop_mass: f64) -> BisectResult |
| G4 | pub fn pass_pow_k_unbiased(n: usize, c: usize, k: usize) -> Option<f64> |
| G5 | pub fn e_bh(e_values: &[f64], alpha: f64) -> Vec<usize> |
| G6 | pub fn verify_ref_precedes_cut(repo: &Path, git_ref: &str, cut_commit: &str) -> Result<(), CutError> |
Worked answer: try the lab first, then open
G1 lowers E for one-cut runs to about 1. G2 turns the selective-timeouts verdict from Better to Inconclusive. G3 raises bisect accuracy from 33% to 92% at more probes. G4 drops pass^3 from 0.216 to 0.100. G5 removes nearly every false Better. G6 blocks main and keeps the checkpoint before the cut.
Putting it together
M0
Every gap in this explainer has the same shape. Same Again computes an honest number under an assumption, and the assumption fails quietly: pairs are independent, Unknown is random, a probe tells the truth, an estimate is the truth, each question is the first, the workspace is the past.
The habit to keep is to ask of any verdict: which assumption would have to fail for this to be wrong, and what would I see if it had?
A teammate ran 12 retries on one task and says their change is Better with E = 40. What do you ask first?
Spot the lie: Which line in this report survives scrutiny? (1) "Unknown was 12%, under the cap, so ignorable." (2) "We stopped at pair 9 when E crossed 20." (3) "We tried 15 graders and kept the best."