# stdio protocol

> The versioned JSONL protocol for custom frontends.

Use `openmax --stdio` to drive a session from an editor or another program. Commands on stdin and events on stdout use JSON Lines, with one JSON object per line. Grant [project trust](https://useopenmax.dev/docs/permissions) before starting the process.

Read the initial `hello` event and check its `protocol_version` against the versions your client supports. Send a user command to start a turn.

```json
{"cmd":"user","text":"Summarize this project"}
```

Read events as the turn runs. Answer any approval request with its `approval_id` and your user's decision. Wait for the `done` event to determine how the turn ended. Send `{"cmd":"quit"}` to close the session after the active turn drains.

Run `openmax --spec stdio` for the contract shipped in your binary. Pipe a captured stdout stream to `openmax --check --stdio` to validate it. The [protocol reference](https://github.com/Max17190/open-max/blob/main/docs/stdio-protocol.md) defines every command and event, along with the guarantees a frontend can rely on.
