Skip to main content

Rule Priority System

Manage project-specific AI guidelines efficiently. Caret's rule priority system automatically blocks duplication across multiple rule files to save tokens and prevents configuration conflicts with clear priorities.

What is the Rules System?

Place a rules file in your project root, and AI automatically reads and follows it:

my-project/
├── .caretrules # Caret-exclusive rules (Priority 1)
├── .clinerules # Cline-compatible rules (Priority 2)
├── .cursorrules # Cursor-compatible rules (Priority 3)
└── src/

Effect: AI automatically follows your project's coding style, naming conventions, and architecture patterns.

Caret vs Cline vs Cursor

ItemClineCursorCaret
.clinerules✅ Supported❌ Not supported✅ Supported
.cursorrules❌ Not supported✅ Supported✅ Supported
.caretrules❌ Not supported❌ Not supported✅ Supported
Priority System❌ None❌ None✅ Yes
Multi-file Merging❌ None❌ None✅ Supported

Supported File Formats

Caret-exclusive rules file with highest priority:

# Project Rules

## Coding Style
- Use TypeScript strict mode
- Function components only
- Use Tailwind CSS

## Naming
- Components: PascalCase
- Functions: camelCase
- Constants: UPPER_SNAKE_CASE

## Prohibited
- No class components
- No any type
- No console.log commits

.clinerules

Compatible when migrating from Cline:

Use TypeScript for all files
Follow React Hooks best practices

.cursorrules

Compatible when migrating from Cursor:

Always use arrow functions
Prefer const over let

Core of Priority System: Token Savings

The most important difference between Caret's rule priority system and other AI coding assistants is duplication prevention.

Problem: Duplicate Loading in Other Tools

Tools like Cline and Cursor load .clinerules, .cursorrules, and .windsurfrules all simultaneously. This causes these problems:

Token Waste: Even if all three files have similar content, everything is sent to AI, consuming thousands of unnecessary tokens on every request.

Configuration Conflicts: When each file has different rules, it's unclear which takes priority, confusing the AI.

Prompt Bloat: As multiple rule files accumulate, prompts become excessively long, reducing space for important code context.

Solution: Caret's Single-Select Approach

Caret selects and loads only one even when multiple rule files exist. This follows clear priority:

Priority 1: .caretrules
Priority 2: .clinerules
Priority 3: .cursorrules
Priority 4: .windsurfrules

Automatic Operation: If a .caretrules file exists, all other rule files are automatically disabled. If .caretrules doesn't exist, it looks for .clinerules, then .cursorrules, and so on.

Actual Behavior Example:

Project folder:
├── .caretrules ← Only this is read
├── .clinerules ← Automatically disabled
└── .cursorrules ← Automatically disabled

After deleting .caretrules:
├── .clinerules ← Now this is read
└── .cursorrules ← Automatically disabled

This approach can reduce token usage by up to 70% and fundamentally prevents configuration conflicts.

Practical Usage Examples

Example 1: React Project

# .caretrules

## Tech Stack
- React 18 + TypeScript
- Vite build
- Tailwind CSS + shadcn/ui

## Component Writing Rules
- All components as functions
- Define Props types with interface
- Filename matches component name (PascalCase.tsx)

## Style Rules
- Tailwind utilities first
- Minimize custom CSS
- Dark mode required

## State Management
- Local state: useState
- Global state: Zustand
- Server state: TanStack Query

## Prohibited
- No styled-components
- No Redux
- No class components

Example 2: NestJS Backend

# .caretrules

## Architecture
- Controller → Service → Repository pattern
- Mandatory DTO usage
- Swagger documentation for all endpoints

## Naming
- Controller: `*.controller.ts`
- Service: `*.service.ts`
- DTO: `*.dto.ts`
- Entity: `*.entity.ts`

## Error Handling
- Use HttpException
- Define custom error classes
- Log all errors

## Security
- JWT authentication required
- Apply rate limiting
- Mandatory input validation

Example 3: Multilingual Project

# .caretrules

## Language Rules
- Code: English
- Comments: Korean
- Commit messages: Korean
- Documentation: Korean

## Code Example
```typescript
// ✅ Correct example
function calculateTotal(items: Item[]): number {
// 전체 금액 계산
return items.reduce((sum, item) => sum + item.price, 0)
}

// ❌ Wrong example
function 합계계산(items: Item[]): number {
// Calculate total
return items.reduce((sum, item) => sum + item.price, 0)
}

## Verify Rules Activation

### Check in Settings

1. Open settings (⚙️)
2. **General** tab → **Rules** section
3. Verify "Project rules activated"

### Status Display

Rules activation displayed in chat header:

🎯 Caret | Agent Mode | 📋 Rules Active


### Manual Deactivation

Ignore rules for specific tasks only:

Specify in prompt: "Ignore rules and quickly create prototype"


## Advanced Features

### Conditional Rules

Apply different rules per directory:

```markdown
# .caretrules

## Default Rules
- TypeScript strict

## /admin Directory
- Additional security validation required
- Admin permission check

## /public Directory
- Simplified code
- Fast loading priority

Team-Specific Rules

Subdivide with .caretrules/ directory:

.caretrules/
├── frontend.md # Frontend team rules
├── backend.md # Backend team rules
└── common.md # Common rules

External Rules Reference

# .caretrules

## Style Guide
- Follow Airbnb JavaScript Style Guide
- Refer to Google TypeScript Style Guide

## Reference Documentation
- https://github.com/airbnb/javascript
- https://google.github.io/styleguide/tsguide.html

Rules Debugging

When AI Doesn't Follow Rules

Check Items:

  1. Is filename correct? (.caretrules not caretrules)
  2. Located in project root?
  3. Are rules unambiguous?
  4. Is there another rule file with higher priority?

Solution:

"Re-read and apply project rules"

Verify Rule Priority

"Show me the currently applied rules"
→ AI displays read rule file and priority

Rules Templates

React + TypeScript

# Project Rules

- TypeScript strict mode
- Function components only
- Props interface required
- Use Tailwind CSS
- Test coverage 80%+

Node.js API

# Project Rules

- Express + TypeScript
- RESTful API design
- Joi validation
- Winston logging
- Jest unit tests

Full-Stack Monorepo

# Project Rules

## Common
- TypeScript
- ESLint + Prettier
- Conventional Commits

## /apps/web
- Next.js 14
- App Router
- Tailwind CSS

## /apps/api
- NestJS
- Prisma ORM
- PostgreSQL

Migration Guide

Cline → Caret

Keep existing .clinerules and add .caretrules:

# Copy existing rules
cp .clinerules .caretrules

# Edit .caretrules to add Caret features

Cursor → Caret

Convert .cursorrules to .caretrules:

mv .cursorrules .caretrules
# Adjust format if needed

Frequently Asked Questions

Q: Is there a rule file size limit? A: Recommended under 10KB. If too long, AI may not remember all content.

Q: Are rule modifications reflected immediately? A: Yes, applied immediately from the next message.

Q: What if multiple rule files conflict? A: Priority applied in order: .caretrules.clinerules.cursorrules.

Q: Can I include sensitive information in rules? A: No. Rule files are sent to AI, so don't include API keys, etc.

Next Steps


The integrated rules system is exclusive to Caret. Cline only supports .clinerules, and Cursor only supports .cursorrules.