carl  by ChristopherKahler

Context augmentation and reinforcement for AI assistants

Created 2 months ago
299 stars

Top 88.9% on SourcePulse

GitHubView on GitHub
Project Summary

Context Augmentation & Reinforcement Layer (CARL) addresses the ephemeral nature of AI assistant sessions by providing dynamic, domain-based behavioral rules for Claude Code. It targets Claude Code users who desire persistent preferences and workflows without the prompt bloat associated with static configurations. CARL offers a significant benefit by enabling AI models to "remember" user-specific coding styles, response formats, and workflow patterns automatically, enhancing personalization and efficiency.

How It Works

CARL operates via a hook that scans user prompts for keywords. Upon matching a keyword to a defined "domain" (a collection of related rules), CARL injects the relevant rules into the AI's context just-in-time. This approach ensures that only pertinent instructions are loaded, maintaining a lean context window and conserving tokens. The system centralizes configuration, domains, and rules within a single carl.json file, managed at runtime by an MCP server. Key architectural choices include scope merging for hierarchical configuration (project-specific overriding global) and context deduplication to prevent redundant rule re-injection.

Quick Start & Requirements

  • Primary install: npx carl-core
  • Prerequisites: Claude Code, Node.js (implied by npx).
  • OS Compatibility: Mac, Windows, and Linux.
  • Setup: Global installation is recommended for system-wide application; local installation applies to the current project. A restart of Claude Code is required post-installation.
  • Links: npm package, GitHub repository

Highlighted Details

  • Dynamic Rule Injection: Rules activate automatically based on prompt keywords and context relevance, disappearing when not needed.
  • Single Source of Truth: All project configurations, domains, and rules are consolidated into a single carl.json file.
  • MCP Tools: Runtime management of domains, rules, and decisions is facilitated via an MCP server, enabling dynamic updates without direct file editing.
  • Scope Merging: Project-level .carl/ configurations seamlessly extend and override global ~/.carl/ settings.
  • Context Dedup: Prevents re-injection of identical rules to optimize token usage, with configurable re-injection frequency.
  • Companion PAUL Integration: Works with PAUL (Plan-Apply-Unify Loop) for structured development, ensuring PAUL-specific rules are only active within PAUL projects.

Maintenance & Community

Developed by Chris Kahler / Chris AI Systems. A "CC Strategic AI" Skool community is mentioned for courses and support. No explicit links to Discord/Slack or a public roadmap are provided in the README.

Licensing & Compatibility

  • License: MIT License.
  • Compatibility: The MIT license permits commercial use and integration with closed-source projects without significant restrictions.

Limitations & Caveats

CARL is specifically designed for the "Claude Code" environment, limiting its applicability to other AI platforms. While a migration path from v1 is provided, the detailed description of v2 architecture suggests ongoing development and potential for evolving features or breaking changes. The effectiveness of context-adaptive "Context Brackets" may require empirical validation.

Health Check
Last Commit

1 week ago

Responsiveness

Inactive

Pull Requests (30d)
1
Issues (30d)
1
Star History
102 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.