Feature Request: Inter-agent message injection — allow external processes to send prompts to a running Claude Code session
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
Problem
We are running multiple Claude Code instances as named agents coordinating on a shared codebase:
- vclod — Claude Code on a VPS (headless server), handles coding tasks
- mclod — Claude Code on a Mac, handles local dev/testing
- aclod — Claude Desktop with MCP tools, acts as orchestrator
The fundamental missing capability is the ability to send a message to a running Claude Code interactive session from an external process. Currently there is no API, socket, or pipe to inject a prompt into an active session.
When aclod (orchestrator) needs to unblock or redirect vclod (worker), the only options are:
- Have the human relay the message manually — not scalable, defeats the purpose of autonomous agents
- Use
UserPromptSubmithooks — only fires when the human types something, not truly autonomous - Use
claude --printheadless mode — works but loses persistent session context
This means true agent-to-agent communication requires the human to be the relay, which breaks any autonomous multi-agent workflow running in the user's absence.
Proposed Solution
One or both of the following:
Option A — External message injection API
A local socket, named pipe, or HTTP endpoint that accepts a prompt and injects it into a running Claude Code session identified by session ID or project directory. Similar to how tmux send-keys works for terminals.
Option B — InboxMessage or TeammateMessage hook event
A new hook event that fires when a designated "inbox file" (or any watched file/path) changes. The hook output would be injected into Claude's context automatically, without requiring human input. This would make the existing TeammateIdle hook pattern fully functional for async agent coordination.
Current Workaround
We built a git-backed inbox system (hub/vclod-inbox.md) with a UserPromptSubmit hook that checks for pending messages on every human prompt. It works when the human is present but fails for autonomous operation. We also tested claude --print as a headless subprocess triggered by a git-watch daemon — viable but loses interactive session continuity.
Why This Matters
The TeammateIdle hook already exists, which shows Anthropic is thinking about multi-agent coordination. This feature is the logical next step — agents need to be able to communicate directly without the human as an intermediary. Without it, Claude Code multi-agent setups require constant human supervision, limiting their value for agentic coding pipelines.
Proposed Solution
One or both of the following:
Option A — External message injection API
A local socket, named pipe, or HTTP endpoint that accepts a prompt and injects it into a running Claude Code session identified by session ID or project directory. Similar to how tmux send-keys works for terminals. The session ID is already exposed in hook payloads, so it could be the identifier.
Option B — File-watch hook event (InboxMessage or TeammateMessage)
A new hook event that fires when a designated watched file changes on disk. The hook output would be injected into Claude's context automatically, without requiring human input. This would make the existing TeammateIdle hook pattern fully functional for async agent coordination.
Either approach would allow one Claude Code instance to send a message to another without requiring the human to relay it manually.
Alternative Solutions
We have implemented or explored the following:
- UserPromptSubmit hook (implemented): Fires a shell script on every human prompt submission, checking the git-backed inbox. Works when a human is present to type something, but does not enable autonomous agent-to-agent messaging without human involvement.
claude --printheadless subprocess + git-watch daemon (designed, not built): A daemon watches the inbox file withinotifywait; on change, spawnsclaude --printwith the message as input. Near-synchronous but each invocation is a fresh context — loses the running session state and tool permissions.
- Human relay (current state): Human reads one agent's Telegram bell notification, then manually tells the other agent to check its inbox. Not acceptable for autonomous operation.
None of these fully solve the problem. A proper message injection API or file-watch hook event in the Claude Code runtime would fill the gap.
Priority
Critical - Blocking my work
Feature Category
CLI commands and flags
Use Case Example
_No response_
Additional Context
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