# Ruler — One Source of Truth for Agent Rules > Ruler centralizes agent instructions in a .ruler/ directory and generates CLAUDE.md, AGENTS.md, Cursor rules, and MCP configs from one config. ## Install Paste the prompt below into your AI tool: # Ruler — One Source of Truth for Agent Rules > Ruler centralizes agent instructions in a .ruler/ directory and generates CLAUDE.md, AGENTS.md, Cursor rules, and MCP configs from one config. ## Quick Use 1) Install ```bash npm install -g @intellectronica/ruler ``` 2) Run ```bash ruler init && ruler apply ``` 3) Verify ```bash Check generated files (e.g., CLAUDE.md / AGENTS.md / .cursor rules) update as expected ``` --- ## Intro **Best for**: teams using multiple coding agents who want consistent instructions and MCP config propagation across tools **Works with**: Node.js + npm/npx, a repo with agent config files (CLAUDE.md/AGENTS.md/.cursor), optional nested project structures **Setup time**: 10 minutes ### Quant Data - Supports Claude Code, Cursor, Codex, Copilot and more (repo) - Setup time ~10 minutes --- ## How to Use It Well Start with a short `.ruler/AGENTS.md` that encodes your real workflow (tests, style, safety). Then turn on nested mode only where components truly differ. ### Adoption Checklist - Start with one real task and keep the scope narrow - Capture a baseline: time-to-first-success and output quality - Version your config/skills so teammates stay in sync ### Guardrails Generated files should stay generated. Avoid manual edits downstream; treat `.ruler/` as the only editable surface. ### FAQ **Q: Is it production-ready?** A: The README labels it as a beta research preview; adopt it in one repo first and keep rollbacks simple. **Q: How does it avoid drift?** A: Rules live in `.ruler/` and Ruler regenerates downstream config files, so you maintain one source of truth. **Q: Can it handle monorepos?** A: Yes. The repo documents nested rule loading for multiple `.ruler/` directories with scoped configs. --- ## Source & Thanks > GitHub: https://github.com/intellectronica/ruler > Owner avatar: https://avatars.githubusercontent.com/u/46264?v=4 > License (SPDX): MIT > GitHub stars (verified via `api.github.com/repos/intellectronica/ruler`): 2,688 --- # Ruler——统一管理各类 Agent 规则 > Ruler 把 AI 代理规则集中到 .ruler/,再自动生成 CLAUDE.md、AGENTS.md、Cursor rules 与 MCP 配置;一处修改,多平台自动同步,适合团队长期维护。 ## 快速使用 1)安装 ```bash npm install -g @intellectronica/ruler ``` 2)运行 ```bash ruler init && ruler apply ``` 3)验证 ```bash Check generated files (e.g., CLAUDE.md / AGENTS.md / .cursor rules) update as expected ``` --- ## 简介 **适合谁**:同时使用多种 coding agent 的团队,希望让指令与 MCP 配置跨工具保持一致 **适用环境**:Node.js + npm/npx、包含 CLAUDE.md/AGENTS.md/.cursor 等配置的仓库、可选的多层项目结构 **安装耗时**:10 分钟 ### 量化信息 - 支持 Claude Code/Cursor/Codex/Copilot 等(仓库) - 装机约 10 分钟 --- ## 用好它的方式 先写一个短的 `.ruler/AGENTS.md` 把真实流程(测试/风格/安全)固化下来;只有当不同子组件确实不同,才开启 nested 模式。 ### 推广清单 - 先选一个真实任务,小范围试跑 - 记录基线:首次成功耗时与输出质量 - 配置/技能要版本化,避免团队漂移 ### 风险与护栏 生成文件就保持生成:不要在下游手改;把 `.ruler/` 当成唯一可编辑入口。 ### FAQ **Q: 能直接全员推广吗?** A: README 标注为 beta/research preview;建议先在一个仓库试点,并把回滚路径写清楚。 **Q: 怎么避免配置漂移?** A: 规则集中存放在 `.ruler/`,再由 Ruler 生成下游配置文件,维护点只有一个。 **Q: monorepo 好用吗?** A: 可以。仓库说明了 nested 规则加载:多个 `.ruler/` 目录可按范围输出到不同配置。 --- ## 来源与感谢 > GitHub:https://github.com/intellectronica/ruler > Owner avatar:https://avatars.githubusercontent.com/u/46264?v=4 > 许可证(SPDX):MIT > GitHub stars(已通过 `api.github.com/repos/intellectronica/ruler` 核验):2,688 --- Source: https://tokrepo.com/en/workflows/ruler-one-source-of-truth-for-agent-rules Author: Prompt Lab