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.mdEach 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-linesHow composition works
- A sub-rule named by the active preset is included in that order.
- A sub-rule present in the user / extra / project tier but not named by the preset is auto-appended. System-tier sub-rules are never auto-appended.
- There is no
@importsyntax — composition is plain concatenation.
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 presetResolution
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
- DotAgents repos — where
rules/sits among the other kinds - Config layers — how tiers merge and override
- Permissions — also composed from groups + presets