Skip to content

next dev generates apps/site/AGENTS.md and apps/site/CLAUDE.md, which are neither committed nor gitignored #4160

Description

@yinlianghui

Out-of-scope finding from #4149, where the PR needed to run the docs site to verify a documented port.

What happens

Running the command QUICK_REFERENCE.md documents for the docs site:

$ pnpm --filter @object-ui/site dev
▲ Next.js 16.3.0 (Turbopack)
- Local: http://localhost:3000
✓ Ready in 684ms

leaves two new files behind:

$ git status --short
?? apps/site/AGENTS.md
?? apps/site/CLAUDE.md

Neither is tracked, and git check-ignore returns nothing for either — they are not in .gitignore. apps/site/CLAUDE.md is one line (@AGENTS.md); apps/site/AGENTS.md is a Next.js-authored block that names its own generator:

This block is written and re-added by next dev — verify at node_modules/next/dist/server/lib/generate-agent-files.js. Removing it from a diff only re-creates the uncommitted change; committing it with your work keeps the tree clean.

So Next.js expects one of two end states: the files are committed, or they are ignored. This repo is in neither.

Why it is worth a card rather than a shrug

Several agents work this repo in parallel worktrees, and git add -A is a common way to stage. Two untracked files that appear from running the app — not from editing anything — are exactly the shape that gets swept into an unrelated PR by an author who never opened them. The generated text actively encourages that ("committing it with your work keeps the tree clean"), which makes the accident feel like the correct move at the moment it happens.

It also collides with an existing convention: this repo's AGENTS.md / CLAUDE.md are hand-written instruction files that agents are told to treat as binding. A generated apps/site/AGENTS.md carrying Next.js framework rules appears in the same namespace, and apps/site/CLAUDE.md's @AGENTS.md import pulls it in for anyone working under apps/site.

Decisions this needs, deliberately not made here

  1. Ignore or commit. Ignoring keeps the tree quiet but means the Next.js guidance never reaches an agent working in apps/site. Committing puts framework-generated content into the repo's instruction namespace, where it will be rewritten by whatever Next.js version runs next. These are different answers with different maintenance stories.
  2. Whether the same generator fires elsewhere. Only apps/site runs Next.js today, so only that directory was observed. Worth confirming before writing a rule.

Not fixed in #4149's PR — that card is scoped to QUICK_REFERENCE.md, and the two files were deleted from that worktree rather than committed.

Searched for duplicates

generate-agent-files, next dev AGENTS.md, apps/site/CLAUDE.md and gitignore AGENTS over open issues in this repo: no hits.


Generated by Claude Code

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions