Field report · 2
I scanned 991 public repos built with AI coding agents. Like last time, their code didn't import a single made-up package. But their READMEs and agent instruction files contain 50,301 install and run commands, and 560 of the package names in them aren't on npm. Coding agents read those files and run those commands.
Method
The first report looked at 174 repos. This time I wanted a bigger sample, and repos where I could be sure an AI agent was involved. So I used GitHub code search to find repos that contain an agent instruction file, which is the file a coding agent reads before it starts working.
| Marker | Read by | Repos |
|---|---|---|
AGENTS.md | Codex, Cursor, Copilot and others | 330 |
CLAUDE.md | Claude Code | 321 |
.cursor/rules, .cursorrules | Cursor | 162 |
.windsurfrules | Windsurf | 77 |
.github/copilot-instructions.md | GitHub Copilot | 53 |
GEMINI.md | Gemini CLI | 41 |
lovable-tagger in package.json | Lovable projects | 23 |
A repo can have more than one marker.
Code search found 11,220 repos. I kept the JavaScript and TypeScript ones that weren't forks or archived, and took the top 1,000 by stars. 991 scanned cleanly. These are mostly small projects: the median has 13 stars, and only 31 have more than 1,000. That's what code search returns, not a sample of the most popular repos on GitHub.
For each repo I did two things:
ghostimport --json on the code, like in the
first report.npm, npx,
pnpm, yarn and bun command out of code blocks in
Markdown files, agent instruction files and package.json scripts. Then I worked
out which packages each command would install or run, using the same parser as the
ghostimport agent hook, and looked every name up on npm.I only used public data: the GitHub API and the public npm registry. Nothing from these repos was executed, I didn't register any package names, and I'm not naming any repo.
Finding 01
Same result as in August, now with almost six times as many repos. When an AI makes up an import, the build fails the first time someone runs it, so it gets fixed before anyone commits.
Outside test folders, ghostimport flagged 141 names as missing from npm and free to register. I opened each one where it was imported:
| What it actually was | Names |
|---|---|
Not an import: an example in a comment, text in a string, or a method that happens to be called require | 53 |
An alias set up in the bundler or tsconfig.json that ghostimport didn't follow | 33 |
| Test fixtures and benchmarks the folder filter missed | 30 |
A dependency installed from GitHub, a tarball or under another name ("zod-3": "npm:zod@…") | 15 |
| A module provided by the host app or generated at build time | 9 |
estree, imported for its types, which come from @types/estree | 1 |
So every one was a false alarm, and most of them are ghostimport's fault. The four biggest causes are fixed in 0.7.3; see Finding 04.
Finding 02
npx-style runs (some in both).
Most of the 560 are harmless once you look at them. They are placeholders like
your-cli-package-name, packages a monorepo README tells you to install before
they've been published, and sentences that just happen to start with npm.
But a person reads your-cli-package-name and knows it's an example. An agent
that has been told to follow the README might just run it. And some of the names look exactly
like what a model would invent:
npm install -g opencode appears in 8 repos, all in a copied
agent template. The real package is opencode-ai. This one can't be abused:
a package called open-code already exists, and npm doesn't let anyone register
a name that differs from an existing one only by punctuation.
.cursorrules file in 2 repos tells the agent to install a package that has
never existed. The functionality lives under a subpath of a different package. I'm not
naming it, because when I checked, anyone could still register it.
ghostimport says up to 321 of the missing names could be registered by anyone, 18 of them
in agent instruction files. That's an upper bound: ghostimport didn't check npm's
punctuation rule at the time, and opencode shows that it matters. Since 0.7.4
it does. I'm not publishing the list.
Finding 03
npx foo first looks for a command called foo in the project's
installed packages. If there isn't one, for example in a fresh clone before
npm install, it downloads and runs the npm package called foo.
Many tools install a command whose name differs from the package name, so docs that say
npx foo work on the author's machine and fetch something else everywhere else.
| Command in docs | The tool it means | What npx fetches without it | Repos |
|---|---|---|---|
npx jsdoc2md | jsdoc-to-markdown | A placeholder that prints a warning | 4 |
npx depcruise | dependency-cruiser | A placeholder that prints a warning | 3 |
npx cucumber-js | @cucumber/cucumber | A placeholder that prints a warning | 2 |
npx eas | eas-cli | An unrelated templating library from 2017, by another author | 3 |
The three placeholders were registered in July 2025 "to prevent dependency confusion". Their README points to Aikido Security's threat intelligence. I read their code and didn't run it: it only prints a warning. So someone is already registering these names before attackers do. That's good, but it only covers the names someone has spotted.
ghostimport rates all four as high risk. Since 0.7 its agent hook also checks
npx, dlx and bunx runs, so it blocks these commands
and tells the agent to find the real tool.
Finding 04
Like in August, running the tool on real code found problems the tests didn't. The worst
one would have made the agent hook block ordinary commands: it read
npm install # Install dependencies as a request to install two packages,
Install and dependencies.
| Bug | What went wrong |
|---|---|
| Shell comments | Words after # were read as package names |
| Flag values | The value after --filter, -w, --prefix and similar flags was read as a package name |
| Local specs | pkg@workspace:*, link:, file: and portal: were treated as downloads from npm |
| Widely used packages | A package with millions of weekly downloads was rated high risk for having one version and one maintainer |
| Scoped names | @ai-sdk/codemod was flagged as a typosquat of nodemon |
| Capital letters | Names with capitals were reported as free to register, but npm doesn't accept new names with capitals |
| Command names flagged | v0.7.1 | v0.7.2 |
|---|---|---|
| Not on npm | 854 in 228 repos | 560 in 156 repos |
| Reported as free to register | 620 | 321 |
| Published, rated high risk | 320 | 162 |
All six are fixed in 0.7.2, each with a test.
Checking the 141 import names in Finding 01 turned up four more bugs:
something.require("x") was read as a require call.npm:, github:, file:) were looked up on npm and
reported as missing.These three were still open when this report was published:
opencode.@types/*, like
estree, were reported as missing.Scan log
| Date | Corpus | Version | Result |
|---|---|---|---|
| 2026-11-14 | 991 agent-built repos · 649,213 files | v0.7.2 | 0 organic hallucinated imports · 560 command names not on npm, 32 in agent files |
| 2026-11-14 | Same | v0.7.1 | 854 command names not on npm · 6 bugs found, fixed in 0.7.2 |
| 2026-08-30 | 174 repos · 23,773 files | v0.5.2 | 0 organic hallucinations · 1 name anyone could have registered, now reserved by Lovable · report |
You don't need my data. Scan your code, then look up the names in the install and
npx commands in your README and agent files.
$ npx ghostimport@0.7.2 ./your-repo $ npm view <name-from-a-command> # a 404 means nobody has published it
An agent instruction file is a script someone else's agent will run. Every npx
line in it should name the package that's on npm, not the command it installs, and every
install line should name a package that exists. If you use Claude Code, the ghostimport
hook checks each command before the agent runs it.