Catch the fake packages AI makes up.
AI coding tools sometimes import a Python package that doesn't exist — it invented the name. mirago reads your code, checks every package against PyPI, and tells you which ones are fake before you install them.
Python 3.10+Windows · macOS · LinuxMIT licensed
$ mirago check app.py
🚨 1 hallucination in app.py
Line 1: import fastjson_validator
→ Package 'fastjson_validator' does not exist on PyPI
Checked 7 imports · 1 error · 0 warnings
$ ▏The problem
One made-up import. Two ways it bites.
You ask an AI tool for some code and it hands you an import that looks perfectly normal. You run pip install. Then one of two things happens.
It doesn't exist
The AI invented the name. pip install fails and you lose ten minutes figuring out the package was never real. Annoying, but harmless.
Worse: it does exist
Someone noticed AI tools invent this exact name, registered it on PyPI, and filled it with malware. Now pip install succeeds— and you've installed something harmful.
This attack has a name: slopsquatting — squatting on the “slop” that AI tools hallucinate. Studies in 2025 found AI models invent package names a noticeable fraction of the time, and attackers are already exploiting it.
How it works
Point it at a file or a folder. That's it.
Reads your code
mirago parses each file with Python's built-in ast module — it understands the structure without ever running your code, and pulls out every package you import.
Checks each one against PyPI
Every package name is checked against the official Python index. Answers are cached on disk for a week, so it stays fast and polite to PyPI.
Tells you what's fake or risky
Doesn't exist? That's an error. Exists but brand-new, barely downloaded, and not already in your project? That's a warning — a possible copycat.
Point it at a folder and mirago walks every .py file inside, skipping noise like .venv, .git, caches and build dirs. Exit code is 1 on problems and 0when clean — so it drops straight into CI. And if PyPI can't be reached, mirago assumes your packages are fine rather than crying wolf.
What it does today
Small, fast, and built not to cry wolf.
mirago only warns when several clues agree. False alarms are what make people uninstall a tool — so caution is the whole point.
Two kinds of detection
Flags names that don't exist at all, plus real-but-risky packages (brand-new + barely downloaded + not in your lockfile).
Did-you-mean fixes
--fixMistype a popular package and mirago suggests the real one. Add the flag to apply it for you.
CI-ready failures
--fail-on warningErrors fail the build by default. Opt into failing on warnings too when you want to be strict.
Machine-readable output
--jsonEmit results as JSON so other tools, dashboards, or CI steps can read them as data, not text.
Smart on-disk cache
--no-cacheAnswers from PyPI are cached for a week. Skip it and re-check live whenever you need to.
Whole-folder walks
Check a single file, a directory, or your entire project — noise dirs like .venv and .git are skipped automatically.
Where it's going
Five levels of “did the AI make it up?”
Each level is deeper and more valuable than the one before. mirago nails level 1 today, and grows from there.
- 1
Does the package exist?
Shipped in 0.1.0import fastjson_validator
- 2
Does the imported name exist in the package?
Up nextfrom requests import get_json
- 3
Does the function call match the real one?
Plannedan argument that doesn't exist
- 4
Does the code do what its comment claims?
Planneda "sort descending" that sorts ascending
- Level 5 — team-style checks — is deliberately skipped; other tools own that.
What's next (roughly in order)
- 1.Run automatically — pre-commit hook + GitHub Action
- 2.Only check what changed — git-diff mode + globs
- 3.Config file — .mirago.toml thresholds & allowlists
- 4.Deeper detection — fake functions, via pyright
- 5.Editor integrations — VS Code + a language server
- 6.Catch mistakes as the AI writes them — real-time guardrail
- 7.Other languages — JavaScript / npm
Add one check before pip install.
mirago is free and open source, and stays that way. Install it in seconds with pipx.
Prefer plain pip? pip install mirago