Does @file syntax works in .mdc rules?

The Rules for AI documentation mention that it is possible to use the @file syntax to attach the content of a file to a rule. Meaning the file content will be added to the context during the first submit and no tool is necessary to access the file.

But after running a lot of experiment, it seems that the @file syntax does ont work for rules. Am I correct?

Note: below the paragraph of Rules for AI mentioning the @file syntax.

Reference Files

Use @file in your project rules to include additional files as context when the rule is applied. Using the @file syntax inside a rule, you can include the contents of another file as part of the rule’s context.

For example, a rule could include @file ../api-guide.md to attach an API guide whenever that rule is applied, giving the AI more information.

These features work together to make rules powerful. You can even reference one rule file from within another using @file, effectively chaining multiple rules together for complex scenarios.

Rules don’t just contain instructions; they can also include file attachments to provide vital context.

+1 on this

Hey, thanks for the report. Unfortunately, this doesn’t work yet. I believe it’ll be fixed in one of the upcoming updates.

I am not getting any autocomplete / suggestion when I use the @ to reference a file.

is that expected?

According to the docs (Rules | Cursor Docs)


Can rules reference other rules or files?

Yes. Use @filename.ts to include files in your rule’s context.