Permission System - johnpeterman72/CursorRIPER.sigma GitHub Wiki

๐Ÿ” Permission System

The Permission System enforces mode-specific operational boundaries, preventing accidental modifications and ensuring safe AI assistance throughout your development workflow.

๐ŸŽฏ Why Permissions Matter

Without permission control, AI might:

  • ๐Ÿšซ Write code during research
  • ๐Ÿšซ Modify plans while executing
  • ๐Ÿšซ Delete files unexpectedly
  • ๐Ÿšซ Search web during focused coding

The permission system creates operational safety through mode-based restrictions.

๐Ÿ”‘ CRUD Permission Model

Permission Matrix (โ„™)

โ„™ = {C: create, R: read, U: update, D: delete}

Each mode has specific CRUD permissions:

Mode Symbol Create Read Update Delete
Research ฮฉโ‚ โœ— โœ“ โœ— โœ—
Innovate ฮฉโ‚‚ ~ โœ“ โœ— โœ—
Plan ฮฉโ‚ƒ โœ“ โœ“ ~ โœ—
Execute ฮฉโ‚„ โœ“ โœ“ โœ“ ~
Review ฮฉโ‚… โœ— โœ“ โœ— โœ—

Legend:

  • โœ“ = Allowed
  • โœ— = Forbidden
  • ~ = Conditional/Limited

๐Ÿ“Š Mode Permissions Breakdown

๐Ÿ” Research Mode (ฮฉโ‚)

โ„™(ฮฉโ‚) = {R: โœ“, C: โœ—, U: โœ—, D: โœ—}

Can Do:

  • Read all files
  • Analyze code structure
  • Search documentation
  • Review git history
  • Access databases (read-only)

Cannot Do:

  • Create any files
  • Modify existing code
  • Delete anything
  • Write to databases

Example Allowed Operations:

// โœ“ Allowed
const data = await readFile('config.json');
const users = await db.select('*').from('users');

// โœ— Forbidden  
await writeFile('output.txt', data);
await db.insert({name: 'John'}).into('users');

๐Ÿ’ก Innovate Mode (ฮฉโ‚‚)

โ„™(ฮฉโ‚‚) = {R: โœ“, C: ~, U: โœ—, D: โœ—}

Can Do:

  • Read everything
  • Create conceptual designs
  • Suggest theoretical approaches
  • Draft pseudo-code

Cannot Do:

  • Create actual files
  • Modify any code
  • Delete anything
  • Implement ideas

Conditional Creation (~):

// โœ“ Allowed: Conceptual creation
"We could create a service like:
class AuthService {
  validateUser() { }
  generateToken() { }
}"

// โœ— Forbidden: Actual file creation
await writeFile('auth.service.js', serviceCode);

๐Ÿ“ Plan Mode (ฮฉโ‚ƒ)

โ„™(ฮฉโ‚ƒ) = {R: โœ“, C: โœ“, U: ~, D: โœ—}

Can Do:

  • Read everything
  • Create specifications
  • Create plan documents
  • Update planning files only
  • Design architectures

Cannot Do:

  • Update production code
  • Delete anything
  • Execute plans

Conditional Updates (~):

// โœ“ Allowed: Update plan documents
await updateFile('architecture.md', newDesign);
await updateFile('plan-checklist.md', tasks);

// โœ— Forbidden: Update code
await updateFile('src/app.js', newCode);

โš™๏ธ Execute Mode (ฮฉโ‚„)

โ„™(ฮฉโ‚„) = {R: โœ“, C: โœ“, U: โœ“, D: ~}

Can Do:

  • All file operations
  • Create new code
  • Modify existing code
  • Limited deletion
  • Database writes

Cannot Do:

  • Search web (focus!)
  • Deviate from plan
  • Mass deletion

Conditional Deletion (~):

// โœ“ Allowed: Targeted deletion
await deleteFile('temp-file.js');
await db.delete().from('sessions').where('expired', true);

// โœ— Forbidden: Mass deletion
await deleteDirectory('src/');
await db.delete().from('users'); // No WHERE clause

๐Ÿ”Ž Review Mode (ฮฉโ‚…)

โ„™(ฮฉโ‚…) = {R: โœ“, C: โœ—, U: โœ—, D: โœ—}

Can Do:

  • Read all files
  • Analyze changes
  • Run tests (read-only)
  • Generate reports
  • Compare versions

Cannot Do:

  • Modify anything
  • Fix issues found
  • Create new files
  • Delete anything

Example Operations:

// โœ“ Allowed
const testResults = await runTests();
const coverage = await analyzeCoverage();
const diff = await gitDiff('main', 'feature');

// โœ— Forbidden
await fixBug(issue);
await updateTestCase(test);

๐Ÿ”„ Operation Categories

๐•†แตฃโ‚‘โ‚โ‚— - Real Operations

Physical changes to the system:

