# Introduction
Source: https://docs.refacto.ai/index
Refacto is an AI-powered code review tool that integrates with your Git tool (like GitHub) and helps reviewers find issues.
## Key Features
Automatically generates **contextual comments** on your pull requests, pointing out potential issues, edge cases, and best-practice violations.
Provides **inline suggestions** along with the code comments, so you can fix issues in just a few clicks.
## Security
We take security seriously — Refacto is built with privacy and compliance at its core.
Your pull request content, comments, and suggestions are processed **in real-time** and **never stored** on our servers.
Our systems and processes meet strict **SOC 2 standards** for security, availability, and confidentiality.
## Support
Need help or want to share feedback?\
We’d love to hear from you.
Email us at [**hello@refacto.ai**](mailto:hello@refacto.ai) and we'll get back to you quickly.
# Azure Repos
Source: https://docs.refacto.ai/integrations/azure_repos
Connect Refacto to your Azure DevOps Repos.
Follow these steps to connect Refacto to your Azure DevOps repositories.
* Navigate to the **Integrations** page in your Refacto dashboard.
* Click **Connect** on **Azure Repos**.
* After clicking **Connect**, you’ll be redirected to the **Azure Repos setup form** in Refacto.
* This form requires three fields: **PAT Token**, **Organisation Name**, and **Bot Email**.
* To get these values, please follow the next steps:
* Create a Review User
* Generate a Personal Access Token (PAT)
You need to create a dedicated **review user** in Azure DevOps.
1. Navigate to **Organization Settings**.
2. Go to **Users** from the sidebar. Click **Add users**.
3. Enter **email** or **review user**. Choose Access level as **Basic**. Choose the projects.
4. Choose **Project Adminstrator** as Azure Devops Group. It is required to create webhooks in **Service Hooks**.
Azure DevOps provides an option to generate a **Personal Access token** for a user. Follow these steps to generate the token:
1. Next to your avatar on the header’s right side is a settings icon, click it, then choose **Personal Access Tokens**.
2. Click **New Token**.
3. Enter a name and an expiry date for the token.
4. Grant the following permissions:
1. **Read & Write** Code.
2. **Read** for Work items.
3. **Read** Graph for user info like email, name, etc.
Copy and save token. As its shown only once.
On the Azure Repos setup page in Refacto, provide the following:
* **PAT Token** – Paste the token you generated above.
* **Azure DevOps Organisation Name** – Extract this from your Azure DevOps URL.\
Example:
> `https://dev.azure.com/bluetowers/`
* → organisation name is **bluetowers**.
* **Bot Email** – Enter the email of the review user you created earlier.
Click **Save Settings** when done.
Your Azure Repos integration is now active.
# Bitbucket Cloud
Source: https://docs.refacto.ai/integrations/bitbucket_cloud
Connect Refacto to your Bitbucket Cloud repositories.
Follow these steps to connect Refacto to your Bitbucket Cloud workspace.
Invite the **Refacto Bot User** to your Bitbucket workspace to allow secure access to repositories during pull request reviews.
* The bot requires **read access** to temporarily clone repositories for analysis.
* Since **Bitbucket App Passwords are deprecated from September 2025**, Refacto uses an **SSH-based authentication mechanism**.
* Add the bot to your workspace using the provided email and grant it read permissions for all repositories (recommended) or only those you want Refacto to review.
**Bot Email:** `security@refacto.ai`
You need to create a **Bitbucket API token** with appropriate permissions.
⚠️ You must have **Administrator access** to the Bitbucket Cloud workspace to create webhooks at the workspace level.
1. Log in to **Bitbucket Cloud** and navigate to\
**Settings → Atlassian Account Settings → Security**,\
or open [https://id.atlassian.com/manage-profile/security/api-tokens](https://id.atlassian.com/manage-profile/security/api-tokens)
2. Click **Create API token with scopes**.
3. Give it a name (e.g., **Refacto Integration**) and set an expiry (recommended **360 days**).
4. Under **Select the app**, choose **Bitbucket**.
5. Under **Select Bitbucket scopes**, check the following scopes:
* **read:user:bitbucket**, **read:account**
* **read:webhook:bitbucket**, **write:webhook:bitbucket**, **delete:webhook:bitbucket**
* **read:workspace:bitbucket**, **read:project:bitbucket**, **read:repository:bitbucket**
* **read:pullrequest:bitbucket**
* **read:issue:bitbucket**
6. Under **Review your API token**, verify details and click **Create Token**.
Copy and save the token — it’s shown only once.
On the Bitbucket Cloud setup page in Refacto, provide the following:
* **Workspace Slug** – The workspace identifier in your Bitbucket URL.\
Example:
> [https://bitbucket.org/bluetowers](https://bitbucket.org/bluetowers) → workspace slug is **bluetowers**
* **API Token Owner’s Email** – The email of the user who created the token.
* **API Token** – The token you generated above.
Click **Save & Sync Repos** when done.
* Navigate to the **Integrations** page in your Refacto dashboard.
* Click **Connect** on **Bitbucket Cloud**.
* After clicking **Connect**, you’ll be redirected to the **Bitbucket Cloud setup form** in Refacto.
* This form requires three fields: **Workspace Slug**, **API Token Owner’s Email**, and **API Token**.
* To get these values, please follow the next steps:
* Create an **API Token**
* Invite the **Refacto Bot User**
Your Bitbucket Cloud integration is now active.
# GitHub
Source: https://docs.refacto.ai/integrations/github
Install and set up Refacto-bot in just a few minutes.
Follow these four simple steps to connect Refacto-bot to your GitHub repositories.
Go to [app.refacto.ai/integrations](https://app.refacto.ai/integrations).\
Here you’ll see all available integrations (**currently GitHub**, with more coming soon).
Click the **Connect** button to start linking your GitHub account.
You’ll be redirected to GitHub’s **Refacto-bot installation screen**.
* Select the repositories or organization you want to connect.
* Click **Install & Authorize** to grant Refacto access.
After authorization, you’ll be redirected back to the app.\
Your GitHub integration will now appear as **Connected**.
# GitLab
Source: https://docs.refacto.ai/integrations/gitlab
Connect Refacto to your GitLab repositories.
### Prerequisites
If you are using a **Self-Managed GitLab** instance (hosted on-premise or in a private cloud), you must ensure Refacto can communicate with your server.
**Allowlist Refacto IP**
Please configure your firewall or security group inbound rules to whitelist the following IP address to ensure uninterrupted connectivity:
**`3.131.112.244`**
Follow these steps to connect Refacto to your GitLab workspace.
* Navigate to the **Integrations** page in your Refacto dashboard.
* Click **Connect** on **GitLab**.
You need to create a **GitLab Personal Access Token** with appropriate permissions.
⚠️ You must have **Administrator / Owner access** to the GitLab group or instance to generate API tokens and create webhooks.
1. Log in to **GitLab** with an account having Owner/Admin permissions.
2. Navigate to **User settings → Personal access tokens → Add new token**, or open directly: `https://gitlab.com/-/user_settings/personal_access_tokens`
3. Under **Create a personal access token**, fill in the following:
* **Token name**: `Refacto Integration`
* **Expiration date**: Recommended **180–360 days**
4. Under **Select scopes**, enable the following required scopes:
| Scope | Mandatory | Purpose | If Missing |
| :---------------- | :-------- | :----------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------- |
| `read_user` | ✅ Yes | Provides access to user identity and account details. Used to correctly attribute commits, merge requests, and comments. | User attribution and reviewer mapping will fail. |
| `read_repository` | ✅ Yes | Allows read access to repositories, branches, and code required for merge request analysis. | Refacto cannot fetch code or diffs for review. |
| `read_api` | ✅ Yes | Grants access to GitLab APIs to fetch projects, groups, merge requests, and pipeline metadata. | Repository and MR metadata cannot be retrieved. |
| `read_registry` | ✅ Yes | Enables access to container registry metadata when repositories reference images. | Image-related context will be unavailable. |
| `api` | ✅ Yes | Required to create and manage webhooks and to post automated review comments on merge requests. | Webhooks won’t trigger and Refacto cannot post feedback. |
5. Review the selected scopes and click **Create token**.
**Important:** Copy the generated token immediately. It will be shown only once.
On the GitLab setup page in Refacto, enter the following details:
* **GitLab Instance URL** – (e.g., `https://gitlab.com` or your self-managed GitLab URL).
* **Personal Access Token** – The token you generated in the previous step.
Click **Save Settings** to complete the setup.
Your GitLab integration is now active. Refacto will automatically:
* Discover repositories
* Create required webhooks
* Start analyzing merge requests
# Jira
Source: https://docs.refacto.ai/integrations/jira
Learn how to connect your Jira account to Refacto in just a few simple steps.
Follow these simple steps to connect your Jira account to Refacto.
Go to [app.refacto.ai/integrations](https://app.refacto.ai/integrations).\
Here you’ll see all available integrations .
Click on **Connect** button to start linking your Jira account
After clicking Connect, you will be redirected to the Atlassian authorization page.\
Refacto AI will request access to your Jira account
Review the permissions and click **Accept** to grant access.
Once you click **Accept**, your Jira account will be successfully connected to Refacto.
You will see a confirmation message:
* Successfully Connected!
* Your Jira account has been successfully connected to Refacto.
\
You will automatically be redirected back to the Refacto dashboard.
After redirection:
* Go back to the **Integrations** page.
* You will now see Jira marked as **Connected**.
* A connected indicator will appear beside Jira.
This confirms that your Jira account is successfully integrated with Refacto.
Your Jira integration is now active. \
Refacto can now fetch Jira data for analytics, reports, task tracking, and investment insights.
# FAQs
Source: https://docs.refacto.ai/settings/custom_instructions/faqs
### 1. My YAML shows “Rejected”. What does it mean?
The instruction block failed validation — check **“Rejection Reason”** in the table for details and resubmit after editing.
### 2. My instructions are approved but not applied to a PR.
Ensure the **match paths/extensions** actually match changed files, and that the **repo name** matches the current PR’s repository.
### 3. Can I have org-wide and repo-specific rules?
Yes — you can define both, and they work inclusively.
* **Org-wide rules** apply to all repositories in your organization, but only if the files match their defined match conditions (`paths` or `extensions`).
* **Repo-specific rules** apply only to the selected repository and follow their own match filters.
* If a file satisfies both org and repo matches, both rule sets are applied — org rules act as the shared baseline, while repo rules add more granular or project-specific checks.
### 4. How do I test before submitting?
Use **“Show Preview”** in the Custom Instructions tab to check how your YAML configuration will be structured and which repositories your rules will apply to.
This helps verify that your match conditions (`paths`, `extensions`) are correctly set. The actual file-level matches are only visible during a live review, where Refacto shows which instructions were applied or skipped for specific files.
### 5. I edited one block — do I need to resubmit all?
No — only select updated/rejected blocks before submission.
### 6. Are comments inside YAML counted in limits?
No, only characters inside `instructions:` fields count.
### 7. Can I use multiple file patterns?
Yes, `paths:` and `extensions:` accept arrays up to 20 items each.
# Get Started
Source: https://docs.refacto.ai/settings/custom_instructions/get-started
Learn how to define and apply custom AI review rules using YAML in Refacto.
* Navigate to **Refacto → Settings → Custom Instructions**.
* You’ll see two tabs:
* **PR Review** – controls how the AI analyzes pull requests.
* **Custom Instructions** – lets you define rules and coding standards using YAML.
You can begin in two ways:
* **Load Example & Get Started** – creates a sample YAML with one org rule and two repo rules.
* **Start from Scratch** – starts with an empty config.
When you load the example, a YAML editor opens with three prefilled blocks (1 org, 2 repo-specific).
You can click **Add Repository** to insert a new block.
| Field | Description | Example |
| ------------------ | --------------------------- | ------------------------------------ |
| `match.paths` | Regex to match file paths | `src/java*` |
| `match.extensions` | File extensions to include | `.ts, .js` |
| `instructions` | The actual review rule text | `"All PRs must include unit tests."` |
Only the content under instructions counts toward the 500-character limit per block.
Below the editor, you’ll find a summary table showing:
* Character usage per block
* Status (No Status, Approved, In Review, Rejected)
* Rejection reason (if any)
Select blocks to send for approval and click **Submit & Apply**.
| Status | Meaning |
| --------- | -------------------------------------------- |
| No status | Not yet submitted |
| In Review | Under validation (usually a few days) |
| Approved | Instructions are active |
| Rejected | Invalid or security violation (reason shown) |
When Refacto reviews a PR, it posts a summary comment with:
* **Applied Instructions** – which rules were used
* **Unapplied Instructions** – skipped rules and reasons (e.g., repo mismatch)
Once approved, your rules automatically apply to all matching PRs across the organization.
# Limits & Validation Rules
Source: https://docs.refacto.ai/settings/custom_instructions/limits
## Limits and Validation
### Character Limits
* 500 characters per block
* 4000 characters total per YAML
### YAML Format Rules
* YAML 1.2 compliant
* 2-space indentation, no tabs
* Allowed root fields: `version`, `language`, `org`, `repos`
### Validation Requirements
* At least one instruction required
* Repo names: alphanumeric, `_` or `-` only
* Up to 10 repos, 20 items per `match` array
### Security Checks
* Avoid terms like “ignore above”, “override”, “forget previous”
* Don’t include text that alters AI behavior or review logic
These safeguards ensure consistent and safe PR reviews.
## Preview and Verify
Use **Show Preview** in the Custom Instructions tab to confirm:
* YAML structure validity
* Which rules apply to which repositories
# Updates & Resubmission
Source: https://docs.refacto.ai/settings/custom_instructions/updates-and-resubmission
You’ll need to update your YAML when:
* Repo structure or coding standards change
* A submission was previously rejected
### To resubmit:
1. Open your existing YAML config
2. Edit only the changed block(s)
3. Select updated or rejected blocks
4. Click **Submit for Review**
Approved blocks stay active until the new version is approved.\
Rejected blocks display a **“Rejection Reason”**.
Avoid flagged words like “ignore above”, “override”, or “bypass”. Keep YAML syntax valid with 2-space indents.
# PR Review Settings
Source: https://docs.refacto.ai/settings/pr_review
You can customize how PR reviews are generated for your organization and individual repositories.
### Auto Review
Automatically reviews PRs when they are opened.
* **Default:** OFF
* **Enable:** Go to **Settings** in Refacto and toggle **Auto Review** ON.
*Enable this if you want reviews to happen automatically without manual intervention.*
### PR Summary
Adds a summarized view of the PR in review comments.
*This helps reviewers quickly understand the changes and context.*
### Sequence Diagram
Generates a sequence diagram for code changes.
*Visualize the flow of your code to make reviews easier and faster.*
### Scope and Precedence
You can configure settings at **Organization Level** or **Repository Level**:
* **Organization Level:** Default settings applied to all repositories.
* **Repository Level:** Custom settings for individual repositories override organization-level defaults.
*Repository settings take priority over organization defaults.*
# Usage
Source: https://docs.refacto.ai/usage
Learn how to trigger PR reviews using Refacto-bot.
## Triggering PR Reviews
Refacto-bot supports two ways to trigger reviews for your pull requests.
Refacto can automatically review a pull request when it's opened.
This feature is off by default. To turn it on, follow these steps:
Navigate to the [Settings](https://app.refacto.ai/settings) page in the Refacto app.
Find the **Auto Review** option and toggle it **ON**.
Once enabled, every new PR is reviewed automatically — perfect for consistent, hands-free checks.
You can also trigger reviews manually by adding a comment in a PR:
```text theme={null}
@refacto-bot
```
Perfect for running reviews **only when you need them**, giving you full control over which PRs get checked.