Repository navigation
Releases
Petri 0.1.5
Extension 0.1.5 and petri-check 0.1.4 (CLI, MCP, Action).
Added
- Staged rollout: a
rampchange inpetri.plan.jsonserves the decided
winner to a share of users (10 → 50 → 100), refused while an experiment still
runs on the flag (measured: 10% → 12%, 50% → 44% of 200 sampled users). - Experiments as pull requests:
petri.plan.jsonwithpetri-check apply [--dry-run](idempotent; production needs"production": true), the Action's
command: apply/dry_run, and the MCP toolpetri_plan_change(proposes
an entry plus a dry run, changes nothing). petri-check rehearse: real visitors through the running app (cookie
identities;--convert formfollows the page's form like a browser), then a
recount of Flagsmith's enrolments and conversions. Refuses production; exits 1
on a mismatch with likely causes. Proven on a throwaway Flagsmith: 30/30, 15/15
on a correct shop, and 15 → 7 on one with an untracked checkout route.- Audience checks at launch: the start approval warns about other running
experiments read in the same code, and segment overrides on the flag. - PETRI017–020: a per-user variant in a cached/static response; a browser
event lost to navigation (noflush()); Pythonmax_buffer_items=1; an
experiment flag read from an SDK that sends no experiment events. All offline. - After completion: Watch alerts if users are still enrolled in a losing
arm after an experiment was completed. - PETRI016: the installed Flagsmith SDK predates the experiment API
(@flagsmith/nodejs< 9.1.0,@flagsmith/flagsmith< 12.1.0, or a legacy
package), so nothing is recorded. Offline; points atpackage.json. - End-to-end CI on self-hosted Flagsmith: every push boots Flagsmith with
experimentation, runs the bootstrap, creates the experiment, and runs
petri-checklive (clean, then a planted bug caught), plus lock, report and
watch. - MCP prompt
wire_experiment: Petri's wiring checklist (one item per
rule) for any agent setting up an experiment, ending with a required clean
petri_check. - Peek-safe sequential test: a mixture SPRT on the hourly timelines gives
each variant an always-valid p-value (0.3% false ships under hourly peeking
in the A/A simulation). Shown inexperimentsandreport. - Health scorecard: traffic split (α = 0.001), arms vs variants, missing
conversions per arm, event storage, measurement continuity, treatment lock,
result freshness and novelty (early vs late lift). In the tree, results
panel,experiments,reportand MCP. - Watch → Pause: a Petri Watch alert in the editor offers to pause the
experiment (approval-gated), so broken data stops accumulating. - "How much longer?": a keep-running verdict says how many more users per
arm would decide it at the current lift. - False-ship eval (
eval/aa.mjs): 2,000 simulated A/A experiments. Peeking
ships a do-nothing variant 36.5% of the time, Petri's single look 8.0% (4.1%
with the Bonferroni bar), and a real +39% winner is found 99.7% of the time. petri-check report: a Markdown decision record (pre-registration,
per-arm results with intervals and expected loss, sample ratio, treatment
lock, Watch, planned stop, verdict, decision), also written to the GitHub job
summary.- Safer self-host defaults: Flagsmith binds to
127.0.0.1, and secrets come
from the environment (random in Codespaces). - Sample size and ETA:
petri-check lock --mde 20%sizes the planned
stop from the control rate (two-proportion power, 80%, Bonferroni across
variants). The CodeLens andexperimentsline show progress and an ETA from
the current enrolment rate. - Offline event checks from the lock: with a committed
petri.lock.json,
CI catches a renamed metric event (PETRI002) or a metric nothing sends any
more (PETRI003) without a Flagsmith key. - PETRI014: a conversion tracked under a different identity than the
exposure (user.emailvsuser.id), so it is never attributed. - PETRI015: a new random identity on every call (
randomUUID()…), so
every visit is a new user. Both run offline. - Production guard: every Flagsmith write to an environment named like
production is titled[PRODUCTION]and warns that real users are affected. - Early decisions are labelled: completing before the pre-registered stop
shows a warning and a Complete early button, and the decision memory
records that it was decided early. - Verified edits: after an approved copilot edit (such as removing the
losing code), Petri runs the project's tests (petri.verifyCommandor
npm test) and restores the file if they fail. - Petri Watch: reads running experiments' hourly per-arm timelines and
alerts when an arm stops converting or enrolling, enrolment stops, or the
split breaks (Poisson and chi-square tests, complete hours only), blaming
the last commit that touched the experiment's code. In the editor
(notification and tree),petri-check watch(exit 1,--refresh), the
Action (command: watch, on a schedule) and MCP. - Pre-registered stop:
petri-check lock --stop-at/--stop-nor Petri:
Pre-register When to Decide records when to decide. The CodeLens shows
progress, and a SHIP before the stop is marked provisional in the copilot's
report andpetri-check experiments. Display only. - Decision memory: completing an experiment records the decision and its
evidence (winner, value, lift, interval, chance to win, expected loss, n) in
petri.lock.json, and a lens shows it above every line holding the shipped
value.
Petri 0.1.4
Extension only; the petri-check CLI is unchanged at 0.1.3.
Added
- Launch gate: before an experiment starts, Petri runs the rules as if it
were running. If the code would record wrong or no data, the approval names
each file and line and the button reads "Start anyway".
Petri 0.1.3
Added
-
Multiple variants. A ship verdict with two or more variants now says
whether the result also clears a Bonferroni-corrected bar (97.5% for two).
The rule itself is unchanged, as pre-registered. -
Expected loss per arm in the results panel, the copilot's report and
ship verdicts: how much worse than control an arm is on average in the
cases where it is worse, so "98% to win" comes with the size of the
downside. -
petri-checkreadsflagsmith.env, so afterselfhost/bootstrap.mjs
the CLI runs all 12 rules with no flags or variables. -
Approval policy test: every copilot tool runs against a recording
Flagsmith client. A decline means nothing is written, an approval means
exactly the shown request is sent, and an unclassified new tool fails the
build. -
Treatment lock (
PETRI013):petri.lock.jsonrecords each running
experiment's variants, split, metrics and a fingerprint of every code path
serving it (written on start, released on completion; alsopetri-check lock
and Petri: Lock Running Experiments). Changing what a running experiment
serves is flagged in the editor as you type, in CI offline from the committed
lockfile, and against live Flagsmith (variant values, split, metrics). -
Measured comparison (docs/eval.md, harness in
eval/):
with Petri an agent fixed the same 6 planted bugs with 48% fewer tokens,
53% fewer turns and 42% less time; both conditions fixed 6/6. -
Skill cleanup as a pull request: the losing-code removal can be a PR
carrying the verdict line, the numbers, a real-or-simulated traffic note and a
checklist; the agent never merges it. -
Agent Skill
skills/flagsmith-experiment-check: wiring check → verdict →
gated completion with the Flagsmith CLI →flagsmith evaluatecheck →
gated cleanup. -
petri-check experiments(one line per experiment with the verdict,
interval, chance to win, expected loss, SRM and therollout_variantid)
and--format brief(one short line per finding), for agents. -
MCP server:
npx petri-check mcpgives any coding agent three
read-only tools:petri_check,petri_experiments(results, SRM, expected
loss and Petri's verdict) andpetri_rule. No tool changes Flagsmith or
code.
Fixed
petri-checkno longer crashes with a stack trace when Flagsmith is
unreachable: it names the URL and exits 2.
Petri 0.1.2
Added
- Zero-click self-hosting.
selfhost/bootstrap.mjsturns a fresh Flagsmith
into a ready one: admin account, organisation, project with Development and
Production, organisation API key and event storage. It writes
flagsmith.jsonandflagsmith.env, and Petri connects without a prompt. - GitHub Codespaces.
.devcontainer/starts Flagsmith with
experimentation, runs the bootstrap, builds and installs Petri, and installs
the demo shop. - Online playground at https://ivan825.github.io/petri/: all 12 diagnostics
and the decision rule run in the browser on pasted code, against a built-in
copy of the Petri Coffee project whose problems you can toggle.
Petri 0.1.1
Fixed
- The SRM guard now works on running experiments. Flagsmith returns a
nullsample-ratio-mismatch p-value while an experiment runs
(Flagsmith#9128), so
the decision rule's SRM check never fired. When Flagsmith reports none,
Petri now runs its own chi-square test of exposures against the
configured split (100 exposures minimum). The tree view marks it
"(Petri)", and the copilot's report says which test it used.
Petri 0.1.0
Petri 0.1.0: run Flagsmith experiments where the code lives.
Install
VS Code
curl -fsSL -o petri.vsix https://github.com/Ivan825/petri/releases/latest/download/petri.vsix && code --install-extension petri.vsixOr download petri.vsix below and use Extensions → ⋯ → Install from VSIX…. Cursor and VSCodium work the same way.
CLI / CI: npx petri-check . or uses: Ivan825/petri@v0.1.0 in a workflow.
What's in it
- 12 diagnostics for experiments that silently lose or skew data, with quick fixes: events sent to Flagsmith Cloud from self-hosted SDKs, event-name case mismatches, reads that skip the exposure, phantom arms, variants without keys and more.
- CodeLens, hovers and a results panel: live split, lift, 95% credible intervals and chance to win, next to the flag read.
- One conservative decision rule: ship only at ≥95% chance to win, no guardrail likely hurt, no SRM, no phantom arms.
- Lifecycle from the editor: start, pause, complete and roll out, then remove the losing code path.
- Experiment Copilot (Claude): idea → flag, metrics and code → start → judge → ship → delete the losing code. Every write shows the exact HTTP request or diff and waits for your approval, and every decision goes to
.petri/audit.jsonl. - Self-hosted Flagsmith in one command, with experimentation enabled.
petri-checkCLI and GitHub Action for CI.
Docs: quick start · diagnostics · copilot · self-hosting