updates to rules.mdx

This commit is contained in:
Nate 2025-06-22 22:58:16 -07:00
parent d2a0a6e722
commit e0dda678d7

View file

@ -55,18 +55,25 @@ For example, you can say "Create a rule for this", and a rule will be created fo
Rules can also 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.
Explore available rules [here](https://hub.continue.dev), or [create your own](https://hub.continue.dev/new?type=block&blockType=rules) in the Hub.
### Syntax
:::info
Rules were originally defined in YAML format (demonstrated below), but we introduced Markdown for easier editing. While both are still supported, we recommend Markdown.
:::
Rules blocks can be simple text, written in YAML configuration files, or as Markdown (`.md`) files. They can have the following properties:
- `name` (**required** for YAML): A display name/title for the rule
- `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"]`).
- `description` (optional): A description for the rule. Agents may read this description when `alwaysApply` is false to determine whether the rule should be pulled into context.
- `alwaysApply`: true - Always include the rule, regardless of file context
- `alwaysApply`: false - Included if globs exist AND match file context, or the agent decides to pull the rule into context based on it's description
- `alwaysApply`: undefined - Default behavior: include if no globs exist OR globs exist and match
- `alwaysApply`: Determines whether the rule is always included. Behavior is described below:
- `true`: Always included, regardless of file context
- `false`: Included if globs exist AND match file context, or the agent decides to pull the rule into context based on it's description
- `undefined` (default behavior): Included if no globs exist OR globs exist and match
<Tabs groupId="rules-example">
<TabItem value="md" label="Markdown">
@ -96,10 +103,13 @@ Rules blocks can be simple text, written in YAML configuration files, or as Mark
```yaml title="doc-standards.yaml"
name: Documentation Standards
globs: docs/**/*.{md,mdx}
alwaysApply: false
version: 1.0.0
schema: v1
rules:
- name: Documentation Standards
globs: docs/**/*.{md,mdx}
alwaysApply: false
rule: >
- Follow Docusaurus documentation standards
- Include YAML frontmatter with title, description, and keywords
@ -163,7 +173,7 @@ Whenever you are writing React code, make sure to
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.
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)
This can be viewed in the rules section of the toolbar (see above), or in the source code [here](https://github.com/continuedev/continue/blob/main/core/llm/constructMessages.ts#L4).
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).