intellectronica/ruler

Ruler — apply the same rules to all coding agents

What it solves

Ruler addresses the complexity of managing AI coding assistant instructions across multiple tools. When teams use different agents (such as GitHub Copilot, Claude, Cursor, and Aider), they often face inconsistent guidance, duplicated effort in maintaining multiple configuration files, and context drift as project requirements change. Ruler provides a single source of truth for these instructions, ensuring all AI agents follow the same rules.

How it works

Ruler centralizes instructions in a .ruler/ directory using Markdown files. It then automatically distributes these rules to the specific configuration files required by various supported AI agents.

Key mechanisms include:

  • Rule Concatenation: It discovers .md files recursively and concatenates them into the target agent's config file, adding source markers for traceability.
  • Nested Rule Loading: Using the --nested flag, Ruler can load instructions from multiple .ruler/ directories throughout a project hierarchy, allowing for component-specific rules (e.g., different rules for /src vs /tests).
  • Configuration: A ruler.toml file manages agent selection, output paths, and Model Context Protocol (MCP) server settings.
  • Automation: It can automatically update .gitignore to keep generated config files out of version control.

Who it’s for

It is designed for developers and teams working in complex codebases or monorepos who use one or more AI coding assistants and want to maintain consistent AI behavior across their entire development environment.

Highlights

  • Broad Agent Support: Compatible with a wide array of tools including GitHub Copilot, Claude Code, Cursor, Windsurf, Cline, Aider, and many others.
  • MCP Propagation: Manages and distributes Model Context Protocol (MCP) server settings across agents.
  • Single Source of Truth: Eliminates the need to manually edit multiple agent-specific config files.
  • Context-Aware Rules: Supports nested directories for granular, area-specific instructions.
  • Safety Features: Includes a revert command to undo changes and restore original files from backups.