skip to content
ccdocs
Commands

cc daemon

Manage the cc daemon — the background process that owns all database writes, exposed as JSON-RPC 2.0 over a Unix socket at ~/.cc-cli/cc.sock.

Usage

cc daemon start              # start in the background (no-op if already running)
cc daemon stop               # stop the running daemon
cc daemon restart            # stop then start (pick up new service code)
cc daemon status             # running state, PID, uptime, RPC count, DB size
cc daemon status -q          # quiet probe: exit 0 if running, 1 if not
cc daemon start --foreground # run in this terminal (debugging)

Verbs

VerbDescription
startStart the daemon in the background. No-op if already running.
stopSend SIGTERM to the running daemon and wait for it to exit.
restartstop then start. Use after updating cc to pick up new service functions.
statusShow running state, PID, socket health, uptime, RPC count, DB size, and last error.
logsTail the daemon and RPC log files.

Flags

These flags are shared across the lifecycle verbs above (logs has its own — see its page).

FlagVerbsDescription
-q, --quietallSuppress output. For status, exit 0 if the daemon is running, exit 1 if not — nothing is printed. This is the contract the shell integration uses to decide whether to auto-launch (see below).
-f, --foregroundstart, restartRun in the foreground, logging to this terminal (Ctrl+C to stop). Useful for debugging.

Why a daemon?

The CLI, web companion, and VSCode extension can all run at the same time. SQLite only supports one writer at a time — without coordination, concurrent writes corrupt data.

The daemon is the single writer. All writes go through it via the Unix socket at ~/.cc-cli/cc.sock. Reads still go directly to the database (safe — SQLite supports unlimited concurrent readers).

Auto-start

The daemon starts automatically when any cc command needs to write — you don't normally run cc daemon start yourself. The shell integration probes it on each prompt and launches it on demand using the quiet status contract:

cc daemon status -q || cc daemon start

cc daemon status -q exits 0 when the daemon is running and 1 when it isn't, so the start only fires when nothing is listening. Use the lifecycle verbs explicitly to restart after an update or to check health.

Files

PathDescription
~/.cc-cli/cc.sockUnix socket — active while the daemon is running
~/.cc-cli/cc-daemon.pidPID file
~/.cc-cli/logs/cc.logDaemon log (rotating)
~/.cc-cli/logs/rpc.logRPC log (rotating)

On this page