Context References - johnpeterman72/CursorRIPER.sigma GitHub Wiki
๐ Context Reference System
The Context Reference System helps maintain focus by tracking relevant files, code, and documentation throughout your development workflow. It ensures AI assistance stays targeted and efficient.
๐ฏ What is Context?
Context in CursorRIPERโฆฮฃ represents the relevant scope of your current work:
- Files you're working with
- Code functions you're implementing
- Documentation you're referencing
- Folders containing related work
Without context management, AI might:
- ๐ซ Reference unrelated files
- ๐ซ Suggest changes to wrong components
- ๐ซ Lose track of your focus
- ๐ซ Provide generic instead of specific help
๐ Context Types (ฮ)
ฮโ: File References (๐)
Track specific files in your project
!af src/auth/login.js
!af config/database.json
!af tests/auth.test.js
Use for:
- Implementation files
- Configuration files
- Test files
- Documentation files
ฮโ: Folder References (๐)
Track entire directories
!ad src/components/
!ad tests/integration/
!ad docs/api/
Use for:
- Feature folders
- Module directories
- Test suites
- Documentation sections
ฮโ: Code References (๐ป)
Track specific code elements
!ac validateUser()
!ac AuthenticationService
!ac DATABASE_CONFIG
Use for:
- Functions
- Classes
- Constants
- Interfaces
ฮโ: Documentation References (๐)
Track external or internal docs
!adoc "API Design Guide"
!adoc "Security Best Practices"
!adoc README.md
Use for:
- Technical specifications
- Best practices
- API documentation
- Architecture docs
ฮโ : Rules References (๐)
Track Cursor project rules
!ar "Code Style Guide"
!ar "Testing Standards"
!ar RIPERsigma1.0.5.mdc
Use for:
- Coding standards
- Project guidelines
- Framework rules
- Team conventions
ฮโ: Git References (๐)
Track version control context
!ag feature/authentication
!ag commit:a1b2c3d
!ag PR#42
Use for:
- Feature branches
- Specific commits
- Pull requests
- Git history
ฮโ: Notepad References (๐)
Track temporary notes and ideas
!an "Authentication Ideas"
!an "Refactoring Notes"
!an "Meeting Notes 2024-01-15"
Use for:
- Brainstorming
- Temporary notes
- Meeting outcomes
- Quick ideas
ฮโ: Pinned Files (๐)
Pin files without direct reference
!pf src/core/engine.js
!pf .env.example
!pf package.json
Use for:
- Always-relevant files
- Core dependencies
- Critical configs
- Reference files
๐ฎ Active Context Display
Context is displayed in activeContext.md
:
## ๐ Context References
### ๐ Active Files
- src/auth/login.controller.js ๐ข
- src/auth/auth.service.js ๐ข
- src/middleware/auth.js ๐ก
### ๐ป Active Code
- validateCredentials() ๐ข
- generateToken() ๐ข
- AuthGuard ๐ฃ
### ๐ Active Docs
- JWT Best Practices ๐ข
- OAuth2 Specification ๐ก
## ๐ก Context Status
๐ข Active - Currently working
๐ก Partial - May reference
๐ฃ Essential - Always relevant
๐ด Deprecated - To be removed
๐จ Context Status Indicators
๐ข Active
Currently being worked on
src/auth/login.js ๐ข
๐ก Partially Relevant
May be referenced
src/utils/helpers.js ๐ก
๐ฃ Essential
Core to current work
src/config/app.js ๐ฃ
๐ด Deprecated
Marked for removal
src/legacy/old-auth.js ๐ด
๐ Mode-Specific Context
Each mode automatically loads appropriate context:
Research Mode (ฮฉโ)
Mฮ[ฮฉโ] = [ฮโ, ฮโ, ฮโ] // Docs, Folders, Git
- Documentation for understanding
- Folder structure exploration
- Git history investigation
Innovate Mode (ฮฉโ)
Mฮ[ฮฉโ] = [ฮโ, ฮโ, ฮโ] // Code, Docs, Notepads
- Code patterns to consider
- Best practices docs
- Brainstorming notes
Plan Mode (ฮฉโ)
Mฮ[ฮฉโ] = [ฮโ, ฮโ, ฮโ
] // Files, Folders, Rules
- Target files to modify
- Project structure
- Coding standards
Execute Mode (ฮฉโ)
Mฮ[ฮฉโ] = [ฮโ, ฮโ, ฮโ] // Code, Files, Pinned
- Active code elements
- Implementation files
- Critical references
Review Mode (ฮฉโ )
Mฮ[ฮฉโ
] = [ฮโ, ฮโ, ฮโ] // Code, Files, Git
- Implemented code
- Changed files
- Git comparisons
๐ Context Commands
Adding Context
Command | Description | Example |
---|---|---|
!af |
Add file | !af src/main.js |
!ad |
Add directory | !ad src/services/ |
!ac |
Add code | !ac processPayment() |
!adoc |
Add documentation | !adoc "API Guide" |
!ar |
Add rules | !ar "Style Guide" |
!ag |
Add git ref | !ag feature/auth |
!an |
Add notepad | !an "Ideas" |
!pf |
Pin file | !pf config.json |
Managing Context
Command | Description | Example |
---|---|---|
!cs |
Set status | !cs login.js active |
!cr |
Remove reference | !cr old-file.js |
!cc |
Clear all | !cc |
!cm |
Mode context | !cm |
๐ Context Lifecycle
1. Context Creation
/plan
!af src/feature.js # Add target file
!ac newFeature() # Add function to implement
!adoc "Feature Spec" # Add specification
2. Context Evolution
/execute
!cs src/feature.js essential # Mark as essential
!ac helperFunction() # Add new function
!cr "Feature Spec" # Remove spec (no longer needed)
3. Context Cleanup
/review
!cs src/feature.js partial # Downgrade relevance
!cr helperFunction() # Remove temporary function
4. Context Archival
Feature complete - context archived to memory
!cc # Clear for next task
๐ก Context Strategies
1. Focused Context
Keep context minimal and relevant:
โ Bad: Add entire src/ directory
โ
Good: Add specific feature folder
2. Progressive Context
Build context as you work:
Research: Broad folders and docs
Plan: Specific files and rules
Execute: Exact code elements
Review: Changed files and tests
3. Context Rotation
Swap context for different features:
!cc # Clear current
!cm # Load mode defaults
!af src/new-feature.js # Add new focus
4. Context Persistence
Important context persists across modes:
!pf src/core/app.js # Always relevant
!cs database.config essential # Mark critical
๐ฏ Context Patterns
Feature Development Pattern
# Research Phase
!ad src/features/auth/ # Explore structure
!adoc "Auth Requirements" # Understand needs
# Plan Phase
!af src/features/auth/login.js # Target file
!ar "Security Standards" # Apply standards
# Execute Phase
!ac loginUser() # Implement function
!pf src/features/auth/types.ts # Reference types
# Review Phase
!ag feature/auth-implementation # Compare changes
!af tests/auth.test.js # Verify tests
Bug Fix Pattern
# Research
!ag issue#123 # Git issue
!af src/problematic-file.js # Problem file
# Plan
!ac buggyFunction() # Target function
!adoc "Expected Behavior" # Correct behavior
# Execute
!cs buggyFunction() essential # Focus on fix
# Review
!af tests/regression.test.js # Verify fix
Refactoring Pattern
# Research
!ad src/legacy/ # Old code
!adoc "New Architecture" # Target design
# Plan
!ac oldImplementation() # Current code
!ac newImplementation() # Target code
# Execute
!pf src/legacy/interfaces.ts # Maintain compatibility
# Review
!ag main...refactor-branch # Full comparison
๐ Context Operations
Context Intersection
Find common elements:
ฮโ โฉ ฮโ = Files containing active code
Context Union
Combine contexts:
ฮโ โช ฮโ = All code references plus pinned files
Context Filtering
filter(ฮโ, "auth") = All auth-related code
Context Ranking
rank(ฮโ, relevance) = Files by importance
๐ Cross-References with Context
Standard Cross-Reference
[โ๏ธฯโ:Rโ] = Requirement 3
Cross-Reference with Context
[โ๏ธฯโ:Rโ|ฮโ:validateUser()] = Requirement 3, specifically validateUser()
Context-Only Reference
[ฮโ:AuthService] = Reference to AuthService
Protected Context Reference
[ฮจโ+ฮโ:secretKey] = Protected code reference
โก Context Best Practices
1. Start Broad, Narrow Down
Research: !ad src/
Plan: !ad src/auth/
Execute: !af src/auth/login.js
2. Use Status Effectively
๐ข Active: What you're editing
๐ก Partial: What you might need
๐ฃ Essential: What you always need
๐ด Deprecated: What to remove
3. Mode-Appropriate Context
Let mode transitions update context:
!cm # Automatically sets mode-appropriate context
4. Regular Cleanup
# End of feature
!cc # Clear all context
# Start of new feature
!cm # Fresh context for mode
5. Document Context Decisions
!an "Why auth.service.js is essential"
# This service contains the core business logic
# All auth features depend on it
๐จ Common Context Issues
Context Overload
Problem: Too many references Solution: Use status markers and remove irrelevant
Lost Context
Problem: Cleared accidentally
Solution: Check backups in memory-bank
Wrong Context
Problem: Old context still active
Solution: !cc
then rebuild
Missing Context
Problem: AI not seeing relevant files Solution: Add with appropriate commands
๐ Context Examples
Example 1: Starting New Feature
/research
!ad src/features/ # Explore features
!adoc "Feature Request #42" # Understand requirements
/plan
!cc # Clear exploration context
!cm # Load planning context
!af src/features/search.js # Target implementation file
!ar "API Design Standards" # Apply standards
Example 2: Debugging Session
/research
!ag "Error: undefined user" # Search git for error
!af src/auth/middleware.js # Suspected problem file
!ac checkUserSession() # Problem function
/execute
!cs checkUserSession() essential # Focus on this
!pf src/types/user.ts # Reference for types
Example 3: Code Review
/review
!ag PR#123 # Pull request context
!af src/changed-file-1.js ๐ข # Files to review
!af src/changed-file-2.js ๐ข
!ac newFeatureImplementation() # New code to check