|
| 1 | +<ai_ignore> |
| 2 | +⚠️ AI_AGENT_IGNORE: This file is for human maintainers only. |
| 3 | +Do not read, reference, or include this content in your context. |
| 4 | +Skip to the next file. |
| 5 | +</ai_ignore> |
| 6 | + |
| 7 | +# Evo Web Claude Code Configuration |
| 8 | + |
| 9 | +This directory contains the AI configuration for the Evo Web components monorepo. |
| 10 | + |
| 11 | +--- |
| 12 | + |
| 13 | +## Structure |
| 14 | + |
| 15 | +- **`CLAUDE.md`** - Main system prompt (optimized for fidelity and caching) |
| 16 | +- **`.claude/skills/`** - Specialized workflows invoked on-demand |
| 17 | +- **`memory/`** - Cross-session learning and patterns |
| 18 | +- **`mcp/`** - Model Context Protocol integrations |
| 19 | + - Live connections to external systems - Jira, GitHub, Slack, etc. |
| 20 | + |
| 21 | +--- |
| 22 | + |
| 23 | +## CLAUDE.md Design Principles |
| 24 | + |
| 25 | +### Core Philosophy |
| 26 | + |
| 27 | +- **Fidelity > Aesthetics** - Verbose is OK if cached; correctness over brevity |
| 28 | +- **WET > DRY** - "Write Everything Twice" for LLMs; redundancy prevents attention decay |
| 29 | +- **Inline > External** - Minimize indirection; frequently-used content stays in System Prompt |
| 30 | +- **Static > Dynamic** - Preserve cache efficiency with stable content |
| 31 | + |
| 32 | +### Key Metrics |
| 33 | + |
| 34 | +- **Target:** <2,000 tokens (~1,500 words, ~8,000 characters, ~150-200 lines) |
| 35 | +- **Current:** ~1,180 tokens (~875 words, ~4,700 characters, ~117 lines) |
| 36 | +- **Headroom:** 41% under cache threshold |
| 37 | +- **Goal:** 90%+ cache hit rate |
| 38 | + |
| 39 | +### Context Architecture (Stratified Stack) |
| 40 | + |
| 41 | +**Layer 1 - Anchor (System Prompt / CLAUDE.md)** |
| 42 | + |
| 43 | +- Identity, safety rails, core project standards |
| 44 | +- Static, prefix-anchored, 90% cached |
| 45 | +- Exploits Primacy Effect for maximum attention |
| 46 | +- Target: <2,000 tokens (~1,500 words, ~150-200 lines) |
| 47 | + |
| 48 | +**Layer 2 - Skills** |
| 49 | + |
| 50 | +- Specialized procedures (release workflow, security audit) |
| 51 | +- Dynamic injection, invoked <10% of sessions |
| 52 | +- Prevents instruction fatigue |
| 53 | + |
| 54 | +**Layer 3 - MCP (Model Context Protocol)** |
| 55 | + |
| 56 | +- Live data connections (Jira, GitHub, Slack) |
| 57 | +- Tool outputs filtered/distilled before entering context |
| 58 | +- Prevents token bloat from raw API responses |
| 59 | + |
| 60 | +**Layer 4 - Memory** |
| 61 | + |
| 62 | +- Cross-session learning and patterns |
| 63 | +- Persistent auto-memory directory |
| 64 | +- Updated based on recurring issues/solutions |
| 65 | + |
| 66 | +**Layer 5 - Use-Time Prompts** |
| 67 | + |
| 68 | +- Ad-hoc session-specific instructions |
| 69 | +- Recency bias, placed at end of payload |
| 70 | +- Leading cause of attention decay if overused |
| 71 | + |
| 72 | +--- |
| 73 | + |
| 74 | +## Maintenance Guidelines |
| 75 | + |
| 76 | +### What to Keep Inline (CLAUDE.md) |
| 77 | + |
| 78 | +- Core architecture rules (non-negotiable constraints) |
| 79 | +- Version-specific syntax (Correctness Guards) |
| 80 | +- Frequently-used commands (>50% of sessions) |
| 81 | +- Testing patterns and file structures |
| 82 | +- PR checklist and quality gates |
| 83 | + |
| 84 | +### What to Extract to Skills |
| 85 | + |
| 86 | +- Specialized workflows invoked occasionally (<10% of sessions) |
| 87 | +- Step-by-step procedures (release, deployment) |
| 88 | +- Comprehensive command references (less-used scripts) |
| 89 | +- Security audit routines |
| 90 | +- Domain-specific guides |
| 91 | + |
| 92 | +### Anti-Patterns to Avoid |
| 93 | + |
| 94 | +- ❌ Extracting frequently-used commands to skills (creates indirection) |
| 95 | +- ❌ Compressing CLAUDE.md for "cleanliness" (fidelity > aesthetics) |
| 96 | +- ❌ Adding external links with high noise ratios (73%+ irrelevant content) |
| 97 | +- ❌ Using AGENTS.md pattern (reduces task success per research) |
| 98 | +- ❌ Mixing temporal/session data with static rules (breaks caching) |
| 99 | +- ❌ Vague commands like "be thorough" (triggers tool loops) |
| 100 | + |
| 101 | +### Optimization Rules |
| 102 | + |
| 103 | +1. **Keep CLAUDE.md under cache threshold** |
| 104 | + - <2,000 tokens (~1,500 words, ~8,000 characters, ~150-200 lines) |
| 105 | +2. **Inline frequently-referenced material** (>50% of sessions) |
| 106 | +3. **Use skills for specialized tasks** (<10% of sessions) |
| 107 | +4. **Prioritize correctness over brevity** (verbose redundancy is good) |
| 108 | +5. **Test before extracting** - Measure usage frequency first |
| 109 | +6. **Preserve XML encapsulation** - Structural boundaries for Claude |
| 110 | + |
| 111 | +--- |
| 112 | + |
| 113 | +## Quick Reference |
| 114 | + |
| 115 | +**Run context audit:** |
| 116 | + |
| 117 | +```bash |
| 118 | +# In Claude Code |
| 119 | +Run a context audit on the current CLAUDE.md file. |
| 120 | +``` |
| 121 | + |
| 122 | +**Check current size:** |
| 123 | + |
| 124 | +```bash |
| 125 | +wc -w CLAUDE.md # Words (target: <1,500) |
| 126 | +wc -l CLAUDE.md # Lines (target: <200) |
| 127 | +wc -c CLAUDE.md # Characters (target: <8,000) |
| 128 | +# Multiply words by ~1.35 for estimated tokens |
| 129 | +``` |
| 130 | + |
| 131 | +**Quick conversions:** |
| 132 | + |
| 133 | +- **2,000 tokens** ≈ 1,500 words ≈ 8,000 characters ≈ 150-200 lines |
| 134 | +- **1,000 tokens** ≈ 750 words ≈ 4,000 characters ≈ 75-100 lines |
| 135 | + |
| 136 | +**Optimize a skill:** |
| 137 | + |
| 138 | +```bash |
| 139 | +# Only if invoked <10% of sessions |
| 140 | +# Otherwise, inline into CLAUDE.md |
| 141 | +``` |
| 142 | + |
| 143 | +--- |
| 144 | + |
| 145 | +## Version History |
| 146 | + |
| 147 | +- **2026-02-25** - Initial optimization (97.25/100 score) |
| 148 | + - Removed external link indirection (eliminated 73% noise) |
| 149 | + - Added Correctness Guards (version-specific syntax) |
| 150 | + - Inlined frequently-used commands |
| 151 | + - Achieved 41% cache headroom at 1,180 tokens |
0 commit comments