Same AGENTS.md injected 9× as "always applied" rules via symlinked skill dirs — 471K tokens of Rules, context 181% full on first turn

Describe the Bug

In a monorepo, Cursor injects the same AGENTS.md file several times as <always_applied_workspace_rule>. It does this once for each symlinked path that resolves to the file. In my workspace this put 471.5K tokens into the Rules category. The context window is 300K, so the context was 181% full before any real conversation. The agent has to summarize again and again from the first turn.

Data from the context-usage panel:

Category Tokens
Rules 471.5K
MCP & dynamic tools 32.4K
Summarized conversation 13.1K
Skills 9.5K
Tool definitions 7.5K
Conversation 3.8K
System prompt 2.1K
Subagent definitions 2.0K
Total ~542K / 300K (181%)

The Rules category held 20 files:

  • 9 copies of vercel-react-best-practices/AGENTS.md. Each copy is byte-identical, and each is about 99.8K chars. The source file is 106 KB, so each copy has the [truncated: AGENTS.md is 106 KB; only the first 100 KB is …] marker.
  • 9 copies of vercel-composition-patterns/AGENTS.md. Each copy is byte-identical and about 15.9K chars.
  • The root AGENTS.md and the root CLAUDE.md. These two are about 72K chars each and almost identical.

Git contains only one real copy of each skill file. The other 8 paths are symlinks. The repo layout is:

packages/skill-pack/.agents/skills/
  vercel-react-best-practices/AGENTS.md      <- the only real file
  vercel-composition-patterns/AGENTS.md
packages/skill-pack/.claude/skills/vercel-*  -> ../../.agents/skills/vercel-*   (symlink)
apps/<app-N>/.agents/skills/pack -> ../../../../packages/skill-pack/.agents/skills   (symlink, 8 apps/packages)
apps/<app-N>/.claude/skills/pack -> ../../.agents/skills/pack                        (symlink)

The 9 injected paths look like this. 8 of them go through .claude/skills/... and 1 goes through .agents/skills/...:

apps/app-1/.claude/skills/pack/vercel-react-best-practices/AGENTS.md
apps/app-2/.agents/skills/pack/vercel-react-best-practices/AGENTS.md
packages/skill-pack/.claude/skills/vercel-react-best-practices/AGENTS.md
...

Other observations

  • Cursor does not inject every nested AGENTS.md. Other nested ones, such as a 37K-char apps/<backend>/AGENTS.md, were not injected. Only the files that live inside skill directories were injected.
  • In the context-usage panel, the per-file estimatedTokens values add up to 296.6K. That sum equals chars ÷ 4. The Rules category total is 471.5K, which is about 2.5 chars/token. The two numbers do not agree.
  • Claude Code and Codex CLI on the same repo do not show this problem. Codex injects only the root AGENTS.md, and its first turn is about 46K tokens in total.

Related: #164295 (symlink double-counting, 2 copies) and #165337 (nested AGENTS.md in monorepos). This report is the same dedupe problem at 9× scale, inside skill directories.

Steps to Reproduce

  1. Put a large AGENTS.md inside a skill directory, for example packages/skill-pack/.agents/skills/big-skill/AGENTS.md.
  2. Symlink that skills directory into several workspace packages, for example apps/a/.agents/skills/pack and apps/b/.agents/skills/pack.
  3. Open the repo root in Cursor and start an Agent chat.
  4. Open the context-usage view. The Rules category lists the same AGENTS.md once for each symlinked path.

I observed this in the repo structure above. I have not yet confirmed it in a minimal standalone repo.

Expected Behavior

  • Cursor resolves symlinks with realpath and injects each unique file only once.
  • Ideally, Cursor does not treat an AGENTS.md inside a skill directory as an always-applied workspace rule. That file is the skill’s reference material, and it should load only when the skill is used.
  • Cursor tells the user, or refuses to start, when always-applied rules alone exceed the context window.
  • .cursorignore or a setting can exclude a path from rule discovery. Please confirm whether this is already possible.

Operating System: macOS 26.5.1 (arm64)
Current Cursor Version: 3.27.14

Does this stop you from using Cursor: Yes. Every new chat in this repo starts over the context limit.

Update: turning off third-party config loading does not fix this.

I turned off “Include third-party Plugins, Skills, and other configs”, which is the workaround suggested in #164295. Then I started a new chat in the same workspace and compared its first-turn prompt with the earlier one:

Before After toggle off
Always-applied rule files 20 19
Total rule chars ~1.18M ~1.11M (−6%)
Root CLAUDE.md injected not injected (the toggle works here)
vercel-react-best-practices/AGENTS.md 9 copies still 9 copies
vercel-composition-patterns/AGENTS.md 9 copies still 9 copies
Context 100% (300K cap) 100% (300K cap)

After the toggle, all 18 duplicated entries come from .claude/skills/... paths, for example apps/app-1/.claude/skills/pack/vercel-react-best-practices/AGENTS.md. Before, 1 of each set came through .agents/skills/....

The docs list .claude/skills/ as a compatibility (third-party) location. So with the toggle off, I expected Cursor to stop reading these paths. The toggle removes the root CLAUDE.md, but it does not gate AGENTS.md files under .claude/skills/. As a result, no setting removes the 9× duplication.

Hey @woai3c,

You’ve read it right. An AGENTS.md that sits inside a skill folder gets picked up as an always-applied rule, and each symlinked package path counts as its own copy, so the same file lands in context once per package. I’ve passed this to the team.

In the meantime, you can exclude the real file with one line in .cursorignore at the repo root:

packages/skill-pack/.agents/skills/**/AGENTS.md

The ignore check resolves symlinks first, so that one line covers every linked copy. It may also stop the agent reading that file when the skill wants it. If you’d rather keep it readable, rename the skill’s AGENTS.md (to something like REFERENCE.md) and update the link in SKILL.md, since only files named AGENTS.md are treated as rules. There’s no separate setting for this today.

On the numbers: the per-file values are a rough characters ÷ 4 estimate, while the category totals are scaled to the actual token count of the request, so the Rules total is the closer figure.