What this thread does
Do first: Add a focused Markdown rule to project-root .clinerules/ or .cline/rules/; use YAML paths frontmatter when it should apply only to matching files.
Short answer
Cline reads rules as persistent context across conversations. Both workspace directories are supported by VS Code, Desktop and CLI; Cline combines files from both, so do not duplicate them. Workspace rules win conflicts with global rules.
What to do
| Item | Exact value / action |
|---|---|
| Rule directories | Project-root .clinerules/ and .cline/rules/ |
| UI creation | Scale icon at the bottom of the Cline panel, left of model selector → New rule file…; creates a .md file in .clinerules/ |
| Interactive creation | /newrule |
| Other detected files | .cursorrules, .windsurfrules, AGENTS.md; individually toggle detected rules in the Rules panel |
| Organization | One concern per file; sample names coding.md, testing.md, architecture.md; numeric prefix 01-coding.md is optional |
| Conditional key | paths: array of glob patterns; YAML frontmatter enclosed by --- |
| Example scopes | src/components/, src/hooks/; any matching pattern and any matching context file activates the rule |
| No frontmatter | Always active |
| Empty array | paths: [] never activates |
| Invalid YAML | Fails open: the rule activates with raw content visible |
| Toggle | Off disables a conditional rule even if files match; on permits condition-based activation |
| Current context | Paths in the message, open tabs, visible files, edited files and pending file operations |
For a conditional rule, begin with this documented frontmatter, then add your Markdown instructions after it:
---
paths:
- "src/components/**"
- "src/hooks/**"
---
| Glob | Meaning / example |
|---|---|
* | Any characters except / |
** | Any characters including /, recursively |
? | One character |
[abc] | One character in the brackets |
{a,b} | Either pattern |
src/**/*.ts | TypeScript files under src/ |
*.md | Markdown files in the root only |
**/*.test.ts | Matching test files anywhere |
packages/{web,api}/** | Files in either named package |
src/components/*.tsx | Direct TSX children, excluding nested directories |
An activation notification can read Conditional rules applied: workspace:frontend-rules.md. Matching can start on the first message or later as context changes. Name file paths explicitly in prompts when activation matters.
Limits and open questions
Only paths is documented as a supported conditional. Rules consume context tokens; keep them short, specific and focused. If a rule fails to activate, inspect the toggle, matching paths and YAML delimiters. If it appears unexpectedly, inspect open tabs and recursive ** patterns. Invalid YAML broadens activation rather than disabling the file.
The page provides no release number, context-token budget or deterministic ordering for conflicting workspace rules.
Not for: Cursor .cursorrules authoring or Gemini CLI GEMINI.md.
Sources
- Cline Rules documentation, Cline.
Checked
2026-11-16; read Cline Rules, supported rule types, workspace precedence, creation, conditional glob syntax, context inputs and troubleshooting; no command was run.
Started from a post by @Cline, packaged by the editor. Original post