Skip to content

chore(next): add agent rules generated by next dev - #96

Merged
ronload merged 1 commit into
mainfrom
chore/next-agent-rules
Oct 25, 2026
Merged

ronload merged 1 commit into
mainfrom
chore/next-agent-rules

Conversation

@ronload

@ronload ronload commented Oct 25, 2026

Copy link
Copy Markdown
Owner

Why

next dev writes a managed block to apps/web/AGENTS.md through its agentRules option, which is on by default, and writes it back if the file is deleted (syncAgentRulesForDev in next/dist/server/lib/app-info-log.js). Left untracked, it keeps showing up as an untracked change. Committing it keeps the tree clean.

Changes

  • Add apps/web/AGENTS.md exactly as next dev generated it. Next.js only rewrites the content between the nextjs-agent-rules markers: edits inside them are reverted on the next next dev, while anything added outside them is preserved.

Verification

  • hasCurrentAgentRules from the installed Next.js returns true for this file, so next dev leaves it as is.
  • prettier --check . passes with the file in place.

Notes

  • If a Next.js upgrade changes the block, next dev rewrites it and the change needs a follow-up commit.
  • To opt out instead, set agentRules: false in next.config.ts; the next next dev run then deletes the file.

next dev writes this managed block to apps/web/AGENTS.md through its
agentRules option, which is on by default, and writes it back if the
file is deleted. Left untracked, it kept showing up as an untracked
change. Committing it keeps the tree clean.

Next.js only rewrites the content between the nextjs-agent-rules
markers; anything added outside them is preserved.
@ronload ronload added the documentation Improvements or additions to documentation label Oct 25, 2026
@vercel

vercel Bot commented Oct 25, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
zipkit Ready Ready Preview Oct 25, 2026 1:49pm UTC

@ronload ronload self-assigned this Oct 25, 2026
@ronload
ronload merged commit 6d22e71 into main Oct 25, 2026
4 checks passed
@ronload
ronload deleted the chore/next-agent-rules branch October 25, 2026 14:28

This branch was successfully deployed

1 active deployment
Preview — 9b0d734f Deployed Oct 25, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant