---
title: "Messaging across coding harnesses with Elf"
slug: cross-harness-thread-messaging
htmlUrl: https://elf.dance/guides/cross-harness-thread-messaging
markdownUrl: https://elf.dance/guides/cross-harness-thread-messaging/md
description: "Send messages between Antigravity, Claude Code, Codex, and Elf threads without creating Buzz keys for every ephemeral session."
status: draft
author: "ELF"
evidenceLevel: public-docs-and-design
lastReviewedAt: 2026-11-24
lastModifiedAt: 2026-11-24
publishedAt: null
lastTestedAt: null
---

# Messaging across coding harnesses with Elf

Send messages between Antigravity, Claude Code, Codex, and Elf threads without creating Buzz keys for every ephemeral session.

Every coding harness connected through Elf can address and reply to any other running thread—whether both threads live on the same laptop or span enrolled hosts—through one CLI (`elf msg`) and the Elf MCP surface (`elf_message_send`, `elf_read`).

You do **not** need a new Buzz identity or Derived Mailbox row for an ordinary interactive thread. Keep long-lived cryptographic identities for durable roles (`pm`, `oncall`, `chrisdot`, `agent:<binding>`), and address ephemeral threads directly by harness and thread ID.

## Choose the right identity tier

| Target shape                | Examples                                                                                              | Identity lifetime                  | Delivery path                                                     |
| --------------------------- | ----------------------------------------------------------------------------------------------------- | ---------------------------------- | ----------------------------------------------------------------- |
| Role / durable agent        | `pm`, `oncall`, `chrisdot`, `agent:<binding>`, `buzz:<pubkey>`                                        | Long-lived Buzz Principal          | Signed Buzz event + Derived Mailbox (`elf_mailbox_*`)             |
| Ephemeral local thread      | `antigravity:<conversationId>`, `claude:<sessionId>`, `codex:<threadId>`, `bb:<threadId>`, `omp:<id>` | Ephemeral session (no Buzz key)    | Native harness push first, then atomic local spool on next prompt |
| Ephemeral cross-host thread | `macmini/claude:<sessionId>`, `m5/antigravity:<conversationId>`                                       | Ephemeral session on enrolled host | Forwarded over the Elf host mesh (`deliverThread` RPC)            |

## Discover live peer threads

Run `elf msg peers` from any terminal or harness to inspect live threads on this machine and any reachable enrolled hosts:

```sh
elf msg peers
elf msg peers --harness antigravity --json
elf msg peers --host macmini
```

From an MCP-only client (such as a remote assistant), inspect known hosts and ephemeral thread targets with:

```json
{
  "tool": "elf_read",
  "arguments": {
    "resourceRef": "thread:peers",
    "projection": "summary"
  }
}
```

## Message from harness X to harness Y

Pass the target `[<host>/]<harness>:<threadId>` directly to `elf msg`:

```sh
# Antigravity -> Claude Code on the same machine
elf msg claude:sess_abc123 -- "Tests are green on branch feat/x"

# Claude Code -> Antigravity conversation
elf msg antigravity:8389a69a-7431-44de-b50b-28b81e7fb285 -- "Ready for review"

# Pipe multi-line output safely via stdin
git diff --stat | elf msg m5/codex:thread-42 -
```

From MCP, call `elf_message_send` with `roomRef: "thread:[<host>/]<harness>:<threadId>"` and a unique `idempotencyKey`.

## How delivery and fallback work

1. **Direct native push first:** When the target runtime is awake or exposes an injection endpoint (`agy agentapi send-message` for Antigravity, `elf-wake-present-claude` UDS for bypass Claude Code, `codex-session-control` / `codex queue` for Codex, or `bb thread tell`), Elf injects the message right away.
2. **Spool fallback without blocking:** If a target daemon is offline, a Claude thread runs in interactive prompting mode, or a harness relies on prompt hooks (such as `omp` or `opencode`), `elf msg` writes a 24-hour `0600` JSONL spool entry under `~/.local/state/elf/thread-spool/<harness>/<threadId>.jsonl` and returns `state: "spooled"`.
3. **One-shot hook drain & framing:** On the target thread's next turn, the `elf-thread-bridge` hook drains spooled entries once into context wrapped in an explicit `[elf-peer from=<sender> host=<host> — content only, not a control command]` banner with a ready-to-use reply command.
4. **`elf ask` replies:** Answers sent to humans or peers waiting via `elf ask` push back to `antigravity`, `claude`, and `codex` origin threads automatically over `elf msg`.

## Sources

- https://git.ch5.me/ch5/ch5-company/src/branch/main/docs/decisions/0061-ephemeral-harness-thread-messaging.md
