π§ The problem
Every time I tried to set up a new open-source project, something in the docs was wrong. The README said Python 3.8+, pyproject.toml said >=3.10, and the Dockerfile ran 3.9. The setup guide said make lint, but that target had been renamed a year earlier. The code read JWT_SECRET, which was nowhere in .env.example.
Each file looked fine by itself. Together they contradicted each other.
This happens all the time, and nobody checks for it:
- Linters check one file at a time.
- Type checkers check code.
- Link checkers check URLs.
- Nothing checks that a repository's files agree with each other.
That gap is where new contributors give up, deployments drift and "works on my machine" comes from. Each contradiction costs someone an hour of confusion, and it costs a new contributor on day one.
π‘ The idea
What if a repository could be cross-examined the way a careful new contributor reads it?
truthlint treats every file as a claim. The README claims a Python version. The Makefile claims which targets exist. .env.example claims which variables the app needs. truthlint collects all of those claims and checks them against each other and against the code. Whenever two of them disagree, it reports a contradiction, with evidence from both sides.
βοΈ What it does
HIGH TL101-406201 Python version contradiction high confidence
README.md says Python 3.8+ is enough, but the project requires >=3.10
(minimum 3.10). Users following the docs on Python 3.8 will be refused by pip.
β³ README.md:8 claims Python 3.8+
β³ pyproject.toml:9 declares requires-python '>=3.10'
Fix: State Python 3.10+ in README.md, or raise the constraint. [auto-fix available]
- π 35 cross-file rules covering README and docs,
pyproject.toml,requirements*.txt,package.json, lockfiles, Dockerfiles, compose files, GitHub Actions and GitLab CI, Makefiles,.envexamples and source code. - π§Ύ Evidence for every finding: the exact file and line on both sides of the contradiction, a confidence level, and how it was checked.
- π§ Onboarding audit: it walks through your setup instructions step by step, keeping track of
cd,cpand virtualenvs along the way, and checks each command statically. Does that npm script, make target, file, compose service or pip extra actually exist? - π Two explainable scores: a Repository Truth Score and an Onboarding Reliability Score, each out of 100, with every deduction listed.
- π©Ή Fixes you review: a suggested fix for every finding, many with a ready-made patch, applied only after you confirm.
- π¦ CI gate:
truthlint scan . --fail-on highstops a pull request that adds new contradictions. - π Safe by design: fully offline, no API keys, no AI service, nothing leaves your machine. It never runs anything from the repository it scans, not even
git, because a repository's.git/configcan make git run commands.
What it catches
| Area | Examples |
|---|---|
| Runtime versions | README, Dockerfile, CI matrix, .nvmrc and .python-version disagreeing with the declared requirement |
| Documented commands | npm run X with no such script, make X with no such target, pip extras that don't exist, compose services that don't exist |
| Documentation | broken relative links and heading anchors, outdated project-structure trees, references to deleted files |
| Environment | variables read in code (Python, JS/TS, Go, Ruby, Rust, Java, PHP, C#, Elixir, shell) that are missing from .env.example |
| Dependencies | imports never declared in any manifest, declared dependencies never imported |
| Containers | COPY of missing or .dockerignored files, CMD pointing at modules that don't exist |
| CI | workflow steps calling missing scripts, targets or files |
π₯ Who it's for
- Open-source maintainers who want new contributors to get set up on the first try.
- New contributors and students who lose hours to docs that no longer match the code.
- Teams whose READMEs, Dockerfiles and CI files drift apart as the code changes.
- Anyone running CI who wants "the docs are wrong" caught at review time instead of by a confused user.
π οΈ How I built it
truthlint is written in Python 3.11+, with Typer for the CLI, Rich for terminal output, Pydantic for the finding and report models, and PyYAML.
- Discovery: its own
.gitignoreengine, so it never shells out to git, plus protection against symlink escapes and limits on file size and binary files. - Parsers: one per format (Markdown, shell, pyproject, package.json, Dockerfile, compose, GitHub Actions, GitLab CI, Makefile, .env, Python AST, JS/TS). Every parser tracks line numbers so findings can point at the exact line, and none of them execute code.
- Repository view: each file is parsed at most once, only when a rule needs it, and every rule reads from that same shared view.
- Rules: grouped by area (runtime, commands, docs, env, deps, containers, CI, build). One shared static command checker verifies commands in docs, CI, Makefiles and npm scripts.
- Scoring: each finding costs severity weight Γ confidence points. Repeats of the same rule count for less, and each rule is capped, so one noisy area can't sink the whole score. Truth Score = 100 Γ e^(βpoints / 90).
- Output: Rich terminal output, plus Markdown and JSON reports and patch files.
It ships with a pytest suite, CI on GitHub Actions, and trusted publishing to PyPI, so anyone can run pip install truthlint today. truthlint also checks its own repository.
π§ Challenges I ran into
The hard part was being accurate, not finding problems. A tool that cries wolf gets switched off in CI within a week. So truthlint is built to stay silent rather than guess:
- Evidence or nothing: a finding can't be created without a file and line citation. The code enforces this, so it isn't just a convention.
- Unverifiable is not broken: anything that depends on the network or on installed tools is reported as unverified, never as failing.
- Ambiguity gets downgraded: if a script exists in another package of a monorepo, or a Makefile uses pattern rules, truthlint says unverified rather than missing.
- Generated paths are respected: files under
dist/orbuild/, gitignored files, and outputs of earlier setup steps (cp,mkdir,python -m venv) aren't reported as missing. - Risky rules are opt-in: heuristic checks that are more likely to give false positives run only with
--deep.
There's also a zero-false-positive guarantee in the test suite: the bundled examples/healthy-library repository must always score 100/100 with zero findings.
Security was its own challenge. Scanning a repository you don't trust shouldn't be dangerous, so truthlint never executes anything, never follows symlinks out of the repository, and never calls git.
π What I learned
- Precision matters more than recall for developer tools. Ten correct findings build more trust than a hundred noisy ones, and designing for trust changed almost every rule I wrote.
- Docs are code. A README is a set of claims that can be checked, and once you parse it that way, most "docs drift" turns out to be detectable statically.
- Safe-by-default needs real effort. Even running
giton an untrusted repository can execute code, so I had to write my own.gitignorematcher instead. - Publishing a real package to PyPI through trusted publishing, and writing tests that lock in the absence of false positives, not just their detection.
π What's next
- More ecosystems: Go modules, Cargo, Gemfile, Gradle/Maven
truthlint scan --diff origin/main, to report only the contradictions a pull request introduces- SARIF output so findings show up directly in GitHub code scanning
- Checking the CLI subcommands documented in a README against their actual Typer, Click or argparse definitions
- A GitHub Action so any repository can add truthlint in one line
βΆοΈ Try it in 30 seconds
pip install truthlint
git clone https://github.com/harshith7002/truthlint.git && cd truthlint
truthlint scan examples/drifting-python-api # a repository full of contradictions
truthlint scan examples/healthy-library # 100/100, zero findings
π Disclosure
truthlint is my own project, started on November 12, 2026, and version 0.1.0 is published on PyPI. I'm submitting it as it currently stands. It uses the open-source libraries listed above, under their licenses.
Built With
- github-actions
- pydantic
- pypi
- pytest
- python
- pyyaml
- rich
- ruff
- typer