You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docs/agent/how-to-customize.md
+6Lines changed: 6 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,12 @@ keywords: [customize, chat]
5
5
sidebar_position: 5
6
6
---
7
7
8
+
## Add Rules Blocks
9
+
10
+
Adding Rules can be done in your assistant locally or in the Hub.
11
+
12
+
[Explore Rules on the Hub](https://hub.continue.dev/explore/rules) and see the [Rules deep dive](../customize/deep-dives/rules.md) for more details and tips on creating rules.
13
+
8
14
## Add MCP tools
9
15
10
16
You can add MCP servers to your assistant to give Agent access to more tools. [Explore MCP Servers on the Hub](https://hub.continue.dev/explore/mcp) and see the [MCP guide](../customize/deep-dives/mcp.mdx) for more details.
Rules allow you to provide specific instructions that guide how the AI assistant behaves when working with your code. Instead of the AI making assumptions about your coding standards, architecture patterns, or project-specific requirements, you can explicitly define guidelines that ensure consistent, contextually appropriate responses.
10
+
9
11
Think of these as the guardrails for your AI coding assistants:
10
12
11
13
-**Enforce company-specific coding standards** and security practices
12
14
-**Implement quality checks** that match your engineering culture
13
15
-**Create paved paths** for developers to follow organizational best practices
By implementing rules, you transform the AI from a generic coding assistant into a knowledgeable team member that understands your project's unique requirements and constraints.
18
+
19
+
### How Rules Work
20
+
21
+
Your assistant detects rule blocks and applies the specified rules while in [Agent](../agent/how-to-use-it), [Chat](../chat/how-to-use-it), and [Edit](../edit/how-to-use-it) modes.
Rules are used to provide instructions to the model for [Chat](../../chat/how-to-use-it.md), [Edit](../../edit/how-to-use-it.md), and [Agent](../../agent/how-to-use-it.md) requests.
8
+
Rules provide instructions to the model for [Chat](../../chat/how-to-use-it.md), [Edit](../../edit/how-to-use-it.md), and [Agent](../../agent/how-to-use-it.md) requests.
9
9
10
-
Rules are not included in most other requests, such as [autocomplete](./autocomplete.mdx) or [apply](../model-roles/apply.mdx).
10
+
:::info Rules are not included in [autocomplete](./autocomplete.mdx) or [apply](../model-roles/apply.mdx).
11
+
:::
12
+
13
+
## How it works
11
14
12
15
You can view the current rules by clicking the pen icon above the main toolbar:
To form the system message, rules are joined with new lines, in the order they appear in the toolbar. This includes the base chat system message ([see below](#chat-system-message)).
17
20
18
-
## `rules` blocks
21
+
## Quick Start
22
+
23
+
Below is a quick example of setting up a new rule file:
24
+
25
+
1. Create a folder called `.continue/rules` at the top level of your workspace
26
+
2. Add a file called `pirates-rule.yaml` to this folder.
27
+
3. Write the following contents to `pirates-rule.prompt` and save.
28
+
29
+
```yaml title=".continue/rules/pirates-rule.yaml"
30
+
name: Pirate rule
31
+
version: 0.0.1
32
+
schema: v1
33
+
rules:
34
+
- Talk like a pirate.
35
+
```
36
+
37
+
Now test your rules by asking a question about a file in chat.
38
+
39
+

19
40
20
-
Rules can be added to an Assistant on the Continue Hub. Explore available rules [here](https://hub.continue.dev/explore/rules), or [create your own](https://hub.continue.dev/new?type=block&blockType=rules) in the Hub. These blocks are defined using the [`config.yaml` syntax](../../reference.md#rules) and can also be created locally.
41
+
## Creating `rules` blocks
42
+
43
+
Rules can be added locally using the "Add Rules" button while viewing the Local Assistant's rules.
44
+
45
+

21
46
22
47
:::info Automatically create local rule blocks
23
-
When in Agent mode, you can simply prompt the agent to create a rule for you using the `builtin_create_rule_block` tool if enabled.
48
+
When in Agent mode, you can prompt the agent to create a rule for you using the `builtin_create_rule_block` tool if enabled.
24
49
25
50
For example, you can say "Create a rule for this", and a rule will be created for you in `.continue/rules` based on your conversation.
26
51
:::
27
52
53
+
Rules can also be added to an Assistant on the Continue Hub.
54
+
55
+
Explore available rules [here](https://hub.continue.dev/explore/rules), or [create your own](https://hub.continue.dev/new?type=block&blockType=rules) in the Hub. These blocks are defined using the [`config.yaml` syntax](../../reference.md#rules) and can also be created locally.
56
+
28
57
### Syntax
29
58
30
59
Rules blocks can be simple text, written in YAML configuration files, or as Markdown (`.md`) files. They can have the following properties:
31
60
32
61
- `name` (**required**): A display name/title for the rule
33
62
- `rule` (**required**): The text content of the rule
63
+
- `schema` (**required**): The schema version of the YAML file (e.g., `v1`)
34
64
- `globs` (optional): When files are provided as context that match this glob pattern, the rule will be included. This can be either a single pattern (e.g., `"**/*.{ts,tsx}"`) or an array of patterns (e.g., `["src/**/*.ts", "tests/**/*.ts"]`).
35
65
36
-
```yaml title="config.yaml"
66
+
```yaml title=".config.yaml"
37
67
rules:
38
68
- Always annotate Python functions with their parameter and return types
39
69
@@ -52,33 +82,60 @@ rules:
52
82
TONE: concise
53
83
```
54
84
55
-
## Chat System Message
85
+
### `.continue/rules` folder
56
86
57
-
Continue includes a simple default system message for [Chat](../../chat/how-to-use-it.md) and [Agent](../../agent/how-to-use-it.md) requests, to help the model provide reliable codeblock formats in its output.
87
+
You can create project-specific rules by adding a `.continue/rules` folder to the root of your project and adding new rule files.
58
88
59
-
This can be viewed in the rules section of the toolbar (see above), or visit the source code [here](https://github.com/continuedev/continue/blob/main/core/llm/constructMessages.ts#L4)
89
+
```yaml title=".continue/rules/new-rule.yaml"
90
+
name: New rule
91
+
version: 0.0.1
92
+
schema: v1
93
+
rules:
94
+
- Always give concise responses
95
+
```
60
96
61
-
Advanced users can override this system message for a specific model if needed by using `chatOptions.baseSystemMessage`. See the [`config.yaml` reference](../../reference.md#models).
97
+
This is also done when selecting "Add Rule" in the Assistant settings. This will create a new folder in `.continue/rules` with a default file named `new-rule.yaml`.
62
98
63
-
## `.continuerules`
99
+
### Examples
64
100
65
-
You can create project-specific rules by adding a `.continuerules` file to the root of your project. This file is raw text and its full contents will be used as rules.
101
+
If you want concise answers:
66
102
67
-
### Simple Examples
103
+
```yaml title=".continue/rules/concise-rule.yaml"
104
+
rules:
105
+
- name: Always give concise answers
106
+
rule: |
107
+
Please provide concise answers. Don't explain obvious concepts.
108
+
You can assume that I am knowledgable about most programming topics.
109
+
```
68
110
69
-
- If you want concise answers:
111
+
If you want to ensure certain practices are followed, for example in React:
70
112
71
-
```title=.continuerules
72
-
Please provide concise answers. Don't explain obvious concepts. You can assume that I am knowledgable about most programming topics.
- use functional components instead of class components
119
+
- use hooks for state management
120
+
- define an interface for your component props
121
+
- use Tailwind CSS for styling
122
+
- modularize components into smaller, reusable pieces
73
123
```
74
124
75
-
- If you want to ensure certain practices are followed, for example in React:
125
+
### Chat System Message
76
126
77
-
```title=.continuerules
78
-
Whenever you are writing React code, make sure to
79
-
- use functional components instead of class components
80
-
- use hooks for state management
81
-
- define an interface for your component props
82
-
- use Tailwind CSS for styling
83
-
- modularize components into smaller, reusable pieces
84
-
```
127
+
Continue includes a simple default system message for [Chat](../../chat/how-to-use-it.md) and [Agent](../../agent/how-to-use-it.md) requests, to help the model provide reliable codeblock formats in its output.
128
+
129
+
This can be viewed in the rules section of the toolbar (see above), or visit the source code [here](https://github.com/continuedev/continue/blob/main/core/llm/constructMessages.ts#L4)
130
+
131
+
Advanced users can override this system message for a specific model if needed by using `chatOptions.baseSystemMessage`. See the [`config.yaml` reference](../../reference.md#models).
132
+
133
+
### `.continuerules`
134
+
135
+
:::warning
136
+
137
+
`.contninuerules`will be deprecated in a future release. Please use the `.continue/rules` folder instead.
138
+
139
+
:::
140
+
141
+
You can create project-specific rules by adding a `.continuerules` file to the root of your project. This file is raw text and its full contents will be used as rules.
0 commit comments