PhantomRef Gate: CI Check That Grounds AI-Generated Code Against Real APIs and Registries — explainer video
A check for developers that blocks AI-generated code if it refers to software packages or functions that don't actually exist.
0:58 · Scripted and voiced by GLM and Piper · 9 Nov 2026
Read the full idea →Transcript
Your AI coding agent just invented a package that doesn't exist — and someone is waiting to register that name. That's a brand-new opening for supply-chain attack.
AI-written pull requests import packages nobody has verified. Some names are pure hallucinations — and malicious agent Skills can even steer your agent toward attacker-registered packages that look perfectly real.
The research quantified it. Across 576,000 code samples from sixteen models, at least 5.2 percent of commercial and 21.7 percent of open-source suggestions named packages that don't exist.
PhantomRef Gate is a zero-ML CI check that grounds every AI-written import against live registries and real API signatures. Nonexistent packages block the merge; fresh or off-baseline ones route to human review.
Enterprises rolling out coding agents could gate every agent-authored pull request. And security platforms like Socket, Snyk, Sonatype, and GitLab could ship it as a native merge check.
Deterministic, auditable, and fast enough for every pull request. Explore PhantomRef Gate and its interactive prototype today.
Research it builds on
- Beyond Functional Correctness: Exploring Hallucinations in LLM-Generated Code
- An Empirical Study of Problem-Aligned Multilingual Code Generation and Directed Code Translation by Large Language Models
- We Have a Package for You! A Comprehensive Analysis of Package Hallucinations by Code Generating LLMs
- Automated Program Refinement: Guide and Verify Code Large Language Model with Refinement Calculus
- Trust Me, Import This: Dependency Steering Attacks via Malicious Agent Skills