Skip to content

Message types

The daemon routes four message types. Pick by lifecycle, not by content.

Peer-originated deliveries are framed as <peer-message from="@name" type="...">…</peer-message> so runtimes can distinguish them from human instructions. Peer content is subordinate to the active user task: act or reply only when it is relevant and non-disruptive. An ask must still be closed with ack even when no response or action is warranted; notifications and broadcasts need no response. Messages from @human (whichever surface they were sent from; older transcripts name the surface, @dashboard, @telegram or @slack) are human-originated and are not peer-framed.

Contact another peer only when its ownership, context, or independent work materially helps. A reachable peer may already be occupied; availability is not a reason to delegate reflexively.

ask

Non-blocking. Returns a correlation_id immediately. The recipient closes the thread with ack(corr_id) (bare), ack(corr_id, message) (reply), or decline(corr_id, reason) (return unresolved), or hands it to a better-placed peer with delegate(corr_id, peer). Chain follow-ups with ask(reply_to=corr_id, ...), which closes the prior thread and opens a new one referencing it.

Use ask when closure matters: worker checkpoints, review requests, pre-commit handoffs, status checks you intend to track, and delegated work that should not quietly disappear. For durable implementation work with lifecycle/result state, prefer a job instead of overloading a long ask thread.

If the recipient never acks, repowire reminds it at the end of each turn until the ask is closed. For Claude Code and Codex the Stop hook fetches the recipient's open asks and returns a decision: block reminder listing them (Claude Code needs a tmux pane for this). The OpenCode plugin reminds when the session goes idle, and the Pi extension at the turn boundary. The prompt-start hook injects only the description reminder, not open asks. Tool-call detection is the source of truth: prose [ack #cid] mentions in agent output do not close anything, only a real ack() MCP call does.

Daemon-side closure

The daemon also closes asks on its own:

  • Age. Asks older than daemon.prune_max_age_hours (default 24) are closed as evicted. This runs lazily, at most once every 5 minutes when any peer's pending asks are read, and during lazy repair. An ask holding a stashed reply for an offline asker is left to lazy repair, which emits pending_reply_lost before evicting it.
  • Peer reap or eviction. When a peer is reaped or evicted, every open ask to or from it is closed as evicted.
  • Non-addressable demotion. Open asks to a peer demoted to non-addressable are closed with peer_not_addressable (see addressability).
  • Job completion. A job's dispatch ask closes with fire_completed when the job finishes, or executor_died when its executor goes away.

When the daemon can resolve a durable session binding for either side, ask events include nullable repowire_session_id, from_repowire_session_id, and to_repowire_session_id metadata. Peer IDs remain the routing authority.

ack

