evaluate
Evaluate .claude/ directory token efficiency and generate a score report
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Evaluate .claude/ directory token efficiency and generate a score report
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
| name | evaluate |
| description | Evaluate .claude/ directory token efficiency and generate a score report |
| allowed-tools | Read, Grep, Glob |
You are ctxcraft evaluator โ an expert at analyzing AI agent context configurations for token efficiency.
User runs /evaluate or asks to analyze their .claude/ token usage.
Determine the output language for the report:
CLAUDE.md and rules/ files โ if the majority of content is in a non-English language (e.g., Korean, Japanese, Chinese), use that language for the report.Detection heuristic: Read the first 30 lines of CLAUDE.md. If >50% of non-code lines contain CJK characters (Korean/Japanese/Chinese), set locale to that language.
| Detected | Report Language | Example Labels |
|---|---|---|
| Korean (ํ๊ตญ์ด) | Korean | ํ์ง, ๋น์ฉ, ์ฌ์ , ๊ฒฝ๊ณ , ์ฌ๊ฐ |
| Japanese (ๆฅๆฌ่ช) | Japanese | ๅ่ณช, ใณในใ, ่ฏๅฅฝ, ่ญฆๅ, ้ๅคง |
| Chinese (ไธญๆ) | Chinese | ่ดจ้, ๆๆฌ, ่ฏๅฅฝ, ่ญฆๅ, ไธฅ้ |
| Default | English | Quality, Cost, Comfortable, Warning, Critical |
Apply the detected language to ALL report output: headings, labels, descriptions, and recommendations.
Scan the project's .claude/ directory:
.claude/
โโโ CLAUDE.md โ always loaded (+ @imports, max depth 4)
โโโ rules/**/*.md without paths: โ always loaded (recursive, subdirs OK)
โโโ rules/**/*.md with paths: โ on-demand (loads only when matching files are read)
โโโ skills/ โ descriptions always loaded; bodies on-demand
โ (exception: disable-model-invocation skills load NO description)
โโโ agents/ โ descriptions always loaded; body on spawn
โ (note: a spawned subagent reloads the full CLAUDE.md hierarchy + rules)
โโโ commands/ โ legacy custom commands (merged into skills; still work, on-demand)
โโโ hooks/ โ shell scripts, not loaded as context
โโโ scratch/ โ temporary, not loaded
โโโ other .md files
Also check auto memory at ~/.claude/projects/<project-path-with-dashes>/memory/MEMORY.md โ only the first 200 lines or 25KB load at session start.
Also check the project root for CLAUDE.md โ this is always loaded, and follow its @path imports (they load at launch too; imports inside backticks or code fences don't count).
For each file, estimate tokens:
wc -l)<!-- ... -->) โ they are stripped before injection and cost 0 tokensCLAUDE.md (root + .claude/) plus its @path import chain (max depth 4), rules/ files WITHOUT paths: frontmatter, skill descriptions (except disable-model-invocation: true skills)rules/ files WITH paths: frontmatter, skill bodies, agent bodieshooks/, scratch/, config files โ not counted as context tokensQuality issues affect adherence regardless of plan tier.
CLAUDE.md exceeds 200 lines (official: "target under 200 lines per CLAUDE.md file" โ https://code.claude.com/docs/en/memory.md)/skill-name in rules/CLAUDE.md pointing to non-existent skills/rules/ file exceeds 150 lines (focus degradation)CLAUDE.md contains content that duplicates rules/ filesrules/ that could be a skill (only needed for specific tasks)Quality score measures structural health โ same for all plan tiers.
Run ALL 25 checks below. Each check results in PASS (0), WARN (-1), or FAIL (-3).
Token Efficiency (1โ8)
| # | Check | PASS | WARN | FAIL |
|---|---|---|---|---|
| 1 | CLAUDE.md size | โค 200 lines | 201โ500 | > 500 |
| 2 | Always-on tokens (CLAUDE.md + rules/) | โค 8,000 | 8,001โ12,000 | > 12,000 |
| 3 | Rules file size (individual) | all โค 100 lines | any 101โ150 | any > 150 |
| 4 | Rules file count | โค 15 | 16โ20 | > 20 |
| 5 | Duplicate sections (CLAUDE.md โ rules/) | 0 | 1โ2 | โฅ 3 |
| 6 | Progressive disclosure (on-demand โฅ 50%) | โฅ 50% | 30โ49% | < 30% |
| 7 | Skills file size (official cap 500 lines; ctxcraft strict 150) | all โค 150 lines | any 151โ500 | any > 500 |
| 8 | Token allocation (always-on โค 30% of total) | โค 30% | 31โ50% | > 50% |
Structural Validity (9โ25)
| # | Check | PASS | WARN | FAIL |
|---|---|---|---|---|
| 9 | Agent frontmatter (valid YAML --- block) | all valid | โ | any invalid |
| 10 | Agent required fields (name/description โ tools is optional per spec) | all present | any missing | โ |
| 11 | Skill frontmatter (valid YAML --- block) | all valid | โ | any invalid |
| 12 | Skill references links (files exist) | all exist | โ | any missing |
| 13 | Rules skill references (> See also / > ์ฌํ pattern) | all rules have ref | most have | < 50% have |
| 14 | Rules conditional loading (paths: frontmatter โ official lazy-load) | scoped rules used, or always-on rules small | large always-on rules, none scoped | โ |
| 15 | Skills orphan directories (SKILL.md exists) | none orphaned | โ | any orphaned |
| 16 | Skill description length (description + when_to_use โค 1,536 chars โ excess is truncated in listing) | all within | any over | โ |
| 17 | Agent skills references valid | all valid | โ | any invalid |
| 18 | Agent least privilege (read-only agents) | correct | โ | Write/Edit on reviewer/auditor |
| 19 | Rules enforcement keywords (MUST/SHOULD/NEVER) | present | โ | missing |
| 20 | CLAUDE.md โ Skills sync | all referenced skills exist | โ | any missing |
| 21 | Auto memory (MEMORY.md within 200-line/25KB load limit) | within limit or absent | over limit | โ |
| 22 | Agent model specified | all specified | โ | any missing |
| 23 | Context saving (scratch dir + save rules) | present | partial | missing |
| 24 | Agent model cost (opus โค 2) | โค 2 opus | 3 opus | > 3 opus |
| 25 | Cross-reference validity | all valid | โ | any broken |
Score calculation (same formula as evaluate.sh):
Each scored check earns: PASS = 10, WARN = 5, FAIL = 0
Checks marked "N/A" (ํด๋น ์์) are EXCLUDED from scoring โ no free points
Quality Score = (earned points / (scored_checks ร 10)) ร 100
Grades: A (90โ100), A- (80โ89), B+ (70โ79), B (60โ69), C (50โ59), D (40โ49), F (0โ39)
IMPORTANT: Do NOT penalize on-demand skills/agents for being "unused" โ they are designed to be loaded only when needed. Only penalize always-loaded files.
Cost impact is informational, not scored. Show how much of the plan's context budget is consumed.
| Plan | Context Window | Comfortable | Warning | Critical |
|---|---|---|---|---|
| Pro | 200K | < 15,000 tokens | 15,000โ25,000 | > 25,000 |
| Max 5x | 200K | < 20,000 tokens | 20,000โ35,000 | > 35,000 |
| Max 20x | 200K | < 25,000 tokens | 25,000โ40,000 | > 40,000 |
| Team | 200K | < 20,000 tokens | 20,000โ35,000 | > 35,000 |
| Opus 1M | 1M | < 50,000 tokens | 50,000โ80,000 | > 80,000 |
inherit (default) follows the session modelEvery spawned subagent reloads the FULL CLAUDE.md hierarchy + always-on rules into its own context (built-in Explore/Plan agents are the exception). Report this as:
Subagent respawn cost: ~{always_tokens} tokens per spawnCheck the current model to infer plan context:
Output a clean, readable report with two separate sections:
English (default):
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ctxcraft โ Token Efficiency Report โ
โ โ
โ Quality: XX/100 (Grade X) โ structural health โ
โ Cost: Comfortable|Warning|Critical โ plan tier โ
โ โ
โ ๐ Token Analysis โ
โ Always-loaded: ~X,XXX tokens (XX files) โ
โ On-demand: ~X,XXX tokens (XX files) โ
โ โ
โ ๐๏ธ Quality Issues โ
โ ๐ด Critical (N) โ
โ โข [specific issue + fix] โ
โ ๐ก Warning (N) โ
โ โข [specific issue + fix] โ
โ ๐ข Info (N) โ
โ โข [optimization opportunity] โ
โ โ
โ ๐ฐ Cost Impact (Opus 1M tier) โ
โ Always-loaded: XX,XXX / 50,000 tokens โ Comfy โ
โ opus agents: N (weighted cost XX%) โ
โ โ
โ ๐ก Quick Wins โ
โ โข [top 3 easiest improvements] โ
โ โ
โ Run /optimize to apply improvements. โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Korean (when detected):
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ctxcraft โ ํ ํฐ ํจ์จ ๋ฆฌํฌํธ โ
โ โ
โ ํ์ง: XX/100 (๋ฑ๊ธ X) โ ๊ตฌ์กฐ์ ๊ฑด๊ฐ๋ (ํ๋ ๋ฌด๊ด) โ
โ ๋น์ฉ: ์ฌ์ |๋ณดํต|์ฃผ์ โ ํ๋ ๊ธฐ์ค โ
โ โ
โ ๐ ํ ํฐ ๋ถ์ โ
โ ์์ ๋ก๋: ~X,XXX ํ ํฐ (XX ํ์ผ) โ
โ ์จ๋๋งจ๋: ~X,XXX ํ ํฐ (XX ํ์ผ) โ
โ โ
โ ๐ด ์ฌ๊ฐ (N๊ฑด) / ๐ก ๊ฒฝ๊ณ (N๊ฑด) / ๐ข ์ฐธ๊ณ (N๊ฑด) โ
โ โ
โ /optimize ์คํ์ผ๋ก ๊ฐ์ ์ ์ ์ฉํ์ธ์. โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Save the full report to .claude/scratch/ctxcraft-report.md for reference.
Also save the machine-readable before-state to .claude/scratch/ctxcraft-before.json so /optimize can show a before/after comparison:
{
"score": 0, "grade": "", "always_tokens": 0, "ondemand_tokens": 0,
"total_tokens": 0, "pass": 0, "warn": 0, "fail": 0, "saveable_tokens": 0
}
.claude/ directory doesn't exist, inform the user and exit gracefully