[FEATURE] Read a local session's replies from the CLI

Status Open
Maintainer reply None cached
Activity 0 comments · opened Oct 15, 2026

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

Cross-session messaging lets a script or another agent post into a running local session through its inbox socket (CLAUDE_CODE_MESSAGING_SOCKET). The other direction has no supported path: an external process cannot read what a local session answered.

Concretely, we coordinate Claude Code desktop sessions with Codex threads on the same machine. Claude can message a Codex thread and read its reply through Codex's own interfaces, but a Codex thread (or a script) that posts into a Claude Code session cannot read that session's reply. claude logs <id> only covers background sessions and prints recent terminal output, not the assistant messages, and the transcript JSONL is an internal format.

A second gap on the same path: a session in bypass-permissions mode holds messages posted to its socket for approval, and the desktop app cannot show that dialog, so unattended posts expire after dialogExpiry. That may be intended; it would help if the documentation said how an external sender should identify itself, or how a user can admit a specific local sender without accepting every message.

Proposed Solution

A CLI read path for local sessions, for example:

claude session read <session-id> [--after <message-id>] [--json]

It would print the session's user and assistant messages (not tool output) in order, with stable message ids, so a sender can read the assistant messages that follow its own post. A --wait --timeout <seconds> option returning when the session goes idle would let a sender block for the reply, mirroring the idle notice that SendMessage already offers between Claude sessions.

Alternative Solutions

Reading ~/.claude/projects/**/<session>.jsonl works but couples external tools to an internal transcript format. claude --resume <id> "prompt" sends, but does not return the reply of an interactive desktop session.

Priority

Medium - Would be very helpful

Feature Category

CLI commands and flags

Use Case Example

  1. A Claude Code desktop session queues a coordination question into a Codex thread.
  2. The Codex thread posts its answer into the Claude session's inbox socket.
  3. The Claude session replies, and the Codex thread reads that reply with claude session read <id> --after <message-id> --json to continue its work.

Additional Context

Related: #97746 (claude send), #98369 (local tools sending into desktop sessions), #88970 (replies to cross-session messages), #24947 (claude inject, with a comment proposing claude output --format json). This request covers only reading a local session's replies.

View original on GitHub ↗