[FEATURE] Scope cross-session messaging (ListAgents/SendMessage) to the session's project

Status Open
Reported on v2.1.260
Maintainer reply None cached
Activity 0 comments · opened Sep 4, 2026

Proposal

Please add a project scope for cross-session messaging.

Today ListAgents lists, and SendMessage delivers to, every Claude Code session on the machine. The only controls are all-or-nothing: crossSessionInbound (accept / hold / refuse), or permission deny rules on SendMessage and ListAgents, which also remove messaging to a session's own subagents. A UserPromptSubmit hook cannot serve as a filter either: peer messages do pass through it (the hook receives the full <cross-session-message from-name="..."> text and the session's cwd), but a block decision there ends the receiving session's current turn, which is worse than the stray message.

A setting such as crossSessionScope: "project" | "machine" (settable per project) would limit discovery and delivery to sessions whose working directory belongs to the same project or git repository, worktrees included. The key already exists: the harness derives from-name from the sender's cwd basename and passes cwd to hooks.

Use case

Several unrelated projects run concurrently on one machine, one of them with multiple coordinated sessions (worktree lanes) that message each other. A session working on a different app keeps receiving messages meant for the other project's lanes, which is distracting and error-prone. The current workaround is crossSessionInbound: "refuse" in the other projects' settings, which only works for projects that never use peer messaging themselves.

Related: #88939 (per-project session-name prefix) addresses naming, not the delivery radius.

Environment

  • 2.1.260 (Claude Code)
  • macOS (Darwin 25.5)

View original on GitHub ↗