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)