---
title: "Control what Gleap reads from your repository"
description: "Put infrastructure, secrets and generated code off limits, in the dashboard or in a .gleap/config.yaml file you commit with the code."
url: https://help.gleap.ai/en/articles/380-control-what-gleap-reads-from-your-repository
collection: "Investigations and Kai Code"
updated: 2026-11-01
language: en
---

# Control what Gleap reads from your repository

Put infrastructure, secrets and generated code off limits, in the dashboard or in a .gleap/config.yaml file you commit with the code.

A repository is rarely worth reading in full. Infrastructure definitions, vendored dependencies, generated clients, test data with real customer names: none of it makes the AI better, and some of it you'd rather Gleap never held. You can put any path off limits, and excluded files are never downloaded.

### Two places to set it

-   **In Gleap**, per repository. Quickest, and nobody needs commit access.
    
-   **In the repository**, in a file, so the rules are versioned with the code and change when the code does.
    

Both apply at once. Where they disagree, Gleap's setting wins: a rule set in the dashboard can't be undone by a commit.

### In the dashboard

1.  Open **Settings → Apps** and open the GitHub connection.
    
2.  Open the repository. You can also reach it through **Knowledge → Code repositories** or an agent’s Code settings.
    
3.  Under **What Kai reads → Hidden from Kai**, enter one path per line in .gitignore syntax.
    
4.  Move focus out of the field to save, then check the saved state.
    

![Knowledge repositories screen in the Pied Piper demo project.](https://staticfiles.gleap.io/p613b5dd730aed737108f87ab/LsZO8VAHpDlueevtDNR0GNE3hxMbi8SQgBLbh9bLKvbsfAcMlDeYJZyhQ9bzEm54l8a5HV6pKs6.png)

The current repository screen shares these exclusions across the agents shown in **Used by**. Older provider screens may instead show **Edit → Excluded paths** with a Save button. Review the connected agents before changing a shared repository.

Dashboard entries only ever exclude. A pattern starting with `!` is treated as a plain exclusion, so the dashboard can't widen access.

### In the repository

Commit a `.gleap/config.yaml` to the root of the repository:

```yaml
version: 1

# Off limits everywhere.
ignore:
  - "infra/**"
  - "**/*.env"

index:
  # Only kept out of what the AI answers from.
  ignore:
    - "**/__fixtures__/**"

code:
  # Only kept out of Kai Code sessions.
  ignore:
    - "scripts/deploy/**"
```

The split exists because the two uses differ. Test fixtures are noise in an answer but useful to a coding agent, so they belong under `index`, not at the top. Anything truly sensitive belongs at the top, where it applies to everything.

If a list of paths is all you need, a `.gleapignore` file at the root works on its own, one pattern per line. Gleap only reads it when there's no `.gleap/config.yaml`.

### Writing patterns

Patterns work exactly like a `.gitignore`, so anything your team already writes there behaves the same here:

```yaml
ignore:
  - "secrets/"                    # the folder, wherever it appears
  - "**/*.env"                    # every .env file, including at the root
  - "packages/vendor/**"          # everything under one package
  - "!packages/vendor/README.md"  # …except this one file
```

One YAML quirk to watch: patterns that start with `!` or `*` must be quoted, or the file won't load. Each list can hold up to 500 patterns.

### What excluding does

An excluded file is never downloaded: not to build knowledge, not to answer a question, not into a Kai Code session. Gleap knows which paths the repository contains, but the contents of excluded files stay with you.

Exclusions also apply backwards. If something was already indexed from a file you've now excluded, the next index clears out what was derived from it.

> **Warning:** Excluding a path Kai Code needs stops it working there: a build can't run without a file it imports. Keep exclusions at the top level to what's truly sensitive, and use the `index` list for everything you exclude only to cut noise.

### Tell the AI what the repository is

The same file can carry context the code can't give: what the repository is for, who the documentation is for, which parts are dead. Up to 4,000 characters:

```yaml
index:
  instructions: |
    This is the customer-facing dashboard.
    Document the admin area only. Everything under legacy/ ships to nobody.
```

A few sentences here are worth more than they look. Naming and intent are the two things reading source code won't tell you.

### If the file has a mistake

> **Info:** A config file that can't be read stops indexing with an error that names the file and the problem, instead of quietly carrying on and reading everything. If you've written exclusions, you'll hear about it when they aren't being applied.

### Related

-   [Connect a code repository](https://help.gleap.ai/en/articles/264-connect-a-code-repository.md)
    
-   [How Kai Support investigations and Kai Code work together](https://help.gleap.ai/en/articles/319-how-investigations-and-kai-code-work-together.md)
    
-   [Check what Gleap stores, where and for how long](https://help.gleap.ai/en/articles/373-check-what-gleap-stores-where-and-for-how-long.md)
