NAME
.clinerules/ — instruction file for Cline
SYNOPSIS
.clinerules/
~/Documents/Cline/Rules/
memory-bank/
METADATA
DESCRIPTION
.clinerules/ is the workspace rules directory for Cline (formerly Claude Dev), an autonomous AI coding agent that runs as a VS Code extension. Cline processes all .md and .txt files within this directory, combining them into unified system instructions. Files can use numeric prefixes (01-coding.md, 02-testing.md) for ordering.
Rules support optional YAML frontmatter with a paths field for conditional activation — rules only load when current files match the defined glob patterns (open tabs, edited files, message paths). Rules without frontmatter are always active. Invalid YAML triggers fail-open behavior where raw content is shown for debugging. Global rules in ~/Documents/Cline/Rules/ apply across all workspaces but are overridden by workspace rules.
Cline uniquely auto-detects rules from other AI tools (.cursorrules, .windsurfrules, AGENTS.md) and displays them in the Rules panel with individual toggles. It also features a memory bank system (memory-bank/ directory) with structured files — projectbrief.md, productContext.md, activeContext.md, systemPatterns.md, techContext.md, and progress.md — providing persistent project context across sessions since Cline's context resets between tasks.
Lower numbers load first. Higher-priority files override lower ones.
STRUCTURE
ANNOTATED EXAMPLE
1# .clinerules/01-general.md
2
3You are a senior full-stack engineer working on a production SaaS application.
4
5## Core Rules
6- Always check memory-bank/ for project context before starting work
7- After significant changes, update relevant memory-bank/ files
8- Write tests for all new functionality
9- Never modify database schemas without creating a migration
10
11## Tech Stack
12- Backend: Node.js + Express + TypeScript
13- Database: PostgreSQL with Prisma ORM
14- Frontend: React 18 + Vite
15- Testing: Jest + React Testing Library
16
17---
18
19## Example: Conditional rule (.clinerules/02-react.md)
20
21```
22---
23paths:
24 - "src/components/**"
25 - "*.tsx"
26---
27
28# React Component Conventions
29
30- Use functional components with TypeScript interfaces for props
31- Export components as named exports, never default
32- Use Tailwind CSS for all styling
33- Keep components under 150 lines; extract sub-components when larger
34```
35
36---
37
38## Memory Bank (memory-bank/)
39The following files maintain project context between sessions:
40
41- `memory-bank/projectbrief.md` — Core requirements and goals
42- `memory-bank/productContext.md` — Why the project exists, UX goals
43- `memory-bank/activeContext.md` — Current focus, recent changes, next steps
44- `memory-bank/systemPatterns.md` — Architecture and design patterns
45- `memory-bank/techContext.md` — Tech stack, setup, dependencies
46- `memory-bank/progress.md` — Status, milestones, known issues
SPECIAL DIRECTIVES
paths: [glob patterns]YAML frontmatter field. An array of glob patterns specifying which files trigger this rule. The rule activates if any pattern matches files in the current context (open tabs, edited files, message paths, pending operations). Examples: 'src/components/**', '*.test.ts', ['src/api/**', '*.spec.ts']. Empty array (paths: []) disables the rule entirely.
/newruleSlash command in Cline chat. Opens interactive rule creation flow to scaffold a new rule file in .clinerules/ with proper frontmatter.
/smolSlash command. Compresses conversation history to reduce token usage while preserving key decisions and context.
/newtaskSlash command. Creates a clean context with preserved decisions from the current session. Useful for starting fresh without losing progress.
COMMON MISTAKES
Cline now uses a directory-based approach. Place .md and .txt files inside .clinerules/ — they are all combined into unified instructions. Use numeric prefixes (01-coding.md, 02-testing.md) for ordering. Add YAML frontmatter with paths: for conditional activation based on file patterns.
Cline's Rules panel auto-detects and displays rule files from other AI tools. Each detected format gets an individual toggle so you can enable/disable them. This means cross-tool rule files can serve double duty.
Cline starts each task from scratch. The memory bank in memory-bank/ stores structured files: projectbrief.md (requirements), productContext.md (product goals), activeContext.md (current focus — updates most frequently), systemPatterns.md (architecture), techContext.md (stack details), and progress.md (milestones). Initialize with 'initialize memory bank' and update with 'update memory bank'.
The directory name is .clinerules as a single word with a leading dot. Common misspellings cause the rules to be silently ignored. The legacy single-file .clinerules also works but the directory is preferred.
Rules are injected into the AI context and consume tokens. Avoid lengthy explanations; link to external documentation instead. Be specific: 'Use camelCase for variables, PascalCase for classes' outperforms vague guidance like 'follow good naming conventions'.
If YAML frontmatter is malformed, Cline fails open — the raw content including the broken frontmatter is visible, which helps debugging. But the conditional activation will not work until the YAML is fixed.