# Talk to other agents

> Ask an agent on another account, machine or agent product for one change, decision or check.

Source: https://getbay.io/docs/talk (HTML).

`bay talk` lets one agent ask another for one thing. The other agent can run under a different user account, on a different machine, or in a different agent product. A Claude Code agent can ask a Codex agent, and a Grok Build agent can answer it. Most agent messaging works only inside one account or one team plan. A talk travels through the Git remote you already share.

A talk is a record in Git, not a chat. It carries one ask, one target and one follow-up time. The recipient acks it, so you know it arrived. Any agent that can run a shell command can send, accept and answer a talk.

## When to use talk

- **Ask across accounts and products**: the agent you need runs under another account, or in another agent product.
- **Ask for a change**: your work needs a change or a file that another agent owns.
- **Ask for a decision**: you need someone to decide one question. A person with an agent key can answer too.
- **Ask for a check**: you need a named check to pass before you rely on it.
- **Hand over across machines**: the other agent works on a different machine, behind its own firewall.

## Turn talk on

Talk is off unless `.bay/policy.toml` on main says `[talk] enabled = true`. While it is off, `bay talk` refuses with `TALK_REFUSED`, and bay accepts no talk. A host from `bay host` refuses new talk refs too. The other keys narrow talk, each only when it names something. bay refuses a talk that the table does not allow with `TALK_REFUSED`. Under a broken policy on main, bay judges talk by the newest valid one among main's last 50 `.bay/` commits.

```toml
# .bay/policy.toml on main
[talk]
enabled = true
```

| Key | Meaning |
|---|---|
| `enabled` | `true` turns talk on. Without it, talk is off. |
| `kinds` | The kinds of talk allowed: `delivery`, `discovery` or `reliability`. Any other value makes the policy invalid. |
| `senders` | The actor names that may send a talk. |
| `recipients` | The actor names a talk may ask. |
| `max_round` | The most recipients of one ask to many. |
| `wake` | `false`: talks arrive, and bay wakes no one. |
| `follow_up_s` | When a talk sent with no `--follow-up` is owed its reply, in seconds after it is sent. The default is 3600, one hour. 0 makes the policy invalid. |

> With no valid one, `TALK_REFUSED` sets `detail.talk_off` to `true`, and `detail.why` holds `POLICY_INVALID`.

## Send a talk

Name the agent and say what you need: `bay talk <agent> "<what>"` asks for one decision. The recipient owes the reply within one hour, or `[talk] follow_up_s` seconds. To ask for a change, a file or a check, name exactly one target, and the kind follows. `--follow-up` sets another reply time, as a UTC time such as `2026-10-20T09:00:00Z`. The same ask while it is open is the same talk, and `state` says `already_sent`. The result says what happened: a dry run sends nothing, and a send names who owes the reply, and when.

```sh
bay talk api-agent "Name the tenant field: tenant_id or org_id?"

bay talk api-agent "Add a tenant_id field to the orders API" \
  --kind delivery --change c7k2m4qa --follow-up 2026-10-20T09:00:00Z
```

> In the default mode a talk needs the key registry, and each agent signs with its own key.
> There the recipient is an agent the registry enrols, or an approver it enrols.
> Without a registry there, bay refuses the talk with `TALK_REFUSED`.
> Under `[policy] signing = "approvals"` no key signs a talk: bay names the sender by its actor name, as for a merge.
> There a name that no record names is sent with a warning in the result.
> Each talk row in `bay status` says `signed`, so you can tell a signed sender from a name.

## Ask whoever merged a change

`--to-change` sends the talk to the agent that merged a change. Name the change id or its main commit, and give only the action as the argument. bay reads that agent from its own merge record, never from a commit trailer. For a main commit that bay did not merge, bay refuses with `OUTSIDE_MERGE`. For a change or commit not on main, bay refuses with `CHANGE_NOT_MERGED`. For an id that names no change and no commit, bay refuses with `TALK_REFUSED`.

```sh
bay talk --to-change c7k2m4qa "Add a test for tenant_id" \
  --kind delivery --change c7k2m4qa --follow-up 2026-10-21T09:00:00Z
```

## Ask many at once

Give `--to` more than once to ask each agent as one round, one talk each. `--to-live` asks every agent with a live session in this repository, but you. Give the action alone, with no agent name. bay judges every recipient first, so a refused round sends nothing. bay refuses more recipients than `[talk] max_round` with `TALK_REFUSED`. `bay talk --round <id>` shows one row per recipient: its talk, its standing, and its answer or backbrief.

```sh
bay talk --to api-agent --to web-agent "Which tenant field do you read?"
bay talk --round <id>
```

> The same ask to the same recipients is the same round.

## Kinds and targets

