Skip to main content
Repository Rules use the same auto-sync mechanism as IDE rule file detection. Enable Auto-sync rules from repo (on Code review → Kody Rules at repository scope, under Configuration) to activate both features. See Rules File Detection for setup.

How to Use

You can create custom Kody Rules directly in your repository by placing structured markdown files in specific directories. This allows you to version control your rules alongside your code and share them across your team.
Repository rule files are imported verbatim — no LLM conversion. The frontmatter is parsed as-is, the markdown body becomes the rule’s instructions exactly as you wrote it (identifiers, formatting and wording preserved), and the Bad/Good examples are imported structurally. Each file produces one rule. Files that don’t parse as the template (missing frontmatter or title) fall back to the LLM importer used for free-form files.

Synchronization

  • Automatic Detection: Repository rules are automatically detected and synchronized when enabled
  • Manual Sync: Add @kody-sync to any rule file to sync it individually (works even with auto-sync disabled)
  • Web Application: Synchronized rules appear on the repository’s Code review → Kody Rules page, with the Auto-sync origin
  • Real-time Updates: Changes to rule files are synced when Pull Requests are closed

File Location

Place your rule files in one of these directories:
  • .kody/rules/**/*.md
  • rules/**/*.md

Rule Template

Each rule file must follow this exact template structure:

Template Fields

Required Fields

Only two things are strictly required: a non-empty title and a non-empty rule body. A file missing either is skipped entirely.

Fields with defaults

Everything else is optional — omit it and the default applies.
severity is accepted as an alias for severity_min, since it’s an easy thing to mistype and the intent is unambiguous. Any value outside the four levels falls back to "medium", and any scope other than "pull-request" is treated as "file".

Example Rules

File-Level Rule Example

Pull Request-Level Rule Example

Setup Requirements

To use Repository Rules, you have two options:
  1. Enable Rules File Detection: Pick the repository in the Code review scope picker, open Kody Rules → Configuration, and turn on Auto-sync rules from repo
  2. Create rule files: Place .md files in .kody/rules/** or rules/** directories
  3. Automatic sync: All rule files sync when PRs are closed

Option 2: Manual Sync (Selective)

  1. Create rule files: Place .md files in .kody/rules/** or rules/** directories
  2. Add sync marker: Include @kody-sync anywhere in the rule file
  3. Commit changes: Only marked files will sync (auto-sync toggle stays off)
Repository Rules use the same synchronization mechanism as Rules File Detection. Use manual sync (@kody-sync) to selectively sync specific rules without enabling automatic synchronization.