~/trust

Nothing changes until you say so.

An experiment touches production: flags real users see, and the code that serves them. Petri and its copilot can propose any of it, but every change waits for a person, shows exactly what will happen, and leaves a record.

  1. 01 Requests
  2. 02 Diffs
  3. 03 Audit log
  4. 04 Agents
  5. 05 Keys and data

01 · Flagsmith writes

The exact request, before it's sent.

Every write is built as a request first: method, path and JSON body. A modal shows it, with why it's needed. Only Approve sends it.

  • The same path for Petri's buttons, quick fixes and the copilot's tools. The copilot has no write access of its own.
  • Declining stops that step. The copilot is told not to retry, and asks what to change instead.
  • Completing against the decision rule, or with no results yet, shows a warning in the approval.
  • The one call that runs without approval asks Flagsmith to recompute results. It changes nothing users see.
  • Production guard: writes to a production environment are titled [PRODUCTION] and say real users are affected. Completing before a pre-registered stop reads Complete early, and is recorded that way.
  • Verified edits: after an approved code edit, Petri runs the project's own tests. If they fail, it restores the file and tells the copilot why.
  • Launch gate: starting an experiment first runs the rules as if it were already running. If the code would record wrong or no data, the approval names each file and line, and the button reads "Start anyway".
  • This is code, not a prompt, and it's tested: policy.test.ts runs every copilot tool against a recording Flagsmith client. A decline sends nothing, an approval sends exactly the request shown, and a new tool fails the build until it's classified.
Approval modal showing the exact POST request the copilot wants to send
Approval: the request the copilot wants to send, in full.

02 · Code changes

A diff, applied as an edit you can undo.

When the copilot wires an experiment into your code or removes a losing branch, it opens a side-by-side diff. Apply change is an ordinary editor edit, so Undo and your source control work as usual. Nothing is committed for you.

Copilot code change shown as a diff with an approval dialog
Diff: what changes in the file, before it changes.

03 · Audit log

Every decision, approved or not, in one file.

Each approval or rejection, yours or the copilot's, is appended to .petri/audit.jsonl in the workspace, one JSON object per line.

.petri/audit.jsonl (example lines)
{"at":"…","actor":"copilot","action":"Create metric “Checkout conversion”","approved":true,"request":{"method":"POST","path":"/environments/…/experiment-metrics/","body":{…}}}
{"at":"…","actor":"copilot","action":"Edit server.mjs","approved":true,"file":"server.mjs"}
{"at":"…","actor":"you","action":"Complete experiment “Delivery promise on the buy button”","approved":false,"request":{…}}

Fields: at, actor (you or copilot), action, approved, and the request or file, plus a note when the approval carried a warning.

04 · Other agents

Read-only by design, gated by default.

MCP server

No write tools at all

npx petri-check mcp lets any agent check wiring and read experiments with Petri's verdict. It can't start, stop, complete or roll out anything. petri_plan_change only drafts a plan entry and previews it as a dry run, so an agent can't change production through it.

Agent Skill

One write per "yes"

The skill is read-only until a ⛔ gate. It shows the exact flagsmith api command, one at a time. On a production environment the person also types the environment's name. It never prints keys.

CI

Blocks, doesn't fix

The GitHub Action reports findings as annotations and fails the check. It changes no code, and calls no write endpoint unless you opt into command: apply.

GitOps

The review is the approval

With petri.plan.json, a change to an experiment is a pull request: the PR shows a dry run, merging applies it, and an entry already in effect is skipped. An environment named like production refuses any entry without "production": true.

Rehearse

Never against real users

petri-check rehearse sends synthetic visitors to count what Flagsmith records. It refuses any environment named like production, because it would add fake users to a real experiment.

Lock

Changes show up in review

petri.lock.json is committed, so locking an experiment, moving its stop date or recording a decision is a diff a reviewer sees, and changing the treatment mid-run fails the PR (PETRI013).

05 · Keys and data

Where your keys live, and what leaves your machine.

WhatWhere
Flagsmith key entered in ConnectVS Code SecretStorage. Never written to settings or files.
Flagsmith key from the CLI or bootstrapYour environment, or flagsmith.env (created with owner-only permissions and gitignored).
Claude keyVS Code SecretStorage, or ANTHROPIC_API_KEY.
Calls Petri makesOnly to the Flagsmith you connect to, and, if you use the copilot, to Anthropic's API with the conversation and the files it reads.
TelemetryNone.
This site's playgroundRuns in your browser. The code you paste never leaves the page.

Found a security problem? See SECURITY.md.