# `rho messages`

## Purpose

`rho messages` owns text-backed communication inside the repo.

V1 should keep this intentionally simple and inspectable.

## Responsibilities

- send a structured message
- receive and list messages
- route inbox and outbox files
- support human-to-human, human-to-agent, and agent-to-human traffic
- i think chat should probably be a unified thread to make it natural for a human to view and interact over the top of agents in a chat thread (agents should be tagged though as being different to humans)
- multiparty chat can just be like any other channel whatsapp / slack style
- chat should be e2e encrypted by default but that could be defined by the .gitattribute rules
- we do want to prevent evaluating all possible messages (including prompt injection ones) at all times so we probably do need a way to ensure that you can read only select things at a time

## Simplify

- keep transport repo-local first
- do not add realtime messaging infrastructure in v1

## Replace Old Functionality With

- stable message manifests in `rho/messages/`
- basic routing by user identity
- optional signatures or encryption through `rho crypto`
- optional interpretation by `rho agent`

## Encrypted Message Envelopes

For the GitHub/two-clone flow, messages should be encrypted and signed as
explicit Rho envelopes before they are committed.

The default path should be:

```bash
rho message send \
  --from user2 \
  --to user1 \
  --encrypt \
  --sign \
  --body request.yaml
```

Committed message files should be ciphertext envelopes. A receiving user runs
host-side Rho code to verify and decrypt selected messages into local staging:

```bash
rho message open <message-id> --identity user1 --out sandbox/.../decrypted/
```

Agents should read only the staged plaintext selected by the host. They should
not receive private keys and should not be asked to decrypt committed envelopes
themselves.

## Leave Off In V1

- chat-specific protocol features
- complex thread/session state
- event buses
