Engineering

The cost of a dependency you did not choose

Editorial · Reveneau · September 16, 2026 · Updated November 23, 2026

The cost of a dependency you did not choose

A coding agent can add a date formatting library to a repository in four seconds. There is no discussion, because the change arrives complete, the tests pass, and the library is a reasonable one.

That package is now in the build. It is in the lockfile, the licence report, the vulnerability scan, the container image, and in the set of things a new engineer has to understand before they can safely change how a date is displayed. Someone on the team will be responsible for it in five years.

Reveneau writes all of its code with AI, and every change has to pass an eval suite written from the specification before it is released. Dependencies are harder to notice than a fault in the code, and they last longer than the code that introduced them.

Is AI-generated code safe to use in a business application?

It can be, when every change passes checks before release that cover two things: the code itself, and the packages the code adds to your build. The code itself is covered in the real cost of shipping unverified code, with Veracode's figures and a study of AI-written files on GitHub. This section is about the packages.

Code models name packages that do not exist. Joseph Spracklen and five co-authors tested 16 models on Python and JavaScript in a paper for the 2025 USENIX Security Symposium (arXiv 2406.10279, version 3 of 2 March 2025, read 23 November 2026). Across 576,000 code samples, "the average percentage of hallucinated packages is at least 5.2% for commercial models and 21.7% for open-source models". The models made up 205,474 different package names.

The same names come back. The authors ran 500 prompts that had produced a made-up name again, 10 times each, and "43% of hallucinated packages were repeated in all 10 queries". That repetition is what an attacker needs. Someone publishes a package under the made-up name on a public registry such as PyPI or npm, with harmful code inside, and the next person whose AI tool suggests that name installs it. The OpenSSF guide for AI code assistants (Security-Focused Guide for AI Code Assistant Instructions, dated 2025-08-01, read 23 November 2026) calls this attack "slopsquatting" and gives a one-line instruction: "Do not add dependencies that may be malicious or hallucinated."

Five checks cover a package that an AI tool added. Each one runs before the change is merged:

Check What it catches
The name exists in the official registry and is the package you meant A made-up name, or a harmful package published under it
Who publishes it and when its first version came out A package with no release history. One published under a made-up name starts with none
A scan for known vulnerabilities Published security flaws in the package and in the packages it brings in
The licence Terms that do not fit how you distribute the product
One sentence on why it exists and what it replaces A second package doing a job the build already does

The OpenSSF guide also tells teams to run dependency checks in the build pipeline, so that problems are found before release. These checks run on every change, however the code was written. The checks for the code itself are in how to do a security review before launch. Reveneau takes responsibility for the whole project, through production and after release.

1. The small effort that used to protect you is gone

Adding a package by hand was never hard. It was, however, embarrassing.

You had to search for it, read the readme, decide the name was right, type it, and then mention it in the pull request description where a colleague might ask why. That whole sequence took a few minutes and carried a small social cost. The cost was useful. It stopped the additions that were only convenient, because convenience is a weak answer when someone might ask you out loud.

An agent has no such hesitation. It has read a large amount of code in which the standard solution to a given problem is a particular package, so it uses that package as automatically as a human writes a for loop. The choice can be defended. The problem is that it was never presented as a choice.

Plan on any repository where agents write code collecting dependencies faster than the same team would add them by hand, and set up the review described below before the first agent change is merged.

2. What a dependency costs over five years

Installing it costs nothing. The costs come in the years after.

The upgrade cost. With every package, you have to follow somebody else's release schedule. They release a major version, they deprecate a function you rely on, they change a default. None of these events are your decision, and all of them happen on their schedule. Ten packages, each needing attention twice a year, is twenty upgrades a year that appear in no plan.

The security risk. A package deep in the dependency tree runs with the same permissions as the code you wrote yourself. Nobody read it. Nobody is going to read it. Your scanner will tell you about known vulnerabilities in it, which is useful and covers only the ones that have been found and published. A package whose name a model made up is a separate risk, covered in the section above.

The compliance risk. In any regulated environment, every dependency is something an auditor can ask about: what licence, what data does it touch, where does it send telemetry. A package added without discussion during a two-week work cycle becomes a question in a diligence process eighteen months later, and the person answering it will not be the person who added it. If the product handles regulated data, the argument in compliance is a specification problem applies here directly: the obligation exists whether or not anyone wrote it down.

The cost of removing it. Removing a dependency is harder than adding one, because once your code calls the library from many places, the library's approach to the problem has become your code's approach.

3. Two packages that do the same job

What an agent cannot know is what is already in your build. Ask for date handling in one change and a validation helper in another, and you can end up with two libraries that do overlapping jobs, each added by a reasonable decision made a month apart. Each one works. Together they are a maintenance problem and a source of confusion for the next engineer, who now has to learn an unwritten rule about which one is used where.

Watch for the same thing with HTTP clients, with schema validators, and with large utility libraries, where a package with two hundred functions gets added so that one of them can be used once.

Transitive dependencies make this harder to see. One direct addition can bring in many packages nobody named. Your manifest gains one line, and your build gains every package that line depends on.

The fix: make the team review the dependency list

Treat the manifest and the lockfile as design decisions that happen to be stored in a file, and review them the way you review code.

Compare the dependency list on every change, with a check in continuous integration that fails when a new top-level entry appears without an explanation. A report someone reads later has no effect. This is the same principle as running evals in the pipeline, described in evals in CI for coding agents: the check has to block the change.

Check the name. Confirm the new entry is the package you meant, published in the official registry by the publisher you expect. This is the check that stops a made-up name from reaching the build.

