Rules and a scanner that keep AI coding agents from shipping generic UI, copy, and code.
Install · Quick start · How it works · The scanner · Agents · Docs · Issues
An agent asked for a landing page will give you the same page every time: a blue-to-purple gradient, glass on every surface, three identical cards, Get Started, a row of invented logos, and a number with no source. fiai is a filter that catches that, and a standard that says what to do instead.
- 40 rules in four stages, written for agents to read.
- 8 skills that an agent loads on demand, one per concern.
- 56 machine checks that prove the mechanical rules on your files.
- 21 coding agents supported by the installer.
fiai is a filter, not a style guide. It prescribes no colours, fonts, or layouts. It rejects technique without a reason, and it rejects results that are clean but lifeless.
fiai needs Node 20.12 or newer and has no runtime dependencies.
npm install -g @fyfix/fiai # the CLI, on your PATH as `fiai`
npx @fyfix/fiai <command> # or run one command with nothing installednpx @fyfix/fiai init # fiai.config.json, fiai.direction.md, fiai.evidence.json
npx @fyfix/fiai install # copy the skills into your agent's folder
npx @fyfix/fiai install --mcp # also register the MCP server in .mcp.json
npx @fyfix/fiai scan # check the project before you hand work overinit writes a starter direction file. Fill it in: it is where your product's point of view comes from. install detects the agents in the project and writes a short pointer into the instruction file each one already reads.
Start a new agent session after installing.
- The rules are the product. Each one says what fails, what passes, and why, in language an agent can follow.
- The skills turn the rules into instructions an agent loads when the task needs them. The core skill carries all 40 rules; the other seven go deeper on interface, copy, access, responsive, code, proof, and audit.
- The scanner checks the mechanical rules on real files: contrast ratios, missing labels, dead links, em dashes, filler words, unverified numbers, secrets, stubs. It reports file, line, check, and rule.
- The verdict is the agent's report at the end: every MUST rule as PASS or FAIL with evidence, every REASONED rule with its one-line reason, and what was not done.
fiai verdictchecks it.
The agent reads the rules and applies judgement. The scanner measures what can be measured. Neither replaces the other.
| Stage | Name | The question it answers | Rules |
|---|---|---|---|
| 1 | Filter | Does this belong here at all? | F-01 to F-12 |
| 2 | Shape | Could this belong to any product, or does it belong to this one? | S-01 to S-10 |
| 3 | Prove | Does it work, for everyone, and is it true? | P-01 to P-12 |
| 4 | Hand over | Can the user check what I claim? | H-01 to H-06 |
Every rule has a tier:
| Tier | Meaning | Effect |
|---|---|---|
| MUST | Absolute. | One violation is a FAIL. |
| REASONED | Allowed with a reason. | Keep it only with a one-line reason in the verdict. |
| TIDY | Consistency and craft. | Fix it unless you have a reason. |
25 rules are MUST, 9 are REASONED, and 6 are TIDY. The full list is in docs/rules.md; fiai rules F-02 explains one.
fiai scan # the whole project
fiai scan src/pages # one folder
fiai scan --changed # what changed since the last commit
fiai scan --staged # what is staged
fiai scan --base origin/main # only the findings that are new since a branch
fiai scan --severity error # errors only
fiai scan --format sarif # text (default), json, sarif, markdown, github
fiai scan --quiet # one line: counts and the gate
fiai scan --cache # reuse the findings of files that have not changed
fiai scan --watch # scan again whenever a file changes
fiai fix # apply the mechanical fixes
fiai fix --dry-run # show what would change
fiai explain a11y/contrast # one check, how to fix it, and the rule it proves
fiai baseline # accept the current findings, fail on new ones
fiai cache # show or clear the per-file cache
fiai hook # pre-commit hook that scans staged files
fiai doctor # check the setup
fiai rules --checks # every machine checkA finding names the file, the line, the check, and the rule:
src/components/InvoiceCard.tsx
5:21 error a11y/contrast P-01 Contrast 2.54:1 between text-gray-400 and bg-white. Body text needs 4.5:1.
5 | <p className="text-gray-400 bg-white">Due soon</p>
hint: Use a darker text shade or a lighter surface.
6:7 warning a11y/button-no-type P-03 A <button> with no type. Inside a form it submits. Add type="button" or type="submit".
6 | <button className="bg-indigo-600 text-white">Pay</button>
The exit code is 0 when the gate passes, 1 when it fails, and 2 when the command is wrong.
fiai scan --base origin/main reports only the findings that are not already in the base ref. It checks the ref out in a temporary worktree, scans it, and hides what it finds there, so there is no baseline file to maintain. The ref must exist locally: run git fetch origin first. --base cannot be combined with --changed or --staged.
fiai scan --cache # reuse the findings of files that have not changed
fiai scan --watch # scan again whenever a file changes
fiai cache # how many files are cached
fiai cache --clear # forget themThe cache is .fiai/cache/scan.json. An entry is reused when the file's content, the settings, and the project facts its checks read are all unchanged, so editing one stylesheet does not make every other file stale. "cache": true in the config turns it on for every scan, and --no-cache skips it once. --watch uses it.
fiai explain a11y/button-no-type # the check, how to fix it, and the rule it proves
fiai verdict --template # the hand-over report to fill in
fiai verdict verdict.md # check a filled-in report
fiai mcp # the same tools over MCP, on stdioexplain takes a check id, a check name, or a unique part of one, and --json prints the same facts for a script. verdict checks the report against H-01 to H-03: every MUST rule has a result and evidence, every REASONED rule says what was kept and why, and the report says what was not done. It exits 1 when the report is not valid. mcp speaks JSON-RPC on standard input and output and offers fiai_scan, fiai_checks, fiai_explain, fiai_rules, fiai_fix, and fiai_verdict.
Try it in your browser at fyfixcom.github.io/fiai, or generate a local copy:
fiai playground --out playground.htmlOne self-contained page: paste markup, CSS, or code, and read the findings in the browser. It needs no server and no network. The package also ships a copy at playground/index.html.
| Group | Checks | Examples |
|---|---|---|
| copy | 10 | Em dashes, emoji in headings, empty adjectives, generic calls to action, filler text, sample names. |
| ui | 13 | The default gradient, stacked glass and glow, pill corners, uniform cards, default typefaces, dead links, handlers that do nothing. |
| a11y | 9 | Contrast below WCAG AA, removed focus, clickable divs, images with no alt, icon buttons with no name, fields with no label. |
| resp | 5 | Fixed widths, type under 14px, tap targets under 44px, 100vh, content that appears only on hover. |
| perf | 2 | Images with no size, scripts that block rendering. |
| code | 12 | Banner and narration comments, TODOs, empty catch blocks, stubs, debug output, secrets, eval, unsafe HTML. |
| proof | 3 | Numbers, claims, and testimonials that are not in the evidence ledger. |
| project | 2 | Interface files with no direction file, animation with no reduced-motion handling. |
It reads HTML, Vue, Svelte, JSX and TSX, CSS and its preprocessors, JavaScript, TypeScript, Java, C, C++, C#, Go, Rust, Swift, Kotlin, PHP, Scala, Dart, Python, Ruby, shell, YAML, TOML, Markdown, and plain text. It does not run your code or fetch your pages; it reads the source. The full list is in docs/checks.md.
fiai.direction.md gives the product a point of view: what it is, who it is for, how it talks, its palette and typefaces. The agent reads it before visual work, and the scanner uses it to tell a decision from a default. Without it, the result is a draft. See docs/direction.md.
fiai.evidence.json lists every number, claim, and testimonial that has a source. The scanner reports anything in copy that is not in it. No source, no number. See docs/evidence.md.
fiai install supports Claude Code, Codex, Cursor, Cline, OpenCode, Gemini CLI, GitHub Copilot, Amp, Qwen Code, Kimi Code, Kilo Code, Hermes, Pi, Qoder, Antigravity, Muse Code, DeepSeek Harness, Kiro, Windsurf, Roo Code, and Trae. Any other agent works with fiai install --dir <folder>. See docs/agents.md.
fiai.config.json sets the profile, which files to scan, severity overrides, extra words, word packs, the cache, the gate, and the baseline path. One line is silenced with a fiai-ignore comment. See docs/configuration.md.
The scanner exits 1 when the gate fails, so a pipeline needs no wrapper. Use the composite action (uses: fyfixCOM/fiai@main), or run the CLI directly: --format github annotates a pull request, SARIF output feeds code scanning, --base origin/main fails only on what is new, and fiai hook blocks a commit on errors. See docs/ci.md.
examples/slop-demo is a small page written the way an agent writes when nobody is checking. Run the scanner on it:
fiai scan examples/slop-demo --no-baselineIt reports 75 findings across every group: 24 errors, 44 warnings, and 7 notes.
bin/fiai.mjs the CLI entry point
src/rules/ the 40 rules, the source of truth
src/skills/playbooks/ the prose of each skill
src/checks/ the 56 machine checks
src/core/ lexer, colour maths, config, discovery, baseline, cache, fixes
src/lexicon/ the English word lists and the all-caps allow list
src/report/ text, JSON, SARIF, Markdown, and GitHub output
src/commands/ one file per CLI command
src/mcp.mjs the MCP server
src/browser.mjs the scanner entry point for the browser
src/playground.mjs the playground page
skills/ generated: one SKILL.md per skill
dist/fiai.md generated: the whole rulebook in one file
docs/ generated references and hand-written guides
playground/index.html generated: the browser playground
schema/ JSON schemas for the config, the ledger, and word packs
examples/slop-demo/ a deliberately bad project
examples/lexicon-packs/ an example word pack
test/ the test suite
npm run build # regenerate skills/, dist/fiai.md, docs/rules.md, docs/checks.md, playground/index.html
npm test # node --test
npm run check # build --check, tests, and a scan of the project itselfThe rules, the skills, and the generated docs come from src/rules/ and src/skills/playbooks/. Edit those, then run the build. fiai build --check fails when the generated files are out of date.
The version in package.json is the release. Bump it and push to main: the publish workflow runs the checks and publishes that version to npm when it is not there yet.
Issues and pull requests are welcome. Run npm run check before you open one.
MIT. See LICENSE.