Cmd+K Shorthand Commands Not Working with Project Rules (.mdc Files)

Bug Report: Cmd+K Shorthand Commands Not Working with Project Rules (.mdc Files)

Issue Description

Shorthand commands defined in project rules (Project Folder.cursor\rules*.mdc files) are not being recognized when used directly in the Cmd+K prompt, even when the rules have alwaysApply: true set. The same commands work properly when explicitly referenced using the @Rules selector.

Steps to Reproduce

  1. Create a project rule file (.mdc) with shorthand commands
  2. Set alwaysApply: true in the file’s frontmatter
  3. Place the file in the .cursor/rules/ directory
  4. Select code in the editor
  5. Press Cmd+K
  6. Type a shorthand command (e.g., !cp)
  7. Observe that the command isn’t processed correctly

Expected Behavior

When typing a shorthand command in Cmd+K, the IDE should recognize and process it according to the logic defined in the project rules, especially when the rule has alwaysApply: true.

Actual Behavior

The IDE scans the code but doesn’t apply the command. In my case, a comment is expected to be added to the code selected in the code window.

Workarounds Discovered

  1. Working method #1: Select code → @Rules → select rule file → type shorthand command
  2. Working method #2: Add just the shorthand command descriptions to global rules in Settings

Environment Details

  • Cursor IDE version: 0.48.8
  • VSCode version: 1.96.2
  • OS: Windows 11 Pro, current
  • Project type: JavaScript/TypeScript, Litegrahp.js build

Additional Information

  • The commands work perfectly when the same content is added to global rules in Settings → Rules for AI
  • The rules file itself works correctly when explicitly referenced using @Rules
  • Works in the main agent chat window
  • This suggests a disconnect between how project rules are processed in Cmd+K vs. when explicitly referenced with @Rules

code ref

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.