Bug: .cursor/rules
not applied when the agent edits a file
Description:
When the agent starts editing or creating a file that matches a rule marked as AutoAttached
in .cursor/rules
, the rule is not injected into the system prompt.
This behavior defeats the purpose of dynamic rule context. The rule should not be loaded at file open or startup โ it should be triggered only when the agent itself interacts with the file (edits, adds, inserts).
Steps to Reproduce:
- Create a rule file like
.cursor/rules/ts.json
withAutoAttached
and a matcher forsrc/test.ts
. - Ask the agent to write code into
src/test.ts
(let the agent open the file itself). - The agent starts editing โ but the corresponding rule is not loaded.
Expected Behavior:
When the agent begins editing any file:
- It should detect a matching
AutoAttached
rule; - Automatically update the system prompt with the rule;
- Proceed with the task using the updated prompt.
Impact:
This makes Cursor rules unreliable.
Without dynamic injection at edit time, the agent works in the wrong context and ignores key project-specific instructions. It severely limits the utility of .cursor/rules
and prevents scalable workflows across large codebases.