rules command manages auto-discovered instruction files that control agent behavior.
As of PraisonAI PR #4338,
rules list/add/clear run natively on a standalone pip install praisonai-code — backed by praisonaiagents.memory.RulesManager, no wrapper needed. The remaining subcommands still require the full wrapper.Quick Start

CLI Auto-Injection
praisonai run, praisonai chat, and bare prompts (praisonai "…", which route to run) 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 modern-engine invocation sees it.
Opt-out
Precedence
--no-rules(always wins)--include-rules <names>(manual list orauto)[rules] autoinconfig.toml- 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
AGENTS.md, CLAUDE.md, PRAISON.md, GEMINI.md, .cursorrules, .windsurfrules) are listed — modular rules under .praison/rules/ and globals are loaded silently.
Usage

List Rules
<name> [<activation>] - <description-truncated-to-60-chars>):
Add Rule
Native standalone — both<name> and <content> are required. Creates a workspace-scoped rule under .praison/rules/<name>.md with activation="always":
1:
Clear Rules
Native standalone — clears onlyworkspace-scoped rules (those rules add created). Hand-authored AGENTS.md / CLAUDE.md / PRAISON.md, global rules, git-root rules, and nested subdir rules are left untouched:
Show Rule Details (wrapper only)
Create Rule (wrapper only)
praisonai rules add my_rule "Always use type hints" instead.
Delete Rule (wrapper only)
Show Statistics (wrapper only)
Include Rules with Prompts
Declared instruction sources
This page covers auto-discovery — files found by convention (AGENTS.md, CLAUDE.md, .cursorrules, etc.). To declare extra sources explicitly, use the top-level instructions: config key or the praisonai run --instructions flag.
Declared sources load up front alongside the auto-discovered walk-up, and
--no-rules suppresses both. See Instruction Sources.
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
- Discovery: Scans project root and git root for rule files
- Priority: Higher priority rules override lower priority
- Injection: Rules are injected into agent system prompts
- Activation: Rules activate based on globs or manual selection

