Agents and live editing

Let an agent edit the open design with undo, live checks and a review mode.

An agent (Claude Code, or any script using the edsnx CLI) can edit the board or schematic that is open in the editor, live: its edits land in the editor’s undo history, mark the file dirty, run the live checks and appear on the canvas as you watch. Without an open editor, edsnx and its MCP server edit the files headless instead.

  1. Turn on softforge.edsnx.agent.enabled (or run Electronics Designer: Start Agent Server). The extension listens on a local socket and writes .vscode/softforge-agent.json in the workspace: the socket path and a random token (the file is readable only by you; add it to .gitignore). The status bar shows Agent: listening, then Agent: connected (n) while clients are attached.
  2. Connect Claude Code: Electronics Designer: Copy MCP Config for Claude Code copies claude mcp add edsnx -- edsnx mcp --attach; run it once in a terminal. edsnx … --attach does the same for single commands. Both find the discovery file from the current folder and refuse to connect with a wrong token.
  3. Open the Agent tab in the right panel of the editor (Electronics Designer: Show Agent Panel, or click the status bar item):
    • the connection: client, session, since when, discovery file, token (masked) and the review mode, with Copy MCP config, Start / Stop and Review edits;
    • Activity: one row per change, with the time, who made it (agents in violet), the command and the document revision before → after, ✓ or ✗ with the reason (a --check that found new violations, a stale revision). Click a row to select and centre the items it touched;
    • Session log: every command is appended to .edsnx/session.jsonl (replayable with edsnx replay); Open log shows it. While the agent works, its cursor moves on the canvas with a label (“Claude · routing GND”) and the items it creates or changes flash in the agent colour.

Review mode (softforge.edsnx.agent.review, on by default; Electronics Designer: Toggle Review of Agent Edits): each agent edit is listed under Review · pending with Accept and Revert, plus Accept all / Revert all; a toast on the canvas counts the pending edits. Reverting the newest change of a file undoes it; an older change is reverted with the opposite edit when there is one (delete what it added, move or rotate back); any other edit (a property, a setup change, a fill) is reverted from the texts kept around it: the items it added, changed or removed are put back in the current file, leaving the newer edits in place, as one undoable step. Only when a newer change touched the same items are you asked to revert that one first. Every agent edit also stays an ordinary undo step: Edit ▸ Undo works whether or not you review, and session.undo / session.redo from the agent keep VS Code’s undo stack in step even when the board’s editor is not the active tab (the step is recorded as its own undo entry there).

Electronics Designer: Export session writes the session log (.edsnx/session.jsonl) as a Markdown report or a JSON document: pick the format and the file; Open shows it.

Settings: softforge.edsnx.agent.enabled (default off), softforge.edsnx.agent.review (default on). Stopping the server (or turning the setting off) disconnects the clients and deletes the discovery file.

AI chat box#

Ask the agent for a change without leaving the canvas: Ctrl+Shift+Space (Cmd+Shift+Space on macOS), the Agent button in the status strip or Electronics Designer: Toggle AI Chat Box opens a floating box over the canvas. Drag it by its header (the position is remembered); Escape closes it.

  • The header shows who answers: a dot (grey: no agent server, amber: listening with no agent attached, green: an agent is attached or running) and “Agent · Claude (edsnx mcp) · attached”.
  • Type a request (“route the USB pair on the top layer, 90 Ω”) and press Enter (Shift+Enter breaks the line). The request goes to the agent with the document the box is open on.
  • While the agent works, a progress line shows what it reports (“routing GND · 3/9 nets”) and the live DRC (or ERC on a schematic) error count; the stop button cancels a request the editor started.
  • The answer appears below the request. The edits the agent made while answering form a proposal card: what changed (14 tracks · 11 vias · DRC 0) and how many changes wait for review, with Accept all, Review changes (the Agent panel’s review list, one entry per edit, see Review mode above) and Revert (undoes them, newest first). With review off the edits apply directly and stay undoable.

Who answers:

  1. An attached Claude Code session. After claude mcp add edsnx -- edsnx mcp --attach (Copy MCP config in the box), the edsnx MCP server of that session subscribes to the chat. Ask Claude to answer the editor chat, or use the /mcp__edsnx__editor-chat prompt: its agent_chat tool returns the requests (wait blocks until one arrives) and agent_reply answers them with progress, text and edits.
  2. An agent the editor starts. When no attached session listens, sending a request starts the agent server if needed, then the command of softforge.edsnx.agent.chatCommand (default claude --print --mcp-config ${mcpConfig} --allowedTools mcp__edsnx) in the workspace folder, with the request on its standard input. ${mcpConfig} is a generated file that runs this extension’s edsnx mcp --attach, so the agent edits the open editor; its printed output is the answer. Set the setting to an empty string to start nothing.
  3. Nobody. When the command is empty or cannot start (Claude Code is not installed), the request waits and the box explains how to attach; a session that attaches later receives the waiting requests.

The protocol (the agent.chat and agent.chatEvent messages, the agent_chat and agent_reply tools) is in docs/agent-protocols.md §2.1.

Documentation for Electronics Designer 2.3.60.