CLAUDE.md Optimization & Symlink Audit Analysis
Date: 2026-02-19 Author: Claude (Opus 4.6) Task: [H.0] Ad-hoc analysis Status: Analysis complete, pending implementation
Executive Summary
Three files are loaded every conversation: Core CLAUDE.md (~3,700 tokens), Rollout-master CLAUDE.md (~1,100 tokens), MEMORY.md (~2,800 tokens) = ~7,600 tokens per conversation.
Through deduplication, trimming overexplained rationale, and moving context-specific MEMORY.md content to topic files, ~2,165 tokens (28%) can be saved with zero information loss.
Additionally, a symlink audit reveals 375 regular CLAUDE.md files vs 99 symlinks across the repository tree. At the root submodule level, 76/78 are correctly symlinked. The bulk of regular files (171) are nested copies inside coditect-dev-generative-ui-development.
Product strategy implication: CLAUDE.md must remain CODITECT-controlled (symlinked to protected installation) so customers cannot modify it. This is critical for ensuring maximum value delivery.
Part 1: Token Budget Analysis
Files Loaded Per Conversation
| File | Bytes | Lines | Est. Tokens | Purpose |
|---|---|---|---|---|
Core CLAUDE.md (.coditect/CLAUDE.md) | 14,744 | 306 | ~3,700 | Framework directives |
| Rollout-master CLAUDE.md | 4,295 | 131 | ~1,100 | Project-specific |
| MEMORY.md | 11,181 | 160 | ~2,800 | Session memory |
| Total | 30,220 | 597 | ~7,600 |
Part 2: Cross-File Duplication
2.1 TRIPLE DUPLICATION: Git Push Safety
The identical directive appears three times per conversation:
| Location | Lines | Bytes |
|---|---|---|
| Core CLAUDE.md lines 39-42 | 4 | ~400 |
| Rollout-master CLAUDE.md lines 50-55 | 6 | ~400 |
| MEMORY.md lines 19-23 | 5 | ~250 |
| Total waste | 11 redundant | ~650 |
Action: Remove from rollout-master and MEMORY.md. Keep only in core.
2.2 DOUBLE DUPLICATION: Analysis Preservation
| Location | Lines | Notes |
|---|---|---|
| Core CLAUDE.md lines 137-174 | 38 | Full protocol with "why" rationale |
| MEMORY.md lines 25-30 | 6 | Summary + lesson learned |
Action: Remove from MEMORY.md. Keep only the unique lesson learned line (J.29 compaction).
2.3 DOUBLE DUPLICATION: Session Log Location
| Location | Lines |
|---|---|
| Core CLAUDE.md lines 127-133 | 7 |
| MEMORY.md lines 153-159 | 7 |
Action: Remove from MEMORY.md.
2.4 DOUBLE DUPLICATION: Document Placement
| Location | Lines |
|---|---|
| Core CLAUDE.md line 151 | 1 |
| MEMORY.md lines 62-65 | 4 |
Action: Remove from MEMORY.md.
2.5 OVERLAP: Agent System
| Location | /which | /moe-agents | /moe-workflow | /agent | Task() distinction |
|---|---|---|---|---|---|
| Core CLAUDE.md (lines 196-206) | Yes | No | No | Yes | Yes |
| Rollout-master CLAUDE.md (lines 107-118) | Yes | Yes | Yes | Yes | No |
Action: Merge into one section in core CLAUDE.md. Add /moe-agents, /moe-workflow, /moe-judges. Drop the "Common:" agent name list. Remove Agent System from rollout-master.
Part 3: Overexplained Protocols (Core CLAUDE.md)
3.1 Analysis Preservation Protocol (38 lines -> ~15)
- Lines 164-167: 4 bullets explaining "why both filename and path" — redundant with the example
- Lines 169-174: 6 "Why this matters" bullets — justification, not instruction
- Lines 143-149: 6 "when to save" bullets — could be 1 general rule
3.2 Session Logging Protocol (24 lines -> ~14)
- Lines 114-116: 3 sentences restating what the table already says
- Line 123: "Why" explanation — redundant after the mandate
3.3 Task ID Protocol (35 lines -> ~20)
- Lines 84-92: Step-by-step grep instructions — could be 2 lines
- Lines 81-82: "Project Association" explanation could be 1 line
Savings Summary
| Section | Current | Proposed | Savings |
|---|---|---|---|
| Analysis Preservation | 38 lines | ~15 lines | ~1,000 bytes |
| Session Logging | 24 lines | ~14 lines | ~450 bytes |
| Task ID Protocol | 35 lines | ~20 lines | ~600 bytes |
| Subtotal | ~2,050 bytes (~510 tokens) |
Part 4: MEMORY.md Context-Specific Bloat
These sections are loaded every conversation but only relevant for specific features:
| Section | Lines | Bytes | Relevance |
|---|---|---|---|
| PDF-to-Markdown v2.5 | 28 | ~2,000 | Only for PDF work |
| UDOM Pipeline v1.3 | 24 | ~1,700 | Only for UDOM work |
| Codestoryai Sidecar | 12 | ~800 | Only for sidecar R&D |
| Browser Extraction | 6 | ~400 | Only for browser work |
| Total | 70 | ~4,900 (~1,225 tokens) |
Action: Move to topic files (memory/pdf-to-markdown.md, memory/udom-pipeline.md, etc.). Leave 1-line pointers in MEMORY.md.
Part 5: Stale / Outdated Content
| Item | Current Value | Actual Value | Location |
|---|---|---|---|
| Agent count | "776" | 805 | Core line 198 |
| Commands count | "377" | 389 | Core line 249 |
| Scripts count | "581" | 617 | Core line 251 |
| Hooks count | "118" | 128 | Core line 251 |
| Skills count | "445" | 451 | Core lines 180, 250 |
| Version footer | "3.3.0" | Frontmatter says "3.1.0" | Core line 304 vs 5 |
| MEMORY.md type | type: skill | Should be type: reference | MEMORY.md line 3 |
| MEMORY.md tokens | tokens: ~1000 | Actual ~2,800 | MEMORY.md line 11 |
| Rollout component count | "3,458" | 3,553 | Rollout line 130 |
Part 6: Missing Content
| Missing Command | In Quick Commands? | In Agent System? |
|---|---|---|
/moe-agents <use-case> | No | No |
/moe-workflow <task> | No | No |
/moe-judges <target> | Quick Commands only | No |
/git-submodule-commit-all | No | N/A |
/session-status | No | N/A |
Part 7: YAML Frontmatter
Both files have YAML frontmatter (~200 bytes each) for MoE classification. Claude doesn't use it for behavior.
| File | Frontmatter Lines | Bytes |
|---|---|---|
| Core CLAUDE.md | 16 | ~400 |
| MEMORY.md | 16 | ~200 |
| Total | 32 | ~600 (~150 tokens) |
Action: Remove frontmatter from both.
Part 8: Total Optimization Potential
| Category | Bytes Saved | Tokens Saved |
|---|---|---|
| Pure duplicates removed | ~1,350 | ~340 |
| Overexplained protocols trimmed | ~2,050 | ~510 |
| MEMORY.md context-specific -> topic files | ~4,500 | ~1,125 |
| YAML frontmatter removed | ~600 | ~150 |
| Stale "Common:" agent list removed | ~150 | ~40 |
| Total | ~8,650 | ~2,165 |
Reduction: ~28% (30,220 -> ~21,570 bytes)
Part 9: Symlink Audit
9.1 Root-Level Submodule CLAUDE.md
| Type | Count | Notes |
|---|---|---|
Symlink -> ~/.coditect/CLAUDE.md | 76 | Correct |
| Regular file (coditect-core/CLAUDE.md) | 1 | This IS the master source |
| Regular file (agent-labs/CLAUDE.md) | 1 | Third-party repo (brainqub3) |
| Total | 78 | 76/78 correctly symlinked |
9.2 All CLAUDE.md Files (Including Subdirectories)
| Type | Count |
|---|---|
| Regular files | 375 |
| Symlinks | 99 |
| Total | 474 |
9.3 Regular Files by Category
| Category | Count | Description | Action |
|---|---|---|---|
| NESTED-GENUI | 171 | Inside coditect-dev-generative-ui-development/submodules/ | Stale copies of other repos |
| ARCHIVE | 52 | Old v4/archived content | Historical, low priority |
| ENTERPRISE-PCF | 19 | Per-industry APQC PCF processes | Industry-specific context |
| CORE-OTHER | 19 | Inside coditect-core (various) | Need case-by-case review |
| VENTURES | 18 | Customer/JV subdirectories | Customer project context |
| CORE-DOCS | 18 | coditect-core internal/docs | Subdirectory context |
| CORE-DIST | 17 | Distribution/packaging | Build context |
| LABS | 14 | Lab research subdirectories | Research context |
| DEV | 12 | Dev submodule subdirectories | Dev project context |
| ROLLOUT-DOCS | 11 | rollout-master docs/ | Subdirectory context |
| CORE-TOOLS | 11 | coditect-core tools/ | Tool-specific context |
| PRODUCTS | 2 | Product subdirectories | Product context |
| CLOUD | 2 | Cloud subdirectories | Infra context |
| OTHER | 8 | Various one-offs | Case-by-case |
9.4 Product Strategy: CLAUDE.md Control
Requirement: CLAUDE.md must be CODITECT-controlled. Customers should not edit it.
Current enforcement:
- Root-level: Symlinks to protected installation (76/78 correct)
- Subdirectory: Regular files (375) — not controlled
Two categories of subdirectory CLAUDE.md:
-
Root-level context (should symlink to master): These provide the core CODITECT framework directives. Already symlinked at root level.
-
Subdirectory context (project-specific): Files like
docs/security/CLAUDE.md,tools/mcp-context-graph/CLAUDE.md— these provide context about that specific subdirectory's codebase. These are NOT copies of the master; they contain different, location-specific content.
Recommendation:
- Root-level CLAUDE.md in each repo: MUST be symlink (already 97.4% compliant)
- Subdirectory CLAUDE.md files: These should also be symlinked to a CODITECT-controlled location OR generated/managed by CODITECT tooling, not hand-edited
- The
coditect-dev-generative-ui-developmentnested copies (171 files) should be cleaned up as they're stale duplicates from before the symlink convention was established
Part 10: Recommended Implementation Order
- Quick wins (dedup + stale fixes): Remove duplicates from rollout-master and MEMORY.md, fix stale counts
- Core CLAUDE.md optimization: Trim overexplained protocols, merge Agent System sections, add missing commands
- MEMORY.md cleanup: Move context-specific content to topic files
- Symlink enforcement: Script to audit and convert root-level CLAUDE.md files to symlinks
- Product strategy: Design CODITECT-managed subdirectory CLAUDE.md system