Using the 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.