Overview
Rules assets define universal behavioral guidelines that modify how AI responds across all interactions. Rules are optional modifiers that can be activated or deactivated during gameplay, allowing users to customize the tone, content, and style of their experience.File Location
Rules files should be placed in:assets/rules/*.yaml
Schema Definition
Required Fields
Unique identifier for the rule. Used internally to reference and activate this rule. Must be unique across all rules.Example:
"gritty", "nsfw", "comedy", "realistic_combat"Convention: The filename should match the ID (e.g., gritty.yaml has id: "gritty")Display name of the rule shown to users. This appears in rule selection menus and UI.Example:
"Gritty Realism", "NSFW Content", "Comedy Mode"The system-level instruction that modifies AI behavior. This text is injected into the system prompt when the rule is active.Example:
"The world is dark, dangerous, and unforgiving. Actions have heavy consequences."Usage:- Written as an imperative instruction to the AI
- Should be clear and specific about the desired behavior
- Affects all AI responses while active
- Can specify tone, content restrictions, or behavioral guidelines
Complete Examples
Tone Modifier
Content Filter
Style Modifier
Gameplay Rule
Narrative Style
Content Restriction
Implementation Details
Rules are loaded at startup and can be activated/deactivated during gameplay. The schema represents a simple key-value structure:engine/utils.py:16 - load_yaml_assets() function
Activation: engine/state.py:48 - ACTIVE_RULES list tracks enabled rules
Prompt Injection: engine/llm.py:78-90 - Active rule prompts are combined into a ### UNIVERSAL LAWS ### block
Command: engine/commands.py:78 - /rule <rule_id> command toggles rules on/off
How Rules Are Applied
When rules are active, their prompts are combined and added to the system prompt:- Multiple rules can be active simultaneously
- Rule prompts are concatenated with double line breaks
- Rules are marked as “UNIVERSAL LAWS” to give them weight
- Rules apply to ALL messages while active
Writing Effective Rules
Structure Your Prompt
A well-structured rule prompt typically includes:- Core Directive - The main behavioral change
- Scope - What aspects of responses are affected
- Guidelines - Specific examples or boundaries
Directive Clarity
Be explicit about what you want:- Vague: “Make things more realistic”
- Clear: “Emphasize realistic consequences: injuries heal slowly, resources are scarce, and exhaustion affects performance”
- Vague: “Add humor”
- Clear: “Look for opportunities for situational comedy, witty dialogue, and absurd contrasts between expectations and reality”
Scope Definition
Specify what aspects are affected:- Tone: Serious, comedic, dramatic, lighthearted
- Content: Violence level, adult themes, profanity
- Pacing: Fast action vs slow contemplation
- Style: Prose style, description density, dialogue patterns
- Logic: Realism vs fantasy, consequences vs plot armor
Multi-Line Prompts
For complex rules, use YAML’s multi-line syntax:Rule Categories
Tone Rules
Control the overall emotional and atmospheric quality:Content Rules
Control what content is included or excluded:Style Rules
Control how narrative is presented:Gameplay Rules
Control mechanical or systems aspects:Best Practices
IDs
- Use lowercase with underscores:
realistic_combat,noir_style - Keep them short and descriptive
- Match the filename:
realistic_combat.yamlcontainsid: "realistic_combat" - Use consistent naming conventions (e.g., all style rules end with
_style)
Names
- Use title case for readability
- Make the effect clear from the name
- Keep under 40 characters for UI display
- Consider category prefixes: “Style: Noir”, “Content: NSFW”
Prompts
- Be Specific: “Combat is lethal” vs “be more realistic”
- Use Imperatives: “Emphasize…”, “Maintain…”, “Avoid…”
- Provide Examples: “Look for opportunities for X, such as Y and Z”
- Consider Interaction: How will this rule interact with others?
- Test Thoroughly: Activate with different characters and worlds
- Length: 50-200 words is ideal; longer prompts may dilute effect
Rule Combinations
Consider how rules work together:Advanced Techniques
Conditional Guidelines
Include conditional logic in your prompt:Graduated Rules
Create multiple versions of the same rule at different intensities:Meta-Rules
Rules that affect how other rules are interpreted:Special Rules
NSFW Rule
The engine specifically checks for a rule with IDnsfw in some commands:
nsfw.yaml rule for adult content.
Troubleshooting
Rule not appearing in available rules list
Rule not appearing in available rules list
- Verify the YAML file is in
assets/rules/directory - Check that the
idfield is present and unique - Ensure the YAML syntax is valid (use a YAML validator)
- Restart the engine to reload assets
- Check logs for loading errors
Rule seems to have no effect
Rule seems to have no effect
- Verify the rule is actually activated (check
/rulecommand) - Make the prompt more specific and directive
- Rules compete with character persona and world prompts
- Try activating the rule alone to test its effect
- Remember AI models interpret instructions with flexibility
Rules conflict with each other
Rules conflict with each other
- Review active rules for contradictions
- Deactivate conflicting rules
- Consider combining rules into a single, coherent prompt
- Test rule combinations systematically
Cannot activate rule with /rule command
Cannot activate rule with /rule command
- Verify the rule ID matches the filename
- Check that the file exists in
assets/rules/ - Ensure proper YAML syntax (use a validator)
- Check engine logs for errors
User Commands
Users can manage rules during gameplay:Related Resources
- World Schema - Worlds also use system prompts
- Character Schema - Character personas interact with rules
- Development Guide - Learn how rules are processed in the engine