Ab test
A/B test an agent's current prompt against a candidate variant from policy/<agent>/candidates/. Runs both on the same scenarios, aggregates rewards, recommends promotion if candidate beats current by >1 stderr with n≥10. Triggers on /ab-test, "compare prompts", "test the candidate", "is the new prompt better".From its SKILL.md
npx -y skills add sethdford/claude-agent-os --skill ab-testAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
2.9 KB, as published. Nobody here has run it
/ab-test — Prompt variant A/B with reward gating
/ab-test <agent> [--candidate <path>] [--runs <k>] [--promote <name>] compares current vs candidate prompts on held-out scenarios and either promotes the winner or surfaces inconclusive.
How
# Run A/B (reads candidates from policy/<agent>/candidates/)
python3 ~/.claude/rl/ab_test.py <agent> --runs 3
# Promote a named candidate (after reviewing the decision.json)
python3 ~/.claude/rl/ab_test.py <agent> --promote <candidate-name>
The runner:
- For each scenario in
~/.claude/evals/scenarios/<agent>/, runs the scenario<runs>times against the live agent prompt. - Same for each candidate in
~/.claude/rl/policy/<agent>/candidates/*.md. - Aggregates per variant:
n,mean reward,stderr. - Promotion rule: candidate's mean > current's mean + max(current.stderr, 0.05) AND n ≥ 10.
- Writes
decision.jsonand prints it.
Output
{
"agent": "verifier",
"scenarios": ["happy-path", "ambiguous-contract", "no-tests-exist"],
"runs_per_scenario": 3,
"current": {"n": 9, "mean": 0.78, "stderr": 0.12},
"candidates": {
"tuner-2026-05-10": {"n": 9, "mean": 0.92, "stderr": 0.08}
},
"winner": "tuner-2026-05-10",
"promote": true,
"promote_command": "python3 ~/.claude/rl/ab_test.py verifier --promote tuner-2026-05-10"
}
If promote: true, the user runs the command to apply. The previous live agent is archived to policy/<agent>/history/<ts>.md.
Cost
A typical /ab-test runs scenarios × runs × (1 + candidates) claude invocations. For 5 scenarios × 3 runs × 2 variants (current + 1 candidate) = 30 calls. With the budget cap (--max-budget-usd 0.3 per call), worst case ~$10. Run when it matters; don't run nightly.
When NOT to use
- No held-out scenarios authored —
/ab-testreturns immediately with an error. Author scenarios via/eval-author <agent>first. - Candidate prompt is identical to current — useless.
- Sample size will be too small (e.g., 1 scenario × 1 run) — no statistical power. Need n ≥ 10 for promotion.
Anti-patterns
- Promoting after a single run — too noisy. Always run
/ab-testand let the promotion rule gate. - Running A/B with scenarios that exclusively tested the current prompt's strengths — selection bias. Mix scenarios.
- Promoting on
meanalone without checkingstderr— high variance candidates often regress later.