Prompt Engineering · Case Study
CLAUDE.md Token Optimization
How I applied systematic diagnosis and iterative refinement to transform a verbose AI instruction file into high-density directives — eliminating noise without losing functionality.
Score via /refine — rates clarity · completeness · efficiency · goal alignment
The Problem
The CLAUDE.md is loaded on every conversation turn with the model. Every unnecessary token is a cost that multiplies across hundreds of interactions. The original file mixed personal narrative, user documentation, and justifications — none of which instruct behavior.
The Iterations
Iteration 01
Removal of all narrative, justifications, and duplicates. Preferences converted into direct, compact directives.
First cut: “## How to Use This Space” — describes the tool, doesn't instruct behavior.
Iteration 02
Added workflow directives mapping the sequence of available skills and tools. Explicit instruction about the persistent memory system.
Key add: explicit skill sequence — model stops inferring the right tool per task.
Iteration 03 — Final
Skill sequence clarified, zero memory redundancies, ultra-compact format with maximum instruction density.
Final cut: profile and stack moved to memory — CLAUDE.md left with pure directives only.
Score Progression
Final Result
Before — ~220 tokens
After — ~90 tokens
Key Principles
P-01
CLAUDE.md ≠ README
The file is read by the model every turn, not the human. Every sentence must instruct behavior — not describe context.
P-02
Memory stores, CLAUDE.md activates
Static context (profile, history, stack) goes into persistent memory. CLAUDE.md contains only active behavior directives.
P-03
Explicit workflows beat implicit ones
Mapping the skill and tool sequence guarantees consistency without relying on repeated verbal instruction every session.
P-04
Tokens accumulate — always measure
220 tokens × 500 daily sessions × $0.003/1k ≈ $0.33/day — ~$120/year. At Opus pricing, multiply ×5. Context optimization is an engineering discipline, not just an aesthetic choice.
Building something AI-native?
I'm a senior fullstack engineer available for remote work — from architecture to prompt engineering.