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
| Endpoint | Method | Description |
|---|---|---|
/status | GET | Agent status (idle/active, model, session info) |
/messages | GET | Conversation history |
/message | POST | Send a user message |
/events | GET | SSE 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
- Scan
~/.cache/agent-code/bridge/for.lockfiles - Parse the JSON to get the port
- Connect to
http://localhost:{port} - 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.