
Code review → Kody Rules at repository scope: pending review, the Review Rules and Memories tabs, filters, and the rules table
Two Types in the Kody Rules UI
Kody Rules are organized into two categories, managed through the Review Rules and Memories tabs in the sidebar under Code review → Kody Rules. Pick Global (or a repository / directory) in the scope picker at the top of the Code review group to choose which level you are editing.- Review Rules
- Memories
Traditional code review rules that run during the dedicated code review stage. They analyze file diffs and PR metadata to enforce coding standards.
- Applied at File-Level (execution mode Per file) or Pull Request-Level (execution mode Per PR)
- Support variables, file references, and MCP functions
- Triggered during automated code reviews
Review Rules
Create Custom Rules
Define rules based on your team’s exact needs. On the Review Rules tab, click New rule (or Write a rule when the list is empty) to open the rule dialog. Review Rules can be applied at two different levels, chosen with the Execution mode field: File-Level (Per file) and Pull Request-Level (Per PR). Both levels support variables, file references, and MCP functions to build powerful, context-aware rules.Variables, File References & MCP Functions
Rules can access rich context through variables, file references, and MCP functions. Here’s what’s available: Variables: Variables represent the context data available during rule execution. Understanding what’s available helps you compose better rules by combining variables with MCP functions and file references.-
File-Level:
fileDiff- The specific changes made to the individual file being analyzed
-
PR-Level:
pr_title- The title of the Pull Requestpr_description- The description/body of the Pull Requestpr_total_additions- Total number of lines addedpr_total_deletions- Total number of lines deletedpr_total_files- Total number of files changedpr_total_lines_changed- Total number of lines modifiedpr_files_diff- Complete diff of all changes across the entire Pull Requestpr_tags- Tags associated with the Pull Requestpr_author- Author of the Pull Requestpr_number- Pull Request number
-
@file:path/to/file.ts- Reference files in the same repository where you’re editing the rule- Use when referencing templates, examples, or configuration files within your current repository
- Example:
@file:src/services/userService.ts
-
@repo:org/project- Reference files in another repository or when configuring rules outside a repo context- Use when enforcing consistency across multiple repositories or referencing shared standards
- Example:
@repo:team/api-standards
- Kody identifies file references automatically when you save a rule
- References are resolved in the background—watch the status indicator next to the editor to confirm completion
- Use accurate blob-style paths (e.g.,
src/utils/helpers.ts) instead of placeholders - File contents are injected into the rule context, allowing Kody to compare, validate, or enforce patterns
- Works in both File-Level and Pull Request-Level rules
- Repository operations: List repositories, get repository files, content, and languages
- PR analysis: Get pull request details, list commits, analyze PR file content
- File content retrieval: Fetch file contents and diffs
- Cross-file validation: Perform advanced analysis across multiple files
- Custom integrations: Any MCP server you’ve connected as a plugin (Jira, custom tools, etc.)
- Use specific file paths rather than generic placeholders
- Reference stable files that represent your team’s standards
- Test file references exist before saving rules to avoid resolution errors
- Combine variables, file references, and MCP functions for comprehensive validation
File-Level Rules
Analyze individual files to catch issues within specific code files. Available Context: See the Variables, File References & MCP Functions section above for details. Available at this level:fileDiff variable, file references (@file, @repo), and MCP functions.
What You Can Do:
- Compare against reference files using
@fileor@repo - Fetch related files or repository data using MCP functions
- Combine variables, file references, and MCP functions to validate patterns, check consistency, or enforce architectural rules
- Rule name: Clearly define the rule purpose
- Execution mode: Per file (the default)
- Path: Limit rules to specific files or directories using glob patterns (leave empty to apply to all files)
- Instructions: Use
fileDiff, reference files with@file/@repo, and call MCP functions to compose powerful rules with rich context. New rules can Start with a popular template - Severity: Set to Critical, High (the default), Medium, or Low
- Advanced settings: Inheritable (on by default; see Rule Inheritance) and Code examples (Bad example / Good example)
src/**/*.ts
⚠️ Severity: Critical
📝 Instructions: “Using equality operators (== or !=) can cause infinite loops if exact values aren’t matched.”
❌ Bad Example:
Pull Request-Level Rules
Analyze the entire Pull Request for cross-file validation and PR-specific requirements. Available Context: See the Variables, File References & MCP Functions section above for details. Available at this level: PR variables (pr_title, pr_description, pr_files_diff, etc.), file references (@file, @repo), and MCP functions.
What You Can Do:
- Validate PR metadata using variables like
pr_title,pr_description,pr_author - Reference configuration files or templates using
@fileor@repo - Fetch additional context using MCP functions (e.g., check if related files exist, validate against repository structure)
- Combine PR variables, file references, and MCP functions to create comprehensive validation rules
- Every service file must have a corresponding test file
- PR description must be complete, clearly stating what was added or removed
- When a new route is created in a controller, it must be registered in routes.json
- Use
pr_total_lines_changedto flag PRs exceeding size limits - Combine
pr_files_diffwith MCP functions to validate cross-file dependencies - Reference
@file:routes.jsonto ensure new routes are registered - Use MCP functions to check if test files exist for modified service files
Composing Powerful Rules
Combine variables, MCP functions, and file references to create sophisticated rules with rich context. Here’s what’s available at each level: File-Level Composition:- Use
fileDiffto analyze the specific changes in a file - Reference related files with
@file:path/to/template.tsto compare against patterns - Call MCP functions to fetch repository data or check if related files exist
- Example: “Analyze
fileDiffand ensure it follows the pattern in@file:src/utils/example.ts. Use MCP to verify related test files exist.”
- Use PR variables (
pr_title,pr_description,pr_files_diff, etc.) to validate PR metadata and size - Reference configuration files with
@file:config.jsonor@repo:org/shared-configto enforce consistency - Call MCP functions to perform cross-file validation, check repository structure, or fetch commit history
- Example: “If
pr_files_diffcontains new routes, verify they’re registered in@file:routes.json. Use MCP to check if corresponding test files exist for all modified service files.”
- Reference files from other repositories with
@repo:org/projectto maintain consistency across projects - Combine with MCP functions to validate against shared standards or templates
- Example: “Ensure API endpoints follow the pattern defined in
@repo:org/api-standards. Use MCP to fetch the latest standards document.”
- MCP functions execute during rule evaluation, enabling rules that adapt to current repository state
- Fetch real-time data about files, commits, or repository structure
- Example: “Use MCP to check the current repository structure and ensure new files follow the existing directory patterns.”
Import from Rules Library
Leverage proven best practices instantly:- On Code review → Kody Rules (Review Rules tab), click Discovery to open the Rules library (Rules Marketplace). You can also reach it from Browse the library when the rules list is empty, or by searching Rules library in the ⌘K command palette.
- Start from Featured, or switch to Browse to search the full catalog and filter rules by Severity, Language, or Packs.
- Open a rule and click Add to my rules, using the repository picker next to it to choose Global or the repositories (and directories) that should get the rule.
- Security: “Disallow use of insecure MD5 hashing.”
- Maintainability: “Limit React components to less than 150 lines.”
Memories
Memories are persistent contextual instructions that Kody learns from your team’s conversations and coding practices. Unlike Review Rules that run during code review, Memories are injected across all prompts and conversations to provide continuous, high-priority context and improve future suggestions.How Memories Work
- Injected everywhere: Memories are included in code review analysis (cross-file, safeguards, PR-level rules) and in conversational interactions
- High-priority context: Memories are treated as high-priority guidance by the AI, ensuring your team’s conventions are consistently applied
- Better future suggestions: Memories help Kody avoid repeating the same mistaken assumptions about your repo
- Intelligent deduplication: When a new memory is created, Kody uses an LLM-based resolution mechanism to determine whether to create it, skip it (if duplicate), or update an existing memory
Creating Memories
There are two ways to create memories:Via Conversation
The most natural way to create memories is through conversation with Kody in your PR comments. Kody detects both explicit and implicit intents to save conventions: Explicit — directly asking Kody to remember:Kody will NOT create memories for transient instructions (e.g., “fix this now”), debugging chatter, questions, vague statements, or requests explicitly scoped to a single task or PR.
Via the UI
You can also create memories manually:- In the sidebar, pick Global (or the repository / directory) in the scope picker at the top of the Code review group, then open Kody Rules. The memory is created at the scope you pick here
- Switch to the Memories tab
- Click New memory (or Add a memory when the list is empty)
- Fill in Memory name and Instructions, then click Create memory
Memory Scopes
Each memory has a scope that determines where it applies:LLM-Generated Memories Approval
By default, AI-generated memories are automatically activated. You can require manual approval before they take effect:- Go to Code review → Kody Rules at the scope you want (Global, a repository or a directory)
- Click Configuration to open the side sheet
- Enable Kody knowledge approval
- AI-generated rules and memories enter a pending state and are not active until approved
- A badge on the Review Rules and Memories tabs shows the pending count
- Pending items appear in the Pending review section at the top of the page, where you approve or discard them (see Pending review below)
- Both new creations and updates to existing rules/memories go through the approval flow
kodus-config.yml:
Pending review
The Pending review section (“Rules and memories awaiting approval.”) lists pending rules and memories together, each marked as a Rule, a Memory, or an Update:- New rules and memories: AI-generated items waiting for approval. Choose Approve to activate the item or Discard to reject it.
- Updates: Proposed changes to an existing rule or memory, shown as a diff. Choose Update existing to apply the change, Create new instead to keep the original and add the proposal as a separate item, or Discard to reject it.
Next Steps
Sync IDE Rules
Automatically import rules from Cursor, Copilot, Claude and other AI coding tools.
Repository Rules
Create rules directly in your repository using structured markdown files.
AI Generation
Let AI generate rules based on your codebase patterns and past reviews.