> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ellomas.com/llms.txt
> Use this file to discover all available pages before exploring further.

# graft verify

> Verify Merkle tree integrity of a branch.

# `graft verify`

Verify that the files in a branch directory match the Merkle tree root recorded in the DAG.

## Usage

```bash theme={null}
graft verify [branch] [flags]
```

If no branch is specified, the active branch is verified.

## Behavior

1. Resolve the branch's tip commit
2. Load the stored tree entries and Merkle root
3. Walk the branch directory, hash every file with BLAKE3
4. Build the Merkle tree from current files
5. Compare computed root against stored root
6. If the commit was unverified (`verified=0`) and verification passes, flip to `verified=1`

## Flags

| Flag        | Alias | Default | Description                     |
| ----------- | ----- | ------- | ------------------------------- |
| `--verbose` | `-v`  | `false` | Show per-file integrity details |

## Examples

### Verify Active Branch

```bash theme={null}
graft verify
```

```text theme={null}
✓ Integrity OK (147 files, root f0e1d2)
```

### Verify Specific Branch

```bash theme={null}
graft verify experiment
```

### Verify with File Details

```bash theme={null}
graft verify --verbose
```

```text theme={null}
✓ Integrity OK (147 files, root f0e1d2)
```

### Failed Verification

```bash theme={null}
graft verify experiment
```

```text theme={null}
✗ Integrity FAILED for experiment (2 changed, 1 missing)
  stored root: a1b2c3d
  actual root: f0e1d2
```

### Failed Verification with Verbose

```bash theme={null}
graft verify experiment --verbose
```

```text theme={null}
✗ Integrity FAILED for experiment (2 changed, 1 missing)
  stored root: a1b2c3d
  actual root: f0e1d2

STATUS    FILE                  EXPECTED HASH   ACTUAL HASH
changed   base/16384/12547     a1b2c3d4e5…     f0e1d2c3b4…
missing   global/pg_control    9876543210ab…   (none)
```

## Diff Types

| Status    | Meaning                                              |
| --------- | ---------------------------------------------------- |
| `changed` | File exists but content hash differs from stored     |
| `missing` | File expected by the DAG but not found on disk       |
| `extra`   | File on disk not recorded in the DAG for this commit |

## Exit Codes

| Code | Meaning                               |
| ---- | ------------------------------------- |
| `0`  | Integrity check passed                |
| `1`  | Verification failed or error occurred |
