Launch offer: use code LAUNCH20 for 20% off any single pack. See the packs

Roo Code Rules Examples: .roo/rules, Modes and AGENTS.md (Source-Checked)

Published 2026-11-20 · 9 min read · by AgentKit Co

Roo Code reads plain Markdown or text files from a .roo/rules/ folder and pastes them into its system prompt, so you don't have to repeat "use pnpm, write a test first" in every task. Each mode can also have its own folder, like .roo/rules-code/.

First, the news: Roo Code, Inc. shut the extension down on May 15, 2026. The final release is 3.54.0 and the GitHub repo is archived, so it won't get fixes. The community fork Zoo Code carries on. We diffed its rule-loading file against Roo's: same logic, plus one fix for relative symlinks. Everything below works in both. Only the settings prefix changes, from roo-cline. to zoo-code..

We didn't copy this from other guides. We read the loader in Roo Code 3.54.0 (custom-instructions.ts), checked it against the official docs, then ran that exact code on 20 test folders on 2026-11-20. Where the docs and the code disagree, we say so.

Download free-roo-code-rules.zip (MIT: rules for every mode, Code and Architect rules, a .roomodes reviewer mode, a check-roo-rules.py checker and its 31-test test.sh)

Where Roo looks, in prompt order

Everything ends up in one "USER'S CUSTOM INSTRUCTIONS" block in this order:

# What Where it comes from
1 Language preference Roo settings
2 Global instructions Prompts tab, "Custom Instructions for All Modes"
3 Mode instructions The mode's customInstructions or the Prompts tab
4 Mode rules ~/.roo/rules-{mode}/, then .roo/rules-{mode}/. Only if both are empty: .roorules-{mode}, else .clinerules-{mode}
5 .rooignore note Added when you use a .rooignore file
6 AGENTS.md AGENTS.md (or AGENT.md) at the workspace root, plus AGENTS.local.md
7 General rules ~/.roo/rules/, then .roo/rules/. Only if both are empty: .roorules, else .clinerules

So mode rules come before general rules, and global files come before project files. Nothing gets merged or overridden. Every file is pasted in. "Project rules take precedence," as the docs put it, just means the project text comes later in the prompt.

Notice the fallback in rows 4 and 7. If ~/.roo/rules/ has any files, a project's .roorules is never read. We confirmed this by running the real loader.

1. Rules for every mode

Save as .roo/rules/01-project.md:

# Project

- What this repo is: [one sentence: what it does and who uses it]
- Stack: [TypeScript 5 strict, Node 22, pnpm]
- Layout: [src/ app code, tests/ mirrors src/, scripts/ one-off tools]

## Commands
- Install: `[pnpm install]`
- Test: `[pnpm test]` (run before you say a task is done)
- Lint and types: `[pnpm lint && pnpm typecheck]`

## Boundaries
- Never read, print or edit `.env*` files or anything under `[secrets/]`
- Ask before adding a dependency, changing a public API or touching `[migrations/]`
- Don't edit generated files: `[dist/, *.gen.ts]`

The download adds 02-code-style.md. Keep this folder short: every file goes into every request, in every mode.

2. Code mode only

Save as .roo/rules-code/01-implementation.md. The folder name has to match the mode's slug exactly: code, architect, ask, debug, orchestrator, or your custom mode's slug.

# Code mode

- Make the smallest change that solves the task. Don't refactor unrelated code.
- Every bug fix gets a test that fails before the fix and passes after it.
- Run `[pnpm test]` after editing. If it fails, fix it or say exactly what is still failing.
- Don't change formatting in files you aren't otherwise touching.
- When you finish, list the files you changed and why, in one line each.

3. Architect mode only

Save as .roo/rules-architect/01-planning.md. By default, Architect can only edit files matching \.md$, so have it write plans to a Markdown file:

# Architect mode

