Pass 3 of 4 · trap · about 60 min
Six traps, three neighbours
Make each tool give a confident wrong answer, then borrow the fix from a field that met it first.
0 of 17 concepts in this pass seen
This pass builds on concepts you have not opened yet: Paired analysis and clustered standard errors, The sa diff pipeline, Partial identification: Manski and Lee bounds, ddmin and ProbDD, Noisy binary search, pass@k against pass^k, Adaptive data analysis and holdout reuse, Temporal lookahead leakage, Anytime-valid inference: e-processes and confidence sequences, Mutation-style witness calibration. Everything below is readable anyway.
Before we break things
E5E7E8
Three recall questions from Pass 2.
With the default --max-trials 20 (10 pairs) and margin 0.05, can sa diff ever return Equivalent?
Both arms pass with p = 0.6 and Cov(A, B) = 0.12 on the same task. What is Var(A − B)?
A cut has n = 5 attempts with c = 3 passes. What do pass_at_k and pass_pow_k report for k = 3?
Every fix in this pass is a proposal, not in same-again. The labs run the same data with and without it, so you can see what it would change.
G1: ten retries dressed as ten tasks
G1
sa diff hands out pairs round-robin over its --cut-dir list [code]crates/sa-ingest/src/experiment.rs:326. Give it one directory and every pair is a retry of one task. The e-value and the interval treat each pair as an independent draw. cut_key is recorded and then ignored.
for pair_idx in 0..max_pairs {
if let Some(cap) = budget.max_cost_usd_micros
&& spent_micros >= cap
{
budget_exhausted = true;
break;
}
Highlighted: let cut_dir = &cut_dirs[pair_idx % cut_dirs.len()];
Pairing helps, retries do not
sa diff with one --cut-dir. Policy B wins all 10 retries of that single task. What does sa diff say?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.
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) | veiled | |
| Cluster-level E | veiled | proposal |
| Effective n (lower bound) | veiled | distinct cuts |
| Cluster-robust SE | veiled | |
| 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(_)) {
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."
G2: the fog that flatters
G2
100 pairs. B wins 18, A wins 4, 55 tie on Pass, 8 tie on Fail, and B times out on 15 where A passed. B's Unknown rate is 15%, under the 20% cap, so the veto does not fire. [toy]betaBinomialEValue(18, 4). sa diff says Better.
Selective timeouts and the Manski bounds
sa diff says Better (E = 24.93). Could B really be no better than A?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) | veiled | |
| Manski upper (best for B) | veiled | |
| Interval contains 0 | veiled |
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;
}
Over all 100 pairs, Δ lies in [−0.01, +0.14]. The worst-case e-value is , nowhere near 20 [toy]computeManskiBounds(selectiveCounts, split). A 20% cap is a speed limit, not a seatbelt.
Spot the lie: "B's Unknown rate was 15%, under the 20% cap, so sa diff's Better verdict (E = 24.93) is safe."
G3: one probe, one verdict, forever
G3
Both search tools call the oracle once per subset or revision and trust the answer. With good revisions passing 90% and bad ones 30%, classic bisect names the right revision 33.1% of the time over 2,000 runs. Probabilistic bisection with up to 20 probes gets it right 92% of the time [toy]compareNoisyBisect(11, { runs: 2000 }).
One flaky probe, two searches
| probe | bisect rev | verdict | PBA rev | verdict | PBA MAP |
|---|---|---|---|---|---|
| 1 | rev-0 | Pass | rev-7 | Fail | rev-1 |
| 2 | rev-15 | Fail | rev-4 | Pass | rev-5 |
| 3 | rev-7 | Fail | rev-5 | Pass | rev-6 |
| 4 | rev-3 | Pass | rev-6 | Pass | rev-7 |
| 5 | rev-5 | Pass | rev-7 | Pass | rev-7 ↺ |
| 6 | rev-6 | Pass | rev-9 | Pass | rev-10 ↺ |
| 7 | rev-11 | Fail | rev-10 ↺ | ||
| 8 | rev-9 | Pass | rev-10 ↺ | ||
| 9 | rev-10 | Pass | rev-11 ↺ | ||
| 10 | rev-11 | Fail | rev-11 ↺ | ||
| 11 | rev-10 | Pass | rev-11 ↺ | ||
| 12 | rev-10 | Pass | rev-11 ↺ | ||
| 13 | rev-11 | Fail | rev-11 ↺ | ||
| 14 | rev-10 | Pass | rev-11 ↺ |
| Bisect bracket | not yet | |
|---|---|---|
| Bisect result | running | |
| PBA most likely first bad | rev-1 (6.7%) | |
| PBA backtracks so far | 0 | |
| PBA result | running | |
| PBA assumes | P(Pass | good) 90%, P(Pass | bad) 30% | |
| Bisect correct (1,000 replays) | 100.0% | confidently wrong 0.0% |
| PBA correct (1,000 replays) | 100.0% | mean 4.0 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,
});
}
}
Shrink is worse, because a lucky Pass deletes a rule. At 15% flake, ddmin deletes at least one needed unit in 86% of 200 runs and recovers the exact set in none. ProbDD, which keeps a probability per unit and repeats probes, deletes a needed unit in 8.5% of runs at a cost of about 60 probes [toy]runNoisyShrinkTrial(7).
Which rules in AGENTS.md actually matter?
ddmin (sa-core)
- 0AGENTS.md#Git · neededkept
- 1AGENTS.md#Tools · dead weightkept
- 2AGENTS.md#Style · dead weightkept
- 3AGENTS.md#Testing · neededkept
- 4AGENTS.md#Plans · dead weightkept
- 5AGENTS.md#Voice · dead weightkept
- 6skill:rust-feedback · neededkept
- 7skill:handoff · dead weightkept
No probe yet.
ProbDD proposal, not in sa-core
- 0AGENTS.md#Git · needed0.25
- 1AGENTS.md#Tools · dead weight0.25
- 2AGENTS.md#Style · dead weight0.25
- 3AGENTS.md#Testing · needed0.25
- 4AGENTS.md#Plans · dead weight0.25
- 5AGENTS.md#Voice · dead weight0.25
- 6skill:rust-feedback · needed0.25
- 7skill:handoff · dead weight0.25
θ starts at 0.25 for every unit.
| step | kept_indices | verdict |
|---|---|---|
| 1 | {0, 1, 2, 3, 4, 5, 6, 7} | Pass |
| 2 | {} | Fail |
| 3 | {0, 1, 2, 3} | Pass |
| 4 | {0, 1} | Pass |
| 5 | {0} | Fail |
| 6 | {1} | Fail |
| 7 | {1} | Fail |
| 8 | {0} | Pass |
| ddmin probes (this run) | 8 / 24 | |
|---|---|---|
| ddmin probes for a full deterministic run | 48 | |
| ddmin result | running | |
| ProbDD probes (this run) | 63 | |
| ProbDD result | running | |
| ddmin deleted a needed rule (200 runs) | veiled | baseline aborted 18.0% |
| ProbDD deleted a needed rule (200 runs) | veiled | exact set 90.5% |
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;
Spot the lie: "sa bisect printed Found { first_bad_index: 7 }, so revision 7 introduced the regression." The agent passes good revisions 90% of the time and bad ones 30%.
G4: the flattering power
G4
n = 5 attempts, c = 3 passes. The code reports . The unbiased estimate counts the triples of attempts that all passed: [toy]comparePassPowK(5, 3, 3).
pass@k climbs, pass^k decays
sa-core reports pass^3 = (3/5)3 = 0.216. Is that a fair estimate of the chance that 3 fresh runs all pass?The tick marks the true p^3 = 0.216 at p = 60%. Averaged over every possible draw of 5 attempts, the plug-in comes out at 0.300 and the unbiased estimator at 0.216.
| plug-in pass^3 | 0.216 | sa-core today |
|---|---|---|
| unbiased pass^3 | veiled | proposal, not in sa-core |
| pass@3 | 1.000 | any k of n must include a pass |
| bias of plug-in at p = 60% | 0.084 |
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))
}
Spot the lie: "Our agent passed 3 of 5 attempts, so pass^3 = 0.216: it gets three in a row about one time in five."
G5: twenty looks, one α
G5
Each sa diff and each rescore starts with a fresh α. Nothing records how many questions have been asked of the same cuts. Twenty tweaks under a true null: the bound is 64.15%, and in 600 simulated replicates 45.3% of them produced at least one false rejection [toy]simulateForkingPredicates(3, { replicates: 600 }).
Tweak the grader twenty times
sa diff on the same cuts after each tweak, each at α = 0.05. Policies A and B are identical. If the tweaks were independent tests, how likely is at least one false Better or Worse?First replicate: one branch per tweak
| tweak | b / a | p | E | verdict |
|---|---|---|---|---|
| v1 | 9 / 15 | 0.307 | 0.51 | Inconclusive |
| v2 | 11 / 7 | 0.481 | 0.43 | Inconclusive |
| v3 | 10 / 13 | 0.678 | 0.31 | Inconclusive |
| v4 | 11 / 12 | 1.000 | 0.26 | Inconclusive |
| v5 | 11 / 7 | 0.481 | 0.43 | Inconclusive |
| v6 | 9 / 10 | 1.000 | 0.28 | Inconclusive |
| v7 | 9 / 15 | 0.307 | 0.51 | Inconclusive |
| v8 | 12 / 9 | 0.664 | 0.32 | Inconclusive |
| v9 | 11 / 9 | 0.824 | 0.30 | Inconclusive |
| v10 | 10 / 8 | 0.815 | 0.32 | Inconclusive |
| v11 | 10 / 7 | 0.629 | 0.37 | Inconclusive |
| v12 | 10 / 6 | 0.454 | 0.48 | Inconclusive |
| v13 | 9 / 6 | 0.607 | 0.41 | Inconclusive |
| v14 | 7 / 9 | 0.804 | 0.34 | Inconclusive |
| v15 | 14 / 7 | 0.189 | 0.82 | Inconclusive |
| v16 | 14 / 8 | 0.286 | 0.57 | Inconclusive |
| v17 | 12 / 9 | 0.664 | 0.32 | Inconclusive |
| v18 | 12 / 13 | 1.000 | 0.25 | Inconclusive |
| v19 | 11 / 9 | 0.824 | 0.30 | Inconclusive |
| v20 | 8 / 10 | 0.815 | 0.32 | Inconclusive |
| Bound 1 − (1 − α)^m | 64.15% | upper bound under independence |
|---|---|---|
| Simulated naive FWER | veiled | 400 replicates |
| Fresh-α e-value FWER | veiled | sa diff per tweak |
| Bonferroni FWER | veiled | |
| e-BH FWER (= FDR under the null) | veiled | proposal |
| Dev winner confirmed on holdout | veiled | 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
Spot the lie: "We shrank the policy on cut X, then confirmed the shrunk policy with sa diff on cut X. Better, E = 31."
G6: the future in the workspace
G6
Without --git-ref or --checkpoint-ordinal, sa cut takes the first recorded checkpoint, whatever cut_seq says [code]crates/sa-ingest/src/cut.rs:102-110. With --git-ref main, it takes whatever main is today, which already contains C2's fix.
Highlighted: let chosen_ref = cfg.git_ref.clone().or_else(|| {
if let Some(ord) = cfg.checkpoint_ordinal {
checkpoints
.iter()
.find(|c| c.ordinal == ord)
.map(|c| c.git_ref.clone())
} else {
Highlighted: checkpoints.first().map(|c| c.git_ref.clone())
}
});
.git cube is sliced off, isolation_verified turns true, and a thread runs from C2 back through the barrier.A cut is the past, sealed by its fingerprint
--git-ref main. Branch main already contains Neon's fix C2. What does the isolation report say?| cut_id | 3e78bc06ce08 | |
|---|---|---|
| cut node | 7 · 2f431d5cbd8a | |
| prefix turns (agent sees) | 6 | |
| held-out witnesses | 6 | |
| node 7 id | 2f431d5cbd8a | clean |
| node 8 id | cdd7f614a428 | clean |
| workspace ref | main → C2 | cut-time commit C1 |
| isolation_verified | veiled | shipped check: no .git, no held-out id hex |
| leaked files | veiled | |
| 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
)));
}
}
The trace ids have a quieter version of the same weakness. Because node ids do not hash their parents, re-parenting a node does not change its id. Only the cut id notices.
Spot the lie: "We cut at the end of session 1 with --git-ref main. The manifest says isolation_verified: true, so the agent never saw the fix."
What a trialist would say
N1
Medicine met every statistical trap in this explainer decades ago, and it had lives at stake. Four of its habits map straight onto Same Again.
| Trial practice | Same Again counterpart |
|---|---|
| Group-sequential designs and α-spending (O'Brien–Fleming) | The e-process: stop early without inflating α (E5) |
| Crossover designs: each patient gets both treatments | Paired cuts: each task gets both policies (E7) |
| Informative dropout and intention-to-treat | Selective timeouts and Manski bounds (G2) |
| Randomised allocation order | A is always dispatched before B (sidebar) |
| Pre-registration (CONSORT) | An e-value ledger that counts every look (G5) |
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
file-exists grader passes whenever answer.md exists. You calibrate it with one bad witness (stale claim, answer.md missing) and one good witness. Does calibrate_all accept it?| What it does | passes whenever answer.md exists, ignores stale claims |
|---|---|
| Witnesses used | 2 bad, 2 good, 1 unknown |
| calibrate_all | Err(BadWitnessNotRejected) |
| Mutation score | 4/20 (20%) |
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: }
}
A trial drug's patients drop out more often when they feel worse. The analysts analyse only completers. Which Same Again gap is this?
What a tester would say
N2
Software testing gave Same Again two of its tools, ddmin and bisect, and it also knows their failure mode by name: the flaky test.
- Mutation testing. Inject small bugs and count how many the tests catch. That is a grader's real accuracy, measured on many bad witnesses instead of one (E4).
- Test oracles. A test is only as good as the thing that decides pass or fail. A calibrated predicate is an oracle with a certificate.
- Flaky tests. Big test teams quarantine tests that pass and fail on the same code. Single-probe bisect and shrink assume there are none (G3).
A test suite has 100% line coverage but kills only 3 of 20 injected bugs. What does that say about the suite?
What an econometrician would say
N3
- Partial identification. Manski showed how to report what the data can and cannot rule out when outcomes are missing. Lee (2009) tightens the bounds by trimming, if you can assume the treatment only moves observation one way (G2).
- Clustered standard errors. Pupils in one classroom are not independent. Neither are retries on one cut. The Moulton factor is the design effect from Pass 2 (G1).
- Look-ahead bias. A backtest that uses revised figures trades on news from the future. A workspace from main is a revised figure (G6).
- Specification search. Try enough models and one will fit. Twenty grader tweaks are twenty specifications (G5).
Lee's trimming fraction for our scenario: A is observed on every pair, B on 85%, so trim of A's outcomes [toy]leeTrimFraction(1, 0.85). Pairing does better still: on B's 15 missing pairs we know A passed.
A trading backtest uses each company's revised annual figures, published months after the trade date. Which Same Again gap is this?
Spot the statistical lie
E1E4E10
Not every claim is a lie. Some survive scrutiny, and learning to say so is part of the skill.
Spot the lie: "Our policy id is a Merkle root, so changing one skill file changes the policy id."
Spot the lie: "Our file-exists grader passed calibration on one bad and one good handover, so it detects stale claims."
Bisect probes the middle revision once. The revision is actually good, but the flaky agent fails it. What happens next?