The background daemon
Check the background sc process with `sc daemon status`. `sc` starts it on demand, so you rarely manage it.
Do this for me on this machine: check my superclaude daemon is running on the current sc build, and upgrade it if it is stale. This is superclaude's own guide. Read all of it as raw Markdown first, without summarizing it: curl -fsSL "https://superclaude.io/docs/daemon.md" Then: 1. Tell me in a few lines what you are going to change. 2. Do every step yourself: run the commands, edit the files, check each result. 3. Stop only for what needs me: a browser sign-in, a choice between options, a secret to paste. 4. Finish by showing it works, and tell me the one command I will use from now on. Other superclaude pages, if you need them: https://superclaude.io/llms.txt
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.scwaits 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.tomlhas 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 statusIt 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
| Command | What it does |
|---|---|
sc daemon status | Running or not, pid, build, and STALE when its build differs from your sc. |
sc daemon start | Starts it if it is not running. |
sc daemon stop | Lets in-flight gateway requests finish, then exits. |
sc daemon stop --force | Stops immediately. |
sc daemon upgrade | Reloads it onto the current sc binary at a quiet moment. |
sc daemon upgrade --force | Reloads now. Requests mid-stream are cut. |
sc daemon reap | Reconciles 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_secsit 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 statusreports abandoned upgrades. - Long-running agents hold a stream open for their whole run, so abandonment is common.
sc daemon upgrade --forceswaps at once: requests mid-stream are cut, and queued connections go to the new build. - If the daemon has stopped answering,
upgraderestarts 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.
| Setting | Scope |
|---|---|
--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.toml | Every 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 startOn 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
| Key | Default | What it does |
|---|---|---|
[daemon] port | 48770 | The control and gateway port. |
[daemon] reload_max_defer_secs | 600 | How long an upgrade waits for a quiet moment before draining. |
[daemon] upstream_idle_timeout_secs | 1800 | The longest silence allowed between two bytes of an upstream response. 0 removes the bound. |
[daemon.accounts_monitor] enabled | false | Switches the active Claude Code account near its usage limit (macOS). |
[daemon.accounts_monitor] interval_seconds | 120 | Seconds between usage checks. |
[daemon.accounts_monitor] switch_threshold_percent | 95 | Usage percentage that triggers a switch. |
[notify] on_blocked | true | Set false to stop the desktop notification when a session waits on you. |
[backup] | absent | Its 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