Installation · Quick Start · Getting Started · CLI Reference · API Reference · Contributing
Rulix is a CLI tool and TypeScript library that gives you a single source of truth for AI coding rules across Cursor, Claude Code, AGENTS.md, and more.
Write your rules once. Rulix generates optimized configs for each tool — handling format differences, scoping semantics, and token budgets automatically.
Every AI coding tool has its own rules format:
| Tool | Format | Location |
|---|---|---|
| Cursor | .mdc with YAML frontmatter |
.cursor/rules/ |
| Claude Code | Markdown with optional frontmatter | .claude/rules/ |
| AGENTS.md | Plain markdown | AGENTS.md |
| Windsurf | Markdown | .windsurf/rules/ |
| Copilot | Markdown | .github/copilot-instructions.md |
If you use more than one tool, you're maintaining duplicate rules that drift apart. Rulix solves this:
.rulix/rules/ .cursor/rules/*.mdc
├── typescript.md → .claude/rules/*.md
├── testing.md → AGENTS.md
└── security.md → (more targets coming)
# npm
npm install -D rulix
# pnpm
pnpm add -D rulix
# yarn
yarn add -D rulix
# bun
bun add -D rulixOr run directly with npx:
npx rulix initRequirements: Node.js 22 or higher.
npx rulix initThis creates a .rulix/ directory with a config.json and a rules/ folder.
Already have rules in Cursor or Claude Code? Import them:
npx rulix import --from cursor
npx rulix import --from claude-codeCreate .rulix/rules/typescript-strict.md:
---
id: typescript-strict
scope: always
description: "Enforce strict TypeScript conventions"
category: style
priority: 1
---
# TypeScript Conventions
- Use `strict: true` in tsconfig
- Never use `any` — prefer `unknown` with type narrowing
- Use explicit return types on public functions
- Prefer `interface` over `type` for object shapesnpx rulix syncThis generates tool-specific configs for every target in your config.json.
npx rulix validateCatches duplicates, vague descriptions, missing fields, and token budget issues.
npx rulix statusShows rule count, token budget usage per tool, and configured targets.
Rules live in .rulix/rules/*.md as Markdown with YAML frontmatter:
| Field | Type | Required | Description |
|---|---|---|---|
id |
string |
Yes | Unique kebab-case identifier |
scope |
"always" | "file-scoped" | "agent-selected" |
Yes | When the rule applies |
description |
string |
Yes | What the rule does (used by AI for selection) |
category |
"style" | "security" | "testing" | "architecture" | "workflow" | "general" |
No | Rule category (defaults to "general") |
priority |
1-5 |
No | 1 = critical, 5 = nice-to-have (defaults to 3) |
globs |
string[] |
If file-scoped |
File patterns this rule applies to |
Scopes explained:
always— Applied to every AI request. Use for project-wide conventions.file-scoped— Applied only when matching files are open. Requiresglobs.agent-selected— The AI decides when to apply this rule based on itsdescription.
See Writing Rules for detailed examples and best practices.
- Import existing rules from Cursor or Claude Code
- Export to Cursor, Claude Code, and AGENTS.md (more targets coming)
- Validate rules for duplicates, conflicts, and vague content
- Token budgets — know when your rules exceed a tool's recommended limits
- Zero LLM dependency — all validation is deterministic, works offline
- Programmatic API — use Rulix as a library in your own tools
- Zero config — sensible defaults, override only what you need
| Tool | Import | Export | Status |
|---|---|---|---|
| Cursor | Yes | Yes | v0.1 |
| Claude Code | Yes | Yes | v0.1 |
| AGENTS.md | — | Yes | v0.1 |
| Windsurf | — | — | Planned |
| Copilot | — | — | Planned |
| Codex | — | — | Planned |
Rulix is configured via .rulix/config.json:
{
"targets": ["cursor", "claude-code", "agents-md"],
"presets": [],
"overrides": {},
"options": {
"tokenEstimation": "heuristic",
"agentsMdHeader": true,
"syncOnSave": false
}
}See Configuration Reference for all options.
Rulix can be used as a library in your own tools:
import { loadRuleset, exportRules, validateRuleset } from "rulix";
// Load rules from a project
const ruleset = await loadRuleset("./my-project");
// Validate
const result = validateRuleset(ruleset);
console.log(result.passed); // true if no errors
// Export to a specific tool
await exportRules("cursor", ruleset.rules, "./my-project");See API Reference for the complete API.
Contributions are welcome! The most impactful ways to help:
- New adapters — Add support for Windsurf, Copilot, Cline, etc.
- Validation rules — New checks for common rule issues
- Bug reports — Especially format edge cases
See CONTRIBUTING.md for setup and guidelines, and Writing an Adapter for the adapter guide.
Daniel Chinome — @danielcinome
