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

Quick Start

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

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

Files over the per-file cap are truncated with a warning. Total context stops at max_chars.

Verbose output

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

Expected Output:

Show Rule Details

Create Rule

Delete Rule

Show Statistics

Include Rules with Prompts

Auto-Discovered Files

PraisonAI automatically discovers instruction files from your project root and git root:
~/.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

With YAML Frontmatter

@Import Syntax

Reference other files in your rules:

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

Programmatic Usage

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.