clamp-sh/analytics-skills/sequential-monitoring
Claude Code and agent skill by clamp-sh/analytics-skills
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Always-valid sequential inference for honest peeking at running A/B tests. Applies mSPRT (mixture Sequential Probability Ratio Test) or confidence sequences so the false-positive rate stays at the nominal alpha even when the test is checked daily. Use this skill when the user asks if it's safe to call an A/B test early, or to peek-check a running test. Pairs with experiment-result-reader and bayesian-experiment-reader, and with analytics-diagnostic-method for the framing discipline. Triggers when Clamp MCP returns mid-experiment exposure and conversion counts, or when a user references peeking, early stopping, sequential testing, alpha-spending, mSPRT, or confidence sequences. Vendor-neutral methodology; works with any analytics source, with Clamp MCP as the canonical integration. Use whenever interpreting an in-flight experiment where the planned horizon has not been reached but the user wants a stop/continue decision.
Install
npx vskill@latest install clamp-sh/analytics-skills/sequential-monitoringSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as clamp-sh/analytics-skills/sequential-monitoring.
Sequential monitoring
A fixed-horizon A/B test promises a 5% false-positive rate at one planned read. The moment you check the result daily and stop "when it looks good", the actual false-positive rate climbs to 20-30%. Sequential testing fixes this: it lets you check as often as you like and stop the moment the evidence is strong enough, with the type-I error still controlled at the nominal alpha. This skill encodes when to apply mSPRT versus confidence sequences, how to read the boundaries, and when sequential math will not rescue an underpowered test.
When NOT to use this
- The test has fewer than ~400 exposed users per variant. Sequential methods do not manufacture power. At n<400 the boundaries are nowhere near being crossed and the honest answer is "wait, do not peek".
- The conversion metric has strong seasonality (B2B day-of-week, retail weekday/weekend, SaaS payday cycles) and the test has not run a full cycle. Sequential boundaries can cross on a Tuesday and uncross by Sunday; the math is valid but the decision is fragile.
- The user wants to design the test (sample size, MDE, variant logic) rather than read a running one. Different skill.
- The experiment was already declared with a fixed analysis plan and the team agreed to read it only at the end. Switching to sequential mid-flight is a governance decision, not a stats one; flag it and ask.
The peeking problem
A fixed-horizon test computes a p-value under the assumption you look once, at the planned end. Each additional peek is another chance to cross the 5% threshold by noise alone.
| Peeks across the test | Actual false-positive rate (nominal 5%) | |
|---|---|---|
| 1 (end only) | 5% | |
| 2 | ~8% | |
| 5 (weekly) | ~14% | |
| 10 (twice weekly) | ~19% | |
| Daily over a month | ~25-30% |
If the user has been "checking how the test is doing" every morning, the nominal 5% threshold is meaningless. They need either a sequential method (always-valid) or alpha-spending (pre-commit to a peek schedule and inflate the threshold).
Method
Phase 1. Decide which sequential framework fits
Two practical options. Pick by the decision the user is actually making.
| Question the user is asking | Use | Output | |
|---|---|---|---|
| "Should we ship treatment or not?" (binary call) | mSPRT | Log-likelihood ratio crosses upper or lower boundary → ship or reject | |
| "What is the lift, with a CI I can trust at any time?" | Confidence sequences | Always-valid CI on lift; ship when the CI excludes 0 (or excludes a minimum effect) | |
| "I just want to peek without breaking alpha" | Either; mSPRT is simpler to read | See above |
Both methods are always-valid: the false-positive rate stays at alpha no matter how often you look. mSPRT is Statsig's default; confidence sequences are GrowthBook's default. The choice is taste plus what the user wants to read.
Phase 2. Verify the setup before peeking
Same prerequisites as experiment-result-reader:
- The experiment is declared (variants, intent, exposure event firing reliably).
- Per-variant exposure counts are roughly balanced (no sample ratio mismatch). SRM contaminates sequential reads just as badly as fixed-horizon ones.
- The conversion event is attributable to the exposure session (or windowed appropriately).
- The smaller arm has n ≥ 400. Below that, sequential math is honest but uninformative.
If any check fails, stop and surface the issue.
Phase 3. Apply mSPRT (binary ship / no-ship)
mSPRT (Johari et al., 2017) generalises Wald's 1945 SPRT to the case where the effect size is unknown. The trick: instead of testing a single point alternative (e.g. "lift = 2pp exactly"), test a mixture over plausible alternatives, weighted by a prior. This gives a single log-likelihood ratio statistic that can be checked at every observation.
For a two-proportion test (conversion rate, control vs treatment):
- Define alpha and the mixture variance. Standard choice: alpha = 0.05, mixture variance tau² ≈ MDE² (e.g. if you cared about detecting a 1pp lift, tau ≈ 0.01).
- Compute the running log-likelihood ratio. At each new observation:
`` logLR(n) = log( (1 / sqrt(1 + n·V/tau²)) · exp( (n·V·(diff)²) / (2·(tau² + n·V)) ) ) ` where n is the per-arm sample size, V is the pooled variance of the proportion, and diff` is the observed control-treatment difference.
- Boundaries. Upper boundary = log(1/alpha) ≈ 3.00 for alpha = 0.05. Lower boundary is symmetric (log(alpha)) for two-sided rejection, or use 0 if you only stop for "treatment wins".
- Stopping rule. If logLR > upper boundary → reject H0, ship treatment. If logLR < lower boundary → accept H0, kill treatment. Otherwise, continue.
Empirical validation from Statsig's deployment: across 50,000 A/A tests, false-positive rate stayed at ≤1.2% (well under the nominal 5%). Across true-effect tests, 58% of decisive results fired by the half-horizon mark, with ~84% of the power of a fixed-horizon test at the same final n.
In practice you do not hand-roll this; a library or the analytics platform computes logLR for you. Your job is to read it and apply the stopping rule honestly.
Phase 4. Apply confidence sequences (always-valid CI on lift)
A confidence sequence (Waudby-Smith & Ramdas, 2021) is a sequence of confidence intervals, one per observation, such that the probability that any of them fails to cover the true parameter is at most alpha. Contrast with fixed-horizon CIs, where the coverage guarantee holds only at the single planned end.
The intervals are wider than fixed-horizon CIs at the same n (the cost of always-valid), but they tighten with sample size and never widen to uselessness. Practical use:
- Compute the lift estimate and its always-valid CI at each peek. Most implementations use an asymptotic confidence sequence based on the empirical Bernstein inequality or a beta-binomial mixture.
- Stopping rule. If the lower bound of the CI on (treatment − control) exceeds 0, ship treatment. If the upper bound is below 0, kill treatment. If the CI contains a meaningful minimum-effect threshold (e.g. 0.5pp), declare practical equivalence.
- Reading the CI. Width is the honest signal. A CI of [+0.2pp, +4.1pp] after two weeks means "directionally positive but the magnitude is still anywhere from trivial to large". Do not paste the midpoint as the answer.
Confidence sequences shine when the user cares about effect size, not just direction. mSPRT shines when the user just wants "ship or not".
Phase 5. Edge cases that break the math
Even with the correct framework, three patterns can produce misleading sequential reads:
- Multi-arm tests without correction. Running control vs treatment_A vs treatment_B and applying mSPRT to each pairwise comparison inflates alpha across the family. Either use a multi-arm sequential test (one against all), or Bonferroni-correct alpha across the pairwise comparisons.
- Switching the metric mid-test. mSPRT and confidence sequences guarantee alpha only for the metric you committed to. If the user defined the primary metric as "signups" but is now reading "revenue per exposed", the alpha guarantee is gone. Treat the new read as exploratory.
- Stopping based on a sliced result. "It crossed the boundary for mobile users" is a slice, not the primary analysis. The alpha guarantee is on the overall comparison. Slices are hypothesis-generating; do not ship on them.
Phase 6. Present the verdict
Mirror the experiment-result-reader Pyramid format, with sequential-specific fields:
If the boundary has not been crossed, the answer is "keep running, do not over-read the direction". Sequential testing does not promise an early answer; it promises an honest one.
Worked example: mSPRT, mid-flight peek at day 14
Worked example: confidence sequence, ambiguous mid-flight read
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/sequential-monitoring/SKILL.md
Popularity
- Repository stars
- 8
- Repository forks
- 1
- 7-day trend score
- 11
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/clamp-sh/analytics-skills/sequential-monitoring)