NxtSoftLabs
CGRAPH DOCS — CONTENTS
CGRAPH

Daemon Architecture

graphd is what makes the graph warm. Instead of rebuilding on every query, it holds the graph in memory, watches the tree, and folds in changes as they happen.

Lifecycle

start ──> build initial graph ──> serve + watch ──┐
                                        ^          │  edits: incremental fold-in
                                        └──────────┘  branch switch: full rescan

              idle-timeout / shutdown ──┴──> re-persist to cgraph-out/ ──> exit
The daemon's lifecycle

Startup

Launch the daemon against a project root:

start the daemon
graphd --root /path/to/project

On first run it builds the initial graph (seconds for a typical tree), then begins serving operations and watching the tree.

Watching

While running, the daemon watches the project and folds source edits into the graph incrementally — usually within a couple of seconds. A large batch, such as a branch switch, collapses into a single full rescan rather than thousands of tiny updates. Pass --no-watch to disable watching; updates then happen only via explicit update operations. See Incremental Updates for the details.

Flags

graphd --root PATH [--idle-timeout SECONDS] [--no-watch]
FlagMeaning
--rootProject tree to index and watch.
--idle-timeoutShut down after this many idle seconds.
--no-watchDon't watch the tree; update only on explicit ops.
Note

The default --idle-timeout value is not stated in the public README and is left pending rather than guessed.

Persistence and shutdown

Incremental state is re-persisted to cgraph-out/ in the background and on shutdown, so restarting the daemon resumes from the last graph instead of a cold rebuild. Shut it down explicitly with the client:

shut down
cgraph-client shutdown