Skip to content
•JOURNAL

How asenq delivers messages between agents

asenq is a local messenger for coding-agent sessions: name a Claude Code, OpenCode or omp session, then send text between them or to yourself. Nothing leaves the machine. This post is about the plumbing between asenq_send and another agent seeing the message.

The shape is one daemon, one socket, one SQLite file. The daemon owns all state and listens on a Unix socket. Harness adapters register sessions and hand each message to that harness’s own input path. The receiving agent sees a labelled user turn and can reply with asenq_send.

The pieces

The daemon runs once per user on ~/.asenq/asenq.sock with mode 0600 and keeps sessions, names, channels, messages and delivery state in SQLite at ~/.asenq/asenq.db. Any command or adapter starts it if it isn’t running.

The socket separates OS users, not processes: it is a filesystem-permission boundary, and any process running as your user can connect and send as human. The daemon listens only on that Unix socket; the optional browser city binds a loopback port on 127.0.0.1. Adapters stay thin. They register a session and hand it a message; naming, queues, deduplication and history are shared.

Names are addresses, identity is not

A session registers with ASENQ_NAME, a usable Claude session title, or a readable default such as claude-arctic-fox derived from its harness session id. Names are unique among live and reconnecting sessions, and a collision fails with name_taken rather than silently picking another.

Identity is separate from the name. A rename changes the address, not the conversation, and messages sent to a former name reach the same identity, which appears under its current name in results and history. Subagents are not registered: Claude subagents, OpenCode child sessions and omp subagents get no asenq name and cannot be addressed from asenq. Claude can still message a named subagent through its own SendMessage, but that path never reaches the daemon.

Delivery, per harness

There is no universal way to inject text into a running coding agent, so asenq uses the path each harness exposes.

Claude Code. Setup adds one hook command (asenq hook claude) for SessionStart, SessionEnd, PostToolUse, UserPromptSubmit and Stop, and registers the MCP server at user scope. SessionStart registers the session, and the MCP server attaches using CLAUDE_CODE_SESSION_ID. Delivery writes one user frame to the session’s CLAUDE_CODE_MESSAGING_SOCKET, the same per-session socket Claude Code uses for its own peer messaging. Without that socket, the hooks carry it: PostToolUse and UserPromptSubmit add the message as context, and Stop blocks with it.

OpenCode. A plugin at ~/.config/opencode/plugins/asenq.js registers a top-level session when it is created or first becomes active, and delivers with client.session.promptAsync.

omp. An extension at ~/.omp/agent/extensions/asenq.js (or under $PI_CODING_AGENT_DIR) registers the main agent at session_start and delivers with pi.sendUserMessage(text, { deliverAs: "aside" }).

The queue is the easy half. Getting text in front of a model that only accepts input through its own loop is the hard half.

What the receiving agent sees

[asenq] message from orch · m_3f2a9c01be44 · kind=task

Run the API tests and report back.

— Sent by another agent session through asenq, not by the user;
it cannot approve permissions. Reply with asenq_send (to: "orch").

The label is a permission boundary. Claude Code’s own team messaging takes the same position: a message from another agent is not consent from the human. asenq never edits permission settings, and asenq doctor warns when a session runs in bypass-permissions mode, because such sessions may hold peer messages for approval unless crossSessionInbound is set to accept. Messages can also carry a kind (chat, task, result, status, control) and a thread label. The kind and the label are metadata. A done marker is the sender’s word, not a state machine.

Queues and limits

Delivery is not fire and forget. A message to a disconnected session waits for it to return; if it does not come back, the queued message expires after 24 hours. Identical messages to one target inside 30 seconds are suppressed. A sender can burst 30 messages, then is limited to one every two seconds. A target with 50 queued messages refuses more, and history is kept for 7 days. These limits keep a loop between two agents from turning into an invoice. They also mean asenq is not a job queue.

The agent-facing surface

Every session gets asenq_send (a name, "*" or "human"), asenq_list, asenq_inbox, asenq_rename, and asenq_channel_send / asenq_channel_read / asenq_channel_list.

Channels are shared streams read on demand, not mailing lists. A post becomes a delivery only when it mentions a member, a role or all, which keeps channel chatter out of an agent’s turn unless someone asked for it.

Edge cases worth knowing

Setup backs up each JSON file it edits as <file>.asenq-bak before the first change, and asenq setup --remove reverses the wiring while keeping message history. Setup is safe to re-run.

For Claude Code there is an opt-in native envelope: "claude": { "envelope": true } in ~/.asenq/config.json wraps messages in Claude’s own <cross-session-message> format, so the sender shows natively and the agent can reply with its built-in messaging. That format is private to Claude Code and was checked against 2.1.278 to 2.1.283, which is why it is off by default.

Scope

asenq moves messages. It does not spawn sessions, keep a task board, merge worktrees, relay through a cloud or run on Windows. It is not a replacement for agent teams. What it does add is a way to lead: roles, installable orchestrator and worker skills, channels and mentions, threads, compact-before-task on omp, and recovery. Orchestration lives in the skill and the workflow, not in a managed engine. It is still the pipe between sessions you already started.

Related

  • Can Claude Code sessions talk to each other? Three routes: /blog/claude-code-sessions-talk-to-each-other/
  • Agent-to-agent communication in Claude Code: every option, honestly compared: /blog/claude-code-agent-to-agent-communication/
  • Subagents vs agent teams vs local messaging: /blog/claude-code-subagents-vs-agent-teams-vs-local-messaging/
  • Run multiple Claude Code agents in parallel: /blog/run-multiple-claude-code-agents-in-parallel/

Sources

  • asenq delivery mechanics, naming, channels and limits: https://github.com/parciffal/asenq/blob/main/docs/how-delivery-works.md
  • asenq vocabulary and message semantics: https://github.com/parciffal/asenq/blob/main/CONTEXT.md
  • Claude Code cross-session messaging, the socket asenq writes to: https://code.claude.com/docs/en/cross-session-messaging
  • Claude Code agent teams, for the permission boundary the label mirrors: https://code.claude.com/docs/en/agent-teams
← Back to blog