feat: SIGHUP handler for config and plugin reload (headless-friendly alternative to /reload-plugins)
Summary
Add a SIGHUP handler that triggers a config and plugin reload without restarting the session. This is the POSIX-standard mechanism for telling a running daemon "re-read your configuration" and would complement the existing /reload-plugins slash command.
Motivation
The /reload-plugins slash command already exists and proves the concept is supported. However, slash commands require an interactive TTY session. When Claude Code runs headlessly — in a CI pipeline, as a background agent, or in a tmux/screen session — there's no way to trigger a reload without killing and restarting the process and losing session state.
SIGHUP is the established POSIX convention for this operation. Every major Unix daemon (nginx, sshd, haproxy, postgresql) reloads configuration on SIGHUP. A system operator or orchestrator can simply run:
kill -HUP $(pgrep -f "claude")
This is especially useful when:
- A
.claude/settings.jsonorCLAUDE.mdfile has been modified mid-session - An MCP plugin has been updated and needs to be reloaded
- An orchestrator is managing multiple Claude Code sessions and needs to push config changes to all of them without restarting
Proposed behavior
On receiving SIGHUP:
- Re-read
~/.claude/settings.json, project-levelsettings.json, andCLAUDE.md - Reload MCP plugins (equivalent to running
/reload-plugins) - Log a status message indicating reload completed (e.g.,
[reload] Config and plugins reloaded.) - Do NOT interrupt the current turn — buffer the reload until the agent is between turns, or apply it immediately if idle
Implementation sketch
// In the main process setup, after existing SIGTERM/SIGINT handlers
if (process.platform !== 'win32') {
process.on('SIGHUP', () => {
// Trigger the same code path as /reload-plugins
// plus re-read settings/CLAUDE.md
});
}
Windows
POSIX signals don't exist on Windows. This handler should be registered conditionally (process.platform !== 'win32'). A Windows alternative (named pipe or file-based trigger) could be a follow-up.
Related
/reload-pluginsslash command (existing, interactive-only)- #5513 —
/reloadSettingscommand request - #24057 — auto-reload when config changes
---
Drafted with AI assistance. AI-C — human-directed, collaboratively written.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