Skip to content

feat(claude-as): --check notes a home whose new sessions start in Code Mode instead of Remote Control - #88

Merged
gutyoh merged 2 commits into
mainfrom
feat/claude-as-check-code-mode-note
Nov 18, 2026
Merged

gutyoh merged 2 commits into
mainfrom
feat/claude-as-check-code-mode-note

Conversation

@gutyoh

@gutyoh gutyoh commented Nov 18, 2026

Copy link
Copy Markdown
Owner

Why

Code Mode turns Remote Control off. A session started in Code Mode never appears in other machines' ListAgents, so SendMessage cannot reach it. On 2026-11-18 a hand-written CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 in the shared settings did this on the devbox and the M4 without anyone noticing. #86 made Code Mode opt-in, but nothing reported it when it was on where Remote Control is meant to start.

What changes

  • bin/claude-as --check: for each home where remoteControlAtStartup is on and Code Mode is on for new sessions, it prints:
    • note new sessions here start in Code Mode, without Remote Control: setup.sh --no-code-mode turns it off, or
    • ...: CLAUDE_CODE_EXPERIMENTAL_CODE_MODE in this environment turns it on when only the environment sets it.
      It is a note, not a failure, because Code Mode can be the person's choice; the exit status doesn't change. The check reuses remote_control_on and code_mode_on, the helpers the start and resume paths already use, so it can't drift from what a start does. An off in the environment, the user settings or managed settings beats any on, so a kept 0 stays quiet.
  • tests/claude-as.bats: three tests. (1) Code Mode on together with Remote Control at startup gives the note once per home. (2) No note when Remote Control isn't meant to start, when a 0 in the environment keeps Code Mode off, or when the settings have a 0. (3) When only the environment sets it, the note names the environment and doesn't send you to setup.sh.
  • docs/how-to-use-multiple-accounts.md: one sentence in the Code Mode note.

Checks

  • bats tests/claude-as.bats: 141/141. The 3 new tests are load-bearing: with the note disabled, tests 1 and 3 fail.
  • just lint (shellcheck): pass.
  • shfmt 3.13.1 (the mise pin) with the repo flags on bin/claude-as: clean. just format-check with a local shfmt 3.14.1 also flags .claude/scripts/lib/statusline/data.sh and lib/setup/mcp.sh. It does the same on main, so this PR didn't cause it.
  • Real M4, read-only: claude-as --check with Code Mode off shows no note. With CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 it shows the environment note for both homes.

Stays clear of #87 and the fnox PR for #85; the files are listed by their author.

🤖 Generated with Claude Code

https://claude.ai/code/session_01M28j9ttBe7qZEaTtpVCKe3

…e Mode instead of Remote Control

Code Mode turns Remote Control off, so a session started in it never
appears in other machines' ListAgents and SendMessage cannot reach it. On
2026-11-18 a hand-written CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 in the
shared settings did that quietly on two hosts. #86 keeps Code Mode opt-in,
but nothing said when it was on where Remote Control is meant to start.

--check now prints a note, not a failure, for each home where
remoteControlAtStartup is on and Code Mode is on for new sessions. It reuses
remote_control_on and code_mode_on, the helpers the start and resume paths
use, so the check cannot drift from what a start does. The note names the
fix: setup.sh --no-code-mode when the settings turn it on, or the
environment variable when only the environment does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M28j9ttBe7qZEaTtpVCKe3
@gutyoh

gutyoh commented Nov 18, 2026

Copy link
Copy Markdown
Owner Author

Self-review, no code change:

  • The environment case is real, not a corner case. In a running Claude session on the M4, the shells still had CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 after the key was removed from settings.json: settings env reaches child shells, but removing it doesn't take it back out. A claude started from such a shell would start in Code Mode. The env-only note names that cause, and setup.sh can't fix it.
  • Known limit: remote_control_on and code_mode_on read the home's settings.json, the cwd's project files and managed settings. They don't read a launcher's --settings <file>, such as the agent-router menus. On the M4 none of the three menus sets either key; I checked them earlier today. A follow-up could teach both helpers about --settings, but the start path doesn't read it either, so --check stays consistent with what a start does.
  • Placement: the note comes after the login lines and before the link checks, in each home's block, so it reads next to the account it concerns.
  • Exit status: unchanged, because it is a note. A Code Mode home with Remote Control meant to start is a choice the person can make.

…variable, not the host

Cross-review from the devbox session: when only the environment turns Code
Mode on, the variable usually came from a session started while the
settings had the key, which passes it to its child shells. Those keep it
after the key is removed. So the note is true of sessions started from this
shell, not of the host's new sessions, and now says so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M28j9ttBe7qZEaTtpVCKe3
@gutyoh
gutyoh merged commit 47c9720 into main Nov 18, 2026
10 checks passed
@gutyoh
gutyoh deleted the feat/claude-as-check-code-mode-note branch November 18, 2026 20:39
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