Require one sentence. Why does this exist, and what does it replace. That is the whole requirement. If nobody can write the sentence, the package should not be in the build. It catches the duplicates at once, because writing "we need a date library" while a date library is already installed is the moment the problem becomes visible.

Review transitive additions separately. They arrived without anyone choosing them, so they need the one place in the process where a person looks at the whole dependency tree.

Keep the package behind your own thin layer where the cost of removing it matters. One file that wraps it, and the rest of your code calls your file. Then replacing it later changes one file. This is the small version of the argument in avoiding vendor lock-in, and the deciding question is the same: how expensive is it to stop using it.

When adding the dependency is the right choice

Writing everything yourself is a mistake too.

If the problem is hard, well specified, and already solved under real scrutiny by people who specialise in it, take the package. Cryptography, timezone arithmetic, PDF parsing, protocol implementations, anything where a subtle error has consequences and where the failure gives no warning. Writing your own crypto to avoid upgrade work is a bad choice.

The case that is hard to decide is the small utility: a package you could reimplement in under a day, solving ten problems when you have one. There, thirty lines you own are better than a dependency you must track, upgrade, audit, and eventually replace.

Why the problem grows as AI writes more of the code

The 2025 DORA report, based on survey responses from nearly 5,000 technology professionals, found that AI adoption has a positive relationship with software delivery throughput and a negative relationship with software delivery stability, and summarised it as "AI doesn't fix a team; it amplifies what's already there" (read 23 November 2026). Dependency management is an example of that. A team that already reviewed its manifest will keep doing so at a higher volume. A team that never looked will now add unreviewed packages faster.

There is a security side too. Veracode's Spring 2026 update (published 24 March 2026, read 23 November 2026), covering over 150 models, reports syntax correctness "exceeding 95%" while "only 55% of generation tasks result in secure code". That study is about the code itself. The packages the code brings in need their own check, and the name check above is the first one.

Code gets rewritten. Dependencies stay, and the next team takes them over.

Related guide: Maintaining custom software.

Sources

Common questions

Is AI-generated code safe to use in a business application?

It can be, when every change passes checks before release that cover the code and the packages it adds. A paper for the 2025 USENIX Security Symposium found code models naming packages that do not exist, on average at least 5.2 percent of suggested packages for commercial models, and anyone can publish a harmful package under such a name. Check that every new package is the real one before it enters the build.

What is the real cost of adding a software dependency?

The install is the smallest part. The recurring costs are the upgrade work as the package follows its own release schedule, the security risk it adds to your build, the audit and licence work it creates in regulated environments, and the removal cost later, which is higher than the cost of adding it because your own code starts calling the package from many places.

Why do coding agents make the dependency problem worse?

They remove the small effort that used to stop unnecessary additions. A human adding a package had to find it, type it, and justify it in a pull request, and that small social cost stopped many unnecessary additions. An agent adds one in seconds with no hesitation and no note, so nobody ever sees it as a decision at all.

How should a team check new dependencies added by an agent?

Review the manifest and lockfile on every change, the same way the team reviews code. Make the continuous integration pipeline fail when a new top-level entry appears without a one-line reason saying why it exists and what it replaces, confirm the name is the package you meant in the official registry, and review transitive additions separately, since those arrive without anyone naming them.

When is adding a dependency the right decision?

When the problem is hard, well specified, and someone else has already solved it under real scrutiny: cryptography, date and timezone handling, PDF parsing, protocol implementations. Writing your own cryptography to avoid a dependency is a worse decision than accepting the package and its upgrade cost.

When should you write the code instead of installing a package?

When the package is small enough that you could write the part you need in under a day, and when the package solves ten problems while you have one. A thirty-line utility you own is cheaper over five years than a dependency you must track, upgrade, audit, and eventually replace when it stops being maintained.

What questions should you ask before accepting a new package?

Who maintains it and how recently did they release a new version, what licence does it carry, how many transitive dependencies does it bring in, what happens to your product if it is abandoned next year, and could you replace it in a week if you had to. If nobody can answer the abandonment question, the package is a risk nobody measured.

How do transitive dependencies change the calculation?

One direct addition can pull in many packages you never named and nobody reviewed, and every one of them runs with the same permissions as code you wrote yourself. Count the whole dependency tree that a package adds, because the tree is what your security scanner and your auditor will be looking at.

What does having too many dependencies do to onboarding?

It increases what a new engineer has to understand before they can safely change anything, because each package carries its own conventions, its own error behaviour, and its own unusual behaviour. Two libraries doing overlapping jobs is worse than either alone, since the newcomer must also learn the unwritten rule about which one to use where.

Does pinning versions solve the problem?

Pinning stops surprise changes. A pinned package still gets older, still collects unpatched vulnerabilities, and still needs a planned upgrade eventually, so pinning turns many small surprises into one large delayed migration that happens at whatever moment is least convenient.

How does this connect to vendor lock-in?

A dependency is a small version of the same problem, and the deciding question is identical: how expensive is it to stop using it. Keep the package behind a thin layer of your own code so that replacing it later changes one file, and accept deep integration only where the cost of removing it is acceptable.

What should a dependency review check?

Whether the addition is necessary, whether the name is the package you meant, whether the licence is compatible with how the product is distributed, how large the transitive tree is, whether the maintainer is active, and whether the same job is already done by something already in the build. Duplicate capability is the easiest finding to fix while the change is still open.

How often should a team audit its dependency list?

Every quarter is a reasonable schedule for a full read of what is in the manifest and why, with automated vulnerability scanning running continuously in between. The quarterly review catches the category that scanners miss entirely: packages nobody uses any more, and two packages doing the same job because two different changes each brought one in.

Start a project