# ADR 0007 · RSI wire protocol and CLI envelope

**Accepted under RFC-0002 D1, D2 and D4.** The catalog CLI and RSI host CLIs share `ancrel.cli.v1`. The existing envelope fixes the spelling of `schemaVersion`, `exitCode` and `diagnostics`. Catalog commands include `release` and `source`. Host commands can include a receipt, structured error, trace identifiers and a next action.

A host reports success with exit 0, conflict or pending human input with exit 1, and invalid input or incompatible versions with exit 2. Existing catalog diagnostics retain their published codes. A shell can stop on failure while an agent reads the error code to decide whether to retry, refresh or request intervention.

The five Draft 2020-12 schemas and eight shared vectors freeze the wire boundary. Task events carry a durable sequence number. Reconnect resumes after the larger of the query cursor and Last-Event-ID. A heartbeat leaves the cursor intact. The final persisted event closes the stream. Host writes from HTTP, CLI and session-scoped tools share one authorization, precondition and idempotency path.
