# grai How It Works: the 8 Mechanical Rules, the Burstiness Floor and the Offline Audit Card

> **Engine state verified against shipped code:** 2026-12-02
> **Canonical URL:** https://grai.page/how-it-works

**Direct Answer:** grai is a deterministic harness, not a model wrapper. The browser engine inside `grai.html` (and the seal worker at grai.page) audits a draft against eight mechanical rules with fixed penalties, a sentence-rhythm floor at `CV >= 0.32` and a Unicode integrity gate. The CLI/MCP engine (`grai-gate` on PyPI) checks the same habit families under snake_case names and adds four flags of its own. No model scores your text. Regular expressions and arithmetic do, and two runs on the same draft return the same number.

---

## 1. Architecture: Deterministic by Construction

Three engines enforce one contract: paste a draft, get a binary verdict and the exact spans that broke it.

| Engine | Where it runs | Stack | Model in the loop |
| :--- | :--- | :--- | :--- |
| Browser engine | `grai.html`, local file, CSP `connect-src 'none'` | Vanilla JS, zero dependencies | None |
| Seal engine | `grai.page/seal` worker, audited mode | Same rule table server-side, volatile RAM | None |
| CLI/MCP gate | `grai-gate` (PyPI) local and `grai.page/api/mcp` | Python stdlib, `gate.py` | None |

The scored path never calls an LLM. Drafting and repair are separate actions you run with your own model. The audit is the part that stays boring on purpose, because boring is verifiable.

---

## 2. The Eight Mechanical Rules (Browser and Seal Engine)

The rule table ships inside `grai.html` as `GRAI_RULES`. Each rule carries a first-occurrence penalty and a smaller repeat penalty, so one slip costs more than a habit. The score starts at 100 and stops at 4.

| Internal code | What it catches | First hit | Repeat |
| :--- | :--- | :--- | :--- |
| `CONTRASTIVE_NEGATION` | The forced opposition formula: "It's not X, it's Y." | -14 | -8 |
| `LESS_MORE_SYMMETRY` | Corporate symmetry: "Less X, more Y." "Stop doing X, start doing Y." | -10 | -6 |
| `EPIPHANY_OPENER` | The formulaic reveal beat: "Here is why..." "Let that sink in." | -10 | -7 |
| `ARROW_BULLET_SLOP` | Arrow cascades and emoji bullet templates. | -12 | -4 |
| `TRIADIC_PADDING` | The empty slogan triplet: "No X. No Y. Just Z." | -12 | -8 |
| `LEXICAL_SLOP` | Generic synthetic vocabulary: state-of-the-art, best-in-class, actionable. | -6 | -5 |
| `VERDICT_COLON` | The pompous verdict colon: "The reality is:" "The takeaway:" | -8 | -4 |
| `PROSE_TRIAD` | Rhetorical triplets and parallel question cascades. | -10 | -5 |

The audit names the rule and quotes the span that fired it. You fix the span yourself or send it to your model with the rule label attached. The gate never rewrites text you did not ask it to.

### SMOOTH_BRIDGE, reported separately

Over-connected paragraph openers ("That's why...", "In other words...") get their own flag instead of sharing the rule table. A draft can pass all eight rules and still read glued together, so the bridge check runs in the same pass.

### The Unicode Integrity Gate

The web engine strips invisible characters before it scores anything: zero-width space through zero-width non-joiner (`U+200B` to `U+200D`) plus the byte order mark (`U+FEFF`). The CLI gate goes further and fails the draft on Unicode obfuscation: mixed-script homoglyphs, BiDi overrides and hidden tag characters cost 25 points per critical hit. Copy-pasted model output often carries these marks. They are invisible in every editor and they ship to the client unless something removes them.

---

## 3. The Burstiness Floor: `CV = sigma / mu`

Burstiness is the coefficient of variation of your sentence lengths: the standard deviation divided by the mean. Flat AI drafts cluster around a polite 15-word mean. Human rhythm swings, so the gate enforces a floor on the ratio. This is why a draft with clean vocabulary can still fail: every sentence is fine, and the rhythm between them is a metronome.

The two engine families draw the line differently, and the difference is published rather than hidden.

**Browser and seal engine:** one binary floor. `CV >= 0.32` passes, anything below flags `FLAT_BURSTINESS`. The audit needs at least 4 sentences to compute a CV at all.

**CLI/MCP gate (`gate.py`):** four graded bands.

| CV range | Verdict | Effect on score |
| :--- | :--- | :--- |
| below 0.32 | flat cadence | hard fail, -20 |
| 0.32 to 0.35 | low burstiness | hard fail, -14 |
| 0.35 to 0.40 | borderline cadence | soft flag, -3 |
| 0.40 and above | human band | clean, target reference is 0.45 |

