Meet CARL:
I spent six months fighting the same problem every Claude Code session.
Context bloat.
You know the pattern. You have 50+ rules you want Claude to follow. System prompts, coding standards, project conventions, workflow patterns. So you dump everything into CLAUDE.md and hope for the best.
Except now every single message burns tokens on rules that aren't relevant. Asking Claude to fix a typo? It still gets injected with your entire MCP server development guide.
I built something to fix this.
Let me introduce you to CARL, (the Context Augmentation Reinforcement Layer), designed to dynamically inject rules based on what you're actually doing.
Say "fix this bug" and you get coding rules. Say "update project status" and you get project management rules. Say "just chatting" and you get either a command to discuss injected (if you set it up that way) or just the global rules (only if you have them active - they can be disabled).
The architecture is simple. A manifest file defines domains with keyword triggers. A Python hook runs on every prompt, matches keywords, and injects only the relevant rules. An MCP server lets you create new domains or toggle them on the fly.
That's it. Text files and a matching algorithm.
The results surprised me. Token overhead dropped 50 to 80 percent depending on the session type. But more importantly, Claude started following the right rules more consistently because they weren't buried in noise.
I had an earlier version that worked well enough for my own use. But after refining a keyword exclusion system, adding domain scoping, and building the MCP management layer, I realized this could help others dealing with the same context management problem.
The whole system is file-based. No database. Git-friendly. Plain text you can read and edit.
I'm thinking about packaging this for others who use Claude Code heavily. If context management is something you've struggled with, I'm curious what your approach has been.
If you want me to package this and send to you, reply in comment with CARL and I'll make sure I reach out once it's wrapped up!
4
7 comments
Chris Kahler
3
Meet CARL:
CC Strategic AI
skool.com/cc-strategic-ai
Build and launch AI-powered SaaS with Claude Code + n8n. No dev team required.
Leaderboard (30-day)
Powered by