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

# Configure with greptile.json (Perforce)

> Configure Greptile settings for Perforce depots.

## Project Boundary

### Where to Place `greptile.json`

You can configure Greptile by adding a `greptile.json` file **at the root of your project boundary**.

The *project boundary* is the **context path shown in the review summary**.

**Example**

If your review summary shows:

> Run with Greptile v3 — Context used: //depot/linux/arch/alpha

Then the configuration file must be placed at:

```
//depot/linux/arch/alpha/greptile.json
```

Greptile will use this file when reviewing changes within that boundary.

### How Greptile Determines the Project Boundary

Greptile determines the boundary based on the **onboarded paths involved in the review**.

**Case A: Review Spans Multiple Onboarded Paths**

If:

* `//depot/project/frontend` is onboarded
* `//depot/project/backend` is onboarded
* `//depot/project` is also onboarded

And the review includes files from both:

```
//depot/project/frontend
//depot/project/backend
```

Then:

* Greptile finds the **nearest common parent**
* Since `//depot/project` is onboarded, it becomes the **project boundary**
* The configuration used will be:

```
//depot/project/greptile.json
```

**Case B: Review Is Limited to a Single Onboarded Path**

If the review only contains files from:

```
//depot/project/frontend
```

And that path is onboarded, then:

* `//depot/project/frontend` becomes the project boundary
* The configuration used will be:

```
//depot/project/frontend/greptile.json
```

### Key Rules

Greptile:

* Uses the **nearest common parent** path
* Only considers parents that are **also onboarded**
* Loads the `greptile.json` file from the resolved project boundary

```json greptile.json theme={}
{
  "strictness": 2,
  "commentTypes": ["logic", "syntax", "style"],
  "instructions": "Ensure all code follows the team's style guide.",
  "ignorePatterns": "greptile.json\n*.md\n*.txt\nscripts/",
  "notify": "silent",
  "emailAuthorOnComplete": true,
  "summarySection": {
    "included": true
  },
  "issuesTableSection": {
    "included": true
  },
  "confidenceScoreSection": {
    "included": true
  },
  "customContext": {
    "rules": [
      {
        "scope": ["**/*.py"],
        "rule": "All functions must have docstrings"
      }
    ],
    "files": [
      {
        "scope": ["**/*.ts", "**/*.js"],
        "path": "//depot/projects/my_project/style_guide.md",
        "description": "TypeScript style guide"
      }
    ],
    "other": [
      {
        "scope": [],
        "content": "Focus on security and performance issues"
      }
    ]
  }
}
```

## Configuration Parameters

All parameters are optional.

| Parameter | Type | Description |
| - | - | - |
| `strictness` | number | Severity threshold for comments (1-3). 1 = all issues, 2 = moderate filtering, 3 = only critical issues. Defaults to 2. |
| `commentTypes` | array | Types of comments Greptile should make. Options: "logic" (business logic issues), "syntax" (language-specific best practices), "style" (formatting, naming conventions). All enabled by default. |
| `instructions` | string | Natural language instructions for code reviews. |
| `ignorePatterns` | string | Newline-separated list of file patterns to ignore, following .gitignore syntax. |
| `autoReview` | array | Swarm review events that start a Greptile review without being asked: `open` (review created) and `push` (review updated). Default `["open"]`. |
| `skipReview` | string | Legacy form of `autoReview`: when set to AUTOMATIC, skips reviews triggered automatically by Swarm review events (opens, updates, etc), the same as `autoReview: []`. |
| `notify` | string | Controls email notifications. When set to `"silent"`, Swarm will not send email notifications to the author or reviewers. |
| `emailAuthorOnComplete` | boolean | If set to true will send an email to the author that the review is completed. Default behavior is false. |
| `summarySection` | object | Controls review summary section. Property: included (boolean). |
| `issuesTableSection` | object | Controls issues table section. Property: included (boolean). |
| `confidenceScoreSection` | object | Controls confidence score section. Property: included (boolean). |
| `customContext` | object | Advanced context with three arrays: `rules`, `files`, and `other`. Each supports optional scope targeting. |

## Ignore Patterns

The `ignorePatterns` field uses `.gitignore` syntax to exclude files from review. Patterns are separated by `\n` (newline characters) in the JSON string. Paths are relative to the project boundary.

```json theme={}
// Ignore specific files
{
  "ignorePatterns": "greptile.json\nREADME.md"
}

// Ignore by file extension
{
  "ignorePatterns": "*.md\n*.txt\n*.log"
}

// Ignore directories
{
  "ignorePatterns": "scripts/\nvendor/\nthird_party/"
}

// Ignore nested directories
{
  "ignorePatterns": "src/utils/testing/\nlib/external/deprecated/"
}

// Ignore with glob patterns
{
  "ignorePatterns": "**/*.generated.*\ntests/**/*.snap\ndocs/**"
}

// Combined example
{
  "ignorePatterns": "greptile.json\n*.md\n*.txt\nscripts/\n**/*.generated.*"
}
```

## Custom Context

The `customContext` field provides additional context for code reviews:

**`rules`** - Specific coding rules to enforce

* Define coding standards or project-specific requirements
* Each rule includes a `scope` (glob patterns) and `rule` (string)

**`files`** - Reference depot documentation files

* Point to existing style guides or reference files using Perforce depot paths
* Includes `path` (e.g., `//depot/projects/my_project/style_guide.md`), `description`, and `scope`

**`other`** - General instructions or context

* Additional background information or high-level guidance
* Includes `content` and optional `scope`

### Scope Targeting

Each context item supports an optional `scope` array using glob patterns. For Perforce, scope patterns work with depot paths:

```json theme={}
{
  "customContext": {
    "files": [
      {
        "scope": ["//depot/apps/**", "//depot/libs/**"],
        "path": "//depot/shared/security-rules.md"
      }
    ]
  }
}
```

Additional scope examples:

```json theme={}
"scope": ["**/*.py"]                   // All Python files
"scope": ["//depot/src/**/*.ts"]       // TypeScript files in depot/src
"scope": []                            // All files (default)
```
