Skip to content

feat: auto-inject --remote-control for interactive sessions#24

Merged
smartwatermelon merged 2 commits intomainfrom
claude/feature-auto-remote-control-1773938033
Mar 19, 2026
Merged

feat: auto-inject --remote-control for interactive sessions#24
smartwatermelon merged 2 commits intomainfrom
claude/feature-auto-remote-control-1773938033

Conversation

@smartwatermelon
Copy link
Copy Markdown
Owner

Summary

  • Every bare claude invocation now automatically registers a named remote session, making it instantly accessible from claude.ai/code and the Claude mobile app
  • Session name is derived from the git repository root (or basename $PWD outside a repo)
  • Injection is skipped for non-interactive uses: --print, --version, --help, --remote-control/--rc (already present), --no-session-persistence, and any positional subcommand arg
  • Opt-out: CLAUDE_NO_REMOTE_CONTROL=true

Changes

File Change
lib/remote-session.sh New module: get_remote_session_name, is_interactive_session, build_remote_control_args
bin/claude-wrapper Sources new module; injects RC args before exec
tests/test-remote-session.sh 22 tests covering all detection paths and opt-out
README.md Feature docs, Remote Control section, troubleshooting, v3.1.0 changelog
tests/README.md References new test file

Test plan

  • tests/test-remote-session.sh — 22/22 passing locally
  • Pre-commit hooks: shellcheck clean, markdownlint clean, code-reviewer PASS, adversarial-reviewer PASS
  • Verify claude in a git repo shows remote session named after repo in claude.ai/code
  • Verify claude --print "hello" is unaffected (no injection)
  • Verify claude remote-control is unaffected
  • Verify CLAUDE_NO_REMOTE_CONTROL=true claude skips injection

🤖 Generated with Claude Code

…ssions

Every interactive `claude` invocation now automatically registers a named
remote session via `--remote-control <name>`, making it immediately accessible
from claude.ai/code and the Claude mobile app without any manual setup.

Session name is derived from the git repository root (or current directory
when outside a repo), matching the mental model of "what am I working on."

Injection is skipped automatically for non-interactive uses:
- --print / -p (print mode)
- --version, --help
- --remote-control / --rc (already present)
- --no-session-persistence (focused analysis / CI)
- Any positional arg (subcommands: remote-control, mcp, etc.)

Opt-out: CLAUDE_NO_REMOTE_CONTROL=true

New files:
- lib/remote-session.sh: three focused functions (get_remote_session_name,
  is_interactive_session, build_remote_control_args)
- tests/test-remote-session.sh: 22 tests, all passing

Updated:
- bin/claude-wrapper: sources new module, injects RC args before exec
- README.md: feature docs, Remote Control section, troubleshooting, changelog
- tests/README.md: new test file referenced

AI review: code-reviewer
Issues fixed: executable bit, markdownlint table style

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Flag values (e.g. the "hello" in `claude -c "hello"`) were incorrectly
classified as subcommands, causing remote control injection to be skipped
for the most common interactive invocation pattern.

Fix: track whether any flag has been seen. A bare positional arg is only
treated as a subcommand when it appears before any flags. Subcommands
(remote-control, mcp, etc.) always precede flags; flag values always
follow their flag.

Post-push loop iteration 1: sentry[bot] lib/remote-session.sh:56

Added tests: -c value, --model value, --resume value, subcommand+flags

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@smartwatermelon smartwatermelon merged commit ef52b2f into main Mar 19, 2026
4 checks passed
@smartwatermelon smartwatermelon deleted the claude/feature-auto-remote-control-1773938033 branch March 19, 2026 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant