~/install
Pick your way in.
Petri connects to any Flagsmith, self-hosted or Cloud. A repo bound with the Flagsmith CLI, or set up by bootstrap.mjs, connects without a prompt. Nothing to install at all? Try the checks in your browser.
01 · In the editor
The extension: catch, show, decide, act, delegate.
VS Code
One line, from the latest GitHub release.
$ curl -fsSL -o petri.vsix https://github.com/Ivan825/petri/releases/latest/download/petri.vsix \
&& code --install-extension petri.vsixOr download petri.vsix and use Extensions → ⋯ → Install from VSIX…
Cursor, VSCodium, Windsurf, Gitpod
Search Petri in Extensions. It's on Open VSX. The same petri.vsix also works through Install from VSIX.
From source
Node 20+. Builds the extension, the CLI bundle and this site's playground engine.
$ git clone https://github.com/Ivan825/petri $ cd petri/extension && npm ci && npm run package # hack on it: open extension/ in VS Code and press F5
The copilot
Optional. Everything else works without it.
Petri: Set Anthropic API Key
Or set ANTHROPIC_API_KEY. The key is kept in VS Code's SecretStorage.
02 · Terminal and CI
The same rules, headless.
npx
No install. Without a key, the code-only rules; with one, all 20 against live data.
$ npx petri-check . $ FLAGSMITH_API_KEY=… npx petri-check . --environment <env key> $ npx petri-check experiments . # every experiment's verdict, health and Watch alerts $ npx petri-check lock . --stop-at 2026-12-05 --mde 20% # fingerprint the treatment, pre-register the stop $ npx petri-check watch . --refresh # exit 1 if the measurement broke $ npx petri-check rehearse . --url http://localhost:3000/ --convert form # recount before launch $ npx petri-check report 2 # experiment #2 as a Markdown decision record
GitHub Action
Fail a pull request that would break an experiment. See it block one.
- uses: Ivan825/petri@v0.1.5
with:
path: .
self_hosted: "true"Experiments as pull requests
Start, pause, complete or ramp from petri.plan.json. Pull requests get a dry run; merging applies it.
- uses: Ivan825/petri@v0.1.5
with:
command: apply
dry_run: ${{ github.event_name == 'pull_request' }}Watch on a schedule
Fail a scheduled job, or a deploy, when a running experiment's measurement breaks.
- uses: Ivan825/petri@v0.1.5
with:
command: watch03 · Coding agents
Give your agent Petri's checks, not its keys.
MCP server
For Claude Code, Cursor, Codex or Copilot. Four tools that change nothing: check a repo, read experiments with Watch alerts and Petri's verdict, explain a rule, and preview a planned change as a dry run. Plus a wire_experiment prompt.
$ claude mcp add petri -- npx -y petri-check mcpAgent Skill
flagsmith-experiment-check: check the wiring, read the verdict, then complete and clean up through the Flagsmith CLI behind approval gates.
$ mkdir -p ~/.claude/skills $ cp -r skills/flagsmith-experiment-check ~/.claude/skills/
04 · Flagsmith
No Flagsmith yet? Two commands, zero clicks.
Self-hosted, zero clicks
Starts Flagsmith with experimentation, then creates the admin account, the project with Development and Production, an organisation API key and event storage. Writes flagsmith.json and a gitignored flagsmith.env.
$ docker compose -f selfhost/docker-compose.yml up -d $ node selfhost/bootstrap.mjs
GitHub Codespaces
All of it in the cloud: Flagsmith, the bootstrap, Petri built and installed, the demo shop's dependencies ready.
05 · Connect and check
What success looks like.
- ConnectPetri: Connect to Flagsmith → your API URL → an organisation API key → an environment. Skipped automatically when
flagsmith.jsonplus a key in the environment orflagsmith.envare present. - Open a file that reads a flagDiagnostics appear in the Problems panel; a read in a running experiment gets a CodeLens like
Delivery promise on the buy button · running · free_shipping +50.4% on Checkout conversion · 98% to win · n=2028. - Try the copilotSelect a function → right-click → Turn Selection into Experiment…, and approve each step.