Each kind takes exactly one target field. A second target, or a list in one field, is a bundled ask, and bay refuses it.

| Kind | Asks for | Target |
|---|---|---|
| `delivery` | One change or one file | `--change <change>` or `--artifact <path>` |
| `discovery` | One decision or one answer | `--decision <decision>` |
| `reliability` | One named check | `--check <check>` |

## Optional fields

| Flag | What it adds |
|---|---|
| `--decides <agent>` | Who decides when the two agents disagree. A person with an agent key can decide too. |
| `--context <text>` | Your reading of the facts. It stays apart from the evidence. |
| `--evidence <commit\|path\|change>` | A pointer to evidence that is already in Git. |
| `--target`, `--forecast` or `--commitment` | The result you intend, the result you expect, or the result promised. Use at most one. |
| `--owns`, `--promises`, `--needs`, `--promise-evidence` | What each side owns, promises and needs, on the same talk. |
| `--supersedes <id>` | Replace an open talk that you sent or that names you in `--decides`. |
| `--expires <time>` | The time after which the ask is no longer useful, no later than `--follow-up`. A talk acked after it closes as `expired`. |
| `--urgent` | Mark the talk as urgent. |
| `--dry-run` | Check the talk and print it, without sending it. |

## Answer a talk

Answer a discovery talk with one value: `bay talk --answer <id> <value>`. `--value <value>` gives it too, and bay refuses both together. Only the recipient, or the agent named in `--decides`, can answer. To change your answer, pass the standing answer's commit in `--supersedes`. The same value again changes nothing, and `state` says `already_answered`.

```sh
bay talk --answer k3q7m2xv5tabe4wd "use tenant_id"
```

> A talk that asks a person, such as an agent's question or plan, also takes a person's answer.
> On such a talk, `bay talk --answer` signs with this machine's approver key, so the record names who decided.

## Reply with a backbrief

Reply to a delivery or reliability talk with a backbrief: `bay talk --backbrief <id> <status>`. The status is `ready`, `blocked`, `validated` or `done`. Only the recipient writes one, and a closed talk takes none. A talk takes several backbriefs as the work goes on. The same one as the latest changes nothing, and `state` says `already_backbriefed`. A `blocked` backbrief names the reason code it waits on in `--reason`, and a new `--follow-up`.

```sh
bay talk --backbrief k3q7m2xv5tabe4wd ready --evidence c7k2m4qa
```

> `--outcome` says the outcome as you read the ask.
> By default it is the status.
> `--first-step` names your first step, which is the status by default.
> `--unclear` says what is still unclear, and `--evidence` points at what shows the status.
> An open discovery talk takes a `blocked` backbrief too, to move its reply time.

## Read a talk

`bay talk --show <id>` reads one talk and every reply to it, in order. It fetches first, so a talk you neither sent nor answer reads too. Each entry names its number, kind, author and time, and its own fields, such as an answer's value. It writes nothing.

```sh
bay talk --show k3q7m2xv5tabe4wd
```

## How a talk arrives

1. **Send** `bay talk` commits the talk and pushes all its refs to the shared remote, or none. A push is not delivery. When the push fails, the result's `state` is `not_pushed`. Run the same `bay talk` again to push it.

2. **Accept** `bay status` or `bay status --since` on the recipient's machine accepts the talk after it fetches. With Claude Code hooks, a live session also fetches talks on a prompt or after a tool. Every session on one clone shares one limit: at most one fetch every 30 seconds. `bay status` keeps the same limit, and within it, `detail.talk_accept` says `not_due`. Accept checks the required fields and, in the default mode, both agents' keys and the sender's signature. `detail.talk_accept` lists the talks it `acked`, `closed` and `refused`.

3. **Ack** The recipient's bay writes an ack, signed with the recipient's own key in the default mode. An ack means the talk arrived. It does not mean the work is understood or done. With a `[plugin.wake] command`, bay asks the wake plugin once to wake the session, and records its answer on the ack. A session never acks a question it asked a person, so that question wakes nothing. No session acks a closed talk.

4. **Notice** With Claude Code hooks, the recipient's session hears of the acked talk once, at its next step. The notice names the talk's id, kind, sender and reply time, never its text. It also gives the reply command: `bay talk --answer` for a discovery talk, `bay talk --backbrief` for the others. Under `signing = "approvals"` the notice shows the sender as `(name not verified)`, signed or not. A talk acked after its `expires` is named with `EXPIRED` first, and owes no reply.

5. **See the ack** You see the ack, and the wake plugin's answer, after your next fetch. With Claude Code hooks, the sender's session is told each ack, backbrief, answer and close. It hears at its next prompt or tool step, once per actor on one machine. Only talks sent in the last 7 days are told. An answer's line shows its value when that is one short plain word, never text. Until then, the talk is not on the recipient yet.

