refactor: optimize CLAUDE.md context footprint (-49%)

Extract Ollama docs and PROJECT_STATE locking protocol to on-demand
reference files. Trim Work Mode to detection table only. Remove verbose
anti-pattern examples and credential encryption details.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-20 12:09:17 -07:00
parent ebad88de57
commit 056e36aeac
4 changed files with 395 additions and 493 deletions

View File

@@ -223,6 +223,40 @@ Committed: db157e3
---
## Update: 19:08 UTC — CLAUDE.md Optimization
### Summary
Refactored `.claude/CLAUDE.md` to reduce context window pressure. Extracted verbose sections to on-demand reference files. No functional changes — same rules, smaller footprint.
### Changes Made
**`.claude/CLAUDE.md`** — 494 lines → 252 lines (~49% reduction)
- Work Mode section: replaced 22-line narrative with a 5-row detection table; dropped color references (color changes don't work programmatically anyway — mode.md handles that)
- PROJECT_STATE.md Action Protocol: removed entirely (~65 lines) — moved to dedicated file
- Ollama section: trimmed from ~90 lines to 5-line summary + pointer
- Auto Context Loading: removed Benefits list, condensed anti-pattern examples to one sentence
- Credential Access: kept the 4 vault commands, removed encryption/key location details
**`.claude/OLLAMA.md`** — new file (67 lines)
- Full Ollama reference: endpoints, models, connection examples, review policy
- Only loaded when Claude needs to call Ollama (Tier 0 tasks)
**`.claude/PROJECT_STATE_PROTOCOL.md`** — new file (42 lines)
- Full locking protocol: what requires a lock, how to claim/release, stale lock rule
- Only loaded when Auto Context Loading finds a PROJECT_STATE.md in a project
### Decisions
- PROJECT_STATE files already have brief locking instructions embedded in their headers — the full protocol in CLAUDE.md was redundant
- Work mode colors were dropped from CLAUDE.md because `/color` is a CLI built-in Claude can't invoke programmatically; mode.md already has the authoritative detail
- Ollama extraction was the biggest single win (~90 lines) — it's only needed for Tier 0 delegation, not every session
### Pending
- None. This was a self-contained optimization pass.
---
## Key Infrastructure Reference
| Resource | Details |