# Message Kinds & Priority — Actual Behavior (ADR 0002 8c #8)

## Goal
Document how AMQ `kind` (`brainstorm|question|answer|decision|review_request|review_response|status|todo`) and `priority` (`urgent|normal|low`) actually behave in the bridge after the ADR 0002 receive-path rewrite. This supersedes the pre-T8 claims below (old polling/formatting wording removed).

## Kind semantics (receive path)

- **Actionable kinds** (may trigger a turn): `question`, `decision`, `review_request`, `review_response`, `answer`, `todo`, `brainstorm`. Source of truth: `ACTIONABLE_KINDS` in `src/receive-policy.mjs`.
- **FYI kind** (context-only, never triggers a turn): `status`. There is no `fyi` kind in amq (verified); `status` is the FYI kind. Urgent status stays context-only even from a trusted sender (`planBatch` test `urgent status remains context-only even from trusted sender`).
- `defaultSendKind` (`src/pi-bridge-view.mjs`): `/amq-bridge send` defaults to kind `question` (actionable) unless `--kind` is given. `status` remains available explicitly for FYI.

## Priority semantics (wake trust gate)

- `priority` is sender-controlled: `urgent | normal | low`, default `normal`.
- **Urgent wake is trust-gated** (ADR 0002 §4, 8c #2): urgent + actionable + trusted source (`attach`/`manual`, or `discover` plus active live presence) → `triggerTurn: true` even when an active message exists. `handshake`/`message`/legacy no-source never wake; `discover` without active presence never wakes. Envelope remains context.
- `isUrgent` (`src/receive-policy.mjs`) checks `priority === 'urgent'`.
- Tests: `planBatch: trusted urgent actionable wakes despite existing activeId`, `planBatch: untrusted urgent actionable never wakes existing activeId`.

## Formatting

### formatEnvelope (receive-path / inbox display / injection) — `src/receive-policy.mjs`
Envelope-only, never a body:
```
<id> · from=<from>[ [<subject>]][ thread=<thread>][ priority=<priority>][ kind=<kind>]
```
- `priority: 'normal'` suppressed; `kind` always shown when present.
- Flows to: watch injection (`amq-bridge-inbox` context), `amq_bridge_inbox` tool/command, migration note.
- Tests: `formatEnvelope: no body in output`, `formatEnvelope: normal priority omitted`.

### formatMessage (transport) — `src/transports/amq-client.mjs`
Envelope-only per ADR 8c #8: `id, from, subject, thread, priority, kind`; **body omitted**. Same field set as `formatEnvelope` (non-normal priority shown, `normal` suppressed).

### formatEvidence / formatReadResult (body-capable)
- `formatEvidence` (`src/transports/amq-client.mjs`): send/reply tool evidence — id, from, to, kind, subject, thread, root, **body preview** (truncated >160 chars).
- `formatReadResult` (`src/pi-bridge-view.mjs`): `amq_bridge_read` output — full body + header lines.
- Body capability is kept on the read/evidence paths; only injection and inbox display are envelope-only.

## Tool surface (kind/priority-relevant)

- `amq_bridge_send` / `amq_bridge_reply`: accept `priority`; `send` accepts `kind` (default `question`). Commands support `--priority` too.
- `amq_bridge_inbox`: envelope-only, newest-first display, `--all` → `cur` history, optional `--limit`. No kind filter parameter (removed in T6; filtering happens server-side via `listInbox` filters, not the tool).
- `amq_bridge_status`: pending count (`list --new` length) + active id + owner mode.

## Historical claims (pre-T8, superseded)

Earlier versions of this doc claimed: `formatMessage` rendered `from -> to [subject] <kind> !priority: body`; `summarizeByKind` context summaries; urgent-mode poll-frequency switching (150ms/500ms); `amq_bridge_inbox` kind-filter param. None exist in the current code — the ADR 0002 rewrite removed the poll loop and per-batch summaries, and 8c #8 made `formatMessage` envelope-only. The section above is the aligned truth.
