# Build and maintain the activity graph

Canonical: https://hypaware.ai/docs/cli-reference/build-and-maintain-the-activity-graph

Plugin: `@hypaware/context-graph`. Use graph help to list the active commands:

```text
hyp graph <subcommand> [args...]
```

```sh
hyp graph --help
```

## `hyp graph project`

```text
hyp graph project [--source <dataset>] [--refresh] [--dry-run]
```

Reads registered projection contracts and writes the derived `node` and `edge`
datasets. It is idempotent, and existing nodes and edges keep their properties
unless you pass `--refresh`, which replaces matching rows with what the
recordings show now. `--source` limits projection to one source dataset, and
`--dry-run` writes nothing. An empty successful result means that no
eligible recordings exist.

```sh
hyp graph project --dry-run
```

## `hyp graph compact`

```text
hyp graph compact [--dry-run]
```

Merges duplicate graph rows and rewrites affected partitions in sorted order.
Queries don't require compaction, but large graphs can read faster afterward.

```sh
hyp graph compact --dry-run
```

