用 scoped .mdc globs 解决 Cursor Composer 的 token 膨胀和响应变慢
Оригинальный заголовок: How to eliminate Composer token bloat and slow response times using scoped .mdc globs
Заголовок и краткое изложение на выбранном языке ожидают перевода.
Cursor Composer 变慢、token 消耗快,常见原因是多个 .mdc 文件设了 alwaysApply: true,4 到 5 条规则会给每轮对话前置 3000+ token 的静态指令,到第 10 轮时 prompt prefill 延迟明显上升。
Полный текст на выбранном языке ожидает перевода. Пока показан оригинал.
If your Cursor Composer is feeling sluggish or burning through token credits rapidly, check your .cursor/rules/ configuration.
A common pitfall is marking multiple .mdc files with alwaysApply: true. When you have 4–5 rules set to alwaysApply, Cursor prefixes 3,000+ tokens of static instructions to every single Composer turn. By turn 10 of a session, prompt prefill latency skyrockets.
Best Practice Fix:
- Use file-matching
globsin your.mdcfrontmatter rather than global application:--- description: Rules for database migrations and queries globs: ["prisma/**", "migrations/**", "**/db/**"] alwaysApply: false --- - Keep only ONE minimal file (
core.mdc) marked asalwaysApply: true:
Keep this file under 50 lines, focused solely on coding style and project-wide invariant commands (e.g. package manager to use, linter command). - Query docs via MCP instead of pasting them into rules:
Don’t paste massive framework documentation or API references directly into.cursorrulesor.mdcfiles. Instead, connect documentation MCP servers so Composer fetches only the relevant sections on-demand.
This keeps your prompt window lean and ensures Composer generates answers in seconds rather than stalling on massive context prefills.
Источник: Cursor Forum · Guides · forum.cursor.com