๐•†แตฃโ‚‘โ‚โ‚— = {
  modify_files,
  write_code, 
  delete_content,
  refactor,
  create_files,
  update_database
}

๐•†แตฅแตขแตฃโ‚œแตคโ‚โ‚— - Virtual Operations

Conceptual work without changes:

๐•†แตฅแตขแตฃโ‚œแตคโ‚โ‚— = {
  suggest_ideas,
  explore_concepts,
  evaluate_approaches,
  design_architecture,
  plan_implementation
}

๐•†โ‚’แตฆโ‚›โ‚‘แตฃแตฅโ‚‘ - Observation Operations

Read-only analysis:

๐•†โ‚’แตฆโ‚›โ‚‘แตฃแตฅโ‚‘ = {
  read_files,
  analyze_content,
  identify_patterns,
  review_code,
  check_status
}

๐Ÿ›ก๏ธ Permission Enforcement

Mode Operation Sets

๐•Š(ฮฉโ‚) = {๐•†โ‚’แตฆโ‚›โ‚‘แตฃแตฅโ‚‘: โœ“, ๐•†แตฅแตขแตฃโ‚œแตคโ‚โ‚—: ~, ๐•†แตฃโ‚‘โ‚โ‚—: โœ—}
๐•Š(ฮฉโ‚‚) = {๐•†โ‚’แตฆโ‚›โ‚‘แตฃแตฅโ‚‘: โœ“, ๐•†แตฅแตขแตฃโ‚œแตคโ‚โ‚—: โœ“, ๐•†แตฃโ‚‘โ‚โ‚—: โœ—}
๐•Š(ฮฉโ‚ƒ) = {๐•†โ‚’แตฆโ‚›โ‚‘แตฃแตฅโ‚‘: โœ“, ๐•†แตฅแตขแตฃโ‚œแตคโ‚โ‚—: โœ“, ๐•†แตฃโ‚‘โ‚โ‚—: ~}
๐•Š(ฮฉโ‚„) = {๐•†โ‚’แตฆโ‚›โ‚‘แตฃแตฅโ‚‘: โœ“, ๐•†แตฅแตขแตฃโ‚œแตคโ‚โ‚—: ~, ๐•†แตฃโ‚‘โ‚โ‚—: โœ“}
๐•Š(ฮฉโ‚…) = {๐•†โ‚’แตฆโ‚›โ‚‘แตฃแตฅโ‚‘: โœ“, ๐•†แตฅแตขแตฃโ‚œแตคโ‚โ‚—: ~, ๐•†แตฃโ‚‘โ‚โ‚—: โœ—}

Permission Check Function

ฮž(op, ฮฉ) = op โˆˆ ๐•Š(ฮฉ) ? allow(op) : ๐•(op, ฮฉ)

Translation: "If operation is permitted in current mode, allow it; otherwise, trigger violation handler."

โš ๏ธ Violation Handling

Violation Detection

๐•(op, ฮฉ) = {
  log_violation(op, ฮฉ),
  create_backup(),
  revert_to_safe_mode(),
  notify_violation(op, ฮฉ)
}

Violation Severity Levels

CRITICAL Violations

Operations that could cause data loss:

- Delete in RESEARCH mode
- Mass updates in REVIEW mode
- Database drops in any mode

HIGH Violations

Operations that break mode discipline:

- Writing code in PLAN mode
- Modifying plans in EXECUTE mode
- Creating files in RESEARCH mode

MEDIUM Violations

Conceptual boundary crossing:

- Implementing in INNOVATE mode
- Searching web in EXECUTE mode
- Fixing bugs in REVIEW mode

LOW Violations

Minor infractions:

- Suggesting code in RESEARCH mode
- Planning details in INNOVATE mode

Violation Response

โš ๏ธ PERMISSION VIOLATION DETECTED
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
Operation: write_code
Current Mode: RESEARCH (ฮฉโ‚)
Severity: HIGH

Action Taken:
โœ… Backup created
๐Ÿ”„ Switched to safe mode (PLAN)
๐Ÿ“ Violation logged

Suggestion:
To write code, switch to EXECUTE mode:
/execute

๐Ÿ” Permission Commands

Check Permissions

Command Description Example Output
!ckp Current mode permissions "EXECUTE: Create โœ“, Read โœ“, Update โœ“, Delete ~"
!pm write_code Check specific operation "โŒ Not permitted in RESEARCH mode"
!sp plan Show mode permissions "PLAN: C:โœ“ R:โœ“ U:~ D:โœ—"
!vm delete_file Suggest appropriate mode "Use EXECUTE mode for deletion"

๐Ÿ“Š Permission Matrices

File System Permissions

Mode Create File Read File Update File Delete File
Research โœ— โœ“ โœ— โœ—
Innovate โœ— โœ“ โœ— โœ—
Plan โœ“* โœ“ โœ“* โœ—
Execute โœ“ โœ“ โœ“ โœ“**
Review โœ— โœ“ โœ— โœ—

