The IDE bridge allows editor extensions (VS Code, JetBrains, etc.) to communicate with a running agent-code instance over HTTP.

How it works

When agent-code starts, it writes a lock file to ~/.cache/agent-code/bridge/. IDE extensions scan for lock files to discover running sessions.

The lock file contains:

{
  "port": 8432,
  "pid": 12345,
  "cwd": "/home/user/project",
  "started_at": "2026-03-31T20:00:00Z"
}

Protocol

EndpointMethodDescription
/statusGETAgent status (idle/active, model, session info)
/messagesGETConversation history
/messagePOSTSend a user message
/eventsGETSSE stream of real-time events

Discovery

Stale lock files (where the PID is no longer running) are automatically cleaned up when any client scans for bridges.

#![allow(unused)]
fn main() {
use rs_code::services::bridge::discover_bridges;

let bridges = discover_bridges();
for b in &bridges {
    println!("Found: pid={} port={} cwd={}", b.pid, b.port, b.cwd);
}
}

Building an extension

  1. Scan ~/.cache/agent-code/bridge/ for .lock files
  2. Parse the JSON to get the port
  3. Connect to http://localhost:{port}
  4. Use the HTTP endpoints to interact with the session

The bridge is read-only by default — the IDE can observe but not control the agent without explicit user action.