# Record a lawyer's review

> Get the generated sentences in front of a lawyer, and record their review so that the documents stop being stamped as unreviewed drafts.

Get the generated sentences in front of a lawyer, and record their review so that the documents stop being stamped as unreviewed drafts. This guide is for the developer who prepares the material and for the lawyer who reviews it.

A review is recorded against the hash of a phrase's exact text. Read [documents and phrase review](/docs/manual/concepts/documents-and-phrase-review/) for the model. The short version: if anyone edits a reviewed sentence afterwards, it becomes a draft again without anyone having to notice.

There is no `consent-kit` command for exporting phrases or recording a review. Both are a few lines against the API of `@consent-kit/documents`, shown below.

## For the reviewer: what you are asked to review

You are reviewing **sentence templates**, not finished documents. A template looks like this:

| Id | EN | DE |
| --- | --- | --- |
| `basis.consent` | Consent (Art. 6(1)(a) GDPR) | Einwilligung (Art. 6 Abs. 1 lit. a DSGVO) |
| `retention.after_event` | {duration} after {event} | {duration} nach {event} |

- Words in `{braces}` are placeholders. They are filled in from the project's registry: a storage period, the name of a processor, a purpose title.
- Every sentence the generator can ever write is in the library. There is no other source of text, apart from an optional free-form introduction and closing that the project writes itself.
- English and German are reviewed separately. Approving one says nothing about the other.
- Your approval is tied to the exact wording. If you want a change, the changed text is what gets approved.

What your review covers, and what it does not, is set out in [FAQ and compliance notes](/docs/manual/faq/). In particular, it does not cover the facts a project fills in, or whether the documents are sufficient for a given site.

Ask for two things: the phrase export (step 2), and a set of generated documents for a real registry, so that you see the templates filled in and in context.

## 1. See what is in use

Your site uses a subset of the library. List the phrases your documents use that have no review:

```sh
npx consent-kit docs --json
```

```json
{
  "ok": true,
  "phraseLibraryHash": "bd6991600467f0f4e2aba0b868ca3bce221536ffae5300ee267c28e892216e27",
  "unreviewedPhrases": [
    { "id": "basis.consent", "locale": "en", "source": "library", "files": ["privacy-policy.en.md", "ropa.en.csv", "ropa.en.md"] },
    { "id": "basis.consent.explanation", "locale": "en", "source": "library", "files": ["privacy-policy.en.md"] }
  ]
}
```

(Trimmed.) Each entry names the phrase, the language and the files that use it. The text summary prints the count:

```
unreviewed  70 phrase texts in use have not been legally reviewed (70 en). The documents are stamped as unreviewed drafts. List them with --json.
```

## 2. Export the phrases

Add `@consent-kit/documents` as a development dependency and write the export to a file:

```js
// export-phrases.mjs
import { writeFileSync } from 'node:fs';
import { exportPhrases } from '@consent-kit/documents';

writeFileSync('phrases-for-review.md', exportPhrases());
```

```sh
node export-phrases.mjs
```

The file is one Markdown table of the whole library: the id, the English and German text, the review status per language with a short hash, and a note on where the phrase appears.

```
| `basis.consent` | Consent (Art. 6(1)(a) GDPR) | Einwilligung (Art. 6 Abs. 1 lit. a DSGVO) | EN: draft `826e14230b76`<br>DE: draft `c5cfbe327b4b` | Name of the lawful basis; heading in the privacy policy, cell in tables. |
```

Send it to the reviewer together with your generated `privacy-docs/`. Ask them to return, for every text they approve, the id, the language and the short hash shown next to "draft". The hash is what proves which wording they saw.

## 3. Record the review

There are two places a review can go. Choose by who the review is for.

### In your project

Use this when your own lawyer reviewed the texts for your site. It needs no change to consent-kit.

In `privacy.documents.json`, next to the registry, give the phrase's text and the review. To approve the library's wording unchanged, repeat it exactly:

```json
{
  "phrases": {
    "basis.consent": {
      "en": {
        "text": "Consent (Art. 6(1)(a) GDPR)",
        "review": {
          "reviewer": "J. Doe, Example LLP",
          "date": "2026-11-28",
          "contentHash": "826e14230b76ffb2b3cbee8be308d5cd3ebec663fa2fcfb40555e9fc45127991"
        }
      }
    }
  }
}
```

`contentHash` is the full SHA-256 of `text`, in lowercase hex, not the short form. Compute it with the package:

