# Manifest

The manifest is a local JSON file that maps SHA-256 hashes to file paths and metadata. It is the bridge between CertiSigma attestations (hash-only, server-side) and the local filesystem (path + size + mtime, client-side).

**The manifest never leaves the client.** CertiSigma sees only hashes.

## Location

By default, Census writes the manifest to `<scanned_directory>/.census-manifest.json`. Override with `--manifest /path/to/output.json`.

## Schema (version 1)

```json
{
  "version": "1",
  "created_at": 1711234567.89,
  "updated_at": 1711234890.12,
  "root_dir": "/path/to/scanned/directory",
  "entries": {
    "a1b2c3d4...64hex...": {
      "hash_hex": "a1b2c3d4...64hex...",
      "path": "relative/path/to/file.pdf",
      "size": 1048576,
      "mtime": 1711234500.0,
      "attested": true,
      "attestation_id": "att_abc123",
      "attested_at": "2026-03-18T14:30:00Z"
    }
  }
}
```

### Fields

| Field | Type | Description |
|-------|------|-------------|
| `version` | string | Manifest schema version (currently `"1"`) |
| `created_at` | float | Unix timestamp of manifest creation |
| `updated_at` | float | Unix timestamp of last modification |
| `root_dir` | string | Absolute path of the scanned directory |
| `entries` | object | Hash-indexed map of file entries |

### Entry fields

| Field | Type | Description |
|-------|------|-------------|
| `hash_hex` | string | SHA-256 hash (64 hex characters) |
| `path` | string | Relative path from `root_dir` |
| `size` | int | File size in bytes |
| `mtime` | float | File modification time (Unix timestamp) |
| `attested` | bool | Whether this hash has been attested |
| `attestation_id` | string or null | CertiSigma attestation ID |
| `attested_at` | string or null | ISO 8601 timestamp of attestation |

## Status command

```bash
census status /path/to/.census-manifest.json
```

Output:

```
Manifest: /data/.census-manifest.json
Root:     /data/sensitive-files
Total:    1523
Attested: 1500
Pending:  23
```

## Export command

Export the manifest contents as CSV or JSON for use in other tools.

```bash
# Export as CSV (default)
census export manifest.json --output inventory.csv

# Export as JSON
census export manifest.json --format json --output inventory.json

# Pipe CSV to stdout
census export manifest.json | head -5
```

CSV columns: `hash_hex`, `path`, `size`, `mtime`, `attested`, `attestation_id`, `attested_at`.

## Atomic saves

Manifest saves use an atomic write pattern: data is written to a `.tmp` file first, then renamed to the final path. This prevents corruption if the process is interrupted during a write.

## Merge behavior (resume)

When resuming a scan (`--resume`), the existing manifest is merged with new scan results:

- **New files** are added.
- **Unchanged files** (same path, size, mtime) keep their existing hash and attestation state.
- **Modified files** (different size or mtime) are re-hashed; attestation state is preserved if the hash is unchanged.

See [scanning.md](scanning.md) for resume details.
