Safety and approvals
For AI agents: this page is Markdown at https://squiggle.sh/docs/agents/safety.md. Every docs page is listed at https://squiggle.sh/llms.txt, and all of them are one file at https://squiggle.sh/llms-full.txt.
Your agent can’t log out, delete, pay or buy in your app unless you approve the step, or your project’s approvals setting lets it through. The block is in Squiggle’s runtime, not in a prompt, so no wording gets the model past it.
- logout
- sign out
- delete
- remove
- destroy
- pay
- purchase
- buy
- checkout
- confirm
- submit order
- deactivate
- close account
tap "Delete account" blocked'Delete account' matches the deny rail — this action is blocked below the model (approvals mode is ask). If the run genuinely needs it, escalate with reason: needs_approval for a scoped single-use grant from a person.
Blocked in the runtime, not in a prompt. The model cannot talk its way past it, because nobody asks the model.
The deny rail
Before any tap is delivered, Squiggle checks the control’s testID, label and text against a list of words. A match is refused when your agent sends it: a program, an answer to a decision, a flow run with run_flow, or a single tap. A program is checked wherever it runs, including squiggle agent run and Studio’s Flows screen. A flow you run yourself, with squiggle flow or from Studio’s Flows screen, isn’t checked: the rail stands between your agent and your app, and a flow you start is already your decision. See the list and the limits in force with:
squiggle agent configagent config defaults — no .squiggle/agent.json ✔ deny rail: enabledrefuses logout | sign\s*out | delete | remove | destroy | pay | purchase | buy checkout | confirm | submit\s*order | deactivate | close\s*account escalation budget 3 action budget 300 wall-clock budget 10m 00s escalation TTL 5m 00sMark your own dangerous controls
The word list can’t know that “Send” moves money, and it only reads one language. Mark a control as destructive in your app, and it is refused whatever it says:
import { agentHint } from '@squiggle.sh/react-native';<Pressable {...agentHint({ id: 'delete-account', destructive: true })}> <Text>Delete account</Text></Pressable>agentHint returns ordinary props: id becomes the testID, and role and label become the accessibility role and label. It works on any component that passes those props on.
In a React web app, import it from @squiggle.sh/react and spread it onto the element. There id becomes data-testid, and role and label become role and aria-label:
import { agentHint } from '@squiggle.sh/react';<button {...agentHint({ id: 'delete-account', destructive: true })}> Delete account</button>Tunable values
The tune tool is the only way your agent writes into your app’s state, and it can only set values your app declared with defineTunable, within the range you gave. It can’t edit other props or state. The deny rail checks each tunable’s name the same way it checks a testID, so a name that matches the word list is refused.
Approve one step
When a run needs a blocked step, it stops and asks for approval. Only the approve_action tool can answer. It is marked as needing a person, so a client that honours that mark, such as Claude Code, asks you before it runs, and your agent can’t approve its own step. In Studio, you approve it from the run log.
An approval covers that one step in that one run, and is used up when the step runs. It is recorded with who gave it. To stop being asked about the same control, pass remember: "session" with approve_action: the control then goes through for the rest of your agent’s MCP session. Relaunching or reloading the app keeps it, such as after a test that signs out. Session approvals belong to one app: another app your agent switches to has its own, and switching back brings the first app’s back. They never get past the deny list or the production rule, described below.
Let your agent approve while you develop
Signing out and deleting test data are often part of the journey you’re testing. Add an approvals block to .squiggle/config.jsonc so your agent doesn’t stop for you every time:
{ "approvals": { "mode": "agent", "environment": "development", "allow": ["Sign out"], "deny": ["Delete account"] }}| mode | What a blocked step does |
|---|---|
ask | Waits for you. The default. |
agent | Signing out goes through. Any other blocked step, such as a delete, a payment or a control your app marked destructive, goes through when your agent says why it is safe, or when it acts on something the run created. In production, only the second counts (below). |
auto | Goes through, except the steps that always wait for you (below). |
Your agent gives its reason with approve: on the step, so the run never stops:
intent: clear-seeded-draftsgoal: visible: { text: No drafts }plan: - tap: { testID: drafts-tab } - tap: text: Delete all drafts approve: the seeded test account's drafts, which the seed script restoresA single tap takes the same reason in its approve field. If a step without a reason is blocked in agent mode, the run asks your agent instead of you, and it answers with resume_intent and agentApprove. In ask mode a reason changes nothing: the step still waits for you. Every step that went through on a reason or on the setting is recorded with who let it through and why, in the run’s report and journal.
Steps that always wait for you
Whatever the mode:
- Controls in
deny. - In production, any blocked step other than signing out, on something the run didn’t create. A control counts as created by the run when its testID, label or text contains text the run typed, such as a task title, or when the row it sits in shows all of that text, or at least its first twelve characters cut short with “…”. Typed text shorter than four characters doesn’t count. Neither does typed text with a word like “delete” or “buy” in it when it matches the control itself; in the row, such text counts if it has at least four other characters. So in
agentorautomode, a run that queues the prompt “Remove the unused imports” can tap that row’s Remove even in production, and a Remove in any other row waits for you. A program and a flow run withrun_flowcount what they typed; a singletapdoesn’t.
Only your approval of the one step, with approve_action, gets it past the production rule. A step’s approve:, the allow list and session approvals, even ones you gave, don’t. The refusal says so, and says which declaration made the app production. If the build doesn’t talk to production data, declare its environment as below; if two places declare it, change each one that says production, because the most production-like wins.
How a blocked step is decided
Squiggle checks these in order, and the first one that applies decides:
- The control is in
deny: it waits for you. - The production rule applies: it waits for you.
- You approved the control for this session (
remember: "session", or theapprovalstool): it goes through. - The control is in
allow: it goes through, in every mode, includingask. - Otherwise the mode decides, as in the table above.
Your approval with approve_action always lets that one step through. deny and allow match a control’s whole testID, label or text, in any case: "Sign out" doesn’t match a button labelled “Sign out of all devices”.
The mode in force is the session’s, if you set one with the approvals tool. Otherwise it is SQUIGGLE_APPROVALS, if set in the environment of the MCP server, Studio or the CLI (for example SQUIGGLE_APPROVALS=auto in a CI job), then your config’s mode, then ask. A program can make its own run stricter, never looser: run_intent with approvals: "ask" makes that run decide as in ask mode, so only allow and your session approvals let a blocked step through, and a looser mode than the one in force is refused.
A value Squiggle can’t read never loosens anything: an unknown mode counts as ask, an unknown environment as production, an allow that isn’t a list of strings is ignored, and a deny that isn’t one makes the mode ask. Squiggle reads the approvals block when your agent connects to the app, so an edit counts from the next connection: restart the MCP server or relaunch the app. A project with no approvals block uses the one in ~/.squiggle/config.jsonc, if there is one.
Change the mode for this session only
The approvals tool sets the mode, or approves controls, for the rest of the session without touching your config. Like approve_action, it asks you before it runs. mode: "config" goes back to the mode from your config or SQUIGGLE_APPROVALS. What is in force now, and everything approved for the session, shows in status under approvals, with every change: who made it and from where. Each change made with the tool is also saved to .squiggle/agent/approvals.jsonl in the project that owns the app; for an app no project owns, it isn’t saved. Session approvals never override deny or the production rule, and they last for the rest of your agent’s MCP session, for the app they were made on.
Change the limits
squiggle agent config --init writes the defaults to .squiggle/agent.json. Edit it to change the words or the limits; a key you leave out keeps its default. Studio and the CLI both read it.
{ "deny": { "pattern": "logout|delete|pay|transfer|send money", "enabled": true }, "budgets": { "escalations": 5, "actions": 300, "wallClockMs": 600000, "escalationTtlSec": 300 }}| Limit | Default |
|---|---|
escalations | 3 decisions per run. |
actions | 300 actions per run. |
wallClockMs | 10 minutes per run. |
escalationTtlSec | 5 minutes to answer a decision before the run gives up. |
What else keeps runs in check
- One run per simulator. Your agent and you never drive the same simulator at the same time.
- Every action is logged in the project’s history, marked as coming from your agent, next to what you ran from the terminal and Studio.
- Every program run is recorded, so a failure already has its replay.
- Nothing is posted without you.
publish_evidenceattaches a recording or screenshot to a pull request only after you add"prEvidence": trueto.squiggle/config.jsonc(squiggle init --pr-evidencedoes it), and it never rewrites what anyone wrote: on a pull request you opened it edits only its own block of the description, and on anyone else’s it comments. It attaches only files Squiggle saved in the project’s.squigglefolder, never another file on your machine.