Cursor Desktop Guide
Context Architecture
Understand the priority of context loading to effectively manage the agent's knowledge:
- Team Rules (Highest priority)
- Project Rules (
.cursor/rules/) - User Rules (Cursor Settings)
- AGENTS.md (Project root and subdirectories)
- Skills (Automatically discovered)
Core Components
AGENTS.md
- Purpose: Global instructions and context for the project.
- Best Practice: Keep compact (<100 lines). Use nested
AGENTS.mdfor subdirectories. - Location: Project root (
AGENTS.md) or subdirectories (e.g.,projects/foo/AGENTS.md).
Project Rules (.cursor/rules/)
- Purpose: Specific, versioned rules.
- Format:
.mdor.mdc(with YAML frontmatter). - Types:
- Always Apply:
alwaysApply: true - Apply Intelligently:
alwaysApply: false(Agent decides based on description) - Apply to Specific Files:
globs: ["pattern"] - Apply Manually:
@rule-namemention
- Always Apply:
Skills (.cursor/skills/)
- Purpose: Portable, versioned packages for domain-specific workflows.
- Structure: Directory with
SKILL.md,scripts/,assets/,references/. - Usage: Multi-step workflows requiring resources or scripts.
Commands (.cursor/commands/)
- Purpose: One-off actions triggered by
/commandin chat. - Format: Simple Markdown files.
Subagents
- Purpose: Isolated AI assistants for heavy tasks or parallel execution.
- Usage: Use
Tasktool. - When to use: Context isolation needed, parallel work, or specialized long-running tasks.
- Cost: Each subagent has its own context window (token overhead).
MCP Servers & Integrations
- Local: Use MCP for stateful connections (e.g., Slack) or CLI tools via
Shellfor request-response (e.g., Jira, GitLab). - Cloud Agents: Not used in this system (require remote repo).
Hooks (.cursor/hooks.json)
- Purpose: Scripts triggered on agent events (e.g.,
preToolUse,afterFileEdit). - Types: Command-based (shell script) or Prompt-based (LLM evaluation).
Best Practices
- AGENTS.md is the entry point, not an encyclopedia.
- Use Rules with globs for file formats (e.g., ADRs).
- Use Skills for complex workflows (reviews, reports).
- Use Commands for simple rituals (
/morning). - Use Subagents only when context isolation is strictly necessary.
- Use
.cursorignoreto exclude archives and cache from Semantic Search. - Use Max Mode (1M tokens) for heavy workflows.
References
- Full documentation: references/REFERENCE.md
- Online up-to-date documentation: https://www.cursor.com/docs
Scan to join WeChat group