The background daemon

Check the background sc process with `sc daemon status`. `sc` starts it on demand, so you rarely manage it.

sc starts the daemon on demand. It runs detached, outlives the shell that started it, and does three jobs:

  • Gateway. On a profile other than direct, Claude Code’s model requests go to the daemon, which routes each role to its endpoint and refreshes Codex and Grok sign-ins. sc waits for it to confirm the endpoints are reachable and the keys valid, so a bad key fails the launch, not the first request.
  • Session events. Each session reports its lifecycle events and a heartbeat. The daemon counts open and waiting sessions and running subagents for the status line and sc daemon status, and on macOS notifies you when a session is waiting on you.
  • Scheduled jobs. Backups run only when config.toml has a [backup] table. The accounts monitor, which switches your Claude Code login near its usage limit (macOS), runs only when you enable [daemon.accounts_monitor].
sc daemon status

It prints whether the daemon is running, its pid and build, and STALE when the build differs from your sc.

Start, stop, upgrade or reap it
CommandWhat it does
sc daemon statusRunning or not, pid, build, and STALE when its build differs from your sc.
sc daemon startStarts it if it is not running.
sc daemon stopLets in-flight gateway requests finish, then exits.
sc daemon stop --forceStops immediately.
sc daemon upgradeReloads it onto the current sc binary at a quiet moment.
sc daemon upgrade --forceReloads now. Requests mid-stream are cut.
sc daemon reapReconciles the session and subagent counts now and says what it dropped and why.
Upgrade it after installing a new sc

Re-running the installer upgrades sc and, when a daemon is running, runs sc daemon upgrade for you. Otherwise the daemon never reloads on its own. If sc daemon status says STALE, run:

sc daemon upgrade
  • An upgrade waits for a moment with no gateway stream in flight. The listening socket survives the swap, so live sessions never see a refused connection.
  • After reload_max_defer_secs it stops taking new gateway requests so the rest can finish. If it is still busy 300 seconds later, the upgrade is abandoned and the old build keeps running. sc daemon status reports abandoned upgrades.
  • Long-running agents hold a stream open for their whole run, so abandonment is common. sc daemon upgrade --force swaps at once: requests mid-stream are cut, and queued connections go to the new build.
  • If the daemon has stopped answering, upgrade restarts it.
Launch without the daemon

Every sc launch starts the daemon if it is not already running, except an incognito launch (-i) and --no-daemon. sc usage starts it too.

--no-daemon launches plain first-party Claude Code with no gateway and no session events. The status line still shows, without daemon data. The flag refuses an explicit non-direct profile and ignores default_profile from config.toml.

Move the daemon to another port

The daemon listens on one fixed loopback port, 127.0.0.1:48770, for both its control routes and the gateway. Change it only if something else already holds that port.

SettingScope
--daemon-port <n>One run. Works on any launch and on sc daemon start, status and stop. It exports SUPERCLAUDE_DAEMON_PORT, so the daemon and any nested sc agree.
SUPERCLAUDE_DAEMON_PORT=<n>Your environment.
[daemon] port = <n> in config.tomlEvery run.

The environment wins over config.toml, which wins over the default. A running daemon picks up a new port only on restart:

sc daemon stop && sc daemon start

On Linux the default ephemeral port range, 32768 to 60999, contains 48770, so another program’s outbound connection can occasionally hold it. If you see an intermittent “port already in use”, move the port below 32768. The macOS range starts at 49152.

Find the daemon’s socket and log

The runtime directory is $XDG_RUNTIME_DIR/superclaude/, else $TMPDIR/superclaude-<uid>/, else /tmp/superclaude-<uid>/. SUPERCLAUDE_RUNTIME_DIR overrides it. It holds the socket, the lock file, the pid file, and daemon.log, which is size-capped with one rotated copy.

Change daemon settings in config.toml
KeyDefaultWhat it does
[daemon] port48770The control and gateway port.
[daemon] reload_max_defer_secs600How long an upgrade waits for a quiet moment before draining.
[daemon] upstream_idle_timeout_secs1800The longest silence allowed between two bytes of an upstream response. 0 removes the bound.
[daemon.accounts_monitor] enabledfalseSwitches the active Claude Code account near its usage limit (macOS).
[daemon.accounts_monitor] interval_seconds120Seconds between usage checks.
[daemon.accounts_monitor] switch_threshold_percent95Usage percentage that triggers a switch.
[notify] on_blockedtrueSet false to stop the desktop notification when a session waits on you.
[backup]absentIts presence turns on scheduled backups.

Edit the file with sc edit config. A port change needs a restart; the backup table is re-read on every cycle.

Next: How it fits together

View as Markdown