docs/customize/deep-dives/rules.mdx
Rules provide instructions to the model for Agent mode, Chat, and Edit requests.
<Info> Rules are not included in [autocomplete](./autocomplete) or [apply](../model-roles/apply). </Info>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).
Continue supports two types of rules with different behaviors:
<Columns cols={2}> <Card title="Local Rules" icon="folder"> - **Location**: `.continue/rules` folder in your workspace - **Visibility**: Automatically visible when using Hub configs - **Creation**: Add rules button in VSCode or manual file creation - **File Management**: Creates actual `.md` files you can edit directly </Card> <Card title="Hub Rules" icon="cloud"> - **Location**: Stored on Continue Mission Control, referenced in config.yaml - **Visibility**: Only appear when referenced in assistant configuration - **Creation**: Created directly on Hub or copied from local rules - **File Management**: No local files created, managed through Hub interface </Card> </Columns>When using Continue, rules are loaded in this order:
uses: in config.yaml).continue/rules folder)~/.continue/rules folder)Below is a quick example of setting up a new rule file:
.continue/rules at the top level of your workspacepirates-rule.md to this folder.pirates-rule.md and save.---
name: Pirate rule
---
- Talk like a pirate.
Now test your rules by asking a question about a file in chat.
Rules can be added locally using the "Add Rules" button.
<Info> **Automatically create local rules**: When in Agent mode, you can prompt the agent to create a rule for you using the `create_rule_block` tool if enabled.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.
</Info>
Rules can also be created and managed on the Continue Mission Control:
.continue/rules files to create Hub rulesconfig.yaml:
rules:
- uses: username/my-hub-rule
.continue/rules/rule-name.md fileRules 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 ruleglobs (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"]).regex (optional): When files are provided as context and their content matches this regex pattern, the rule will be included. This can be either a single pattern (e.g., "^import .* from '.*';$") or an array of patterns (e.g., ["^import .* from '.*';$", "^export .* from '.*';$"]).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: Determines whether the rule is always included. Behavior is described below:
true: Always included, regardless of file contextfalse: Included if globs exist AND match file context, or the agent decides to pull the rule into context based on its descriptionundefined (default behavior): Included if no globs exist OR globs exist and match</Tab>
<Tab title="YAML">
```yaml title="doc-standards.yaml"
name: Documentation Standards
version: 1.0.0
schema: v1
rules:
- name: Documentation Standards
globs: docs/**/*.{md,mdx}
alwaysApply: false
rule: >
- Follow Mintlify documentation standards
- Include YAML frontmatter with title, description, and keywords
- Use consistent heading hierarchy starting with h2 (##)
- Include relevant Admonition components for tips, warnings, and info
- Use descriptive alt text for images
- Include cross-references to related documentation
- Reference other docs with relative paths
- Keep paragraphs concise and scannable
- Use code blocks with appropriate language tags
You can create project-specific rules by adding a .continue/rules folder to the root of your project and adding new rule files.
Rules files are loaded in lexicographical order, so you can prefix them with numbers to control the order in which they are applied. For example: 01-general.md, 02-frontend.md, 03-backend.md.
---
name: TypeScript Best Practices
globs: ["**/*.ts", "**/*.tsx"]
---
# TypeScript Rules
- Always use TypeScript interfaces for object shapes
- Use type aliases sparingly, prefer interfaces
- Include proper JSDoc comments for public APIs
- Use strict null checks
- Prefer readonly arrays and properties where possible
- modularize components into smaller, reusable pieces
Problem: You created rules in the Hub but don't see them in VSCode, or vice versa.
Solution:
uses: syntaxProblem: When you click "Edit" on a rule in VSCode, it tries to open the Hub even though the rule is local, or shows an incorrect URL.
Root Cause: This happens when you have a mix of local and Hub rules, and Continue can't properly determine where each rule originates.
Workaround:
.continue/rules/ folder and edit the .md fileProblem: Your rules exist but don't show up in the rules toolbar.
Check These:
.continue/rules/ (not .continue/rule/).md files with proper YAML frontmatterconfig.yamlContinue includes a simple default system message for Agent mode and Chat 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 in the source code here.
Advanced users can override this system message for a specific model if needed by using chatOptions.baseSystemMessage. See the config.yaml reference.