Skip to content

Complete built-in Agent workflow ​

This is the complete Visdiff path: select several rendered elements, send their source-aware context to the Agent, review a real diff, apply it, and see the changed UI after hot reload.

1. Install and start the project ​

Install Visdiff:

bash
npm install -D visdiff

Register the Vite adapter before the framework plugin:

ts
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { visdiffVite } from 'visdiff/vite'

export default defineConfig({
  plugins: [visdiffVite(), react()],
})

Start the development server and configure a model provider. Open the running app and turn on Visdiff.

Click one element, then Shift-click related elements. Visdiff keeps them as one attachment and refreshes their rendered context before each message.

The selection carries:

  • current text, tag, runtime selector, and class names;
  • computed style and geometry;
  • source file, line, and column when source anchors are available;
  • viewport and page URL;
  • which elements were selected together.

These are facts for the Agent, not user instructions.

3. Ask for a concrete result ​

Click Add to Agent, then describe the result and constraints in plain language.

For example:

Make the backgrounds of these three cards dark green. Keep the text readable and preserve their layout.

The Agent analyzes the instruction and selected context. When intent or source mapping is unclear, it asks a focused question instead of guessing.

4. Inspect the real proposal ​

Before approval, Visdiff writes the proposed source edits to the working tree. This lets you inspect:

  • the changed project-relative files;
  • a unified diff;
  • the live hot-reloaded page;
  • the Agent's summary.

The proposal is not committed or silently finalized. You decide whether to keep it.

5. Apply or reject ​

  • Apply changes keeps the proposed files and runs checks from .visdiff/config.json.
  • Reject restores the file content captured at the start of the turn.

If a configured check fails, the Agent gets one repair attempt. If checks still fail, Visdiff restores the files changed during that turn and reports the failure.

Without .visdiff/config.json, the checks list is empty; Visdiff does not invent commands to run.

6. Confirm the visible result ​

After approval, close the chat or keep it beside the page and verify the selected elements. In the main demo, the three original white cards become dark green while their text and layout remain intact.

That visible result is the key confirmation: the action changed application source and the development server re-rendered it.

Alternative: task handoff ​

The visual task queue is still available when you prefer an external coding agent:

  1. Preview an edit in the overlay.
  2. Add an intent note.
  3. Click Apply to enqueue a task or Copy to create a prompt.
  4. Have an external agent read it with the CLI or MCP.
  5. Verify the source change and clear only completed task IDs.

Continue with the external Agent workflow, CLI and MCP, or task format reference.

Give your coding agent visual feedback on your app