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

# Repositories

> Add Git repositories to your agent context

Add repositories to your agent context to give it access to dbt repo, semantic layers (Cube, LookML, etc.), documentation, or anything else.

## Why Add Repositories?

Adding repositories to your context allows your agent to:

* Access dbt model definitions and documentation
* Access your semantic layer repository
* Reference internal documentation

## Adding a Repository

When you run `nao init`, you can add a repository interactively:

```bash theme={null}
nao init
```

Or add repositories in your `nao_config.yaml`:

```yaml theme={null}
repos:
  - name: dbt_project
    url: https://github.com/your-org/dbt-project
```

You can also use a local path instead of a Git URL:

```yaml theme={null}
repos:
  - name: dbt_project
    local_path: ../dbt
```

`url` and `local_path` are mutually exclusive. You must set exactly one.

Optional file filters:

```yaml theme={null}
repos:
  - name: dbt_project
    local_path: ../dbt
    include:
      - "models/**/*.sql"
      - "models/**/*.yml"
    exclude:
      - "**/__pycache__/**"
      - "*.pyc"
```

### Syncing only a subdirectory

If you only need a specific folder from a large repo (e.g. the `models/` directory from a monorepo), use `include` patterns to scope the sync:

```yaml theme={null}
repos:
  - name: dbt_models
    url: https://github.com/your-org/monorepo
    include:
      - "dbt/models/**"
```

This clones the full repository but only indexes files matching the pattern. Combine multiple patterns to pull from several subdirectories:

```yaml theme={null}
repos:
  - name: data_platform
    url: https://github.com/your-org/data-platform
    include:
      - "dbt/models/**/*.sql"
      - "dbt/models/**/*.yml"
      - "docs/data-dictionary/**/*.md"
    exclude:
      - "**/test_*"
```

For local paths, you can also point `local_path` directly at the subdirectory instead of using filters:

```yaml theme={null}
repos:
  - name: dbt_models
    local_path: ../monorepo/dbt/models
```

## Context Files

**Synchronisation**
Sync your repositories to pull the latest content:

```bash theme={null}
nao sync
```

This will:

1. Clone or copy the repository
2. Extract relevant files from the specified path
3. Index the content for the agent
4. Make it searchable

**Context Output**

The output will be the synced repository content in the `repos/` folder.

After syncing, repositories are stored in:

```
context/
└── repos/
    └── dbt_project/
```
