Approval mode
How Studio reviews and applies AI-generated changes.
Approval mode is the safety valve between Studio's AI and your project files. Every change the AI proposes is staged as a patch; the mode controls which patches are applied for you and which wait for explicit consent.
The three modes
Confirm (default)
Every patch waits for explicit Accept or Reject. Nothing changes your files until you click.
Auto
Safe additive patches (creating new files, lengthening edits) apply themselves. Destructive ones still wait.
Dangerous
Every patch applies immediately, no review. For exploratory or throwaway projects.
The mode lives in the chat header above the input field. Switch it any time. Your choice persists in localStorage and syncs across browser tabs.
Confirm (default)
Every AI-proposed patch lands in a Pending Patches card directly under the assistant's message. You see:
- The file path.
- A coloured kind badge:
+NEW(create),~EDIT(in-place edit),*REPLACE(full file replace),-DELETE(remove). - A line-level diff with green additions and red deletions.
- Per-patch Accept / Reject buttons, plus Accept all / Reject all at the message level.
Your originals are untouched until Deploy. Rejecting a patch is non-destructive — it's never applied.
Auto
In auto mode, Studio applies a patch immediately if it's classified additive:
write_filepatches that create a new file (no destination yet exists).edit_filepatches where the replacement text is at least as long as the search string. The heuristic: if you're not removing characters, you're probably adding intent rather than tearing something out.
Anything else — replacing an existing file, edits that shrink content, deletions — still stages and waits for review. So auto mode lets the AI ship scaffolding without nagging, while keeping you in the loop for anything that could lose work.
Dangerous
Every patch applies on arrival. There is no review card, no Accept button. Use this for throwaway prototypes or when you want maximum velocity and accept that you'll fix mistakes after the fact (Studio's git history makes recovery easy).
What "additive" means
Studio classifies each patch before staging it:
| Patch source | Operation | Additive? |
|---|---|---|
write_file | Path doesn't exist (create) | yes |
write_file | Path already exists (replace) | no |
edit_file | replace.length >= find.length | yes |
edit_file | replace.length < find.length | no |
Edits where the search string appears more than once are rejected before they stage at all — Studio refuses to guess which occurrence to change.
Duplication warnings
If a new patch creates content that already exists elsewhere in the file, the patch card shows a warning. The AI sometimes restates a block instead of moving it; the warning gives you a chance to reject and re-prompt before duplicates land.
How it interacts with Deploy
Accepted patches modify the in-browser file contents. Deploy is what writes them to the connected GitHub repo and pushes to your CloudShell instance. So you can stack multiple turns of accepted edits, review the cumulative diff, and only Deploy when you're ready.
Where this lives in code
- State machine and classifiers:
lib/approvalMode.ts - Per-turn patch staging:
app/studio/StudioApp.tsx - Pending patches UI:
components/PendingPatchesCard.tsx