Skip to content

Built-in agent ​

The Visdiff overlay includes a chat that can change project source directly. It uses a model provider you configure. Capture, the JSON queue, and the CLI/MCP handoff work without any model configuration.

Workflow ​

  1. Open Visdiff and select one or more elements.
  2. Add the selection to Agent. The chat keeps a visible attachment for the selected elements.
  3. Describe the intended change in plain language.
  4. The Agent inspects the source and writes a proposed edit so the diff and hot reload can be reviewed.
  5. Review the diff. Apply changes keeps it and runs configured checks; Reject restores the original content.

Agent attachments remain tied to the selected page elements; they are not screenshots or a silent source patch. When source mapping or intent is ambiguous, the agent should ask rather than guess.

Configure a provider ​

Set these variables in the environment of the development server process:

VariableMeaning
VISDIFF_PROVIDERdeepseek (default), openai, openrouter, ollama, anthropic, or custom.
VISDIFF_API_KEYAPI key. Required for every provider except ollama.
VISDIFF_MODELModel name. Defaults to deepseek-flash for deepseek; required for the other providers.
VISDIFF_BASE_URLEndpoint override. Required for custom.

Blank values count as unset.

ProviderEndpointNotes
deepseekhttps://api.deepseek.comDefault provider.
openaihttps://api.openai.com/v1ChatGPT API.
openrouterhttps://openrouter.ai/api/v1Many hosted models.
ollamahttp://localhost:11434/v1Local models; no key.
anthropicAnthropic native APIVISDIFF_BASE_URL overrides the URL.
customYour URL in VISDIFF_BASE_URLAny OpenAI-compatible endpoint.

Only deepseek has been run end-to-end. The other providers are covered by configuration tests; check them against your own key before relying on them.

Configure project checks ​

Visdiff does not guess which checks a project should run. To run verification after approval, add a .visdiff/config.json file in the project root:

json
{
  "checks": [
    { "name": "lint", "command": "npm run lint" },
    { "name": "typecheck", "command": "npm run typecheck" },
    { "name": "test", "command": "npm test" }
  ]
}

Checks run in order from the project root. Each command is reported as passed or failed in the final result. If checks fail, the Agent gets one repair attempt; if they still fail, Visdiff restores the files changed in that turn.

Without this file, the checks list is empty. The Agent does not infer or run arbitrary package scripts on its own.

Make the variables visible to Vite ​

Visdiff does not read .env files. The variables must be in process.env when Vite starts. Either export them in your shell, or load them in vite.config:

ts
import { defineConfig, loadEnv } from 'vite'

export default defineConfig(({ mode }) => {
  const env = loadEnv(mode, process.cwd(), 'VISDIFF_')
  for (const [key, value] of Object.entries(env)) {
    process.env[key] ??= value
  }
  return {
    // plugins: [visdiffVite(), react()],
  }
})

loadEnv with the VISDIFF_ prefix reads only VISDIFF_* keys, so other secrets in .env are not copied. Restart the dev server after changing these values.

Data sent to the model ​

The configured provider receives the chat messages, selected-element facts, and the project file contents that the Agent reads while locating and editing the change. It can also receive outputs from its project file tools.

The key and model settings stay on the development server. Review your provider's data policy before sending private source code or user data.

Keys stay on the server ​

The key and model settings are read on the server and are never written into your project or sent to the browser. Add .env to .gitignore if it holds a real key.

Missing configuration ​

If VISDIFF_API_KEY is missing for a provider that needs one, the chat shows this error before any model call:

Set VISDIFF_API_KEY in the development server environment before sending a chat message.

Capture, queue, CLI, and MCP keep working.

Changing settings ​

The model client is rebuilt when the resolved configuration changes, so the next chat message uses the new provider or model. Restarting the dev server is still the simplest way to pick up changed environment files.

Give your coding agent visual feedback on your app