# Generated Artifacts

> Derive every published form deterministically from one canonical source, and drift-check the committed output byte-for-byte.

**Tier:** 4 · **Normative weight:** supports `TM-PUB-002`, `TM-OBS-003`
**Requires:** nothing

## Problem it removes

Published forms — rendered docs, manifests, AI context files — get edited
directly, and the canonical source stops being canonical. Or they are
regenerated on a machine with a different toolchain and silently differ
from what review approved.

## Mechanism

One generator, deliberately minimal in its dependencies, that builds every
derived form from the canonical source: page markdown, bundled context, a
manifest binding each artifact to its SHA-256, machine schemas. The
generated tree is committed, and a `--check` mode rebuilds to a temporary
result and compares byte-for-byte — drifted or hand-edited artifacts fail
the check rather than shipping (the checking read repairs nothing,
per `TM-OBS-003`). The manifest's digests are what a downstream consumer
verifies against, and its source revision is what a
[publication freeze](/docs/truth-machine/kit/publication-freeze/) later
binds (`TM-PUB-002`).

A pre-commit gate that runs the check turns "never edit generated files"
from a reminder into a mechanism.

## Cost

Authoring: days for a real generator — the largest build cost in the
catalog, paid once. Per change: regeneration is one command, enforced by
the gate. Per session: none.

## Do not adopt when

Nothing is derived: the source is the published form. Adopt the smallest
piece that applies — a manifest with digests is valuable even when the
"generator" is a copy step.

## Evidence

This repository's own `build_publication.py` and pre-commit gate are the
assessed mechanism (see the
[publication contract](/docs/truth-machine/reference/publication/)); the
kinra-site renderer's snapshot check extends the same digest chain to the
served site. Observed in kinra-site.

## Template

None — generators are repository-specific; this repository's
[`manifest.json`](/docs/truth-machine/manifest.json) shows the output
contract.

## Related patterns

[Publication Freeze](/docs/truth-machine/kit/publication-freeze/) records
which generated artifact actually shipped.
