Policy as code review.
Open source AI code review without vendor lock-in. Write your team's review rules as markdown files with a YAML frontmatter. Kodus reads them, scopes them by path or PR shape, and enforces them on every pull request. Same files your IDE already reads (Cursor, Claude Code, Copilot, Windsurf) get picked up automatically.
Policy as code review is when a team writes its review rules as files the AI reviewer reads on every pull request. The rules live in markdown files (or the dashboard), with a YAML frontmatter for scope and a plain-English instructions section. Architecture constraints, security patterns, naming conventions, and compliance checks become version-controlled rules that run automatically.
Generic AI review misses your team's rules.
Most AI code reviewers run the same generic checks on every codebase. Static analyzers stop at syntax-level patterns. Both miss the rules that actually matter to your team: where the domain boundary is, which decorators are required on PII endpoints, what naming convention repository methods follow. Three things happen when those rules live only in human heads.
Generic AI gives generic feedback
An out-of-the-box reviewer suggests “extract a function” on code that violates a hard architecture rule it has never been told about. The PR looks approved on style and gets merged. The boundary breaks silently.
Static analyzers stop at syntax
ESLint and SonarQube catch syntax patterns. They cannot tell you that the new endpoint forgot the audit-log decorator your compliance team requires, or that the service skipped the domain port and called infrastructure directly. Those rules are semantic, not syntactic.
Tribal knowledge does not scale
Senior engineers carry the rules in their heads and catch violations in PR comments. New hires miss the same things. Reviews become inconsistent depending on who is online. There is no audit trail, no enforcement, no way to onboard a junior on the team's actual standards.
You write the rules. Kodus enforces them.
Policies live where every other engineering artifact lives. In version control, on a branch, behind a pull request. Four guarantees ship with the policy layer by default.
01 ━
Markdown files plus instructions
YAML frontmatter for scope (title, path globs, severity, language). A ## Instructions section for the rule body in plain English. No plugin SDK, no AST queries, no XPath.
02 ━
Reuses your IDE rule files
Kodus auto-detects .cursorrules, CLAUDE.md, .windsurfrules, .github/copilot-instructions.md, and a few more. Whatever your team wrote for their IDE works for the AI reviewer too.
03 ━
Inherits Global to Directory
One rule set across the org, repository-level overrides, directory-level via path globs. Five teams in one monorepo run five overlapping rule sets without conflict.
04 ━
Generates rules from PR history
Automatic Rules Generation reads three plus months of your review history, clusters the patterns your team already enforces by hand, and proposes them as draft rules. You review and import the ones you want active.
Three places rules can live. Same engine reads all of them.
Kodus reads rules from .kody/rules/, from the IDE rule files your team already maintains, and from the Kodus dashboard. All three converge into one rule set on every pull request.
Markdown files in the repo
Drop a markdown file under .kody/rules/ (or rules/ at the repo root). YAML frontmatter for scope, a ## Instructions section for the rule body.
--- title: "PII endpoints need @AuditLog" scope: "file" path: ["src/api/users/**"] severity_min: "high" --- ## Instructions Block endpoints touching personal data without the @AuditLog decorator.
Your existing IDE rule files
Kodus auto-detects rule files your team already keeps for IDEs and agentic coding tools. Same content, two consumers (the IDE and the AI reviewer).
# Auto-detected:
.cursorrules
CLAUDE.md
.windsurfrules
.github/copilot-instructions.md
.sourcegraph/**/*.rule.md
.aider.conf.yml
Dashboard at app.kodus.io
Author rules in the web UI under Code Review Settings → Repository → Kody Rules. Browse the Discovery Rules library and import presets (Security, Maintainability, Testing) with one click.
# Discovery Rules categories
Security
Maintainability
Style conventions
Testing
Performance
Custom (your own)
Six kinds of rules, all the same syntax.
Architecture boundaries, security patterns, API contracts, performance traps, naming conventions, compliance checks. Each one is a markdown file with a path glob and a severity floor. Real shapes below, all valid Kody Rule frontmatter.
Layer boundaries
Domain layer cannot import from infrastructure layer. Anything that crosses must go through a port.
Required decorators on PII
All endpoints handling personal data must use the @AuditLog decorator. Flag the PR with a critical severity finding.
Public surface, public contract
Public methods in services must have OpenAPI annotations. Surface as a medium-severity suggestion when missing.
No N+1 in hot paths
No N+1 query patterns in route handlers. Flag any loop that issues a query inside another iteration.
Repository method prefixes
Repository methods must follow findBy, getBy, or listBy prefixes. Surface as a low-severity rename suggestion.
New endpoints need tests
When a new API route is added, ensure corresponding tests are included in the PR.
Global to Repository to Directory. Same engine.
Rules inherit down three levels. A global rule covers every repo. A repository rule overrides for that repo. A directory-scoped rule (via path globs) overrides for that folder. One markdown file per rule, one engine reading all of them.
monorepo/ └── .kody/rules/ ├── no-console-in-prod.md path: src/**/*.ts ├── domain-import-guard.md path: src/domain/** ├── audit-log-on-pii.md path: src/api/users/** ├── api-needs-openapi.md path: services/**/*.ts ├── new-endpoint-needs-tests.mdscope: pull_request └── no-direct-db-in-routes.md path: routes/api/**
Path globs do the per-team scoping. A rule with path: services/payments/** only fires on diffs that touch that folder. A rule with scope: "pull_request" looks at PR-level metadata (title, files changed, author) instead of file diffs.
From PR opened to inline comments. Four stages, the model you brought.
Deterministic pipeline. Real components in the repo, no marketing-ware. Click any stage to read the source.
Trigger from your Git host or the CLI.
Webhooks come in from GitHub, GitLab, Bitbucket, and Azure DevOps. Self-managed flavors work the same way: GitHub Enterprise Server, GitLab Self-Managed, Bitbucket Data Center. Or skip the Git host entirely and trigger reviews from the Kodus CLI in your dev loop or CI.
Kody builds the picture before it writes anything.
A sandbox is provisioned for the review (local on your box, hosted on E2B, or skipped entirely if you don't want one). Kody reads the diff, walks the code structure, and pulls in your Kody Rules and linked tickets. Everything assembled, then it starts looking for problems.
One reviewer by default. Four specialists when you ask for it.
In normal mode Kody runs as a single generalist reviewer that covers logic, security, and performance in one pass, plus your Kody Rules agent if you have rules configured. Switch the review to deep mode and three dedicated specialists go in parallel instead. Same model you brought, same sandbox.
default · logic, security, and performance in one agent
enforces your team's custom rules and conventions
deep mode · three specialists run in parallel
every agent uses the provider you set in .env
Findings come back on the PR or in the CLI.
When the review starts on a PR, Kody posts line-anchored inline comments and sets approve or request-changes status, right next to the rest of your CI. When it starts from the CLI, the same findings stream back to your terminal as structured output you can pipe, fail builds on, or feed into another tool.
Policy changes are git history.
Every rule change ships through the same PR flow as your application code. Every enforcement decision is logged with a rule id and a verdict. Compliance auditors get an export, not a screenshot.
Policies live in git
Rules are files in your repo. Changing a rule is a pull request, with reviewers, with diff history, with blame. Roll back a bad policy the same way you roll back any other code change.
Every enforcement is logged
Rule id, file path, line, verdict (block, warn, suggest), PR author, timestamp. Queryable through the dashboard or via API. Filter by rule, by author, by time window.
Built for auditors
CSV or JSON export of the enforcement log over any date range. Map rules to SOC 2, PCI-DSS, HIPAA controls. Show your auditor a real artifact, not a slide deck claim.
Most reviewers run the same checks on every codebase.
Static analyzers (SonarQube, Codacy) catch syntactic patterns. AI reviewers (CodeRabbit, Sourcery) lean on generic best practices. Both miss the rules that are specific to your team. Here is how the five tools stack on the eight things that matter for policy-driven review.
Only tool that reuses your IDE rule files and generates rules from past PRs.
| Capability |
Kodus
|
CR CodeRabbit | SQ SonarQube | CY Codacy | SC Sourcery |
|---|---|---|---|---|---|
| Rule authoring | |||||
| Write rules in plain English | Yes | Path instructions | Java + XPath | Pattern config | Pattern + replacement |
| Policy lives in the repo | .kody/rules/*.md | .coderabbit.yaml | sonar-project.properties | .codacy.yml | .sourcery.yaml |
| Reuses IDE rule files (Cursor, Claude, Copilot) | Auto-detected | Manual pointer | No | No | No |
| Generates versioned rules from past PRs | Auto Rules Generation | Learnings (vector DB) | No | No | No |
| Scope and teams | |||||
| Per-folder granularity | Yes, stacked | Path filters | Project-level | Project-level | Per-rule paths |
| Multi-team policies in one repo | Yes | Single ruleset | Single ruleset | Single ruleset | Single ruleset |
| Audit and access | |||||
| Versioned audit trail | Exportable log | Dashboard log | Server log | Partial | Partial |
| Open source agent | AGPLv3 | No | Community Edition | No | No |
| Free hosted option | Yes | Trial | SonarCloud (OSS) | Free for OSS | Free for OSS |
Notes. CodeRabbit Learnings remembers past PR feedback in their vector DB; Kodus Automatic Rules Generation surfaces drafts you import as markdown in .kody/rules/, so the audit trail is git. IDE rule auto-detection (Cursor, Claude Code, Copilot, Windsurf) is a Kodus exclusive on this peer set. Open source column counts the review agent itself, not the company.
For teams whose rules are not in a style guide.
Regulated industries and multi-team engineering orgs cannot rely on tribal knowledge to enforce review standards. Four shapes of team where versioned policies replace inconsistent human review.
PCI-DSS code review patterns
Payment processing code carries explicit compliance constraints (no logging of full PAN, tokenization on entry, audit on every read). Each one is a markdown rule with a path glob and a critical severity floor.
title: "No card numbers in logs" path: ["src/payments/**"] severity_min: "critical"
HIPAA-aware patterns
PHI handling requires explicit access checks and audit logging on every read path. Generic AI review will not know that. A rule file will.
title: "PHI reads need @AuditAccess" path: ["src/patient/**"] severity_min: "critical"
Zero-trust enforcement
Every cross-service call has to carry an identity token. No service-to-service trust by IP, no fallthrough auth. Flag the PR if a client call drops the authenticated context.
title: "Service clients need auth" path: ["src/services/**/client.ts"] severity_min: "high"
Ownership and boundary enforcement
Five teams in one monorepo. Each owns a service folder. Each ships rules scoped to their path. The platform team owns the shared API contract rules across the boundary.
title: "No cross-team imports" path: ["services/team-a/**"] severity_min: "high"
FAQ
It means your team's review rules live in files the AI reviewer reads on every pull request. Each rule is a markdown file with a YAML frontmatter for scope (path globs, severity, language) and a ## Instructions section in plain English. Architecture boundaries, security patterns, naming conventions, compliance checks all become version-controlled rules. The rules stop being tribal knowledge in senior engineers' heads. They become a real artifact, in the repo, alongside the code.
Generic AI feedback applies the same checks to every codebase. Kody Rules are specific to your team. Generic AI will suggest extracting a function. A Kody Rule will flag a PR with a critical severity finding because the domain layer imported from infrastructure, which violates your architecture rule. Both run, both add value, but only one knows your team's actual standards.
Two locations work out of the box: .kody/rules/**/*.md or rules/**/*.md. Each file is one rule. Kodus also auto-detects rule files your team already keeps for IDEs and agentic tools (.cursorrules, CLAUDE.md, .windsurfrules, .github/copilot-instructions.md, .sourcegraph/**/*.rule.md, .aider.conf.yml). If you do not want files in the repo at all, author rules in the dashboard at app.kodus.io. All three sources merge into one rule set per pull request.
YAML frontmatter plus a markdown instructions section. Required frontmatter fields: title, scope ("file" or "pull_request"), path (array of globs), severity_min (low, medium, high, critical). Optional: languages, buckets, enabled. The body after the frontmatter is a ## Instructions heading followed by free-form English describing the rule. No DSL to learn.
Yes, through the path field. A rule with path: ["services/payments/**"] only fires on diffs that touch that folder. Rules inherit Global → Repository → Directory, with directory scoping done via path globs in single rule files. Monorepos with five teams run five overlapping rule sets without conflict. Branch-level scoping is not supported today.
Yes, through Automatic Rules Generation. Kodus reads three plus months of historic review comments, clusters the patterns your team enforces by hand, and surfaces them as draft rules in the dashboard. Generated rules are not active by default. You review the drafts, edit if needed, and import the ones you want enabled. Updates run weekly after the initial generation.
Yes, twice over. Rule files live in git, so every change is a commit with author, reviewer, diff, and timestamp. Every finding generated by a rule is logged in the dashboard with the rule id, file, severity, PR author, and timestamp. The audit log is exportable as CSV or JSON for compliance reviews.
A rule emits a finding with a severity level (low, medium, high, critical). What happens with the finding depends on the Policy layer: by default Kody posts non-blocking suggestion comments. Optionally, you can turn on Request Changes so high or critical findings mark the review as changes-requested. Or Auto-approve when no findings hit the configured severity floor. Severity comes from the rule, action comes from the policy.
SonarQube custom rules require a Java plugin or XPath expressions, apply at the project level, and stop at syntactic patterns. Kody Rules are markdown files with plain-English instructions, scope by path glob, and run semantic checks (an AI reviewer reading the rule, not a regex). You can run both: SonarQube for static analysis, Kodus for the rules your team actually argues about in code review.
Yes. Discovery Rules is a curated library inside the Kodus dashboard. Filter presets by severity, language, or tag (Security, Maintainability, Style conventions, Testing, Performance). Import the ones you want with one click and edit them like any other rule. Examples shipped today include “disallow MD5 hashing” and “React components under 150 lines.” Docs at docs.kodus.io have the full reference for Kody Rules.
Write the rule. Ship the enforcement.
Drop a markdown file under .kody/rules/ in your repo. YAML frontmatter for scope, plain-English instructions for the rule body. Kodus reads it on every PR.
Kodus
/api/cockpit?orgId=....