> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kodus.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Automatic Rules Generation

> Kody can automatically generate custom rules by analyzing your team's code review history. Let her learn from your past reviews to create personalized coding standards.

<Warning>
  **Requires at least 3 months of Kody review history on the repository.** This feature derives rules from Kody's past reviews on your PRs, so repositories that have just onboarded won't produce useful suggestions. If you recently started using Kody, come back after a few months of real reviews.
</Warning>

## Quick Overview

* **Auto-Generation**: Kody analyzes your review history to create new rules
* **Data-Driven**: Uses 3 months of review data for intelligent insights
* **Smart Suggestions**: Generates rules based on actual team patterns
* **Optional Approval**: Generated rules are active by default; turn on **Kody knowledge approval** to review each one before it takes effect
* **Continuous Learning**: Weekly rule updates as your team evolves

<Frame caption="Generate from past reviews and Kody knowledge approval in the Kody Rules Configuration sheet">
  <img src="https://mintcdn.com/kodus/O447Mtyto-OZAUba/images/sync-rules.png?fit=max&auto=format&n=O447Mtyto-OZAUba&q=85&s=3071781ec4f342f6a0bd38bfed9d3798" alt="Kody Rules Configuration sheet" width="1055" height="1148" data-path="images/sync-rules.png" />
</Frame>

## How It Works

### 1. Turning On Rules Generation

Rules generation is set per repository:

1. In the sidebar, pick the repository in the scope picker at the top of the **Code review** group, then open **Kody Rules**
2. Click **Configuration** to open the side sheet
3. Turn on **Generate from past reviews**
4. Optionally, use the reviewer picker below the toggle (**Learning from all reviewers** by default) to exclude developers whose review comments Kody should not learn from

### 2. Analysis Process

The first time you turn on **Generate from past reviews** for a repository, Kody will:

* **Scan Review History**: Analyzes the last 3 months of closed PRs in your repository
* **Identify Patterns**: Discovers common feedback themes and coding preferences
* **Extract Standards**: Converts review patterns into actionable rules
* **Generate Rules**: Creates custom rules tailored to your team's style

This may take a few minutes. Generated rules then appear on the repository's **Kody Rules** page.

### 3. Reviewing Generated Rules

Generated rules are listed with the **Kody-generated** origin (use **Filters → Origin → Kody-generated** to see only them). Open any of them to edit, pause, or delete it like any other rule.

### 4. Approving Rules Before They Take Effect

<Warning>
  By default, generated rules are **active as soon as they are created** and are
  enforced on the next code review.
</Warning>

To review generated rules before they take effect, turn on **Kody knowledge approval** in the same **Configuration** sheet. With approval on:

* **Pending Review**: New generated rules land in the **Pending review** section at the top of the Kody Rules page instead of being enforced
* **Choose Selectively**: **Approve** the rules that match your team's needs and **Discard** the rest
* **Activation**: Only approved rules are enforced during code reviews

## Continuous Learning

After the initial setup, Kody maintains an ongoing learning cycle:

* **Weekly Updates**: Kody generates new rule suggestions every week
* **Evolving Standards**: Rule suggestions adapt as your team's coding style evolves
* **Refined Accuracy**: Suggestions become more precise over time
* **Regular Reviews**: New rules appear weekly (in **Pending review** when approval is on)

## Requirements

* **Minimum Data**: At least 3 months of review history in the repository
* **Active Reviews**: Regular code review activity for better pattern detection
* **Repository Access**: Proper permissions to modify repository rules


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.