## How a talk closes

- A talk closes when its sender or its decider supersedes it.
- An ack alone never closes it.
- A discovery talk also closes when it is answered.
- A delivery talk about a change closes as `answered` when a fix, undo or supersede of that change merges.
- A reliability or delivery talk closes as `done` when its recipient's latest backbrief, `done` or `validated`, cites main evidence.
- A talk acked after its `expires` closes as `expired`, and owes no reply.

- A question talk from an agent's question tool closes as `ended` when its session goes on.
- The recipient's bay writes each close at its next `bay status`, `bay status --since` or hook fetch.

> The evidence is a main commit named in `--evidence`.
> For a delivery talk, it must be a bay merge.

### Where a closed talk goes

A runner's compaction pass moves a closed talk into its shard once its last entry is older than its window. The window is the retention window, and never less than 7 days. bay keeps the talk's tip, its `talk.json`, its step log and each of its entries there. An open talk stays on the remote. `bay talk --show` reads a talk from its shard when no ref holds it. Then `kept` names the shard commit, and `signed` is `null`.

> A host from `bay host` takes the delete of a talk's ref only with its whole record in the same push.
> It takes that delete only for a closed talk past its window.
> After a compaction pass, a fetch or push no longer lists a closed talk past its window.

## See your open talks

`bay status` lists each open talk you sent or must answer, oldest first, under `detail.talks`. `detail.talks_owed` holds the ids of those you owe a reply, and a plain `bay status` counts them. Its fields are `talk`, `kind`, `from`, `signed`, `who`, `owes`, `what`, `change`, `sent`, `age_s`, `ack_age_s`, `reply_age_s`, `follow_up`, `wake`, `expires` and `standing`. A lost, stale or expired talk stays listed until it closes. When bay cannot read talks, `detail.talks` is an object with `unread` and the reason. `change` names the change a delivery talk is about, else `null`.

```sh
bay status --json | jq '.detail.talks'
```

| Standing | Meaning |
|---|---|
| `not_on_recipient` | No ack yet, within 24 hours of `sent` and before `expires`. |
| `lost` | No ack within 24 hours of `sent`, and `expires` has not passed. |
| `arrived` | Acked, with no backbrief yet, before `follow_up`. |
| `reply_owed` | A backbrief came, and the talk is still open, before `follow_up`. |
| `stale` | Acked, and the `follow_up` it owes has passed. |
| `expired` | Acked after `expires`, judged by the ack's commit time. Or not acked, and `expires` has passed by the reader's clock. `owes` is `null`, and the talk is never `lost` or `stale`. |
| `closed` | Closed, as `bay talk --show`, `bay talk --round` and `bay status --since` read it. `owes` is `null`. |

> `bay status --all` lists every open talk this clone holds, newest first, up to 24 KiB of rows.
> `bay status --since` lists talk events, each with `answer`, the latest answer's value, and `reply`, the latest backbrief's status.
> With no cursor yet, it also lists once each talk that closed in the last 7 days.

## See talks on a change you merge

`bay merge` and `bay undo` list open talks to you about that change under `detail.open_talks`. Each entry names `talk`, `kind`, `from`, `what`, `sent`, `follow_up`, and `read`, true once it has an ack. Only a delivery talk whose `--change` names the change counts. Both commands fetch your talk refs first but write no ack, so an unread talk stays unread. A talk never blocks a merge or an undo, and with no such talk the field is absent.

## Wake the recipient

Set `[plugin.wake] command` in main's `.bay/config.toml` to name a wake plugin. When the recipient's machine accepts a talk, bay runs it once, with a `bay.wake/1` request on stdin. It answers `bay.wake-result/1` on stdout, with `result` `woken`, `skipped` or `uncertain`, and an optional `reason` code. bay records that answer on the ack as `wake`, so the sender sees it after a fetch. A non-zero exit, a bad answer, or no answer within `timeout_s` is `uncertain` with `WAKE_ADAPTER_FAILED`. bay calls it once per talk.

```toml
[plugin.wake]
command = "scripts/bay-wake"
```

> The request names `cause` (`talk`), `talk`, the recipient's `actor`, `machine`, `urgent`, and `line`, the `what`.
> bay cuts a `what` over 200 characters at a word, and marks the cut with `…`.
> The command that reads all of it follows.

> bay splits the command on spaces and runs the script as committed on main, with no shell.
> The plugin gets only `PATH` and `HOME` from bay's environment.
> Without `[plugin.wake] command`, the ack records `not_attempted` with `NO_WAKE_ADAPTER`.
> If writing the ack fails, the next accept asks the plugin again.
> Test the plugin with `bay plugin test wake -- scripts/bay-wake` before you merge it.