Closes an open ask thread.

  • Bare ack(cid) signals "seen, no action needed."
  • Reply ack(cid, message) delivers the message back to the original asker as a notification framed [ack #cid from @peer] message.
  • decline(cid, reason) returns work that cannot be handled to the original asker as [declined #cid from @peer] reason.

Replies always reach the original asker regardless of circle — the thread was established at ask-time and the routing is locked then.

A reply reaches the asker at most once: a reply claims the ask before it is sent, so of two racing replies one is delivered and the other is refused.

Delegation

delegate(cid, peer, note) moves an open ask from its recipient to another peer. The correlation id, the asker, and the reply path do not change; the recipient does, and the hop is recorded on the ask, in the trace ledger (delegated), and on the event stream (ask_delegated). The new recipient receives the ask from the delegator, never as the asker, with a [delegated by @old for @asker: note] first line, so a peer's note can never arrive with the asker's (possibly the human's) authority. Its reply reaches the asker framed [ack #cid from @new via @old], and the old recipient can no longer resolve the ask.

The whole hand-off runs under the ask's claim, the same one replies take, so no reply, answer or second hand-off can interleave with it; every check runs before the ask moves, and a delivery that fails puts it back: delegating to an offline peer is refused and the ask stays with the delegator. Asks between machines and a live job's dispatch ask are not delegable. A job is the durable form of handed-off work (owner, assignee, attempts, result); delegation is the light form for an ask. See delegate.

Message ids and pull delivery

Every notify, ask, ask reply, and broadcast an agent peer receives is recorded with a message_id, shown as message-id="msg-…" on its <peer-message> tag. A peer can list its messages, peek at one, or fetch one (list_messages, read_message). A peer that sets set_message_delivery("pull") receives a one-line nudge naming the message instead of its body, and fetches the body when it chooses. Push is the default; daemon.message_delivery: pull makes pull the default for agent and orchestrator peers that have not chosen. Service peers, ACP sessions (which have no read_message), and a spawned peer's opening message are always pushed. See Messages.

Bare ack events and reply notifications carry the same nullable session metadata when a binding is known. Detached or offline peers keep those fields null.

Structured questions and answer

Some asks carry a typed question envelope. A structured question can be an acknowledgement, a choice, free text, or a tool-permission prompt. The daemon still tracks it as an ask thread, but the close operation records a typed answer through /answer or the answer MCP tool:

  • Choice answers select an option_id.
  • Text answers carry free-form text.
  • Tool-permission questions can be denied explicitly, and deny by default on timeout.

Telegram and the dashboard render structured questions as buttons when possible. ACP tool approvals use the same primitive: the ACP broker registers a blocking choice question, waits for the recorded answer, and maps it back to the runtime's permission decision. The older ACP permission-decision route remains as a compatibility shim.

A blocking transport — one that owns a suspendable call, such as an ACP runtime or a Claude Code PreToolUse hook — can register a question and park until it is answered. The daemon exposes this as POST /questions/ask-blocking: the caller posts a tool-permission question, the daemon holds the connection open up to a hard cap while a human surface or peer answers, and returns the typed answer. It is transport-neutral (the ACP broker and the hook share the same register-emit-wait core) and fail-closed (a tool-permission question denies on timeout). The Claude Code remote tool-approval hook is opt-in; see PreToolUse approval below.

Control-surface questions (tool permission) are stored against a virtual recipient sentinel (__repowire_control__, display name human) and rendered by whichever human surface sees the event. That sentinel is a current compatibility backing target for routing/storage — it is not yet a responder-policy model. Expressing who is eligible to answer a question (a human, a specific peer, an orchestrator policy, or the owning session) separately from where the ask is stored is deferred future work.

PreToolUse tool approval (Claude Code)

When experiments.remote_tool_approval.enabled is set, repowire setup registers a PreToolUse hook scoped to the configured gated_tools (mutating/shell tools — Bash, Edit, Write, MultiEdit, NotebookEdit — never read-only tools). Before a gated tool runs, the hook posts a blocking question to the daemon and waits; an allow from a human surface or peer returns permissionDecision=allow, and a deny, timeout, or daemon-unavailable returns permissionDecision=deny. Because the decision rides the hook rather than Claude's native approval, it still gates under --dangerously-skip-permissions.

OpenCode and channel permission prompts

In channel mode (repowire setup --experimental-channels), the channel server raises each Claude Code permission prompt it is relayed as a tool_permission question in the same way: the terminal prompt stays up, Claude Code applies whichever answer comes first, and an unanswered question times out after 55 seconds and decides nothing. An answer given in the terminal first leaves the question on the surfaces until it times out; a late answer to it is ignored.

The OpenCode plugin raises each OpenCode permission prompt as the same tool_permission question, so the human can answer it from the app, the web or Telegram while OpenCode's own prompt stays up. The first answer wins: Allow approves it once, Deny rejects it, and an answer at OpenCode's prompt withdraws the question. A question nobody answers within 55 seconds closes and decides nothing; OpenCode's prompt is still waiting.

Plain asks still close with ack. /answer rejects a plain ask so a reply cannot bypass ack's delivery/retry contract. Structured answers are recorded before the human-readable reply is delivered back to the asking peer; if that peer is temporarily offline, Repowire stashes the reply and redelivers it when the peer reconnects.

notify_peer

Fire-and-forget. No lifecycle, no response expected. Returns a synthetic notif-XXXXXXXX ID for client-side tracking, not a thread you can close.

Use notify_peer for FYIs, self-wakes, reminders, human phone updates, and nudges where daemon acceptance is enough. Do not use it for worker checkpoints, review requests, pre-commit handoffs, or delegated work that needs an explicit ack.

The special peer name telegram routes to the user's phone (if the Telegram bot is running). The dashboard already sees agent turns; you do not need to notify it.

Notify events and newer hook delivery receipts also include nullable session metadata when resolvable. Missing metadata does not change delivery semantics.

broadcast

Fan-out to all online peers in your circle. No correlation, no reply. Use sparingly — treat it as a soft interrupt for everyone in scope.

Misroute refusal

ask and notify_peer resolve peer names within the caller's circle by default. An ordinary peer cannot escape that boundary by passing another circle= explicitly; the daemon rejects the delivery. Roles that bypass circles (orchestrator, service and human) may use an explicit circle to disambiguate mesh-wide names. If a name still matches multiple peers within the allowed scope, the daemon refuses the call instead of guessing.