# agent-can
Agent-first CAN bus session frontend for real devices. Designed to be consumed by LLM agents over MCP or CLI.
## Quick start
```sh
nix develop -c cargo build
agent-can connect \
--adapter usb1 \
--bitrate 500000 \
--dbc vehicle=./vehicle.dbc
agent-can status
agent-can schema --filter 'vehicle.*'
agent-can message list --allow-raw
agent-can message read --select vehicle.Foo
agent-can message send --target 0x123 --data DEADBEEF
agent-can message send --target vehicle.Foo --data '{"enable":1,"torque":12}'
agent-can trace start --path ./session.asc
agent-can disconnect
```
MCP mode: `agent-can --mcp` exposes the same verbs as MCP tools over stdio.
## Architecture
```text
CLI or MCP → local JSON-lines IPC → session daemon
- CAN backend (PEAK / SocketCAN)
- connect-time DBC alias registry
- raw event buffer + latest-value index
- periodic send schedule table
- raw ASCII trace export
```
One live session per daemon. The daemon owns all hardware and observation state. CLI and MCP are stateless transports over a shared request contract.
## Platform support
| Windows | PEAK CAN (USB/PCI) | Primary target |
| Linux | SocketCAN | Supported |
| macOS | — | Compiles, no hardware backend |