---
url: /en/repo/settings-npc.md
description: >
  Explains how to configure AI assistant (NPC) roles, knowledge bases, and
  interaction buttons for a repository via .cnb/settings.yml, enabling
  intelligent code review and Q&A collaboration.
---
Configure dedicated AI assistant roles, knowledge base, and interaction buttons
to enable intelligent collaboration for your repository.

## Use Cases

* Set up dedicated AI roles to assist with code review and Q\&A
* Import AI configurations from other repositories for knowledge sharing
* Customize the knowledge base button to improve AI assistant discoverability
* Define the role's domain expertise and communication style through prompts

## Minimal Configuration

Configuring just one role is enough to provide your repository with an
AI assistant that can be `@`-mentioned:

```yaml title=".cnb/settings.yml"
npc:
  roles:
    - name: Expert
      prompt: |
        You refer to yourself as "Expert" and are committed to providing professional, accurate technical answers.
```

After configuration, use it by `@repo-path(Expert)` in an Issue or PR comment.
For more usage and customization, see [NPC](../build/npc.md#quick-start).

## Configuration

Add the `npc` configuration to `.cnb/settings.yml`:

```yaml title=".cnb/settings.yml"
npc:
  imports:
    list:
      - cnb/docs
  roles:
    - name: Code Assistant
      slogan: code is cheap, show me your prompt
      prompt: You are now Code Assistant, focused on helping write and optimize code
      enableThinking: false
      avatar:
        src: ".cnb/knowledge-base-hover.png"
    - name: Reviewer
      prompt: |
        You are a code reviewer, focused on code quality review and improvement suggestions.
  defaultRepo: "cnb/docs"
  defaultRole: "Reviewer"
  button:
    name: "Quick Ask AI"
    description: "Click, start AI!"
    hoverImage: ".cnb/knowledge-base-hover.png"
```

## Parameter Reference

### Import Configuration

| Parameter         | Type     | Default | Description                                                              |
| ----------------- | -------- | ------- | ------------------------------------------------------------------------ |
| `npc.imports.list`| string\[] | -       | List of repo paths to import AI configs from (e.g., `cnb/docs`)         |

### Role Configuration

| Parameter               | Type    | Default | Description                                                            |
| ----------------------- | ------- | ------- | ---------------------------------------------------------------------- |
| `npc.roles[].name`      | string  | -       | Role name                                                              |
| `npc.roles[].slogan`    | string  | -       | Role slogan                                                            |
| `npc.roles[].prompt`    | string  | -       | Role description prompt                                                |
| `npc.roles[].enableThinking`|boolean|true   | Whether to enable thinking mode                                        |
| `npc.roles[].avatar.src` | string  | -       | Avatar image, supports images from repo's default branch          |

### Global Configuration

| Parameter         | Type   | Default | Description                                              |
| ----------------- | ------ | ------- | -------------------------------------------------------- |
| `npc.defaultRepo` | string | -       | Default selected repository for the knowledge base popup |
| `npc.defaultRole` | string | -       | Default selected role for the knowledge base popup       |

### Knowledge Base Button Configuration

| Parameter                | Type   | Default | Description                                                            |
| ------------------------ | ------ | ------- | ---------------------------------------------------------------------- |
| `npc.button.name`        | string | -       | Button name                                                            |
| `npc.button.description` | string | -       | Button description                                                     |
| `npc.button.hoverImage`  | string | -       | Hover image, only supports images from the repository's default branch |

:::tip
Role avatars and knowledge base button hover images only support files from the repository's default branch.
Simply provide the relative path from the repository root.
:::