```js
import { phraseContentHash } from '@consent-kit/documents';

console.log(phraseContentHash('Consent (Art. 6(1)(a) GDPR)'));
// 826e14230b76ffb2b3cbee8be308d5cd3ebec663fa2fcfb40555e9fc45127991
```

or, for text that is already in Unicode NFC form, in a shell:

```sh
printf '%s' 'Consent (Art. 6(1)(a) GDPR)' | shasum -a 256
```

If the reviewer wants different wording, put their wording in `text` and hash that. A replacement may only use the placeholders the phrase already has.

Run `docs` again:

```sh
npx consent-kit docs
```

```
unreviewed  69 phrase texts in use have not been legally reviewed (69 en). The documents are stamped as unreviewed drafts. List them with --json.
override    basis.consent (en, reviewed by the project): "Consent (Art. 6(1)(a) GDPR)" replaces "Consent (Art. 6(1)(a) GDPR)"
```

The count went down by one. The override is listed on every run, with its status. If the status says `unreviewed`, the hash does not match the text.

Things to know:

- The review counts only while the hash matches. Edit `text` and the phrase is a draft again until you record a new review.
- The key under the phrase id is a registry locale (`de-AT`) or its base language (`de`). The registry locale wins when both are present.
- A project review pins your copy of the text. If a later version of consent-kit changes the library's wording, your documents keep printing your reviewed text; the report shows both, so you can see that they have diverged.
- An override that cannot be applied (unknown phrase id, empty text, a placeholder the phrase does not have) makes `docs` fail with `override_rejected`.

### In the library

Use this when the review is meant for everyone who uses consent-kit. It changes a file in the `@consent-kit/documents` package, so it is a contribution to the consent-kit repository.

From a clone of the repository:

```js
// record-review.mjs
import { writeFileSync } from 'node:fs';
import { PHRASE_REVIEWS, recordReview, renderReviewsModule } from './packages/documents/src/index.ts';

const reviews = recordReview(PHRASE_REVIEWS, {
  id: 'basis.consent',
  locale: 'en',
  reviewer: 'J. Doe, Example LLP',
  date: '2026-11-28',
  expectedHash: '826e14230b76',   // the short hash the reviewer returned
});

writeFileSync('packages/documents/src/phrases/reviews.ts', renderReviewsModule(reviews));
```

```sh
node --experimental-strip-types record-review.mjs
```

`recordReview` records the review against the current text of the phrase. With `expectedHash`, it refuses when the text has changed since the reviewer saw it:

```
consent-kit: the en text of "basis.consent" has changed since it was sent for review; export it again
```

`renderReviewsModule` writes the list back as source:

```ts
export const PHRASE_REVIEWS: readonly PhraseReview[] = [
  { id: 'basis.consent', locale: 'en', reviewer: 'J. Doe, Example LLP', date: '2026-11-28', contentHash: '826e14230b76ffb2b3cbee8be308d5cd3ebec663fa2fcfb40555e9fc45127991' },
];
```

Call `recordReview` once per approved text, passing each result into the next call. There is one review per phrase and language; a new one replaces the old. Do not edit `reviews.ts` by hand.

## 4. Gate on it

Once every phrase you use is reviewed, the "Unreviewed draft" banner disappears from the documents. Keep it that way in CI:

```sh
npx consent-kit docs --check --require-reviewed
```

`--require-reviewed` exits 1 while any phrase text in use has no review on record:

```
consent-kit: docs refused: --require-reviewed is set and unreviewed phrase texts are in use
```

It will start failing again when:

- you add a registry feature that uses a phrase you had not needed before (a first processor outside the EU, a first collection point);
- you add a locale;
- you update consent-kit and a library phrase changed, unless your project review pins that text.

Each of those is a reason to go back to the reviewer, which is the point.

## 5. Review the rest

The phrase library is not the whole document. Before publishing, someone qualified should also read:

- **The facts.** Purposes, bases, retention periods, recipients, the legitimate interests you state. They come from your registry and no phrase review covers them.
- **The `intro` and `outro` slots**, if you set them. They are your own text and are printed as written.
- **Your own registry texts**: purpose titles and descriptions, artefact descriptions, field notices and consequences. They appear in the banner and in the documents, and they are not phrases.
- **The gaps** that `docs` reports.

## Related

- [Documents reference](/docs/manual/reference/documents/)
- [Project files](/docs/manual/reference/project-files/#privacydocumentsjson)