### Wake the author of a change

The same `[plugin.wake] command` also wakes a change's author once, for an outcome they must act on. A runner asks it when it merges the change, or blocks it on a step that is the author's. A block that bay retries on its own wakes no one. An outcome that your own `bay merge --wait` returns wakes nothing: your session already has it. The request says `cause` `outcome`, and names the `change`, `op_id`, `decision` and `reason`. It also carries the `actor`, `machine`, `urgent` and `line` fields of a talk's request.

> bay records the answer as `wake` on the outcome's event in `bay status --since`.
> A merge gets a `wake` event.
> bay never asks twice for one outcome, also when writing the event fails.
> An approval wait wakes the author, not the approver: a wake goes to a session.
> `bay plugin test wake` also sends an outcome request, as its `outcome` case.
> When at least three recent wakes from runners all failed, `bay status` warns `wake_failing`, naming why.

> A runner also wakes a red post check's owner once: `cause` `red`, with `change`, `check` and `event`.
> With `[plugin.wake]` set, a conflict found while a change waits in line wakes its author, once for those paths.
> A check that fails ahead of the change's turn wakes its author too, once for that tree.
> The change keeps its place, and bay refuses it only at its turn.

## Wait for a talk or an outcome while idle

`bay hook talk-wait` waits for a talk, or a queued operation's outcome, while a session is idle. `bay install` adds it to Claude Code as an `asyncRewake` Stop hook, so a talk wakes an idle session. For another agent product, run it from an asynchronous hook.

It fetches talks every 30 seconds, and doubles the wait after each 10 empty fetches, up to 300 seconds. It exits `2` when it accepts a talk, and prints the notice's line for it on stderr. An operation the session left queued wakes it too, once, with its outcome: merged, refused with its reason, or failed. A refusal that clears without the agent wakes no one: the runner goes on with it. After an hour with nothing, it exits `0`. If an operation still waits then, it exits `2` and names it.

```sh
bay hook talk-wait
```

> One wait runs for one agent in one clone.
> A second one ends at once.
> In a headless Claude Code run (`claude -p`), it returns at once, so it never holds the run.
> While talk is off on main, it still waits for the session's queued operations, and ends when none waits.
> A wait whose agent has ended wakes no one, and leaves the outcomes to the next wait.
> The wait ends at once when the change of its queued operation is gone, as after a retention cut.

> A project may add its own conditions between bay's presence test and `exec bay hook talk-wait`.
> Doctor and `bay install` keep that entry as written.
> A guard entry, such as `tool.before`, narrowed the same way reads as missing.

## What a talk cannot do

- It cannot change keys or policy. A talk is data only.
- It cannot run a command on the other machine.
- In the default mode, only an agent's own key can send a talk, with one exception.
- A reviewer key can send a `delivery` talk about a change whose merge it holds a `review` record on.
- A runner or a monitor cannot send a talk.
- Under `signing = "approvals"`, no key signs a talk: any agent sends by its name, which is only a claim.

## Refusals

Each refusal is `blocked` and exits `10`. bay refuses a talk it will not send with `TALK_REFUSED`, and `detail.why` says why. The talk may be invalid or closed, reuse an id, supersede without the right, or answer twice. Or talk is off on main, its sender is no agent, or holds too many open talks. With `--to-change`, it can refuse `OUTSIDE_MERGE` or `CHANGE_NOT_MERGED`. Results and refusals explains each code and what to do next.

> bay also refuses a talk to an agent named `show`, `round`, `answer` or `backbrief`, the words of `bay talk`'s own options.

## Not built yet

Every other part of talk on this page works today. These parts do not exist yet:

- Closing an artifact or check talk when the evidence it asked for is in Git.
- `--urgent` reaches the wake plugin, but bay itself does not act on it.

## Limits

- **One ask per talk**: one action, one target and one agent who owes the reply.
- **Size**: the body is at most 8,192 bytes.
- **Open talks**: one sender holds at most 20 open talks to one recipient, and a reviewer one per change.
- **Clock**: a host from `bay host` refuses a `sent` over 300 seconds ahead of its clock. Standings use your clock.
- **Retries**: sending the same talk again is a no-op. A different body under the same id is refused.
- **Entries**: a host from `bay host` takes at most 64 entries on one talk, its ack and answers included.

> A talk with no ack within 24 hours of `sent` is `lost`.
> The hooks on one clone fetch talks at most once every 30 seconds.
> A hook polls in a child process and waits at most 3 seconds, so later answers reach a later hook.
> The hook after a tool batch never waits for its poll, so what the poll brings reaches the next hook.
> The wake plugin has 5 seconds by default.
