Quick start
Set up ai-rulez in a repository, add a rule, and generate the files for five assistants.
You need the ai-rulez CLI (Installation). To try it without installing, replace ai-rulez with
npx ai-rulez@latest or uvx ai-rulez in every command below.
1. Create the configuration
Section titled “1. Create the configuration”Run init at the root of your repository:
ai-rulez init acmeCreated .ai-rulez/ for acme...Example content created: - rules/code-quality.md - context/architecture.md - skills/code-reviewer/SKILL.md - skills/ai-rulez/SKILL.md.ai-rulez/ now holds the configuration and some example content you can edit or delete:
.ai-rulez/├── config.toml├── index.md├── rules/│ ├── code-quality.md│ └── index.md├── context/│ ├── architecture.md│ └── index.md├── skills/│ ├── ai-rulez/│ │ ├── SKILL.md│ │ └── index.md│ ├── code-reviewer/│ │ ├── SKILL.md│ │ └── index.md│ └── index.md├── agents/└── domains/| Directory | Holds | Loaded by the assistant |
|---|---|---|
rules/ |
Instructions the assistant must follow | Always, or only for matching files |
context/ |
Background: architecture, conventions, glossary | Always |
skills/ |
SKILL.md playbooks with optional scripts and references |
On demand, when the task matches the description |
agents/ |
Subagent definitions | When delegated to |
domains/ |
The same folders, per team or subsystem | When a profile selects the domain |
The index.md files list the content of each folder. ai-rulez maintains them; you do not edit them.
2. Choose your tools
Section titled “2. Choose your tools”Open .ai-rulez/config.toml and set presets to the assistants your team uses:
version = "5.0"name = "acme"presets = ["claude", "cursor", "codex", "copilot", "gemini"]The comment above presets in the generated file lists all 52 built-in presets; Supported harnesses
describes what each one writes.
3. Add a rule
Section titled “3. Add a rule”ai-rulez add rule testing --priority high --content '# Testing
- Every bug fix ships with a regression test.- Run `make test` before you commit.'Rule added successfully.ai-rulez/rules/testing.mdThe file it writes:
---type: Decisiontitle: Testingx-ai-rulez: kind: rule id: testing metadata: priority: high---
# Testing
- Every bug fix ships with a regression test.- Run `make test` before you commit.You can also create files by hand. .ai-rulez/ is an OKF bundle, so each file should have a type
(Decision for rules, Concept for context, Playbook for skills); title is optional. ai-rulez settings such as
priority and paths go under x-ai-rulez.metadata. See Rules for path-scoped rules and activation modes.
4. Generate
Section titled “4. Generate”ai-rulez generateWarning: generate will write 1 new or changed command(s) that your tools will run (from .../acme/.ai-rulez/config.toml): hook SessionStart: sh -c '...' -> claudeReview them before you start a tool in this project. Silence with --yes or AI_RULEZ_ACK_COMMANDS=1.INFO Generating with configuration profile=defaultINFO Generation complete files=12generate lists every command it adds to a tool’s configuration so you can review it. The SessionStart hook here is
the default remote-session hook, which runs ai-rulez generate when a cloud session starts.
The files it wrote:
| File | Used by |
|---|---|
AGENTS.md |
All rules and context, for Codex, Cursor, Copilot and (through .gemini/settings.json) Gemini CLI |
CLAUDE.md |
Claude Code; contains @AGENTS.md, so it loads the same instructions |
.agents/skills/<name>/SKILL.md |
Skills for the tools that read .agents/skills |
.claude/skills/<name>/SKILL.md |
Skills for Claude Code |
.gemini/settings.json |
Tells Gemini CLI to read AGENTS.md |
.mcp.json, .cursor/mcp.json, .vscode/mcp.json, .codex/config.toml |
The ai-rulez MCP server, in each tool’s format |
.claude/settings.json |
The SessionStart hook |
The start of AGENTS.md:
<!--🤖 AI-RULEZ :: GENERATED FILE — DO NOT EDITProject: acmeSource: .ai-rulez/config.toml...-->
# acme
## Rules
### code-quality
**Priority:** high...
### testing
**Priority:** high
- Every bug fix ships with a regression test.- Run `make test` before you commit.
## Context
### architecture...To get one instruction file per tool
(GEMINI.md, .github/copilot-instructions.md, …) instead of a shared AGENTS.md, set agents_md = false; see
AGENTS.md and .agents/skills.
5. Validate and commit
Section titled “5. Validate and commit”ai-rulez validate # content, link and security checksai-rulez generate --check # exits 2 if a generated file differs from the sourcevalidation: no findings in 1 root(s)INFO Generated files are up to date roots=1Commit the source and the generated files together:
git add .ai-rulez AGENTS.md CLAUDE.md .agents .claude .codex .cursor .gemini .vscode .mcp.jsongit commit -m "Add ai-rulez configuration"Generated files are committed by default, so every teammate and CI job sees the same instructions. To keep them out of
git instead, set gitignore = true in config.toml; generate then maintains a managed block in .gitignore.
Day-to-day use
Section titled “Day-to-day use”| Task | Command |
|---|---|
Regenerate after editing .ai-rulez/ |
ai-rulez generate |
| Regenerate on every change | ai-rulez generate --watch |
| Add a skill, agent or command | ai-rulez add skill db-migrations, ai-rulez add agent reviewer, ai-rulez add command release |
| Add a personal, gitignored rule | ai-rulez add rule my-notes --local (Local configuration) |
Remove everything generate wrote |
ai-rulez clean |
| Diagnose the setup | ai-rulez doctor |
Starting from existing files
Section titled “Starting from existing files”If the repository already has a hand-written CLAUDE.md, AGENTS.md, .cursor/rules/ or similar, import it
instead of starting from the example content. In a repository without .ai-rulez/:
ai-rulez init --from autoIf you already ran ai-rulez init, init --from refuses to replace the existing .ai-rulez/; import into it
instead:
ai-rulez convert --writeBoth run convert, which maps each file into .ai-rulez/ and prints what it mapped,
approximated or dropped. The next generate replaces the originals with generated files. Without an import,
generate stops at the existing file:
Error: refusing to overwrite 1 existing file(s) ai-rulez cannot prove it wrote: CLAUDE.md (an existing file ai-rulez did not write). Import the file with `ai-rulez convert --write`, move or delete it, or pass --force to overwrite itTroubleshooting
Section titled “Troubleshooting”| Symptom | Fix |
|---|---|
error AR9B1 okf-type-invalid: frontmatter has no non-empty `type` |
A hand-written file has frontmatter without type. Add type (step 3), or create the file with ai-rulez add. |
warning AR9B1 okf-type-invalid: no frontmatter block |
The file is plain Markdown. It still loads; add frontmatter with type, or run ai-rulez migrate okf to add it. |
warning AR9B0 okf-index-mismatch: concept ... is not listed |
Run ai-rulez generate; it refreshes the index.md listings. |
| A rule does not appear in a tool’s file | Check the rule’s targets and paths (Rules) and that the tool is in presets. |
generate --check fails in CI |
Someone edited .ai-rulez/ without regenerating. Run ai-rulez generate and commit the result. |
Next steps
Section titled “Next steps”- Configuration: every key in
config.toml. - Domains & profiles: content per team, selected with
--profile. - Skill frontmatter and Rules: activation, scoping and per-tool output.
- Includes and Installed skills: share content across repositories.
- GitHub Actions: check generated files and run validation in CI.
- Examples: complete configurations for common setups.
