# Consume a snapshot

Run Enola as a subprocess and load the graph into your own store.

> Web page: https://enola.tech/docs/snapshot-files
> All pages: https://enola.tech/llms.txt

## Produce a snapshot

One repository:

```shell
enola --generate /path/to/repo
```

Several repositories, one linked graph:

```shell
enola --generate cluster.yaml --out /var/lib/acme/enola-graph
```

One repository writes to its own `.enola/`. A cluster writes once, to `--out`, or to `~/.enola/graphs/<key>/` without it, and the run prints the directory as `Output:`.

Exit code `0` means the files are current. On any other code, do not read files already in the directory. When nothing changed, the run prints `Snapshot unchanged` and writes nothing. Keep `extractor_cache.json` between runs to stay fast.

## Load the files

| File | Contents |
| --- | --- |
| `receipt.json` | Format version, snapshot id, provenance, counts and extraction quality |
| `facts.jsonl` | The graph, one fact with its relations per line |
| `insights.json` | Findings with their evidence |
| `flows.json` | The ways into the program, ranked by reach |
| `docs.jsonl` | Full comments, joined to facts by `id` |

1. **Read the receipt first.** Reject a `format_version` you do not support. Skip the load when `snapshot_id` is the one you have.
2. **Check what you read** against `fact_count`, `insight_count` and `output_hashes`. Trust `flows.json` and `docs.jsonl` only when `output_hashes` lists them.
3. **Load facts by `id`.** Several records can share one, so merge their relations and keep every location.
4. **Load relations by `target_id`.** When it is absent, keep the target name as unresolved. Do not pick a match.
5. **Load findings.** A missing `fact_id` in the evidence is valid.
6. **Show the quality block.** Parse errors and excluded files say how complete the graph is.

## Read while a run writes

A run publishes by renaming files into place, `receipt.json` last, and keeps the snapshot before it in `previous/`. A reader should read the receipt first and compare each file with `output_hashes`. On a mismatch, read again a moment later, or read `previous/`.

## Plan for a new Enola

The Enola version is part of `snapshot_id`, so an upgrade changes it and you should load again. Accept unknown kinds and properties within a supported `format_version`.

Complete rules are in [INTEGRATING.md](https://github.com/enola-labs/enola/blob/main/docs/INTEGRATING.md), and every field is in the [schema](https://github.com/enola-labs/enola/tree/main/docs/schema). [The graph](https://enola.tech/docs/graph.md) explains what the facts mean.
