# CLI Reference
> The cgraph, graphd, and cgraph-client commands and their flags.
[Source](https://open.nxtsoft.io/docs/cgraph/cli)

CGraph ships four binaries. This page is the reference for the command-line
surface; see [Quick Start](/docs/cgraph/quick-start) for a guided walkthrough.

## cgraph

The one-shot CLI: scan a tree, build the graph, write exports, exit.

```text
cgraph [--root PATH] [--out PATH]
```

| Flag | Meaning |
| --- | --- |
| `--root` | Source tree to scan (defaults to the current directory). |
| `--out` | Directory for the graph and exports. |

### Enrichment subcommands

`cgraph` also drives the host-side semantic enrichment workflow:

```text
cgraph enrich-plan   [--root PATH] [--out PATH] [--drop DIR]
cgraph enrich-ingest [--root PATH] [--out PATH] [--drop DIR]
```

| Flag | Meaning |
| --- | --- |
| `enrich-plan` | Produce a chunk plan for host-written enrichment fragments. |
| `enrich-ingest` | Validate and fold host-written fragments into the graph. |
| `--drop` | The semantic drop directory for enrichment fragments. |

## graphd

The daemon: keep the graph warm and watch the tree.

```text
graphd --root PATH [--idle-timeout SECONDS] [--no-watch]
graphd --benchmark-query --graph PATH --query TEXT
graphd --version
```

| Flag | Meaning |
| --- | --- |
| `--root` | Project tree to index and watch. |
| `--idle-timeout` | Shut down after this many idle seconds. |
| `--no-watch` | Don't watch the tree; update only on explicit ops. |
| `--benchmark-query` | Run a one-off benchmark query against a graph. |
| `--graph` / `--query` | The graph path and query text for `--benchmark-query`. |
| `--version` | Print the version. |

## cgraph-client

The thin client: send an operation and a JSON payload to a running daemon.

**operations**

```bash
cgraph-client --root /path/to/project query   '{"q":"Parser"}'
cgraph-client context '{"q":"Parser","budget":5000}'
cgraph-client update  '{"path":"."}'
cgraph-client status
cgraph-client shutdown
```

The operations mirror the MCP tools: `query`, `explain`, `impact`, `path`,
`context`, `update`, `status`, and `shutdown`.

## cgraph-mcp

The MCP server, run by an agent over stdio. It takes `--root` and `--daemon`
and otherwise resolves both from the environment — see
[MCP Integration](/docs/cgraph/mcp).

Flags shown here are those stated in the public README. Additional flags and
defaults (for example, the `--idle-timeout` default) are not enumerated publicly
and are left out rather than guessed.