*Plan documents only **With confirmation

Database Permissions

Mode Insert Select Update Delete
Research โœ— โœ“ โœ— โœ—
Innovate โœ— โœ“ โœ— โœ—
Plan โœ— โœ“ โœ— โœ—
Execute โœ“ โœ“ โœ“ โœ“*
Review โœ— โœ“ โœ— โœ—

*With WHERE clause

External Service Permissions

Mode Web Search API Calls Git Operations Package Install
Research โœ“ โœ“* โœ“* โœ—
Innovate โœ“ โœ“* โœ“* โœ—
Plan โœ“ โœ“* โœ“* โœ“**
Execute โœ— โœ“ โœ“ โœ“
Review โœ“ โœ“* โœ“* โœ—

*Read-only **In package.json

๐Ÿ’ก Permission Strategies

1. Mode-First Thinking

Before any operation, check mode:

Current mode: RESEARCH
Want to: Write code
Action: Switch to EXECUTE first

2. Progressive Permissions

Build up permissions as needed:

Research โ†’ Read only
Innovate โ†’ Read + Conceptual
Plan โ†’ Read + Create specs
Execute โ†’ Full permissions
Review โ†’ Read only again

3. Permission Boundaries

Respect hard limits:

// In EXECUTE mode
if (operation === 'delete' && !hasWhereClause) {
  throw new PermissionError('Mass deletion forbidden');
}

4. Safe Fallbacks

On violation, revert to safe state:

Current: EXECUTE with error
Fallback: PLAN mode
Action: Re-plan approach

๐ŸŽฏ Common Permission Patterns

Feature Development

RESEARCH: Read existing code (R: โœ“)
INNOVATE: Design approach (C: ~)
PLAN: Create specifications (C: โœ“)
EXECUTE: Implement feature (C: โœ“, U: โœ“)
REVIEW: Verify implementation (R: โœ“)

Bug Fix Flow

RESEARCH: Read bug reports (R: โœ“)
PLAN: Design fix (C: โœ“ for plan)
EXECUTE: Apply fix (U: โœ“)
REVIEW: Verify fix (R: โœ“)

Refactoring Process

RESEARCH: Analyze current code (R: โœ“)
INNOVATE: Design new structure (C: ~)
PLAN: Create migration plan (C: โœ“)
EXECUTE: Refactor code (U: โœ“, D: ~)
REVIEW: Ensure functionality (R: โœ“)

๐Ÿšจ Permission Edge Cases

1. Emergency Fixes

Need immediate fix but in wrong mode:

Solution: Quick mode switch
/execute
// Fix critical bug
/review

2. Exploration During Execution

Need to research while coding:

Solution: Note question, finish current task, then:
/research
// Investigate approach
/execute

3. Plan Changes During Execute

Realize plan needs adjustment:

Solution: Pause execution
/plan
// Update plan
/execute
// Continue with new plan

4. Accidental Violations

Tried forbidden operation:

Response:
- Operation blocked
- Backup created
- Clear guidance provided
- No harm done

๐Ÿ›ก๏ธ Permission Safety Features

Automatic Backups

Before risky operations:

if (isDestructive(operation)) {
  createBackup();
  confirmOperation();
}

Transaction Rollback

For database operations:

try {
  await db.transaction(async (trx) => {
    // Permitted operations
  });
} catch (error) {
  // Auto rollback
}

File System Protection

Prevent catastrophic deletions:

const PROTECTED_PATHS = ['/', '/src', '/node_modules'];
if (PROTECTED_PATHS.includes(path)) {
  throw new PermissionError('Cannot delete protected path');
}

๐Ÿ“‹ Permission Reference Card

Quick Permission Check

Research: Read-only
Innovate: Read + Think
Plan: Read + Design  
Execute: Full access
Review: Read-only

Operation Quick Guide

Want to... Need Mode
Read code Any mode
Write code EXECUTE
Create plan PLAN
Delete file EXECUTE
Search web NOT EXECUTE
Fix bug EXECUTE
Check quality REVIEW

๐ŸŽ“ Permission Examples

Example 1: Research Violation

[MODE: RESEARCH]
User: "Create a new authentication service"

Response: โš ๏ธ Cannot create files in RESEARCH mode
To create files, switch to EXECUTE mode:
/execute

Example 2: Execute Limitation

[MODE: EXECUTE]
User: "Search for best authentication practices"

Response: โš ๏ธ Web search disabled in EXECUTE mode
Complete current task, then:
/research

Example 3: Conditional Permission

[MODE: PLAN]
User: "Update the architecture diagram"

Response: โœ“ Updating architecture.md (planning document)

๐Ÿ“š Related Topics


โ† Context References | Home | Cross-References โ†’