riff: A Prose Linter With Rule Codes Like Ruff
riff is a prose linter I wrote at my day job. It reads a document, flags writing tells and clarity problems, and reports each one with a rule code you can select, ignore, and configure, the same way ruff does for Python. It’s MIT licensed and on PyPI, and this week I started running it on this blog.
uv tool install riff-lint
riff draft.md
The PyPI package is riff-lint (the name riff was taken), and it installs a riff command. It needs Python 3.11 or later. To try it once without installing anything, run uvx --from riff-lint riff draft.md.
Two kinds of rules
riff ships 107 rules: 25 static and 82 semantic.
The static rules are plain Python and run in milliseconds. They count things a model is bad at counting: sentences over a word limit, Title Case headings, curly quotes and arrows, lists where every item opens with a bold lead-in, and rhythm signals like unusually even sentence and paragraph lengths. One of my favorites is CLR004, which flags a document that leans on “X instead of Y” and “not X but Y” framing.
The semantic rules are yes/no questions. “Does this paragraph announce what it’s about to say before saying it?” is JEV001. “Does it narrate its own writing process?” is JEV002. They’re asked of a decision model, which returns a calibrated probability for each question and generates no text. By default that model is TypeSafe’s Jev. Every rule asked about the same paragraph shares one call, and each finding prints its probability, so you can tune a per-rule threshold in config.
Chat models are rejected on purpose.
riff also speaks OpenAI’s Decisions API (--model openai:gpt-6-luna) and any server that implements the System One decision endpoint, but the thresholds are tuned to Jev.
It reads documents as a hierarchy
Each rule declares the level it judges: a sentence, a block (paragraph, list item, table cell), a title, a section, or the whole document. Most rules read blocks. Some read higher up: JEV702 asks whether a section’s body delivers what its heading promises, and JEV711 reads only a deck’s slide titles in order and asks whether they tell the argument on their own.
Markdown, plain text, HTML, Word, and PowerPoint files all work, and so does a URL. Give it an http(s) link and it fetches the page, strips navigation and sidebars, and lints the article body. A .pptx is linted as a presentation, so a cover slide with a date or a closing “Thank you” isn’t read as an essay’s preamble. Before the rules run, riff classifies the document type (email, memo, blog post, release notes, and so on) with one question. Some rules only make sense for some types. A greeting is normal in an email and odd in a memo, so the greeting rule skips emails and letters. You can force the type with --type, which skips the classification call.
Configuration works like ruff
A riff.toml (or a [tool.riff] table in pyproject.toml) is discovered from the file’s directory upward, and the flags will feel familiar:
select = ["RIF", "CLR", "JEV"]
ignore = ["JEV002"]
extend-select = ["JEV401"]
max-sentence-words = 40
[thresholds]
JEV001 = 0.7
House style goes in custom rules, with no fork needed. There are three kinds: jev rules (your own yes/no question), phrase rules (literal strings, checked offline), and regex rules. A team that never wants to see “circle back” or “synergy” in a memo can add a phrase rule in a few lines.
Checking that an edit kept the facts
The feature I’d point people to first is riff --compare SOURCE REWRITE. Fixing what a linter flags is an edit to how a draft sounds, and it should leave every claim alone. --compare reports every number, name, quotation, code span, and link target the rewrite lost or added, plus any dropped superlative, scope, negation, or hedge words. It’s lexical on purpose, so a rewrite that dropped “only” or “roughly” gets caught.
It exits 1 when something changed, which makes it easy to put in a script.
Running it on this blog
This week I ran riff over the 21 posts and drafts queued for the next couple of months. The static pass found 55 issues. The biggest group was 31 CLR004 repeated contrast frames, then 14 long sentences, 8 bold-led lists, and 3 posts with paragraph lengths that were too uniform.
The semantic pass on Jev found 116 more, mostly JEV001 preamble (38) and JEV002 reasoning leaks (24), plus weak intensifiers, false suspense, negative statements, and a handful of quotable lines that didn’t say anything. That run made 765 calls and reported a cost of about six cents.
Every fix went through --compare against the pre-edit copy, so the rewrites changed how the posts read and kept what they said. riff is now a make riff target in the repo, next to the linter I already had.
Where to find it
The code, the full rule catalog with sources for every rule, and the changelog are at github.com/scale-venture-partners/riff. The current release is 0.3.0. riff --list-rules prints the catalog and riff --explain JEV001 explains any single rule. If you write a custom rule that would help other people, the contributing guide covers how to probe a new rule before it gets turned on by default.
Stay in the loop
Get notified when I publish new posts. No spam, unsubscribe anytime.