Where does the bug appear (feature/product)?
Cursor IDE - Rules, Skills, and the Context Usage panel
Describe the Bug
The Context Usage panel reports ~5.9K tokens of Rules and ~2.1K of Skills in brand-new chats after every rule and skill file has been removed from disk. Cursor appears to serve the rule/skill index from a cached snapshot in the global state database and does not invalidate it when the underlying files change, so every conversation is charged for rules that no longer exist. Because the whole prefix is re-sent each turn, the cost repeats for the life of every chat. Users who deliberately trim their rule set to control context see no benefit from doing so.
Steps to Reproduce
- Start with a populated rule set: 36 .mdc files in
~/.cursor/rules/, 5 in the workspace.cursor/rules/, 7 skills in~/.cursor/skills/. Context Usage shows Rules 6.7K, Skills 2.1K. - Move every rule and skill file to a directory outside
.cursor. Leave both.cursor/rulesfolders empty and delete thealwaysApply: truerule. - Confirm nothing remains: no .mdc under
~/.cursor, no AGENTS.md, no .cursorrules, no nested.cursor/rulesor.cursor/skills, and no~/.agents,~/.claudeor~/.codex. - Open a new agent chat and view Context Usage.
Expected Behavior
Rules reports 0, since no rule file exists in any documented location.
Actual Behavior
Rules reports 5.9K and Skills 2.1K in every new chat, essentially unchanged from the populated state and stable across repeated new chats.
Evidence of the stale cache
In ~/AppData/Roaming/Cursor/User/globalStorage/state.vscdb, table ItemTable:
agentData.cacheStorage.agentEnvironment.slashMenuItems.v2.local.glass.empty-window 15,679 chars
agentData.cacheStorage.agentEnvironment.slashMenuItems.v2.local.glass.5478...4f1ecf 15,679 chars
Both blobs still contain skill entries whose files had been moved out of .cursor roughly 40 minutes earlier, e.g. {"id":"skill-anm/SKILL.md","name":"anm","description":"ANM (Notification Manager)...","type":"skill"}.
Deleting rows matching agentData.cacheStorage.agentEnvironment% with Cursor closed is the only workaround I found.
Operating System
Windows 10.0.26200
Current Cursor Version
Version: 3.11.25
Commit: fc2563ec93d793fc275eef734405a4fdf8b47b20
VS Code base: 1.125.0
Additional Information
Request ID: <paste via chat “…” menu → Copy Request ID>
Related feature request, which is why this bug is costly rather than cosmetic: conditional per-prompt rule loading is currently impossible. beforeSubmitPrompt accepts only continue and user_message, so a hook cannot inject context based on prompt content; only sessionStart supports additional_context and it fires unconditionally, costing the same as an alwaysApply rule. Adding additional_context to beforeSubmitPrompt would let users load a workflow only when its trigger word appears.

