Feature request: External message injection API for active Claude Code sessions

Resolved 💬 3 comments Opened Apr 24, 2026 by pablomatices Closed Apr 28, 2026

Summary

Add a mechanism to send a prompt to an already-running Claude Code session from an external process and receive the response — without requiring the user to type in the UI.

Use case

I'm building a WhatsApp companion bot (Hermes) that bridges my phone to my Claude Code sessions. When I'm away from my Mac, I want to send a message like "check the Saturno project for pending proposals" and have it run inside my actual active Saturno session — with its full conversation history and context — then receive the result back on WhatsApp.

Today I can run claude --print "task" --cwd /project/dir which correctly picks up CLAUDE.md and project files. But this creates a new session, losing the in-memory conversation history of the session currently open in the UI.

Proposed solution

Any of these would work:

  1. Named pipe / Unix socket per session: ~/.claude/sessions/<session-id>.sock — write a prompt, read the response.
  2. --session-id <uuid> flag for --print: run a task inside an existing session by ID, not just resume its history.
  3. Local HTTP endpoint per running session (e.g., localhost:PORT/prompt) — POST a message, GET the streaming response.
  4. --continue --print that actually injects into the latest session rather than creating a fork.

Why this matters

This is the missing piece for Claude Code to work as a true background agent. Right now external tools can:

  • ✅ Trigger new sessions
  • ✅ Read project files
  • ✅ Use --continue to resume history

But they can't:

  • ❌ Talk to the session the user has currently open
  • ❌ Inject a prompt into a running agentic loop
  • ❌ Get a response from a session without the user being at the keyboard

A simple IPC mechanism would unlock Claude Code as a true AI companion — reachable from mobile, from other processes, from voice assistants, from automation tools.

Current workaround

Running claude --print "task" --cwd /project/dir in the correct project directory. Works, but creates a parallel session without the active conversation context.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