# `Raxol.AgentClientProtocol.Connection.Ctx`
[🔗](https://github.com/DROOdotFOO/raxol-agent/blob/raxol_agent_client_protocol-v0.1.0/packages/raxol_agent_client_protocol/lib/raxol/agent_client_protocol/connection.ex#L1)

Per-dispatch handler context.

One `Ctx` is built by `Raxol.AgentClientProtocol.Connection` for every
inbound request/notification and handed to the handler task that runs the
matching callback OUTSIDE the Connection process. `handler_state` is
**read-only per dispatch**: handlers are
concurrent tasks, so there is no safe way to thread mutable state through
them — stateful per-session logic lives in the Session layer, not here.

`reply_ref` is present (`reference()`) for requests and `nil` for
notifications. `rx_seq` is the inbound frame's monotone sequence stamp
— `begin_prompt` forwards it to the Session so cancel-vs-prompt
commutes by wire order. `delivery_stamp` is the receiver-assigned
ordering key (`Raxol.AgentClientProtocol.Delivery.t()`) for a
`session/update` dispatch — `nil` for every other dispatch.

# `t`

```elixir
@type t() :: %Raxol.AgentClientProtocol.Connection.Ctx{
  caps: term() | nil,
  conn: pid(),
  delivery_stamp: Raxol.AgentClientProtocol.Delivery.t() | nil,
  handler_state: term(),
  reply_ref: reference() | nil,
  role: :agent | :client,
  rx_seq: non_neg_integer(),
  session_sup: pid() | nil,
  task_sup: pid() | nil
}
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
