feat: auto-inject --remote-control for interactive sessions#24
Merged
smartwatermelon merged 2 commits intomainfrom Mar 19, 2026
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
claudeinvocation now automatically registers a named remote session, making it instantly accessible from claude.ai/code and the Claude mobile appbasename $PWDoutside a repo)--print,--version,--help,--remote-control/--rc(already present),--no-session-persistence, and any positional subcommand argCLAUDE_NO_REMOTE_CONTROL=trueChanges
lib/remote-session.shget_remote_session_name,is_interactive_session,build_remote_control_argsbin/claude-wrapperexectests/test-remote-session.shREADME.mdtests/README.mdTest plan
tests/test-remote-session.sh— 22/22 passing locallyclaudein a git repo shows remote session named after repo in claude.ai/codeclaude --print "hello"is unaffected (no injection)claude remote-controlis unaffectedCLAUDE_NO_REMOTE_CONTROL=true claudeskips injection🤖 Generated with Claude Code