Skip to main content
Repository Rules are always kept in sync: there is no setting to turn on. They are the only files in a repository that become Kody Rules. Instructions written for coding agents (CLAUDE.md, AGENTS.md, .cursor/rules) are handled separately, see Coding-Agent Instructions.

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. A file that doesn’t parse as the template (missing frontmatter, title or body) is skipped, and the sync logs it; nothing is generated from it.

Synchronization

  • Automatic Detection: Repository rules are detected and synchronized in every connected repository; there is nothing to enable
  • Import now: On the repository’s Kody Rules → Configuration sheet, Import rule files now reads every rule file on the default branch
  • Web Application: Synchronized rules appear on the repository’s Code review → Kody Rules page, with the Auto-sync origin (rules imported from coding-agent files before they stopped converting show Agent file instead)
  • Real-time Updates: Changes to rule files are synced when Pull Requests are merged into the default branch

File Location

Place your rule files in one of these directories, at the repository root or in any subdirectory:
  • .kody/rules/**/*.md
  • rules/**/*.md
  • .rules/** and docs/coding-standards/** (only files that follow the template)

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

  1. Create rule files: Place .md files that follow the template in .kody/rules/** or rules/**. Files in .rules/** and docs/coding-standards/** that follow the template are imported too.
  2. Merge them: A rule file syncs when a Pull Request that adds, changes, renames or removes it is merged into the default branch. Removing the file removes its rule.
  3. Existing files: To import rule files that are already on the default branch, use Import rule files now in the repository’s Kody Rules → Configuration sheet.
New rules land active, or in Pending review when Kody knowledge approval is on.
Add @kody-ignore anywhere in a rule file to keep it in the repository without syncing it. Its existing rule is removed on the next sync.

Verifying sync and rule evaluation (self-hosted)

On self-hosted deployments the API logs carry grep-able markers for debugging:
  • [kody-rules-sync] — per-run sync summary: which files were imported, skipped (with the reason) or removed.
  • [kody-rules-eval] — per-file evaluation trace during a review: exactly which rules (uuid + title) were selected into the prompt for each reviewed file.
If a rule shows as active in the UI but never appears in [kody-rules-eval] for the files you expect, check its Path glob — a rule only runs on files matching its path.

Rule limits

Organizations on the cloud Free plan (or whose subscription was canceled or expired) and self-hosted instances running without a valid license (Community Edition) evaluate at most 10 active rules per review (oldest first). Rules beyond the cap stay in the list as Locked and are skipped on every PR; a banner on Code review → Kody Rules says how many are skipped. Paid cloud plans and licensed self-hosted instances have no such limit. If rules beyond the 10th don’t fire, this limit is why.