> ## 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.

# System Prompts

> Override or extend the agent's system prompt per surface from your context repo

Each bot surface (nao web Bot, Slack, Teams, Telegram, WhatsApp, Mattermost, and automations) ships with a built-in system prompt. You can customize or fully replace that prompt per surface by adding markdown files to an `agent/prompts/` folder in your context repo - no code changes or forking required.

Because the files live in your context repo, prompt changes are versioned with the rest of your context and stay reviewable in pull requests. `nao init` scaffolds the `agent/prompts/` folder for you with a `README.md` and an example `slack.md`.

## Per-surface files

Place any of these files in `agent/prompts/`:

| File | Applies to |
| - | - |
| `system.md` | Every surface (nao web Bot, Slack, Teams, Telegram, WhatsApp, Mattermost, automations) |
| `slack.md` | Slack Bot only |
| `teams.md` | Teams Bot only |
| `telegram.md` | Telegram Bot only |
| `whatsapp.md` | WhatsApp Bot only |
| `mattermost.md` | Mattermost Bot only |
| `automation.md` | Automation runs only |

Resolution order for a given surface:

1. The surface-specific file (e.g. `slack.md`), if present.
2. Otherwise `system.md`, if present.
3. Otherwise nao's built-in default prompt.

The nao web Bot has no surface-specific file - it uses `system.md` when present, otherwise the built-in default.

> [!TIP]
>
> Prompt files are read fresh on every run, just like `RULES.md`. You can edit a prompt and see the change on the next message without restarting nao.

## Replace vs. extend: `{{ nao_prompt }}`

By default, a prompt file **fully replaces** the built-in prompt for that surface.

To **keep** the default and only add to it, include the `{{ nao_prompt }}` placeholder. At runtime it expands to nao's default prompt for that surface (in `slack.md` it expands to the default Slack prompt, in `mattermost.md` to the default Mattermost prompt, in `system.md` to the web prompt, and so on). The placeholder tolerates whitespace variations (`{{nao_prompt}}` or `{{ nao_prompt }}`) and can appear more than once.

Extend the default Slack prompt - `agent/prompts/slack.md`:

```markdown theme={null}
{{ nao_prompt }}

## Extra Slack guidance
- Always start the answer with a one-line TL;DR.
- Link the source dashboard when one exists.
```

Fully replace the default for every surface - `agent/prompts/system.md`:

```markdown theme={null}
You are the ACME analytics assistant. Answer only with figures sourced
from the `prod_finance` schema, and never speculate beyond the data.
```

Without `{{ nao_prompt }}`, the file content becomes the entire prompt.

> [!NOTE]
>
> Internal runs that pass an explicit system prompt (for example, context recommendations) are not affected by these overrides.

## Warehouse dialect rules

nao also adds SQL rules to the built-in prompt based on the warehouses your project is connected to. This happens automatically: the rules for a dialect are injected whenever a connection of that type exists, so you do not have to restate them in `RULES.md`.

The exact rules for each dialect live in one file in the nao repo. Rather than restate them here (they evolve as we add coverage), each row links to the source:

| Connection type | Dialect rules |
| - | - |
| BigQuery | Identifier quoting, safe division, window `GROUP BY`, aggregate-function differences: [view rules](https://github.com/getnao/nao/blob/65c988553861ba94773f9ba8278b07d89e0097ee/apps/backend/src/components/ai/dialect-rules.tsx#L61-L92) |
| Redshift | `PERCENTILE_CONT`, `LISTAGG`, string concat, date and filtered-count differences: [view rules](https://github.com/getnao/nao/blob/65c988553861ba94773f9ba8278b07d89e0097ee/apps/backend/src/components/ai/dialect-rules.tsx#L103-L134) |
| MSSQL and Fabric | `TOP N`, no `GROUP BY ALL`, T-SQL date functions, `ISNULL()`: [view rules](https://github.com/getnao/nao/blob/65c988553861ba94773f9ba8278b07d89e0097ee/apps/backend/src/components/ai/dialect-rules.tsx#L41-L60) |
| MySQL | Identifier quoting, `IFNULL()`: [view rules](https://github.com/getnao/nao/blob/65c988553861ba94773f9ba8278b07d89e0097ee/apps/backend/src/components/ai/dialect-rules.tsx#L93-L102) |
| ClickHouse | Read `indexes.md` for ordering and partitioning before querying: [view rules](https://github.com/getnao/nao/blob/65c988553861ba94773f9ba8278b07d89e0097ee/apps/backend/src/components/ai/dialect-rules.tsx#L30-L40) |

Warehouses without a dialect entry (for example PostgreSQL, Snowflake, Databricks, DuckDB) use the generic SQL rules in the built-in prompt.

> [!NOTE]
>
> Dialect rules are part of nao's built-in prompt. A prompt file that fully replaces the default drops them; keep `{{ nao_prompt }}` in the file if you want to preserve them.

**Next Steps**

> [card] [Rules](https://docs.getnao.io/nao-agent/context-builder/rules-context.md)
>
> Shape per-message behavior with RULES.md

> [card] [Custom Context](https://docs.getnao.io/nao-agent/context-builder/custom-context.md)
>
> Organize your context repo however works best


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.