Skip to content
Awaisdev01Public

About

✅ The CI gate for AI-written content — verify claims in AI text against a facts file you control. Zero dependencies, deterministic, no LLM. Studio app included.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

✅ factcheck

The CI gate for AI-written content.

AI writes your README, docs, release notes, and marketing copy. Nobody checks the claims it makes. factcheck does — deterministically, against a facts file you control, exiting nonzero like a linter.

Zero dependencies · pure Python 3.9+ · MIT

CI License: MIT

Why · Quick start · How it works · CI · FAQ

factcheck — AI wrote your README. Who checked the claims?


$ factcheck check docs/
[ERROR] README.md:12 — claim not in FACTS.md — add it or fix the text
    claim: Processes 50,000 events per second on a single laptop.
[WARNING] README.md:13 — claim only partially covered
    claim: Supports 12 languages out of the box (closest fact: "supports 8 languages")

4 claims checked — 0 verified, 3 errors, 1 warnings   # exit 1 → CI blocks

Your AI-generated "50,000 events/sec" just became a merge blocker until someone either fixes the number or adds it to the facts file with a source.

Why

AI models don't just write prose — they assert. 50,000 events per second. 12 languages. 99.9% uptime. SOC 2 compliant. Some of it was true last quarter, some of it was never true, and all of it ships because reviewing AI text feels like reviewing prose, not auditing claims.

Fact-checking tools hallucination-hunt with another LLM — which means new hallucinations, an API bill, and non-deterministic CI.

factcheck is the opposite: you declare the ground truth in FACTS.md (one line per fact, with a source), and the checker verifies AI-written text against it with deterministic matching. No API, no model, no drift. It's tsc for the truth — you give it the types.

Quick start

git clone https://github.com/Awaisdev01/factcheck.git
cd factcheck
python3 factcheck.py init          # scaffold FACTS.md

# add your real facts, one per line:
#   - processes 25,000 events per second :: benchmark/README.md
#   - supports 8 languages :: docs/i18n.md

python3 factcheck.py check README.md
python3 factcheck.py check docs/ --fail-on error
python3 factcheck.py check . --stats --json

Exit codes: 0 = all claims verified · 1 = blocking findings · 2 = setup problem (no FACTS.md). CI-native by design.

How it works

  1. Extract claims from the target text — sentences containing numbers, quantities, or factive verbs ("supports", "processes", "requires"). Code blocks and comments are skipped.
  2. Match against FACTS.md three ways, in order:
    • exact / substring containment
    • token-overlap (Jaccard + containment, stopwords removed)
    • numeric agreement — if the claim and the fact both contain numbers, the key numbers must match, or the claim is unverified (that's how 50,000 never passes as 25,000)
  3. Grade each claim: verified / related (warning) / unverified (error)
  4. Exit like a linter — --fail-on error (default) or --fail-on warning

FACTS.md (you write) vs README.md (AI wrote) — factcheck verifies the AI side against your facts

Every finding tells you what to do: add the claim to FACTS.md with a source, fix the text, or allowlist it in .factcheck-allow.

Use it in your agents

factcheck works as a skill — the agent verifies its own claims before finishing. Same repo, three install paths:

Claude Code / Antigravity / Kiro (plugin manifest included):

git clone https://github.com/Awaisdev01/factcheck.git ~/.claude/skills/factcheck

The skill teaches the agent the discipline: init FACTS.md with the user's real facts, check every text it writes, fix errors (never silently allowlist), report coverage before committing.

Cursor / Codex / Windsurf: the repo ships a .cursorrules — clone and open the folder.

Any project (agent-independent) — one command:

curl -fsSL https://raw.githubusercontent.com/awaisdev5765/factcheck/main/install.sh | bash

Installs factcheck.py + a FACTS.md template, wires the GitHub Actions workflow, adds a pre-commit hook (blocks commits with unverified claims), and registers the Claude Code skill if ~/.claude/skills exists. Then: edit FACTS.md with your real facts → push → CI verifies every claim.

Or without the installer: commit factcheck.py + FACTS.md and add the CI step below. The exit code is the gate regardless of which agent wrote the text.

CI

name: factcheck
on: [push, pull_request]
jobs:
  verify:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: python3 factcheck.py check README.md docs/ --stats

The self-check is real: factcheck's own CI runs factcheck against its own README. Bad example in, blocked exit out.

FAQ

Does this use an LLM? No. That's the point. Deterministic matching means the same input always produces the same verdict — CI can trust it, and it costs nothing to run.

What about claims I can't enumerate? Use --fail-on warning for advisory mode, and the .factcheck-allow file for known-safe prefixes. Coverage stats (--stats) show exactly how much of your text is verified.

How is this different from hallucination detectors? They score plausibility with a model. factcheck checks conformance with your declared facts. You audit the facts file once; the gate is deterministic forever after.

factcheck vs the alternatives

factcheck LLM-based checkers Reviewers eyeballing it
Deterministic (same input → same verdict) ✓ ✗ ✗
Runs in CI as an exit-code gate ✓ flaky ✗
API cost per run $0 $$$ your time
Can block a merge ✓ risky ✗
Knows YOUR ground truth ✓ (FACTS.md) ✗ partially

What text does it read? Markdown, plain text, reStructuredText — READMEs, docs folders, release notes, landing-page copy. Anything a human reads as prose.

The pipeline

factcheck is stage 4 of a full "vibe coder ships a real app" toolkit:

Stage Tool What it verifies
Design nativetap Mobile UI correctness (HIG/M3 rules)
Code prism_doctor Code smells, hardcoded values
Claims factcheck (this repo) AI-written text vs your ground truth
Launch shipcheck Store listings, release readiness

factcheck studio — open your project, see every claim

Don't want the terminal? Run the local studio app:

python3 studio.py path/to/your-project

Opens a browser UI at localhost:8765: file tree of your docs, every claim highlighted inline (green = verified, amber = related, red = unverified), hover a claim to see the closest fact and its source, and an editable FACTS.md panel — save and watch claims flip color. Localhost only, zero dependencies, nothing leaves your machine.

factcheck studio — inline claim verification

Editing workflows in the studio:

  • Inline fix — hover an unverified claim, type the corrected text, hit Fix: the file is patched and re-checked instantly
  • Declare as fact — if the claim is actually true, one click adds it to FACTS.md (with a TODO source you fill in)
  • File badges — the sidebar shows the unverified count per file, so you know where the trouble is before clicking
  • Project switcher — paste any absolute path in the header to open a different project; recent projects stay in the dropdown

Roadmap

  • v0.1 — claim extraction, 3-tier matching, numeric agreement, CI gate
  • --format sarif for GitHub code scanning integration
  • Pre-commit hook (pre-commit framework manifest)
  • VS Code extension: underline unverified claims as you type
  • GitHub Action (factcheck/action@v1) one-line CI install
  • Facts-file linting: catch ambiguous or unsourced facts

Contributing

Small, sourced PRs welcome — the checker is ~300 lines of dependency-free Python. Bug reports with a minimal repro (text + facts file) get fixed fastest.

License

MIT — see LICENSE.

About

✅ The CI gate for AI-written content — verify claims in AI text against a facts file you control. Zero dependencies, deterministic, no LLM. Studio app included.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages