Code IDE chat agent: multi-turn edits and approvals
Tools the agent has access to (read_file, write_file, apply_diff, delete_file), the approval gate, and the checkpoint history that backs every turn.
The chat agent in the Code IDE is a different beast from the legacy workbench chat. The legacy chat is page-scoped and mostly one-shot — describe a change, it rewrites the page. The IDE’s agent loops over multiple turns, reading files, searching, and proposing edits across the whole tree, then asks for your approval before any destructive change.
What the agent can do
- read_file — read any file in your tree. Auto-runs; never asks for approval.
- search_files — grep across the site for a pattern. Auto-runs.
- write_file — create or overwrite a file. Asks for approval before running.
- apply_diff — surgical edit to part of a file. Asks for approval, shows the diff first.
- delete_file — remove a file. Asks for approval with the path in red.
The approval gate is non-skippable for destructive tools. You see exactly what’s about to change, click Approve or Reject, and the agent continues with whichever you chose. Reject just ends that branch — the agent typically re-plans and proposes something else.
Good prompts for the agent
The IDE agent thrives on tasks that need it to look around before acting. Try:
- "Find every page that has the hero section and change the headline to ___."
- "Refactor styles.css — pull the color palette into CSS variables."
- "Add an About page that matches the home page’s layout."
- "My contact form isn’t submitting — what’s wrong?"
One-line tasks like "make the hero blue" still work but the legacy workbench is faster for those — the IDE agent will do a few read_files before the write you want.
Checkpoints — the undo layer
Every turn that fires a destructive tool creates a checkpoint before it runs. Click ↻ History in the topbar to see the list. Each entry has a label (the prompt that triggered it), who authored it (you or which model), and a Restore action that replaces the entire file tree with that snapshot.
Restoring is itself reversible — it creates a "Before restoring …" safety snapshot first, so an accidental restore can be undone by restoring that. Checkpoints stick around for the lifetime of the site; mark important ones as a milestone so they’re never auto-pruned.
Cancelling mid-turn
If the agent is taking too long or going somewhere you don’t want, click Stop in the chat panel. The current tool call finishes (it’s safer to let it complete than abort halfway), then the loop exits cleanly. Anything the agent already wrote stays; anything it was about to propose is dropped.
Step by step: Edit a website's code directly
Switch on the Code editor, move a site into it, and let the agent make changes you approve. Moving a site is permanent.
- 1Switch it on
Open Settings and choose Code IDE. Turn the switch on. Only the workspace owner can.
You should see: "Saved."
- 2Decide before you move a site
Open a site in Web Design and press Code editor at the top. A message asks you to confirm, because this is permanent: the site's pages move into files, and the workbench can no longer edit them. Practise on a copy or a test site first. To start a new code project instead, choose New app when creating a site.
You should see: A file tree on the left, a code editor in the middle and the site chat on the right.
- 3Edit a file
Open a page or a stylesheet from the file tree and edit it. Standard editor shortcuts work, such as find and replace. Press ▶ Preview to see the site in a new tab.
You should see: Your edit is saved as a draft. The live site does not change.
- 4Ask the agent
Describe a change in Site chat, for example "make every button use rounded corners". You can paste a screenshot to show what you mean. The agent reads and searches files by itself, but asks before it writes, changes or deletes one, and shows the difference first.
You should see: A proposed change waiting for your approval.
- 5Approve, and undo if needed
Approve the changes you want; Approve all accepts every change in that answer. Before each approved change the editor saves a checkpoint. Press ↻ History to open Checkpoints and Restore an earlier state.
You should see: The files show the change, or are back as they were.
- 6Publish
Press Publish at the top of the Code editor. It opens the same publish window as any other site.
You should see: The live site shows the change.
If something goes wrong
- There is no Code editor button on the site.
- The Code IDE is switched off for the workspace, or your role cannot edit the design. Ask the workspace owner.
- You cannot switch a site back to the workbench.
- This is by design. Once a site's pages are files, only the Code editor can change them. Use Checkpoints to undo changes.
- "You don't have permission to publish"
- Your project role can edit but not publish. Ask a project owner to publish.