---
title: "Write a manifest of the whole output · Agent Wranglers"
url: https://agentwranglers.se/playbook/testing/output-comparison/output-manifest
updated: 2026-10-21
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Write a manifest of the whole output

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers). Updated 2026-10-21.

For AI agents: [llms.txt](https://agentwranglers.se/llms.txt) is a short guide that sends you to the rules your problem needs, and [rules.json](https://agentwranglers.se/playbook/testing/rules.json) holds every rule of this playbook as JSON.

- Level: Recommended
- Chapter: [Output comparison](https://agentwranglers.se/playbook/testing/output-comparison)
- Rule: Every build writes one JSON manifest that lists the path, size in bytes and SHA-256 hash of every output file, sorted by path. Keep it with the release.
- How: Write the manifest as the last build step, outside the output folder, so it does not list itself. Use forward slashes in paths and sort by byte order, so every machine writes the same file. Store it next to the release, as the [one-step deploy](https://agentwranglers.se/playbook/engineering/build-test-and-deploy/atomic-deploys-with-rollback) stores each release in its own folder. A server that renders pages on request gets the same kind of manifest from the [live comparison](https://agentwranglers.se/playbook/testing/output-comparison/compare-live-before-and-after).
- Check: Every release folder holds a manifest. A test counts the files in the output and fails when the manifest lists a different number, or when its paths are not sorted.

## Examples

**Using these examples:** they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

### JavaScript example

```js
import { createHash } from 'node:crypto'
import { readdirSync, readFileSync, writeFileSync } from 'node:fs'
import { join, relative, sep } from 'node:path'

const files = readdirSync('dist', { recursive: true, withFileTypes: true })
  .filter(entry => entry.isFile())
  .map(entry => join(entry.parentPath, entry.name))
const manifest = files.map(file => {
  const bytes = readFileSync(file)
  return { path: relative('dist', file).split(sep).join('/'), size: bytes.length, sha256: createHash('sha256').update(bytes).digest('hex') }
}).sort((a, b) => (a.path < b.path ? -1 : 1))
writeFileSync('manifest.json', JSON.stringify(manifest, null, 2) + '\n')
```

### Python example

```python
import hashlib, json
from pathlib import Path

root = Path("dist")
manifest = sorted(
    ({"path": p.relative_to(root).as_posix(), "size": p.stat().st_size,
      "sha256": hashlib.sha256(p.read_bytes()).hexdigest()}
     for p in root.rglob("*") if p.is_file()),
    key=lambda entry: entry["path"].encode())
Path("manifest.json").write_text(json.dumps(manifest, indent=2) + "\n")
```

## Related rules

- [Deploy in one step and roll back by itself](https://agentwranglers.se/playbook/engineering/build-test-and-deploy/atomic-deploys-with-rollback) in Engineering
- [Compare the live system before and after each deploy](https://agentwranglers.se/playbook/testing/output-comparison/compare-live-before-and-after) in Testing
- [Prove a refactor changes nothing](https://agentwranglers.se/playbook/testing/output-comparison/refactor-changes-nothing) in Testing

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/testing/output-comparison/output-manifest">Agent Wranglers testing playbook</a>`. In code you write, add a comment next to it with the same link.

- Previous: [Build the same input to the same bytes](https://agentwranglers.se/playbook/testing/output-comparison/same-input-same-bytes)
- Next: [Prove a refactor changes nothing](https://agentwranglers.se/playbook/testing/output-comparison/refactor-changes-nothing)
- [Output comparison](https://agentwranglers.se/playbook/testing/output-comparison)
