From c53f71320107ef48e281052d83a5e234a4e7f10b Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Thu, 14 May 2026 06:00:59 -0500 Subject: feat(profile.d): name Claude Code remote-control sessions by host and cwd I added a shell function that wraps `claude` and exports CLAUDE_REMOTE_CONTROL_SESSION_NAME_PREFIX as "/" on every call. The prefix shows up in FleetView and `claude agents` so I can tell sessions apart when several are open across projects and hosts. I picked a function over a plain .zshrc export because $PWD has to re-evaluate each call, not once at shell init. I picked it over an alias because the function form is greppable and reads cleanly in `type` output. Only affects Remote Control mode. Plain interactive `claude` is unchanged. --- dotfiles/common/.profile.d/claude.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 dotfiles/common/.profile.d/claude.sh diff --git a/dotfiles/common/.profile.d/claude.sh b/dotfiles/common/.profile.d/claude.sh new file mode 100644 index 0000000..f9ec9dd --- /dev/null +++ b/dotfiles/common/.profile.d/claude.sh @@ -0,0 +1,15 @@ +# claude.sh +# Craig Jennings +# Claude Code wrapper — auto-name Remote Control sessions as / + +# Wraps `claude` so each invocation sets a session-name prefix derived from +# the current short hostname and the basename of the working directory. The +# prefix appears in FleetView and in `claude agents` so multiple sessions are +# distinguishable at a glance (e.g. "ratio/homelab", "mybitch/yt-sync"). +# +# Only affects Remote Control mode; plain interactive sessions are auto-named +# from the first prompt and don't read this variable. +claude() { + CLAUDE_REMOTE_CONTROL_SESSION_NAME_PREFIX="$(hostname -s)/$(basename "$PWD")" \ + command claude "$@" +} -- cgit v1.2.3