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
List auto-discovered rules example

CLI Auto-Injection

praisonai run and praisonai chat automatically load project instruction files from the current directory (and walk up to the git root). Zero config required — drop an AGENTS.md into your project and every CLI run sees it.

Opt-out

GoalHow
Disable for a single runpraisonai run "task" --no-rules
Disable globallySet [rules] auto = false in ~/.praisonai/config.toml
Override the size capSet [rules] max_chars = 16000 in config.toml
Still load a specific manual rulepraisonai run "task" --include-rules security

Precedence

  1. --no-rules (always wins)
  2. --include-rules <names> (manual list or auto)
  3. [rules] auto in config.toml
  4. Default: auto-loading on

Size caps

CapDefaultWhere to change
Per file12 KB (12000 chars)Hard-coded in RulesManager.MAX_RULE_CHARS
Total32 KB (32000 chars)[rules] max_chars in config.toml
Files over the per-file cap are truncated with a warning. Total context stops at max_chars.

Verbose output

praisonai run "Refactor the auth module" --verbose
# Loaded project instructions: AGENTS.md, CLAUDE.md
Only root-priority files (AGENTS.md, CLAUDE.md, PRAISON.md, GEMINI.md, .cursorrules, .windsurfrules) are listed — modular rules under .praison/rules/ and globals are loaded silently.

Usage

Manage Auto-Discovered Rules

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
praisonai "Task" --no-rules

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
~/.praisonai/rules/*.mdGlobal modular rulesLow
~/.praisonai/AGENTS.mdGlobal single-file instructions (loaded by load_context_files())Lowest
~/.praisonai/AGENTS.md is loaded by load_context_files() as the lowest-precedence layer whenever walk_up=True (the default). It is separate from the modular ~/.praisonai/rules/*.md files loaded by RulesManager. See Context Files → CLI auto-loading for how chat, run, code, and tui automatically inject this context into the agent system prompt.
Monorepos with per-subtree instruction files: see On-demand Subtree Attachment for why a sibling package’s AGENTS.md only loads once the agent opens a file inside it.

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
@~/.praisonai/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

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