open-rules
v0.1.2
Published
Consolidate agent rules into .open-rules and sync to Copilot/Cursor/Claude formats.
Maintainers
Readme
AI Rules Consolidator
Centralize AI-agent instructions in a single source folder (.open-rules) and generate compatible files for tools such as Copilot, Cursor, and Claude Code.
Why
Instead of duplicating instructions in multiple formats, keep them in one place and sync adapters.
Quick start
npm install
npm run init
npm run syncThis creates:
.open-rules/config.json(source + targets config).open-rules/*.mdrule files (source of truth).github/copilot-instructions.md.cursor/rules/open-rules.mdcCLAUDE.md
CLI
open-rules init
open-rules add security-basics
open-rules import all --force --sync
open-rules sync
open-rules sync --dry-runImport sources from existing tool files into .open-rules:
open-rules import
open-rules import copilot cursor
open-rules import claude --force
open-rules import all --sync- default sources:
all(copilot,cursor,claude) --force: overwrite existing imported files (90-import-<source>.md)--sync: runsyncimmediately after import
Config
Default config in .open-rules/config.json:
{
"rulesDir": ".open-rules",
"includeExtensions": [".md", ".txt", ".mdc"],
"excludeFiles": ["README.md", "config.json"],
"targets": {
"copilot": {
"enabled": true,
"path": ".github/copilot-instructions.md",
"applyTo": "**/*",
"sourceMode": "reference"
},
"cursor": {
"enabled": true,
"path": ".cursor/rules/open-rules.mdc",
"applyTo": "**/*",
"sourceMode": "reference"
},
"claude": {
"enabled": true,
"path": "CLAUDE.md",
"sourceMode": "reference"
}
}
}You can add more targets by adding entries under targets.
For Copilot, set targets.copilot.applyTo to include frontmatter in generated output.
For Cursor, set targets.cursor.applyTo to a glob (or array of globs) to control where the rule applies.
Set sourceMode to embed (default) or reference per target:
embed: copy merged.open-rulescontent into generated filereference: generated file only points to.open-rulesfiles as source of truth
Typical workflow
- Add/edit files in
.open-rules/ - Run
open-rules sync - Commit both source rules and generated adapters
Adding a new target
Target renderers are split by file under src/targets/:
src/targets/<target>.js: render logic for one targetsrc/targets/index.js: target registry map
To add a target, create a renderer file and register it in src/targets/index.js.
