Expose remote control session state to hooks
Feature Request
When a Claude Code session has an active remote control connection, hooks have no way to detect this. It would be valuable to expose remote control state — either as an environment variable in the hook environment (e.g., CLAUDE_REMOTE_CONTROL=true) or as a field in the JSON input passed to hooks via stdin.
Use Case
I have a Notification hook that sends Pushover push notifications to my phone when Claude is waiting for approval. This works great when I'm away from my desk — I get a ping, walk over, approve, and work continues.
However, when I'm using remote control from my phone, these notifications become spam. Every approval request triggers a push notification to the same phone I'm already actively using to interact with the session. The notifications are disruptive and redundant.
The hook uses macOS ioreg idle time to decide whether to notify, but during remote control the Mac's idle time stays high (no local mouse/keyboard input) even though I'm actively working. There's no reliable way to distinguish "user is AFK" from "user is working via remote control."
Current Workaround
I use a manual flag file (~/.claude/.remote-control) that I touch before starting remote control and delete when done. The hook script checks for this file and skips notifications when it exists. This works but requires manual management.
Proposed Solution
Any of these would work:
- Environment variable — Set
CLAUDE_REMOTE_CONTROL=true(or a session count) in the hook's environment when one or more remote control clients are connected - JSON field — Include
"remote_control": truein the JSON input passed to hooks via stdin - Session info file — Write a file (e.g.,
~/.claude/remote-control-sessions) that lists active remote control connections, which hooks can check
Option 1 is simplest and most useful for shell scripts.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