# Incremental Updates
> How the daemon keeps the graph current without rebuilding it.
[Source](https://open.nxtsoft.io/docs/cgraph/incremental-updates)

A warm graph is only useful if it stays current. The daemon folds changes into
the existing graph rather than rebuilding from scratch — most of the time.

## Fold-in vs. full rescan

_Small changes fold in; large batches rescan_

```text
edit a few files  ──>  incremental fold-in   (~ a couple of seconds)
branch switch     ──>  one full rescan        (collapses the batch)
```

- **Ordinary edits** are folded into the graph incrementally, usually within a
  couple of seconds.
- **A large batch** — switching branches, say — collapses into a single full
  rescan instead of thousands of tiny updates. Rebuilding once is cheaper than
  folding in a whole tree's worth of changes.

## Explicit updates

Without `--watch`, or to force a refresh, ask the daemon to update:

**explicit rescan**

```bash
cgraph-client update '{"path":"."}'
```

## Persistence

Incremental state is re-persisted to `cgraph-out/` in the background and on
shutdown, so the next start resumes from the current graph rather than a cold
build.

## Building vs. empty

While the graph is under construction, queries return `graph_state: "building"`,
so a caller can tell "not ready yet" apart from "genuinely no results".

The debounce window and the batch-size threshold that tips a fold-in into a full
rescan are not stated in the public README, and are left pending rather than
invented.
