Cursor Context Management
Load if: Using Cursor, context >60% Prerequisites: @smith-ctx/SKILL.md
CRITICAL: Context Commands
Agent prompts for context status, then recommends /summarize at 60-70%.
Automatic summarization uses smaller flash model → vague summaries, lost details. Recommend manual /summarize before auto-trigger.
After any summarization:
- Re-state critical context (task, files, decisions)
- Use @ mentions to restore files:
@auth/middleware.ts @auth/tokens.ts
/summarize - Manual Summarization
When to use: Before automatic trigger, between task phases
Recommendation format:
/summarize
After summarizing, re-add critical files:
@auth/middleware.ts @auth/tokens.ts
Verify summary preserved:
- Task goals
- File locations
- Design decisions
- Next steps
Recommend /summarize for the user to run rather than claiming to execute it directly. Recommend manual /summarize rather than relying solely on automatic summarization. Verify summary quality before continuing.
@ Mentions - Force-Include Files
Syntax: @filename or @path/to/file.ext
Use @ mentions for:
- After summarization (restore critical files)
- Before implementation (load files to modify)
- Large files >600 lines (@codebase truncates at 250)
Patterns:
@auth/middleware.ts @auth/tokens.ts # Multiple files
@src/auth.ts @tests/auth.test.ts # File + tests
Use @ mention (not @codebase) for files >600 lines, since @codebase only loads the first 250. @ mention specific files rather than entire directories, and only @ mention files you'll actually use.
@codebase - Discovery Only
Use for: Finding files, understanding patterns Limitation: Returns summaries, not complete code
Workflow:
@codebase authentication middleware→ Find files@auth/middleware.ts→ Load full file- Implement with complete context
.cursorrules - Persistent Instructions
Location: .cursorrules in project root
Put in .cursorrules (project-specific):
- Technology stack
- Project structure
- Reference to @AGENTS.md
Put in skill files (personal/global):
- Universal principles
- Language style
- Git workflow
Example:
# Project Rules
Follow standards from @AGENTS.md
## Stack
- Framework: NestJS
- Database: PostgreSQL
- Testing: Jest
Related
- @smith-ctx/SKILL.md - Universal context strategies
Before You Finish
Proactive context management:
- Prompt for context status
- At 60-70%: Recommend
/summarizebefore auto-trigger - After summarization: Remind to re-add files with @ mentions
Agent RECOMMENDS - user executes the command.
File size strategy:
- <250 lines: @codebase works
- 250-600 lines: Use @ mention
-
600 lines: Always @ mention