I often want to reload Claude Code mid-session to pick up changes to MCP servers, hooks, or other settings. The default workflow is a little clunky: I need to manually exit, then restart, then tell Claude that I restarted.
As a result, I wanted a /reload command that I could run to restart Claude and automatically continue the conversation. Also, by making it a command, Claude can actually invoke it itself when it detects a need to reload. This allows Claude to restart itself when needed without human intervention, so it can run more autonomously.
I figured this out when making (yet another) Google Drive MCP. I wanted to have Claude build it and automatically reload to test it.
Initial exploration
Since I was in Claude Code already, I worked on this with Claude. I figured we could find an approach that worked and then codify.
First attempt: Exit with a special code
Claude's initial idea was to have the skill exit Claude with some special exit code. Perhaps exit 42 to signal "please reload", and a wrapper script to listen for that code. This would work well since I already typically run Claude via short custom commands, so we could hook into that.
I asked about reasonable or semantic exit codes, and Claude suggested using 129 rather than an arbitrary code.
Exit code details
Claude says: SIGHUP (signal 1) is the Unix convention for "reload configuration". Daemons like nginx and Apache reload their config on SIGHUP rather than terminating. And exit code 128+N is the shell convention for "terminated by signal N." So 129 would mean "reload requested" -- semantically correct and following established Unix patterns.However, merely exiting from a Bash tool use doesn't work. Bash commands run in subprocesses, so exiting the subprocess with a special code just kills that subshell.
Second attempt: Find a built-in flag
We looked at Claude Code's docs and --help for a way to pass an exit code to /exit, but there's no /exit <code>, /reload, or /restart built-in.