- Read the relevant code before proposing anything. Name the files you read.
- Write the plan to `[docs/plans/<short-name>.md]`.
- Every plan has: Problem, Approach, Files to change, Risks, How we'll test it.
- Prefer the boring option that fits the existing code over a new library or pattern.
- Ask at most 3 clarifying questions, then plan with stated assumptions.

4. A custom mode in .roomodes

Save as .roomodes at the workspace root (YAML; Roo also accepts JSON). This "reviewer" mode can read and run commands but can only edit Markdown files under reviews/:

customModes:
  - slug: reviewer
    name: 🔍 Reviewer
    description: Review the current branch and write findings to reviews/
    roleDefinition: >-
      You are a careful senior code reviewer. You find real bugs, security problems and
      missing tests in a diff, and you explain each one with a concrete fix.
    whenToUse: Use this mode to review a branch or pull request before merging.
    customInstructions: Start by running git diff against the base branch.
    groups:
      - read
      - command
      - - edit
        - fileRegex: reviews/.+\.md$
          description: Review notes only

Its longer rules go in .roo/rules-reviewer/ (the download includes one). Rules from the source:

  • Required: slug (letters, numbers and dashes only), name, roleDefinition, groups. Valid groups are read, edit, command, mcp and modes. In 3.54.0, browser is deprecated and gets silently dropped.
  • One bad mode drops the whole file. If any mode fails validation, Roo shows an error and loads none of the modes in that .roomodes. A file without a top-level customModes: key loads nothing, and you get no error at all.
  • fileRegex is a JavaScript regex tested against the path Roo passes to its edit tool. It isn't anchored, so reviews/.+\.md$ matches reviews/x.md wherever it appears in the path.
  • Same slug, project wins. A .roomodes mode replaces a global one (from custom_modes.yaml) with the same slug. A custom mode named code replaces the built-in Code mode.

AGENTS.md: yes, and it's on by default

Roo reads AGENTS.md from the workspace root on every request, as well as your .roo/rules/ files. It isn't a fallback, despite what some template sites say. Details from the code:

  • If AGENTS.md is missing or blank, Roo reads AGENT.md instead. The file name must be exactly AGENTS.md.
  • AGENTS.local.md next to it is always added too, even with no AGENTS.md. Use it for personal notes you keep out of git.
  • To turn it off, set "roo-cline.useAgentRules": false in VS Code settings. In Zoo Code, it's "zoo-code.useAgentRules".
  • Subfolder AGENTS.md files are ignored unless "Enable subfolder rules" is on (see the checklist).

Already keep an AGENTS.md for Codex, Cursor or Copilot? Then put the shared rules there and keep .roo/rules-{mode}/ for the mode-specific ones. See AGENTS.md examples.

Why your Roo rules aren't loading: 9 checks

  1. You opened a file, not a folder. Roo uses the workspace folder (in a multi-root workspace, the folder of the file you have open). With no folder open, it falls back to ~/Desktop.
  2. A global rule switched off your fallback file. Any file in ~/.roo/rules/ means .roorules and .clinerules are never read, in any project. The same goes for ~/.roo/rules-code/ and .roorules-code. Move the file into .roo/rules/.
  3. An empty file counts. The docs say empty files are skipped. In the code, an empty file in .roo/rules/ still counts as a rule (it adds a header line), so your .roorules is ignored.
  4. You came from Cline. Roo reads a .clinerules file only. Cline's newer .clinerules/ folder isn't read at all. Copy those files into .roo/rules/ (see our Cline rules examples).
  5. The folder name doesn't match the mode. It has to be rules- plus the exact slug: rules-code, not rules-Code or rules_code. Case matters on Linux. Also, .roo/rules.md is a file, not the folder Roo reads.
  6. Order isn't what you think. Files are sorted by file name only, ignoring folders. So .roo/rules/zz/00-first.md comes before .roo/rules/01-a.md, and 10-x.md comes before 9-y.md. Pad your prefixes: 01-, 02-, 10-.
  7. A monorepo package has its own .roo/. Only the workspace root's .roo/ is read unless you turn on Settings > "Enable subfolder rules" (off by default). It finds .roo folders with ripgrep, skipping node_modules and .git.
  8. Your .roomodes failed validation. One invalid slug or a missing roleDefinition drops every mode in the file, so rules-yourmode/ never gets used.
  9. Junk files get loaded. Roo loads every file in the folder, not just .md and .txt, so a notes.json or a README goes into your prompt. Only cache and temp files are skipped (*.log, *.bak, *.lock, *.tmp, *.swp, .DS_Store and a few more). Symlinks are followed, up to 5 levels deep.

