Toggle War: Roast My Code
Prompts are code. Test them like it.
Most teams ship a prompt change on a hunch: it felt better in three examples. Toggle War is a small, real example of the alternative: put the prompt behind a feature flag, split traffic, define success up front, and let a stats engine tell you which version wins.
The question
Does an AI code review written as a kind mentor or as a savage roast get copied more often? It's a deliberately playful question, because the point is the method: the same loop works for any prompt, model or tone you'd otherwise argue about in a meeting.
How the experiment is built
- 01Visitor
random id, same reviewer every time
- 02Flagsmith flag
review_prompt, bucketed 50/50
- 03Reviewer prompt
the flag value goes to the model
- 04Review delivered
logged as the exposure
- 05Copy = vote
result_copied event
- 06Win probability
Flagsmith's Bayesian engine
- The flag is the prompt.
review_promptis a multivariate Flagsmith flag whose value is the system prompt. The two variations arecontrol(mentor) andsavage. - Fair split. Every visitor is bucketed 50/50 on the server by a random visitor id, and always gets the same reviewer, so nobody sees both.
- Only tone differs. Both prompts have the same length cap and structure, and the same model (
openai/gpt-oss-20bon Groq). The savage prompt must still give correct fixes. - The metric fires early.
result_copiedis an occurrence metric: did the visitor copy the review? It happens within seconds, which matters with a four-day window. - Clean exposures. A visitor only counts as exposed once a review was actually delivered, so provider failures never pollute the data.
- The reveal comes after the vote. You're only told which reviewer you met once you've copied, so knowing can't sway the result.
- Ship through the same flag. When the evidence is strong, the owner approves a rollout from the War Room and the flag serves the winner to everyone. No redeploy.
How to read the numbers
Flagsmith reports a win probability (the chance one version is truly better) and a 95% credible interval for the lift. A high probability isn't proof: if the interval still crosses zero, “no difference” hasn't been ruled out. Flagsmith also waits for at least 50 identities per variation (and 5 conversions) before comparing, and flags a sample-ratio mismatch if the split looks broken. The War Room draws the leading pod larger and plots the interval against the zero line.
Honest limitations
- Copy rate isn't quality. A funnier review may be copied to share, not because it's more useful. A real follow-up would add a guardrail metric.
- Simulated seed. 300 of the visitors were simulated through the real SDK, with conversion rates I assumed, to test the pipeline before launch. They're disclosed on the War Room and shouldn't count as evidence. Real traffic is what decides the result.
- Small, self-selected sample. People who find this are developers who like hackathon projects. Four days is short, and novelty effects are likely.
- One snippet type, one model. The result says little about other languages, models or tasks.
What I'd test next
- The same flag with a model id as the value: cost vs quality of two models.
- Review length (short vs thorough) with a guardrail on “reported as wrong”.
- Segments by language, using Flagsmith traits, to see whether the winner depends on the code.