docs / Miri for Agents / For Editors — miri agent

For Editors — miri agent

An agent with a shell should use the commands above. miri agent is for tools that want to keep one compiler running instead of starting it for every command — an editor plugin, or a service with no shell. It speaks JSON-RPC 2.0 over standard input and output, framed with a Content-Length header the way a language server is:

→ {"jsonrpc":"2.0","id":1,"method":"check","params":{"path":"main.mi"}}
← {"jsonrpc":"2.0","id":1,"result":{"schemaVersion":1,"ok":false,"command":"check","diagnostics":[…]}}

→ {"jsonrpc":"2.0","id":2,"method":"fixApply","params":{"path":"main.mi"}}
← {"jsonrpc":"2.0","id":2,"result":{"schemaVersion":1,"ok":true,"command":"fix","diagnostics":[…]}}

Each method answers with exactly the JSON its command prints. The methods are initialize, check, explain, fixApply, view, patch and skillsGet, and $/cancelRequest cancels one in flight. The full protocol is in docs/agent-protocol.md, and tools/agent_client.py is a small working client in Python.