A draft at CV 0.34 passes the web floor and still fails the CLI gate. Both engines are deterministic about it. You can argue with an opinion. You cannot argue with the arithmetic. The corpus behind the floor: [grai.page/methodology](https://grai.page/methodology).

---

## 4. The Offline Audit Card vs. the Server Seal

Two proof artifacts exist, and the boundary between them is exact.

**The offline audit card (local, zero network).** In `grai.html` you print the cadence certificate: an A4 card with the measured profile, the rule results and a SHA-256 fingerprint of the payload, computed in the browser through WebCrypto with a pure-JS SHA-256 fallback for `file://` sessions. The page carries `connect-src 'none'` in its Content Security Policy, so the browser itself refuses outbound requests. Profiles and drafts stay in `localStorage` with a one-click `.grai` export. Nothing is uploaded because the transport is disabled.

**The seal payload (hash-only).** The certificate's seal payload contains a salted SHA-256 of the draft (`draftHash`), plus hashes of the profile and the settings. The draft text never enters the object. You copy the payload to `grai.page/seal` and the server signs the envelope with ECDSA P-256 (key `grai-seal-1`, algorithm ES256). The server sees hashes. It never sees the draft.

**The audited server seal.** Agency mode is the one path where the draft travels: you submit the text once, the worker runs the same eight rules in volatile memory, and the prose is discarded after the hash is computed. What lands in Cloudflare KV is the SHA-256 commitment, the score, the CV, the rule count and the agency reference. The public receipt at `grai.page/verify/:hash` shows exactly that. A draft that fails the gate gets HTTP 422 and no signature (`not_issued_failed_gate`). Zero prose is stored. The claim is precise: the audited seal sends the draft once and keeps none of it.

The registry of live receipts is public at [grai.page/proof](https://grai.page/proof), and the full protocol for agencies is documented there.

---

## 5. What the CLI/MCP Gate Adds

`gate.py` implements the same habit families under snake_case names: `heres_why` (epiphany opener), `contrast` (forced opposition), `arrows`, `zombie` (lexical slop), `verdict_colon`, `prose_triad`, `triplet`, `closing`, `smooth_bridge`. On top of the shared set it adds four checks the web scorer does not run:

| Flag | What it adds | Effect |
| :--- | :--- | :--- |
| `em_dash` | Em dashes and double-hyphen separators in prose | hard fail, -18 per hit, capped at 3 |
| `triplet` | Three consecutive sentences within a narrow length band | hard flag on monotony |
| `closing` | Engagement-bait closers: "Thoughts?", "Agree or disagree?" | soft penalty |
| `run_on` | Run-on sentences past the 32-word cap | hard flag |

The CLI runs locally (`uvx --from grai-mcp grai-gate-mcp`), in CI through [grai-gate-action](https://github.com/adrianpeticila/grai-gate-action), or over the remote MCP endpoint at `grai.page/api/mcp`. Install steps: [grai.page/mcp](https://grai.page/mcp).

---

## 6. Frequently Asked Questions

### Do the browser engine and the CLI gate give the same score?

No, and the difference is documented. Both are deterministic and both check the same habit families, but the web floor is binary at 0.32 while the CLI grades 0.32 to 0.40 into low-burst and borderline bands. A draft at CV 0.36 passes the web scorer and reads borderline on the CLI. Pick the engine that matches your pipeline and stay on it.

### Why does my draft fail with zero flagged vocabulary?

Because vocabulary is only the small layer. Rhythm gets scored too, and so does structure: opposition formulas, slogan triplets, glued paragraph bridges. Invisible characters count. A draft can be clean on every word and still read machine-made, because the metronome is the tell. The audit names the span and the rule for each hit. Fix it, rerun, watch the number move.

### Can a client verify the signed card without installing anything?

Yes. The receipt at `grai.page/verify/:hash` is a public URL with no account and no login. It shows the score, the CV against the floor, the rule count and the ECDSA P-256 signature status with the key id. Anyone who wants to check the signature by hand can pull the public keyring from `/api/pubkey`.

---

**Checkout:** [Solo Offline Edition ($79/yr)](https://grai.page/pricing/) | [Agency Verification Protocol ($99/mo or $790/yr)](https://grai.page/pricing/)

**Related:** [Methodology study](https://grai.page/methodology) | [Free AI tell checker](https://grai.page/ai-tells/) | [MCP and CLI](https://grai.page/mcp) | [Public proof registry](https://grai.page/proof) | [Buyer FAQ](https://grai.page/faq)
