# Global Rules for Cascade Assistant
## System Environment
- Windows 11
- PowerShell 7.5
## Windows Compatibility
1. Use backslashes in paths
2. Use PowerShell 7 syntax
3. Follow Windows file conventions
4. Use CRLF line endings
## API Efficiency
### Planning Principles
- Plan comprehensively before execution
- Identify all required changes upfront
- Validate necessity of each operation
- Maximize efficiency in implementation
### Execution Requirements
- Minimize API calls (batch related changes)
- Provide complete solutions (no incremental implementation)
- Combine file edits and operations
- Cache information to avoid redundant calls
- Avoid unnecessary user interaction
## Code Quality
### Technical Standards
- Validate syntax and formatting
- Ensure proper closure and imports
- Include error handling
- Maintain security practices
### Implementation Approach
- Match requirements precisely
- Start simple, add complexity only when needed
- Document design decisions
- Provide clear explanations
## Memory Bank Integration
Cascade relies on Memory Bank and persistent memories after session resets. ALL memory bank files MUST be read at the start of EVERY task.
### Memory Bank Structure
The Memory Bank consists of required core files and optional context files in Markdown format:
mermaid
flowchart TD
PB[projectbrief.md] --> PC[productContext.md]
PB --> SP[systemPatterns.md]
PB --> TC[techContext.md]
PC --> AC[activeContext.md]
SP --> AC
TC --> AC
J[journal/*] --> AC
AC --> P[progress.md]
### Memory Bank Files
CRITICAL: Rename cline_docs/ to memory-bank/ if exists. If memory-bank/ or core files missing, CREATE IMMEDIATELY by:
1. Reading all documentation
2. Asking for missing information
3. Using verified information only
4. Ensuring complete context before proceeding
#### Core Files (Required)
1. projectbrief.md - Foundation
* Project requirements, goals, source of truth
* Create at project start, shapes all other files
2. productContext.md - Purpose
* Problem definition, project justification
* Functional description, UX objectives
3. activeContext.md - Current State
* Work focus, recent changes
* Next steps, active decisions
4. systemPatterns.md - Architecture
* System structure, component relationships
* Technical decisions, design patterns
5. techContext.md - Technology Stack
* Technologies, development environment
* Constraints, dependencies
6. progress.md - Status Tracker
* Completed features, pending work
* Current status, known issues
7. journal/ - Change History
* Document major changes with reasoning
* Use dated entries (YYYY_MM_DD_name.md)
* Validate every ~15-20 API calls
* Flag approach divergences
#### Additional Files
Create specialized documentation in memory-bank/ for feature specs, integration requirements, API contracts, testing strategies, and deployment procedures.
### Documentation Updates
Memory Bank updates occur when:
1. Discovering new project patterns
2. After implementing significant changes
3. When user requests with *update memory bank* (MUST review ALL files)
4. When context needs clarification
mermaid
flowchart TD
Start[Update Process]
subgraph Process
P1[Review Files]
P2[Check Memories]
P3[Document State]
P4[Clarify Steps]
P5[Update .membankrules]
P6[Update Memories]
P1 --> P2 --> P3 --> P4 --> P5 --> P6
end
Start --> Process
### Project Intelligence
The .membankrules file works with persistent memories to maintain a learning system:
mermaid
flowchart TD
Start{New Pattern}
subgraph Sources [Pattern Sources]
J[Journal]
PM[Memories]
C[Code]
U[User]
end
subgraph Learn [Learning Process]
D1[Identify]
D2[Validate]
D3[Update Memories]
D4[Document Rules]
end
subgraph Apply [Usage]
A1[Read Rules]
A2[Check Memories]
A3[Apply Patterns]
A4[Improve Work]
end
Start --> Sources
Sources --> D1
D1 --> D2
D2 --> D3
D3 --> D4
Learn --> Apply
A1 --> A2
A2 --> A3
A3 --> A4
### What to Capture in .membankrules
- Key decisions
- Project patterns
- User preferences
- Project patterns
- Known challenges
- Decision evolution
- Tool usage patterns
REMEMBER: Memory Bank is the link to previous work after reset. Maintain with precision. Focus on valuable insights. .membankrules grows smarter with continued work.
For "initialize/update memory bank" requests:
1. Review ALL files THOROUGHLY
2. Never skip content during memory operations
## Core Workflows
### Chat Mode
mermaid
flowchart TD
Start[Start] --> ReadMem[Read Memory Bank]
ReadMem --> CheckFiles{Files Complete?}
CheckFiles -->|No| CheckPMem[Check Persistent Memories]
CheckPMem --> Plan[Create Plan]
Plan --> Document[Document in Chat]
CheckFiles -->|Yes| Verify[Verify Context]
Verify --> Journal[Review Journal]
Journal --> MemPatterns[Check Memory Patterns]
MemPatterns --> Strategy[Develop Strategy]
Strategy --> Present[Present Approach]
### Write Mode
mermaid
flowchart TD
Start[Start] --> ReadMem[Check Memory Bank]
ReadMem --> CheckPMem1[Check Persistent Memories]
CheckPMem1 --> Update[Update Docs]
Update --> Rules[Update .membankrules]
Rules --> Reset[Reset API Count]
Reset --> Execute[Execute Task]
Execute --> Journal[Update Journal]
Journal --> Count{API Call Count}
Count -->|< 15-20| Execute[Execute Task]
Count -->|Validation Due| CheckPMem2[Check Related Memories]
CheckPMem2 --> Validate{Validate Progress}
Validate -->|On Track| Reset[Reset API Count]
Validate -->|Off Track| Reassess[Switch to Chat Mode]
## Persistent Memory Usage
### Memory Creation
- Create memories for key decisions, patterns, and context
- Focus on quality over quantity
- Ensure universal readability
- Avoid duplicating information
### Memory Retrieval
- Read ALL memory bank files at task start
- Retrieve memories for specific context
- Combine with .membankrules for comprehensive understanding
- Validate against current state
No Docs configured
No Prompts configured
No Data configured
No MCP Servers configured