Skip to content

Commit b05a543

Browse files
claude[bot]claude
andauthored
fix(docs): stop next dev writing untracked AGENTS.md / CLAUDE.md into apps/docs (#10780)
`next dev` (Next 16.3.1) runs `ensureAgentRulesForDev` on boot and, whenever it detects an AI coding agent, scaffolds `apps/docs/AGENTS.md` and `apps/docs/CLAUDE.md`. Neither path is tracked or ignored, so both land as `??` and any `git add -A` after booting the docs server sweeps them into an unrelated PR. Those two filenames are load-bearing here: the root `AGENTS.md` is the binding playbook and agents are told to read the `AGENTS.md` governing the files they touch. A Next-authored stub pointing at `node_modules/next/dist/docs/` can be read as this repo's discipline, and its own text argues for committing itself. The generated `CLAUDE.md` is the single line `@AGENTS.md`, an import directive that pulls the stub in. Set `agentRules: false` in `apps/docs/next.config.mjs`, turning generation off at the source rather than gitignoring the paths: an ignore rule for `apps/docs/AGENTS.md` would silently swallow a future repo-authored `AGENTS.md` for this app, failing invisibly at exactly the moment someone was adding real guidance there. Claude-Session: https://claude.ai/code/session_01DdCnBGcHeufjrq7drTD3wt Co-authored-by: Claude <noreply@anthropic.com>
1 parent 6130cb7 commit b05a543

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

apps/docs/next.config.mjs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,28 @@ const withMDX = createMDX();
66
/** @type {import('next').NextConfig} */
77
const config = {
88
reactStrictMode: true,
9+
// `next dev` otherwise writes `apps/docs/AGENTS.md` and `apps/docs/CLAUDE.md`
10+
// into the working tree whenever it detects an AI coding agent (Next 16
11+
// `ensureAgentRulesForDev`). Neither path is tracked or ignored, so both land
12+
// as `??` and any `git add -A` after booting the docs server sweeps them into
13+
// an unrelated PR. Those two filenames are load-bearing in this repo: the
14+
// root `AGENTS.md` is the binding playbook and agents are told to read the
15+
// `AGENTS.md` governing the files they touch, so a Next-authored stub
16+
// pointing at `node_modules/next/dist/docs/` can be read as this repo's
17+
// discipline -- and the generated text argues for committing itself, which
18+
// nudges an agent the wrong way. The generated `CLAUDE.md` is the single
19+
// line `@AGENTS.md`, an import directive that pulls the stub in.
20+
//
21+
// Disabled at the source rather than gitignored on purpose: an ignore rule
22+
// for `apps/docs/AGENTS.md` would silently swallow a future repo-authored
23+
// `AGENTS.md` for this app, failing invisibly at exactly the moment someone
24+
// was trying to add real guidance there. A visible untracked file is a better
25+
// failure than an invisibly ignored one for this filename specifically.
26+
//
27+
// This only stops future generation: a checkout that already ran `next dev`
28+
// keeps its copies until they are removed once by hand
29+
// (`rm -f apps/docs/AGENTS.md apps/docs/CLAUDE.md`).
30+
agentRules: false,
931
// No `output: 'standalone'` here on purpose. The standalone packer
1032
// (`writeStandaloneDirectory` -> `copyTracedFiles`) opens
1133
// `.next/next-server.js.nft.json`, and that open is the ONLY thing in a

0 commit comments

Comments
 (0)