chaff

chaff checks writing the way a linter checks code. It reports what will slow a reader down, what
the document contradicts about itself and what a rewrite quietly changed. It reads English and
Japanese, returns the same findings for the same text every time, and never rewrites what you
wrote.
Try it with nothing installed: playground (English) ·
playground (日本語)
This repository is named lab. Alongside chaff it holds scoria, a code quality assay
for TypeScript and JavaScript. 日本語の案内は isamu.github.io/lab/ja にあります。
First run
With Node.js 24 or later, nothing to install, no config file, no API key, no language to declare:
npx chaffjs article.md # one file
npx chaffjs . # every Markdown file here
npx chaffjs --help # every command
Here is a run against a draft written to sound like generated text:
$ npx chaffjs --compact draft.md
draft.md blog/tech · English genre from the default
3:1 warning "it is important to note that" emphasises without saying anything
empty-intensifier
3:86 info "paradigm shift" is a cliché
cliche
7:1 info This sentence runs 43 words (limit 40)
max-sentence-length
15:1 warning Closes with "in conclusion"
closing-cliche
4 findings, 67 rules not run
Without --compact, each finding carries why it matters, what to write instead and the command
that relaxes the rule if you disagree:
─── line 3 ───────────────────────────────────────────────────
It is important to note that the benefits of this change are not merely incremental.
⚠ Empty intensifier
"it is important to note that" emphasises without saying anything
"Extremely important" does not say what matters or why. It only feels emphatic.
→ Say what matters and why. If you cannot, the sentence can go.
Relax this rule: npx chaffjs relax empty-intensifier
The marks are the weight of a finding: ✖ an error, ⚠ a warning, · for information.
Numbers and dates that disagree with each other
The largest group of rules does not read style at all. It reads the document's own arithmetic and
calendar, and most of what it finds is invisible to a careful reader:
$ npx chaffjs --compact invoice.md
9:30 error The amount $1,900 is not quantity × unit price (2 × $900 = $1,800)
line-amount-mismatch
12:26 warning The period "1 November 2026 to 20 October 2026" ends before it starts
date-range-reversed
14:24 error 1 October 2026 is a Thursday, not a Friday
date-weekday-mismatch
14:43 error "13 PM" is not a time (with AM or PM, the hour runs to 12)
impossible-time
Along the same lines:
- a total that is not the sum of its items
- a tax line that does not match the rate
- a share of a group over 100%
- a deadline that falls after the event it is for
- a net figure that is not the gross minus the deductions
- a year-to-date figure below this period's
- a meter reading whose difference is not the usage billed
The second version of a document
A linter reads one document. The harder problem arrives when a model rewrites it, because what
comes back is a document you did not write and nothing records what moved.
facts takes an inventory before the rewrite. compare reads it back afterwards.
npx chaffjs facts report.md
npx chaffjs compare report.md report-short.md
report.md → report-short.md
✗ 9 facts dropped (in report.md, not in report-short.md)
heading: Breakdown (report.md:11)
number: 60% (report.md:15)
number: 30 (report.md:15)
number: 25% (report.md:16)
number: 12 (report.md:16)
number: 16% (report.md:17)
number: 8 (report.md:17)
heading: Timeline (report.md:19)
number: 48 (report.md:32)
Facts checked: 23 → 14: numbers 16→9, dates 1→1, headings 6→4, …
9 facts dropped, 0 facts added
That run asked a model to halve a quarterly report. Nothing was invented and nine things went: the
breakdown table, and the basis for "60 documents next quarter", which was "up from 48 this
quarter". The conclusion that rested on those numbers stayed. The rewrite reads correctly, which
is why reading it again does not catch this.