Skip to main content
The rules command manages auto-discovered instruction files that control agent behavior.

Quick Start

# List all loaded rules
praisonai rules list

Usage

List Rules

praisonai rules list
Expected Output:
╭─ Loaded Rules ───────────────────────────────────────────────────────────────╮
│  📜 PRAISON.md (project root)                                               │
│  📜 CLAUDE.md (project root)                                                │
│  📜 .cursorrules (project root)                                             │
│  📜 python-guidelines.md (.praison/rules/)                                  │
╰──────────────────────────────────────────────────────────────────────────────╯

Show Rule Details

praisonai rules show <rule_name>

Create Rule

praisonai rules create my_rule "Always use type hints"

Delete Rule

praisonai rules delete my_rule

Show Statistics

praisonai rules stats

Include Rules with Prompts

praisonai "Task" --include-rules security,testing

Auto-Discovered Files

PraisonAI automatically discovers instruction files from your project root and git root:
FileDescriptionPriority
PRAISON.mdPraisonAI native instructionsHigh
PRAISON.local.mdLocal overrides (gitignored)Higher
CLAUDE.mdClaude Code memory fileHigh
CLAUDE.local.mdLocal overrides (gitignored)Higher
AGENTS.mdOpenAI Codex CLI instructionsHigh
GEMINI.mdGemini CLI memory fileHigh
.cursorrulesCursor IDE rulesHigh
.windsurfrulesWindsurf IDE rulesHigh
.claude/rules/*.mdClaude Code modular rulesMedium
.windsurf/rules/*.mdWindsurf modular rulesMedium
.cursor/rules/*.mdcCursor modular rulesMedium
.praison/rules/*.mdWorkspace rulesMedium
~/.praison/rules/*.mdGlobal rulesLow

Rule File Format

Basic Format

# Guidelines

- Use type hints for all functions
- Follow PEP 8 style guide
- Include docstrings for public methods

With YAML Frontmatter

---
description: Python coding guidelines
globs: ["**/*.py"]
activation: always  # always, glob, manual, ai_decision
---

# Guidelines

- Use type hints
- Follow PEP 8

@Import Syntax

Reference other files in your rules:
# CLAUDE.md
See @README for project overview
See @docs/architecture.md for system design
@~/.praison/my-preferences.md

How It Works

  1. Discovery: Scans project root and git root for rule files
  2. Priority: Higher priority rules override lower priority
  3. Injection: Rules are injected into agent system prompts
  4. Activation: Rules activate based on globs or manual selection

Activation Modes

ModeDescription
alwaysRule is always active
globActive when file matches glob pattern
manualOnly active when explicitly included
ai_decisionAI decides when to apply

Programmatic Usage

from praisonaiagents import Agent

# Agent auto-discovers CLAUDE.md, AGENTS.md, GEMINI.md, etc.
agent = Agent(name="Assistant", instructions="You are helpful.")
# Rules are injected into system prompt automatically

Agent-Requested Rules

Agents can create, read, and manage rules dynamically using built-in tools:
from praisonaiagents import Agent
from praisonaiagents.tools.rules_tools import (
    create_rule_tool,
    list_rules_tool,
    get_rule_tool,
    delete_rule_tool,
    get_active_rules_tool
)

# Create an agent that can manage rules
agent = Agent(
    name="RulesManager",
    role="Rules Administrator",
    tools=[create_rule_tool, list_rules_tool, get_rule_tool, delete_rule_tool]
)

# Agent can now create rules dynamically
response = agent.chat("Create a rule for Python coding standards")

Available Tools

ToolDescription
create_rule_toolCreate a new rule with name, content, and options
list_rules_toolList all available rules
get_rule_toolGet content of a specific rule
delete_rule_toolDelete a rule
get_active_rules_toolGet rules active for current context

Tool Parameters

create_rule_tool(
    name="python-style",           # Rule name (filename)
    content="- Use type hints",    # Rule content
    description="Python standards", # Short description
    globs="**/*.py",               # Comma-separated glob patterns
    activation="glob",             # always, glob, manual, ai_decision
    priority=10,                   # Higher = applied first
    scope="workspace"              # workspace or global
)

Best Practices

Use .local.md files for personal preferences that shouldn’t be committed to git.
High-priority rules override lower-priority ones. Be careful with conflicting instructions.
DoDon’t
Use PRAISON.md for project-wide rulesPut personal prefs in shared files
Use .local.md for personal overridesCommit .local.md files
Use globs for language-specific rulesApply all rules to all files
Keep rules concise and actionableWrite verbose instructions