Bug Report: read_file tool strips frontmatter from .mdc files
Version: 1.0.0 (Universal)
VSCode Version: 1.96.2
Commit: 53b99ce608cba35127ae3a050c1738a959750860
Date: 2025-06-04T19:21:39.410Z
Electron: 34.5.1
Chromium: 132.0.6834.210
Node.js: 20.19.0
V8: 13.2.152.41-electron.0
OS: Darwin x64 24.5.0
The read_file
tool systematically strips Jekyll-style YAML frontmatter from .mdc (Markdown Cursor Rules) files, creating a fundamental disconnect between filesystem reality and tool accessibility.
File System Reality (via terminal cat
):
---
description: Defines the canonical specification for .mdc file frontmatter...
globs: ["*.mdc"]
alwaysApply: false
---
# MDC File Frontmatter Specification
Tool Return Value (via read_file
):
# MDC File Frontmatter Specification
(frontmatter completely missing)
Binary Confirmation (via hexdump
):
00000000 2d 2d 2d 0a 64 65 73 63 72 69 70 74 69 6f 6e 3a |---.description:|
File definitively starts with ---\n
but tool strips everything before first markdown header.
- Create an .mdc file with frontmatter:
---
description: Test rule
globs: ["*.test"]
alwaysApply: false
---
# Test Rule Header
- Use AI agent
read_file
tool to access the file - Compare with terminal
cat
command output
Expected: read_file
should return complete file content including frontmatter
Actual: read_file
returns only content after frontmatter closing delimiter
- Test Failures: Frontmatter validation tests fail because tools can't access the frontmatter they're meant to validate
- AI Agent Limitations: Agents cannot programmatically read or edit frontmatter using standard file tools
- Workflow Disruption: Forces manual verification and reliance on terminal commands for .mdc operations
- Rule System Broken: Cursor Rules depend on frontmatter, but tools can't inspect it
We've had to implement these workarounds:
- Use
run_terminal_cmd
withcat
for frontmatter inspection - Use
grep
andsed
for frontmatter editing - Manual verification of all .mdc operations
This bug breaks the fundamental premise of programmatic .mdc file handling. Could you investigate whether this is:
- An intentional design decision (and if so, provide alternative frontmatter access methods)
- An unintended side effect of Markdown processing
- A configuration issue we can resolve
The bug affects our entire .mdc validation framework and forces us to bypass the standard tool ecosystem for these critical configuration files.
Thanks for building such an incredible tool! Even with this bug, the experience has been transformative.
Best regards, [User]
P.S. - Full documentation of our investigation and workarounds is available in our project at .cursor/rules/00-project-meta/mdc-file-frontmatter-specification.mdc
under the "🚨 CRITICAL TOOL BUG" section.