Changesets · Branches · Tags · Compare
| Changeset | 1edb336bdb829c7609ffd435d364a3343978ce57488596258e301ce187e9a073 |
|---|---|
| Author | Tomasz Stefaniak <tomasz.p.stefaniak@gmail.com> · 2025-06-11 16:31 -07:00 |
| Committer | GitHub <noreply@github.com> · 2025-06-11 16:31 -07:00 |
| Parents | fe4ed82781c7, be26cc4523c9 |
7 files changed
modified docs/docs/agent/how-to-customize.md +1 −1
| @@ -9,7 +9,7 @@ | ||
| 9 | 9 | |
| 10 | 10 | Adding Rules can be done in your assistant locally or in the Hub. |
| 11 | 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. | |
| 12 | +[Explore Rules on the Hub](https://hub.continue.dev/explore/rules) and see the [Rules deep dive](../customize/deep-dives/rules.mdx) for more details and tips on creating rules. | |
| 13 | 13 | |
| 14 | 14 | ## Add MCP tools |
| 15 | 15 |
modified docs/docs/blocks/rules.md +1 −1
| @@ -22,4 +22,4 @@ | ||
| 22 | 22 | |
| 23 | 23 | ## Learn More |
| 24 | 24 | |
| 25 | -Learn more in the [rules deep dive](../customize/deep-dives/rules.md), and view [`rules`](../reference.md#rules) in the YAML Reference for more details. | |
| 25 | +Learn more in the [rules deep dive](../customize/deep-dives/rules.mdx), and view [`rules`](../reference.md#rules) in the YAML Reference for more details. |
modified docs/docs/chat/how-to-customize.md +1 −1
| @@ -7,7 +7,7 @@ | ||
| 7 | 7 | |
| 8 | 8 | There are a number of different ways to customize Chat: |
| 9 | 9 | |
| 10 | -- You can add a [`rules` block](../hub/blocks/block-types.md#rules) to your assistant to give the model persistent instructions through the system prompt. See the [rules deep dive](../customize/deep-dives/rules.md) for more information. | |
| 10 | +- You can add a [`rules` block](../hub/blocks/block-types.md#rules) to your assistant to give the model persistent instructions through the system prompt. See the [rules deep dive](../customize/deep-dives/rules.mdx) for more information. | |
| 11 | 11 | - You can configure [`@Codebase`](../customize/deep-dives/codebase.mdx) |
| 12 | 12 | - You can configure [`@Docs`](../customize/deep-dives/docs.mdx) |
| 13 | 13 | - You can [build your own context provider](../customize/tutorials/build-your-own-context-provider.mdx) |
deleted docs/docs/customize/deep-dives/rules.md +0 −141
| @@ -1,141 +0,0 @@ | ||
| 1 | ---- | |
| 2 | -description: Rules are used to provide instructions to the model for Chat, Edit, and Agent requests. | |
| 3 | -keywords: [rules, .continuerules, system, prompt, message] | |
| 4 | ---- | |
| 5 | - | |
| 6 | -# Rules | |
| 7 | - | |
| 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 | - | |
| 10 | -:::info Rules are not included in [autocomplete](./autocomplete.mdx) or [apply](../model-roles/apply.mdx). | |
| 11 | -::: | |
| 12 | - | |
| 13 | -## How it works | |
| 14 | - | |
| 15 | -You can view the current rules by clicking the pen icon above the main toolbar: | |
| 16 | - | |
| 17 | - | |
| 18 | - | |
| 19 | -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)). | |
| 20 | - | |
| 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 | - | |
| 40 | - | |
| 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 | - | |
| 46 | - | |
| 47 | -:::info Automatically create local rule blocks | |
| 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. | |
| 49 | - | |
| 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. | |
| 51 | -::: | |
| 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 | - | |
| 57 | -### Syntax | |
| 58 | - | |
| 59 | -Rules blocks can be simple text, written in YAML configuration files, or as Markdown (`.md`) files. They can have the following properties: | |
| 60 | - | |
| 61 | -- `name` (**required**): A display name/title for the rule | |
| 62 | -- `rule` (**required**): The text content of the rule | |
| 63 | -- `schema` (**required**): The schema version of the YAML file (e.g., `v1`) | |
| 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"]`). | |
| 65 | - | |
| 66 | -```yaml title=".config.yaml" | |
| 67 | -rules: | |
| 68 | - - Always annotate Python functions with their parameter and return types | |
| 69 | - | |
| 70 | - - name: TypeScript best practices | |
| 71 | - rule: Always use TypeScript interfaces to define shape of objects. Use type aliases sparingly. | |
| 72 | - globs: "**/*.{ts,tsx}" | |
| 73 | - | |
| 74 | - - name: TypeScript test patterns | |
| 75 | - rule: In TypeScript tests, use Jest's describe/it pattern and follow best practices for mocking. | |
| 76 | - globs: | |
| 77 | - - "src/**/*.test.ts" | |
| 78 | - - "tests/**/*.ts" | |
| 79 | - | |
| 80 | - - uses: myprofile/my-mood-setter | |
| 81 | - with: | |
| 82 | - TONE: concise | |
| 83 | -``` | |
| 84 | - | |
| 85 | -### `.continue/rules` folder | |
| 86 | - | |
| 87 | -You can create project-specific rules by adding a `.continue/rules` folder to the root of your project and adding new rule files. | |
| 88 | - | |
| 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 | -``` | |
| 96 | - | |
| 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`. | |
| 98 | - | |
| 99 | -### Examples | |
| 100 | - | |
| 101 | -If you want concise answers: | |
| 102 | - | |
| 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 | -``` | |
| 110 | - | |
| 111 | -If you want to ensure certain practices are followed, for example in React: | |
| 112 | - | |
| 113 | -```yaml title=".continue/rules/functional-rule.yaml" | |
| 114 | -rules: | |
| 115 | - - name: Always use functional components | |
| 116 | - rule: | | |
| 117 | - Whenever you are writing React code, make sure to | |
| 118 | - - 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 | |
| 123 | -``` | |
| 124 | - | |
| 125 | -### Chat System Message | |
| 126 | - | |
| 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. |
added docs/docs/customize/deep-dives/rules.mdx +177 −0
| @@ -0,0 +1,177 @@ | ||
| 1 | +--- | |
| 2 | +description: Rules are used to provide instructions to the model for Chat, Edit, and Agent requests. | |
| 3 | +keywords: [rules, .continuerules, system, prompt, message] | |
| 4 | +--- | |
| 5 | + | |
| 6 | +import TabItem from "@theme/TabItem"; | |
| 7 | +import Tabs from "@theme/Tabs"; | |
| 8 | + | |
| 9 | +# Rules | |
| 10 | + | |
| 11 | +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. | |
| 12 | + | |
| 13 | +:::info Rules are not included in [autocomplete](./autocomplete.mdx) or [apply](../model-roles/apply.mdx). | |
| 14 | +::: | |
| 15 | + | |
| 16 | +## How it works | |
| 17 | + | |
| 18 | +You can view the current rules by clicking the pen icon above the main toolbar: | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | +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)). | |
| 23 | + | |
| 24 | +## Quick Start | |
| 25 | + | |
| 26 | +Below is a quick example of setting up a new rule file: | |
| 27 | + | |
| 28 | +1. Create a folder called `.continue/rules` at the top level of your workspace | |
| 29 | +2. Add a file called `pirates-rule.md` to this folder. | |
| 30 | +3. Write the following contents to `pirates-rule.md` and save. | |
| 31 | + | |
| 32 | +```md title=".continue/rules/pirates-rule.md" | |
| 33 | +--- | |
| 34 | +name: Pirate rule | |
| 35 | +--- | |
| 36 | + | |
| 37 | +- Talk like a pirate. | |
| 38 | +``` | |
| 39 | + | |
| 40 | +Now test your rules by asking a question about a file in chat. | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | +## Creating `rules` blocks | |
| 45 | + | |
| 46 | +Rules can be added locally using the "Add Rules" button while viewing the Local Assistant's rules. | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | +:::info Automatically create local rule blocks | |
| 51 | +When in Agent mode, you can prompt the agent to create a rule for you using the `builtin_create_rule_block` tool if enabled. | |
| 52 | + | |
| 53 | +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. | |
| 54 | +::: | |
| 55 | + | |
| 56 | +Rules can also be added to an Assistant on the Continue Hub. | |
| 57 | + | |
| 58 | +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. | |
| 59 | + | |
| 60 | +### Syntax | |
| 61 | + | |
| 62 | +Rules blocks can be simple text, written in YAML configuration files, or as Markdown (`.md`) files. They can have the following properties: | |
| 63 | + | |
| 64 | +- `name` (**required** for YAML): A display name/title for the rule | |
| 65 | +- `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"]`). | |
| 66 | +- `alwaysApply`: true - Always include the rule, regardless of file context | |
| 67 | +- `alwaysApply`: false - Only include if globs exist AND match file context | |
| 68 | +- `alwaysApply`: undefined - Default behavior: include if no globs exist OR globs exist and match | |
| 69 | + | |
| 70 | +<Tabs groupId="rules-example"> | |
| 71 | + <TabItem value="md" label="Markdown"> | |
| 72 | + ```yaml title="doc-standards.md" | |
| 73 | + --- | |
| 74 | + name: Documentation Standards | |
| 75 | + globs: docs/**/*.{md,mdx} | |
| 76 | + alwaysApply: false | |
| 77 | + description: Standards for writing and maintaining Continue Docs | |
| 78 | + --- | |
| 79 | + | |
| 80 | +# Continue Docs Standards | |
| 81 | + | |
| 82 | +- Follow Docusaurus documentation standards | |
| 83 | +- Include YAML frontmatter with title, description, and keywords | |
| 84 | +- Use consistent heading hierarchy starting with h2 (##) | |
| 85 | +- Include relevant Admonition components for tips, warnings, and info | |
| 86 | +- Use descriptive alt text for images | |
| 87 | +- Include cross-references to related documentation | |
| 88 | +- Reference other docs with relative paths | |
| 89 | +- Keep paragraphs concise and scannable | |
| 90 | +- Use code blocks with appropriate language tags | |
| 91 | + | |
| 92 | + ```` | |
| 93 | + </TabItem> | |
| 94 | + <TabItem value="yaml" label="YAML"> | |
| 95 | + | |
| 96 | + ```yaml title="doc-standards.yaml" | |
| 97 | + name: Documentation Standards | |
| 98 | + globs: docs/**/*.{md,mdx} | |
| 99 | + alwaysApply: false | |
| 100 | + rules: | |
| 101 | + - name: Documentation Standards | |
| 102 | + rule: > | |
| 103 | + - Follow Docusaurus documentation standards | |
| 104 | + - Include YAML frontmatter with title, description, and keywords | |
| 105 | + - Use consistent heading hierarchy starting with h2 (##) | |
| 106 | + - Include relevant Admonition components for tips, warnings, and info | |
| 107 | + - Use descriptive alt text for images | |
| 108 | + - Include cross-references to related documentation | |
| 109 | + - Reference other docs with relative paths | |
| 110 | + - Keep paragraphs concise and scannable | |
| 111 | + - Use code blocks with appropriate language tags | |
| 112 | + ```` | |
| 113 | + | |
| 114 | + </TabItem> | |
| 115 | + | |
| 116 | + </Tabs> | |
| 117 | + | |
| 118 | +### `.continue/rules` folder | |
| 119 | + | |
| 120 | +You can create project-specific rules by adding a `.continue/rules` folder to the root of your project and adding new rule files. | |
| 121 | + | |
| 122 | +```md title=".continue/rules/new-rule.md" | |
| 123 | +--- | |
| 124 | +name: New rule | |
| 125 | +--- | |
| 126 | + | |
| 127 | +Always give concise responses | |
| 128 | +``` | |
| 129 | + | |
| 130 | +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.md`. | |
| 131 | + | |
| 132 | +### Examples | |
| 133 | + | |
| 134 | +If you want concise answers: | |
| 135 | + | |
| 136 | +```md title=".continue/rules/concise-rule.md" | |
| 137 | +--- | |
| 138 | +name: Always give concise answers | |
| 139 | +--- | |
| 140 | + | |
| 141 | +Please provide concise answers. Don't explain obvious concepts. | |
| 142 | +You can assume that I am knowledgable about most programming topics. | |
| 143 | +``` | |
| 144 | + | |
| 145 | +If you want to ensure certain practices are followed, for example in React: | |
| 146 | + | |
| 147 | +```md title=".continue/rules/functional-rule.md" | |
| 148 | +--- | |
| 149 | +name: Always use functional components | |
| 150 | +--- | |
| 151 | + | |
| 152 | +Whenever you are writing React code, make sure to | |
| 153 | + | |
| 154 | +- use functional components instead of class components | |
| 155 | +- use hooks for state management | |
| 156 | +- define an interface for your component props | |
| 157 | +- use Tailwind CSS for styling | |
| 158 | +- modularize components into smaller, reusable pieces | |
| 159 | +``` | |
| 160 | + | |
| 161 | +### Chat System Message | |
| 162 | + | |
| 163 | +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. | |
| 164 | + | |
| 165 | +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) | |
| 166 | + | |
| 167 | +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). | |
| 168 | + | |
| 169 | +### `.continuerules` | |
| 170 | + | |
| 171 | +:::warning | |
| 172 | + | |
| 173 | +`.contninuerules` will be deprecated in a future release. Please use the `.continue/rules` folder instead. | |
| 174 | + | |
| 175 | +::: | |
| 176 | + | |
| 177 | +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. |
modified docs/docs/hub/blocks/block-types.md +1 −1
| @@ -35,7 +35,7 @@ | ||
| 35 | 35 | |
| 36 | 36 | Rules blocks are instructions that your custom AI code assistant will always keep in mind - the contents of rules are inserted into the system message for all Chat requests. [Explore rules](https://hub.continue.dev/explore/rules) on the hub. |
| 37 | 37 | |
| 38 | -Learn more in the [rules deep dive](../../customize/deep-dives/rules.md), and view [`rules`](../../reference.md#rules) in the YAML Reference for more details. | |
| 38 | +Learn more in the [rules deep dive](../../customize/deep-dives/rules.mdx), and view [`rules`](../../reference.md#rules) in the YAML Reference for more details. | |
| 39 | 39 | |
| 40 | 40 | ## Prompts |
| 41 | 41 |
modified docs/docs/reference.md +1 −1
| @@ -296,7 +296,7 @@ | ||
| 296 | 296 | |
| 297 | 297 | List of rules that the LLM should follow. These are concatenated into the system message for |
| 298 | 298 | all [Chat](./chat/how-to-use-it.md), [Edit](./edit/how-to-use-it.md), and [Agent](./agent/how-to-use-it.md) requests. |
| 299 | -See the [rules deep dive](./customize/deep-dives/rules.md) for details. | |
| 299 | +See the [rules deep dive](./customize/deep-dives/rules.mdx) for details. | |
| 300 | 300 | |
| 301 | 301 | Explicit rules can either be simple text or an object with the following properties: |
| 302 | 302 |