Skip to content

Context References

Saros Industries edited this page Jun 28, 2025 · 1 revision

📎 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 (Ω₁)

[Ω₁] = [Γ₄, Γ₂, Γ₆] // Docs, Folders, Git
  • Documentation for understanding
  • Folder structure exploration
  • Git history investigation

Innovate Mode (Ω₂)

[Ω₂] = [Γ₃, Γ₄, Γ₇] // Code, Docs, Notepads
  • Code patterns to consider
  • Best practices docs
  • Brainstorming notes

Plan Mode (Ω₃)

[Ω₃] = [Γ₁, Γ₂, Γ₅] // Files, Folders, Rules
  • Target files to modify
  • Project structure
  • Coding standards

Execute Mode (Ω₄)

[Ω₄] = [Γ₃, Γ₁, Γ₈] // Code, Files, Pinned
  • Active code elements
  • Implementation files
  • Critical references

Review Mode (Ω₅)

[Ω₅] = [Γ₃, Γ₁, Γ₆] // 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

📚 Related Topics


← Code Protection | Home | Permission System →

🚀 Getting Started


🧠 Core Concepts


⚡ Features


📖 Guides


📋 Reference


🔌 Advanced

MCP Integration

BMAD Enterprise


🔧 Troubleshooting

Quick Navigation

🚨 Emergency Procedures

📋 Common Issues

Installation & Setup

  • Installation Issues
    • Node.js Version Compatibility
    • Package Installation Failures
    • Framework Dependencies Missing
    • Database Connection Issues
    • Port Conflicts
    • Environment Setup Issues
    • Build and Development Issues
    • Framework CLI Issues

Configuration & Runtime

  • Configuration & Runtime Issues
    • Framework Configuration Problems
    • Runtime Performance Issues
    • Module Loading and Plugin Issues
    • Database and Storage Issues
    • Memory Leaks and High Memory Usage
    • High CPU Usage

BMAD Module

  • BMAD Module Issues
    • BMAD Module Initialization Problems
    • Business Model Canvas Issues
    • Stakeholder Management Issues
    • Analytics and Reporting Issues
    • Performance Optimization

Database & API

  • Database & API Issues
    • Database Connection Problems
    • Database Migration Issues
    • API Performance and Reliability Issues
    • Data Consistency Issues
    • Transaction Problems

Performance & Memory

Security & Authentication

  • Security & Authentication Issues
    • Authentication Failures
    • Authorization Problems
    • JWT Token Issues
    • Session Management
    • CORS and Security Headers
    • SSL/TLS Configuration

Deployment & Production

  • Deployment & Production Issues
    • Production Deployment Failures
    • Environment Configuration
    • Load Balancing Issues
    • Monitoring and Logging
    • Backup and Recovery

Information to Gather

When reporting issues, please include:

  • Framework version (npm list @cursoriper/core)
  • Node.js version (node --version)
  • Operating system and version
  • Error messages and stack traces
  • Steps to reproduce the issue
  • Configuration files (sanitized)
  • Recent changes or deployments

Tech Docs & Suport


📞 Support & Community


📋 Release Notes

Last Updated: June 28, 2025
Framework Version: CursorRIPER.sigma v1.0+

For the original verbose framework, see CursorRIPER

← Back to Home

Clone this wiki locally