CLINERULES(5)CLINERULES(5)

NAME

.clinerules/ — instruction file for Cline

SYNOPSIS

.clinerules/

~/Documents/Cline/Rules/

memory-bank/

METADATA

FORMATMarkdown
FILENAME.clinerules/
CASE SENSITIVENo
TOOLCline
ENCODINGUTF-8
GIT COMMITTEDYes
MAX SIZE5KB per rule file, 50KB total memory bank
SINCECline (formerly Claude Dev) 2024

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.

Load Order
1~/Documents/Cline/Rules/(global)
1memory-bank/(project)
2.clinerules/(project)

Lower numbers load first. Higher-priority files override lower ones.

STRUCTURE

├──YAML Frontmatter (optional)
Optional frontmatter block with a paths field for conditional activation. Rules with paths only activate when current files match the defined glob patterns. Rules without frontmatter are always active. Supports standard glob patterns: *, **, ?, [abc], {a,b}.
├──Role / Identity
Define the role Cline should assume (e.g., 'You are a senior backend engineer'). Sets the tone and expertise level.
├──Project Context
Overview of the project, its tech stack, and architecture. Especially important because Cline's context resets between tasks.
└──Rules / Constraints
Specific coding rules and constraints. These are injected as system instructions.

ANNOTATED EXAMPLE

.clinerules/
markdown
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]
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.

/newrule
/newrule

Slash command in Cline chat. Opens interactive rule creation flow to scaffold a new rule file in .clinerules/ with proper frontmatter.

/smol
/smol

Slash command. Compresses conversation history to reduce token usage while preserving key decisions and context.

/newtask
/newtask

Slash command. Creates a clean context with preserved decisions from the current session. Useful for starting fresh without losing progress.

COMMON MISTAKES

Gotchas
✗WRONG Using a single .clinerules file at the project root
✓RIGHT Use a .clinerules/ directory with multiple .md files for organized, conditionally-activated rules

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.

✗WRONG Not knowing Cline auto-detects other tools' rules
✓RIGHT Cline auto-detects .cursorrules, .windsurfrules, and AGENTS.md with individual toggles

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.

✗WRONG Expecting Cline to remember previous conversations automatically
✓RIGHT Use the memory bank pattern (memory-bank/) for persistent context across sessions

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'.

✗WRONG .cline-rules or cline.rules
✓RIGHT .clinerules/ (directory, no hyphens, no dots in the middle)

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.

✗WRONG Writing overly verbose rules
✓RIGHT Keep rules specific and scannable — they consume context tokens

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'.

✗WRONG Invalid YAML frontmatter silently breaking rules
✓RIGHT Invalid YAML triggers fail-open: raw content is shown for debugging

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.

USED BY

SIMILAR FILES

CLAUDE.mdClaude Memory File
.cursorrulesCursor Rules (Legacy)
.cursor/rules/*.mdcCursor Rules (MDC Format)
.windsurfrulesWindsurf Rules (Legacy)

COMPARISONS

agentconfig.ing2026-03-16CLINERULES(5)