I was playing around with next@canary and the Copilot. I installed it and asked the Copilot to create a route.

I was surprised to see that it used some APIs I had not used or learnt about before. It was different suggestion than what I expected and what I was using in the same codebase.

I started to dig deeper there to understand what’s really happening here.

Actually I was thinking that Copilot is using some stale training data there or maybe mixing stuffs up from some random blog posts.

But the import path it suggested looked official. So I decided to check my project again.

What I actually found in node_modules

I found that there was a directory inside the package:

node_modules/next/dist/docs/

The directory was not empty. I found that it mirrors the structure of the Next.js site — App Router guides, Pages Router docs, API reference, architecture notes. There were lots of stuffs in there.

I learnt that Next.js starting from v16.2.0-canary.37+, started to bundle version-matched documentation inside node_modules/next/dist/docs/.

This changes how AI agents can understand Next.js

create-next-app@canary also generates a AGENTS.md file at the project root with a bunch of instructions:

<!-- BEGIN:nextjs-agent-rules -->
...instructions telling agents to read bundled docs before writing code...
<!-- END:nextjs-agent-rules -->

Many tools support copilot reading agents.md behavior by default. If the agent respects that file, it reads local documentation first.

Next.js ships its own version-matched docs inside node_modules.

How it changed my understanding with AI agent and Next.js

I assumed the model was “remembering” things from it’s training data or it was reading my dependencies.

If your setup honors AGENTS.md, the source of truth isn’t the internet anymore. Now AI agent will follow the documentation of Next.js version installed which is exact files found in nextjs dist docs folder.

Now it feels more like dependency resolution. Next.js is getting AI friendly faster.