Context Augmentation & Reinforcement Layer - Dynamic rules for Claude Code
npm install carl-corebash
npx carl-core
`
Works on Mac, Windows, and Linux.
!CARL Install
"Rules that load when relevant, disappear when not."
Why CARL · Getting Started · How It Works · Core Concepts · With PAUL
) for on-demand modes
The result: Claude remembers how you work without wasting context on rules you don't need right now.
---
Who This Is For
Claude Code users who want persistent preferences without bloated prompts.
You've figured out what works for you — coding style, response format, workflow patterns. CARL makes those preferences stick:
- Define rules once, use them forever
- Rules activate automatically based on context
- Override or extend per-project as needed
- No manual prompt engineering each session
If you find yourself repeating instructions to Claude, CARL is for you.
---
Getting Started
`bash
npx carl-core
`
The installer prompts you to choose:
1. Global — Rules apply to all Claude Code projects (~/.claude + ~/.carl)
2. Local — Rules apply to current project only (./.claude + ./.carl)
It also asks whether to add the CARL integration block to your CLAUDE.md.
Restart Claude Code after installation.
$3
After install, type *carl in any prompt:
`
*carl
`
This activates CARL Help Mode — an interactive guide that can:
- Explain how CARL works
- Help you create custom domains
- Show your current configuration
- Guide you through rule syntax
*carl is your entry point for learning and managing CARL.
$3
`bash
npx carl-core@latest
`
---
How It Works
`
You type: "help me fix this bug"
│
▼
┌───────────────────────┐
│ CARL Hook Scans │
│ Your Prompt │
└───────────────────────┘
│
▼
┌───────────────────────┐
│ Matches "fix bug" │
│ → DEVELOPMENT domain │
└───────────────────────┘
│
▼
┌───────────────────────┐
│ Injects Your Rules │
│ Into Context │
└───────────────────────┘
│
▼
Claude responds with your
coding preferences baked in
`
The hook runs on every interaction, reads your .carl/manifest, and injects only the rules that match your current task.
$3
`
.carl/
├── manifest # Domain registry (states + keywords)
├── global # Universal rules (always loaded)
├── commands # Star-command definitions
├── context # Context-aware rules (fresh/moderate/depleted)
└── {custom-domain} # Your domain files
`
---
Core Concepts
$3
A domain is a collection of related rules. Create domains for different contexts:
| Example Domain | Trigger Keywords | What It Does |
|----------------|------------------|--------------|
| DEVELOPMENT | "fix bug", "write code" | Your coding preferences |
| CONTENT | "write script", "youtube" | Your content creation style |
| CLIENTS | "client project", "deliverable" | Project-specific rules |
When your prompt matches a domain's keywords, its rules load automatically.
$3
Explicit triggers using *commandname syntax:
`
*brief explain recursion
`
Unlike domains (automatic), star-commands are intentional. Use them for workflow modes:
- Response formatting (concise vs detailed)
- Task modes (planning vs execution)
- Review and analysis patterns
Create your own star-commands for frequently-used behaviors.
$3
Controls which domains exist and when they activate:
`
DEVELOPMENT_STATE=active
DEVELOPMENT_RECALL=fix bug, write code, implement
DEVELOPMENT_EXCLUDE=
DEVELOPMENT_ALWAYS_ON=false
`
| Field | Purpose |
|-------|---------|
| STATE | active or inactive |
| RECALL | Keywords that trigger loading |
| EXCLUDE | Keywords that prevent loading |
| ALWAYS_ON | Load every session if true |
$3
Simple KEY=VALUE in domain files:
`
DEVELOPMENT_RULE_0=Code over explanation - show, don't tell
DEVELOPMENT_RULE_1=Prefer editing existing files over creating new
DEVELOPMENT_RULE_2=Run tests after implementation changes
`
Pattern: {DOMAIN}_RULE_{N}=instruction
---
Configuration
$3
| Location | Scope | Use Case |
|----------|-------|----------|
| ~/.carl/ | All projects | Universal preferences |
| ./.carl/ | Current project | Project-specific rules |
Local rules override global when both exist.
$3
1. Create file .carl/myworkflow (lowercase)
2. Add rules with uppercase prefix:
`
MYWORKFLOW_RULE_0=First instruction
MYWORKFLOW_RULE_1=Second instruction
`
3. Register in manifest:
`
MYWORKFLOW_STATE=active
MYWORKFLOW_RECALL=keyword1, keyword2
`
Or use *carl and say "help me create a domain" for guided setup.
---
CARL + PAUL
CARL has a companion: PAUL (Plan-Apply-Unify Loop).
| Tool | Purpose |
|------|---------|
| CARL | Dynamic rule injection — how Claude behaves |
| PAUL | Structured development workflow — how work flows |
They complement each other:
- CARL loads PAUL rules when you're in a .paul/ project
- PAUL enforces loop integrity (plan → apply → unify)
- CARL keeps PAUL rules out of context when not needed
Without CARL: PAUL rules would bloat every session.
Without PAUL: Complex projects lack structure.
Together: lean context + reliable workflow.
---
Troubleshooting
Rules not loading?
1. Check manifest has STATE=active
2. Verify recall keywords match your prompt
3. Ensure hook is configured in ~/.claude/settings.json
Too many rules loading?
1. Make recall keywords more specific
2. Use EXCLUDE to block unwanted matches
3. Split broad domains into focused ones
Need help?
- Type *carl for interactive guidance
- Check .carl/manifest for current configuration
---
Philosophy
$3
Static prompts waste tokens on irrelevant rules. CARL loads only what's needed:
| Approach | Context Cost |
|----------|--------------|
| Static CLAUDE.md | All rules, every session |
| CARL | Only matched rules |
More room for actual work.
$3
CARL is transparent:
- See exactly which domains loaded
- Know why rules activated (keyword match)
- Override with star-commands when needed
No hidden behavior.
$3
CARL provides structure, not opinions. The default domains are examples — customize or replace them entirely. Your workflow, your rules.
---
What's Included
`
carl-core/
├── hooks/carl-hook.py # The injection engine
├── .carl-template/ # Default configuration
│ ├── manifest # Domain registry
│ ├── global # Universal rules
│ ├── commands # Star-command definitions
│ └── context # Context bracket rules
└── resources/ # Optional management tools
├── commands/carl/ # /carl:manager and related commands
└── skills/ # Domain management helpers
``