v1.20Grok Build CLI support →

Rules

Rules are the standing instructions handed to every agent — the content that becomes CLAUDE.md, AGENTS.md, GEMINI.md in each agent's home. Instead of one giant file, agents-cli composes them from small, single-topic sub-rules.

On disk

rules/
├── rules.yaml            # presets: named, ordered lists of sub-rules
└── subrules/
    ├── core-hard-lines.md   # one rule fragment — plain markdown, NO frontmatter
    ├── git-readonly.md
    └── code-quality.md

Each sub-rule is plain markdown with no frontmatter — its whole content is concatenated into the agent's instructions, so write it as direct guidance. Keep one concern per file; small fragments are easy to reorder, share, and override per tier.

Presets

rules.yaml defines presets — each an ordered list of sub-rule names (without the .md). The active preset (default: default) is concatenated, top to bottom, into one instructions document.

# rules/rules.yaml
presets:
  default:
    subrules:
      - core-hard-lines
      - code-quality
      - git-readonly
  minimal:
    subrules:
      - core-hard-lines

How composition works

Because an unreferenced extra-tier sub-rule auto-appends into the system prompt, keep shared/extra repos' rules/ intentional — anything you drop there reaches every agent that loads the repo.

Where it lands

On sync, the composed document is written to each agent under its native name — CLAUDE.md for Claude, GEMINI.md for Gemini, .cursorrules for Cursor, AGENTS.md for Codex/OpenCode. You author once in rules/; agents-cli writes the right filename per agent.

agents rules list            # presets and sub-rules, with sync status
agents rules view default    # the composed document for a preset

Resolution

Rules follow the layered model like every kind: ./.agents/rules/ (project) over ~/.agents/rules/ (user) over an extra repo over ~/.agents-system/rules/ (system). See Config layers.

Related