The free check-roo-rules.py in the download runs these checks for you. Point it at a folder and a mode, and it lists the files Roo would load, in prompt order, with a warning for each problem:

$ python3 check-roo-rules.py . --mode code
Workspace: /home/you/my-app
Mode: code
Global dir: /home/you/.roo (missing)

Roo would add these, in this order:
  [mode rules (rules-code)]
     1. .roo/rules-code/01-implementation.md
  [AGENTS.md]
     2. AGENTS.md
  [rules (.roo/rules)]
     3. .roo/rules/01-project.md
WARNING: .roorules is ignored because a .roo/rules/ folder has files.

We checked it against Roo's own loader: across 20 test folders and 4 settings combinations, both listed the same files in the same order.

FAQ

Is Roo Code still maintained? No. Roo Code, Inc. shut it down on May 15, 2026 to focus on Roomote, and archived the repo after the 3.54.0 release. The final release should keep working, according to the team's farewell post. Zoo Code, the community fork, reads the same .roo/ files and was still shipping releases in November 2026.

Does Roo Code read AGENTS.md? Yes, by default, from the workspace root, alongside your .roo/rules/. Turn it off with roo-cline.useAgentRules: false.

.roo/rules/ or .roorules? Use the folder. .roorules is only read when no rules folder (global or project) has any files.

Do global rules override project rules? Neither overrides the other. Both are pasted into the prompt, global first. If they contradict each other, the model sees both, so remove the conflict.

Can I move my Roo rules to another tool? Cline reads .clinerules/ and AGENTS.md. Kilo Code's docs describe .kilo/rules/ files listed in kilo.jsonc. Putting the shared rules in AGENTS.md is the most portable option. Our Roo to Cline, Kilo and Zoo migration guide has the full file mapping and a free dry-run script.

Get matching files for every tool

The free AGENTS.md generator builds AGENTS.md, CLAUDE.md, Cursor, Copilot, GEMINI.md and Kiro files from your package.json or pyproject.toml, and Roo reads the AGENTS.md as-is. The AI Coding Agent Config Kit adds 12 stack templates and prompts that audit and test them. Using other tools too? See Cline rules, Cursor rules, Windsurf rules, aider CONVENTIONS.md and why AGENTS.md isn't working.

AgentKit Co is not affiliated with Roo Code, Inc. or the Zoo Code project.

AI Coding Agent Config Kit

Instruction-file templates for 12 stacks and 12 prompts that write and audit them. 34-page PDF, $14.

Not ready to buy? Start with the free PDF.

Get 10 of our most-used prompts as a free PDF from Gumroad. You will be asked for your email so Gumroad can deliver it.

Keep reading

Agent Skills (SKILL.md) Explained: Formats, Folders and SafetyWhat an Agent Skill is, how SKILL.md works, which folders Claude Code, Codex, Cursor and Copilot read, and how to write and vet one. Checked on 2026-10-17.4 min readAGENTS.md Examples: 7 Copy-Paste Files for Real Projects (2026)Seven AGENTS.md examples to copy: Next.js, Python API, Go, a monorepo with nested files, a global ~/.codex file, an override and review rules.7 min readWhat Is an AI Agent? Plain-English Guide for BeginnersWhat an AI agent is, how it differs from a chatbot or automation, and the four building blocks every agent has. No jargon.4 min read