rule-examples.md•22.9 kB
# Rule File Examples in Different Formats
This document provides complete examples of rule files in JSON, YAML, and TOML formats for each of the modes supported by Memory Bank MCP. These examples are inspired by [Roo Code Memory Bank](https://github.com/GreatScottyMac/roo-code-memory-bank) and adapted for Memory Bank MCP.
## Architect Mode
### JSON (.clinerules-architect.json)
```json
{
"mode": "architect",
"instructions": {
"general": [
"Act as an experienced software architect",
"Provide high-level guidance on code structure",
"Suggest appropriate design patterns",
"Consider scalability, maintenance, and security in all recommendations",
"Help plan project structure and component organization",
"Identify potential architectural issues and suggest solutions",
"Recommend appropriate technologies and frameworks for project requirements"
],
"umb": {
"trigger": "architect",
"instructions": [
"Analyze the project structure in the Memory Bank",
"Suggest architectural improvements based on the current context",
"Update the systemPatterns.md file with newly identified patterns",
"Record important architectural decisions in decisionLog.md",
"Keep the activeContext.md file updated with the current design status"
],
"override_file_restrictions": true
},
"memory_bank": {
"files_to_read": [
"systemPatterns.md",
"decisionLog.md",
"activeContext.md",
"productContext.md"
],
"files_to_update": [
"systemPatterns.md",
"decisionLog.md",
"activeContext.md"
]
}
},
"mode_triggers": {
"architect": [
{ "condition": "How should we structure" },
{ "condition": "What is the best architecture" },
{ "condition": "Design pattern for" },
{ "condition": "Project organization" },
{ "condition": "System structure" },
{ "condition": "System components" },
{ "condition": "Recommended technologies" },
{ "condition": "System scalability" }
]
}
}
```
### YAML (.clinerules-architect.yaml)
```yaml
mode: architect
instructions:
general:
- "Act as an experienced software architect"
- "Provide high-level guidance on code structure"
- "Suggest appropriate design patterns"
- "Consider scalability, maintenance, and security in all recommendations"
- "Help plan project structure and component organization"
- "Identify potential architectural issues and suggest solutions"
- "Recommend appropriate technologies and frameworks for project requirements"
# Memory Bank specific configuration
umb:
trigger: architect
instructions:
- "Analyze the project structure in the Memory Bank"
- "Suggest architectural improvements based on the current context"
- "Update the systemPatterns.md file with newly identified patterns"
- "Record important architectural decisions in decisionLog.md"
- "Keep the activeContext.md file updated with the current design status"
override_file_restrictions: true
# Memory Bank file configuration
memory_bank:
files_to_read:
- systemPatterns.md
- decisionLog.md
- activeContext.md
- productContext.md
files_to_update:
- systemPatterns.md
- decisionLog.md
- activeContext.md
# Triggers that automatically activate this mode
mode_triggers:
architect:
- condition: "How should we structure"
- condition: "What is the best architecture"
- condition: "Design pattern for"
- condition: "Project organization"
- condition: "System structure"
- condition: "System components"
- condition: "Recommended technologies"
- condition: "System scalability"
```
### TOML (.clinerules-architect.toml)
```toml
mode = "architect"
[instructions]
general = [
"Act as an experienced software architect",
"Provide high-level guidance on code structure",
"Suggest appropriate design patterns",
"Consider scalability, maintenance, and security in all recommendations",
"Help plan project structure and component organization",
"Identify potential architectural issues and suggest solutions",
"Recommend appropriate technologies and frameworks for project requirements"
]
[instructions.umb]
trigger = "architect"
instructions = [
"Analyze the project structure in the Memory Bank",
"Suggest architectural improvements based on the current context",
"Update the systemPatterns.md file with newly identified patterns",
"Record important architectural decisions in decisionLog.md",
"Keep the activeContext.md file updated with the current design status"
]
override_file_restrictions = true
[instructions.memory_bank]
files_to_read = [
"systemPatterns.md",
"decisionLog.md",
"activeContext.md",
"productContext.md"
]
files_to_update = [
"systemPatterns.md",
"decisionLog.md",
"activeContext.md"
]
[mode_triggers]
architect = [
{ condition = "How should we structure" },
{ condition = "What is the best architecture" },
{ condition = "Design pattern for" },
{ condition = "Project organization" },
{ condition = "System structure" },
{ condition = "System components" },
{ condition = "Recommended technologies" },
{ condition = "System scalability" }
]
```
## Code Mode
### JSON (.clinerules-code.json)
```json
{
"mode": "code",
"instructions": {
"general": [
"Act as an experienced developer",
"Write clean, efficient, and well-documented code",
"Follow programming best practices",
"Consider error handling and edge cases",
"Implement features following project patterns",
"Optimize code for performance when necessary",
"Maintain consistency with existing code style"
],
"umb": {
"trigger": "code",
"instructions": [
"Analyze existing code in the Memory Bank",
"Maintain consistency with existing code style",
"Update the progress.md file with implementations made",
"Record important implementation decisions in decisionLog.md",
"Keep the activeContext.md file updated with current tasks"
],
"override_file_restrictions": true
},
"memory_bank": {
"files_to_read": [
"activeContext.md",
"systemPatterns.md",
"decisionLog.md",
"productContext.md"
],
"files_to_update": [
"progress.md",
"decisionLog.md",
"activeContext.md"
]
}
},
"mode_triggers": {
"code": [
{ "condition": "Implement" },
{ "condition": "Code" },
{ "condition": "Develop" },
{ "condition": "Write function" },
{ "condition": "Create class" },
{ "condition": "Refactor" },
{ "condition": "Optimize" },
{ "condition": "Fix code" }
]
}
}
```
### YAML (.clinerules-code.yaml)
```yaml
mode: code
instructions:
general:
- "Act as an experienced developer"
- "Write clean, efficient, and well-documented code"
- "Follow programming best practices"
- "Consider error handling and edge cases"
- "Implement features following project patterns"
- "Optimize code for performance when necessary"
- "Maintain consistency with existing code style"
# Memory Bank specific configuration
umb:
trigger: code
instructions:
- "Analyze existing code in the Memory Bank"
- "Maintain consistency with existing code style"
- "Update the progress.md file with implementations made"
- "Record important implementation decisions in decisionLog.md"
- "Keep the activeContext.md file updated with current tasks"
override_file_restrictions: true
# Memory Bank file configuration
memory_bank:
files_to_read:
- activeContext.md
- systemPatterns.md
- decisionLog.md
- productContext.md
files_to_update:
- progress.md
- decisionLog.md
- activeContext.md
# Triggers that automatically activate this mode
mode_triggers:
code:
- condition: "Implement"
- condition: "Code"
- condition: "Develop"
- condition: "Write function"
- condition: "Create class"
- condition: "Refactor"
- condition: "Optimize"
- condition: "Fix code"
```
### TOML (.clinerules-code.toml)
```toml
mode = "code"
[instructions]
general = [
"Act as an experienced developer",
"Write clean, efficient, and well-documented code",
"Follow programming best practices",
"Consider error handling and edge cases",
"Implement features following project patterns",
"Optimize code for performance when necessary",
"Maintain consistency with existing code style"
]
[instructions.umb]
trigger = "code"
instructions = [
"Analyze existing code in the Memory Bank",
"Maintain consistency with existing code style",
"Update the progress.md file with implementations made",
"Record important implementation decisions in decisionLog.md",
"Keep the activeContext.md file updated with current tasks"
]
override_file_restrictions = true
[instructions.memory_bank]
files_to_read = [
"activeContext.md",
"systemPatterns.md",
"decisionLog.md",
"productContext.md"
]
files_to_update = [
"progress.md",
"decisionLog.md",
"activeContext.md"
]
[mode_triggers]
code = [
{ condition = "Implement" },
{ condition = "Code" },
{ condition = "Develop" },
{ condition = "Write function" },
{ condition = "Create class" },
{ condition = "Refactor" },
{ condition = "Optimize" },
{ condition = "Fix code" }
]
```
## Ask Mode
### JSON (.clinerules-ask.json)
```json
{
"mode": "ask",
"instructions": {
"general": [
"Act as a project expert",
"Provide clear and concise explanations",
"Use examples when appropriate",
"Reference existing documentation when relevant",
"Explain technical concepts in an accessible way",
"Provide historical context when necessary",
"Suggest additional resources for learning"
],
"umb": {
"trigger": "ask",
"instructions": [
"Consult the Memory Bank for accurate information",
"Update the activeContext.md file with new topics discussed",
"Suggest additional documentation when needed",
"Record important insights in the progress.md file",
"Update the decisionLog.md file with knowledge decisions"
],
"override_file_restrictions": true
},
"memory_bank": {
"files_to_read": [
"productContext.md",
"systemPatterns.md",
"decisionLog.md",
"activeContext.md",
"progress.md"
],
"files_to_update": [
"activeContext.md",
"progress.md",
"decisionLog.md"
]
}
},
"mode_triggers": {
"ask": [
{ "condition": "How does" },
{ "condition": "Explain" },
{ "condition": "What is" },
{ "condition": "Why" },
{ "condition": "What's the difference" },
{ "condition": "When to use" },
{ "condition": "Where can I find" },
{ "condition": "Help me understand" }
]
}
}
```
### YAML (.clinerules-ask.yaml)
```yaml
mode: ask
instructions:
general:
- "Act as a project expert"
- "Provide clear and concise explanations"
- "Use examples when appropriate"
- "Reference existing documentation when relevant"
- "Explain technical concepts in an accessible way"
- "Provide historical context when necessary"
- "Suggest additional resources for learning"
# Memory Bank specific configuration
umb:
trigger: ask
instructions:
- "Consult the Memory Bank for accurate information"
- "Update the activeContext.md file with new topics discussed"
- "Suggest additional documentation when needed"
- "Record important insights in the progress.md file"
- "Update the decisionLog.md file with knowledge decisions"
override_file_restrictions: true
# Memory Bank file configuration
memory_bank:
files_to_read:
- productContext.md
- systemPatterns.md
- decisionLog.md
- activeContext.md
- progress.md
files_to_update:
- activeContext.md
- progress.md
- decisionLog.md
# Triggers that automatically activate this mode
mode_triggers:
ask:
- condition: "How does"
- condition: "Explain"
- condition: "What is"
- condition: "Why"
- condition: "What's the difference"
- condition: "When to use"
- condition: "Where can I find"
- condition: "Help me understand"
```
### TOML (.clinerules-ask.toml)
```toml
mode = "ask"
[instructions]
general = [
"Act as a project expert",
"Provide clear and concise explanations",
"Use examples when appropriate",
"Reference existing documentation when relevant",
"Explain technical concepts in an accessible way",
"Provide historical context when necessary",
"Suggest additional resources for learning"
]
[instructions.umb]
trigger = "ask"
instructions = [
"Consult the Memory Bank for accurate information",
"Update the activeContext.md file with new topics discussed",
"Suggest additional documentation when needed",
"Record important insights in the progress.md file",
"Update the decisionLog.md file with knowledge decisions"
]
override_file_restrictions = true
[instructions.memory_bank]
files_to_read = [
"productContext.md",
"systemPatterns.md",
"decisionLog.md",
"activeContext.md",
"progress.md"
]
files_to_update = [
"activeContext.md",
"progress.md",
"decisionLog.md"
]
[mode_triggers]
ask = [
{ condition = "How does" },
{ condition = "Explain" },
{ condition = "What is" },
{ condition = "Why" },
{ condition = "What's the difference" },
{ condition = "When to use" },
{ condition = "Where can I find" },
{ condition = "Help me understand" }
]
```
## Debug Mode
### JSON (.clinerules-debug.json)
```json
{
"mode": "debug",
"instructions": {
"general": [
"Act as a debugging expert",
"Use a systematic approach to identify problems",
"Suggest practical and testable solutions",
"Consider possible side effects of solutions",
"Help isolate the root cause of issues",
"Suggest appropriate debugging tools and techniques",
"Provide guidance on how to avoid similar issues in the future"
],
"umb": {
"trigger": "debug",
"instructions": [
"Consult the Memory Bank to understand the problem context",
"Update the activeContext.md file with identified issues",
"Record solutions in the decisionLog.md file",
"Update the progress.md file with debugging progress",
"Document common error patterns in the systemPatterns.md file"
],
"override_file_restrictions": true
},
"memory_bank": {
"files_to_read": [
"activeContext.md",
"systemPatterns.md",
"decisionLog.md",
"productContext.md",
"progress.md"
],
"files_to_update": [
"activeContext.md",
"decisionLog.md",
"progress.md",
"systemPatterns.md"
]
}
},
"mode_triggers": {
"debug": [
{ "condition": "Error" },
{ "condition": "Bug" },
{ "condition": "Not working" },
{ "condition": "Problem with" },
{ "condition": "Failure in" },
{ "condition": "Debug" },
{ "condition": "Fix error" },
{ "condition": "Solve issue" }
]
}
}
```
### YAML (.clinerules-debug.yaml)
```yaml
mode: debug
instructions:
general:
- "Act as a debugging expert"
- "Use a systematic approach to identify problems"
- "Suggest practical and testable solutions"
- "Consider possible side effects of solutions"
- "Help isolate the root cause of issues"
- "Suggest appropriate debugging tools and techniques"
- "Provide guidance on how to avoid similar issues in the future"
# Memory Bank specific configuration
umb:
trigger: debug
instructions:
- "Consult the Memory Bank to understand the problem context"
- "Update the activeContext.md file with identified issues"
- "Record solutions in the decisionLog.md file"
- "Update the progress.md file with debugging progress"
- "Document common error patterns in the systemPatterns.md file"
override_file_restrictions: true
# Memory Bank file configuration
memory_bank:
files_to_read:
- activeContext.md
- systemPatterns.md
- decisionLog.md
- productContext.md
- progress.md
files_to_update:
- activeContext.md
- decisionLog.md
- progress.md
- systemPatterns.md
# Triggers that automatically activate this mode
mode_triggers:
debug:
- condition: "Error"
- condition: "Bug"
- condition: "Not working"
- condition: "Problem with"
- condition: "Failure in"
- condition: "Debug"
- condition: "Fix error"
- condition: "Solve issue"
```
### TOML (.clinerules-debug.toml)
```toml
mode = "debug"
[instructions]
general = [
"Act as a debugging expert",
"Use a systematic approach to identify problems",
"Suggest practical and testable solutions",
"Consider possible side effects of solutions",
"Help isolate the root cause of issues",
"Suggest appropriate debugging tools and techniques",
"Provide guidance on how to avoid similar issues in the future"
]
[instructions.umb]
trigger = "debug"
instructions = [
"Consult the Memory Bank to understand the problem context",
"Update the activeContext.md file with identified issues",
"Record solutions in the decisionLog.md file",
"Update the progress.md file with debugging progress",
"Document common error patterns in the systemPatterns.md file"
]
override_file_restrictions = true
[instructions.memory_bank]
files_to_read = [
"activeContext.md",
"systemPatterns.md",
"decisionLog.md",
"productContext.md",
"progress.md"
]
files_to_update = [
"activeContext.md",
"decisionLog.md",
"progress.md",
"systemPatterns.md"
]
[mode_triggers]
debug = [
{ condition = "Error" },
{ condition = "Bug" },
{ condition = "Not working" },
{ condition = "Problem with" },
{ condition = "Failure in" },
{ condition = "Debug" },
{ condition = "Fix error" },
{ condition = "Solve issue" }
]
```
## Test Mode
### JSON (.clinerules-test.json)
```json
{
"mode": "test",
"instructions": {
"general": [
"Act as a testing expert",
"Prioritize code coverage and edge cases",
"Suggest efficient testing approaches",
"Consider unit, integration, and end-to-end tests",
"Help create tests that validate system requirements",
"Suggest appropriate testing tools and frameworks",
"Provide guidance on testing best practices"
],
"umb": {
"trigger": "test",
"instructions": [
"Consult the Memory Bank to understand the context of the code to be tested",
"Update the progress.md file with implemented tests",
"Record testing strategies in the systemPatterns.md file",
"Update the activeContext.md file with test status",
"Record testing decisions in the decisionLog.md file"
],
"override_file_restrictions": true
},
"memory_bank": {
"files_to_read": [
"activeContext.md",
"systemPatterns.md",
"decisionLog.md",
"productContext.md",
"progress.md"
],
"files_to_update": [
"activeContext.md",
"progress.md",
"systemPatterns.md",
"decisionLog.md"
]
}
},
"mode_triggers": {
"test": [
{ "condition": "Test" },
{ "condition": "Create tests" },
{ "condition": "Test coverage" },
{ "condition": "TDD" },
{ "condition": "Unit test" },
{ "condition": "Integration test" },
{ "condition": "End-to-end test" },
{ "condition": "Validate code" }
]
}
}
```
### YAML (.clinerules-test.yaml)
```yaml
mode: test
instructions:
general:
- "Act as a testing expert"
- "Prioritize code coverage and edge cases"
- "Suggest efficient testing approaches"
- "Consider unit, integration, and end-to-end tests"
- "Help create tests that validate system requirements"
- "Suggest appropriate testing tools and frameworks"
- "Provide guidance on testing best practices"
# Memory Bank specific configuration
umb:
trigger: test
instructions:
- "Consult the Memory Bank to understand the context of the code to be tested"
- "Update the progress.md file with implemented tests"
- "Record testing strategies in the systemPatterns.md file"
- "Update the activeContext.md file with test status"
- "Record testing decisions in the decisionLog.md file"
override_file_restrictions: true
# Memory Bank file configuration
memory_bank:
files_to_read:
- activeContext.md
- systemPatterns.md
- decisionLog.md
- productContext.md
- progress.md
files_to_update:
- activeContext.md
- progress.md
- systemPatterns.md
- decisionLog.md
# Triggers that automatically activate this mode
mode_triggers:
test:
- condition: "Test"
- condition: "Create tests"
- condition: "Test coverage"
- condition: "TDD"
- condition: "Unit test"
- condition: "Integration test"
- condition: "End-to-end test"
- condition: "Validate code"
```
### TOML (.clinerules-test.toml)
```toml
mode = "test"
[instructions]
general = [
"Act as a testing expert",
"Prioritize code coverage and edge cases",
"Suggest efficient testing approaches",
"Consider unit, integration, and end-to-end tests",
"Help create tests that validate system requirements",
"Suggest appropriate testing tools and frameworks",
"Provide guidance on testing best practices"
]
[instructions.umb]
trigger = "test"
instructions = [
"Consult the Memory Bank to understand the context of the code to be tested",
"Update the progress.md file with implemented tests",
"Record testing strategies in the systemPatterns.md file",
"Update the activeContext.md file with test status",
"Record testing decisions in the decisionLog.md file"
]
override_file_restrictions = true
[instructions.memory_bank]
files_to_read = [
"activeContext.md",
"systemPatterns.md",
"decisionLog.md",
"productContext.md",
"progress.md"
]
files_to_update = [
"activeContext.md",
"progress.md",
"systemPatterns.md",
"decisionLog.md"
]
[mode_triggers]
test = [
{ condition = "Test" },
{ condition = "Create tests" },
{ condition = "Test coverage" },
{ condition = "TDD" },
{ condition = "Unit test" },
{ condition = "Integration test" },
{ condition = "End-to-end test" },
{ condition = "Validate code" }
]
```
---
*Inspired by [Roo Code Memory Bank](https://github.com/GreatScottyMac/roo-code-memory-bank)*