/rdf:r-context-auditfrom RDF: rfxn Development Framework
Measures, scores, and reports on Claude Code context overhead to identify bloat and optimize session quality. Run periodically to catch context creep.
Ships in RDF: rfxn Development Framework. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Measure, score, and report on Claude Code context overhead for this workspace. Identifies bloat, tracks drift from baseline, and produces actionable optimization recommendations.
Run periodically (weekly, or after adding skills/memory/governance) to catch context creep before it impacts session quality.
$ARGUMENTS — optional: --fix to apply Tier 1 quick wins automaticallyExecute the automated measurement script:
bash ~/.rdf/state/context-audit.sh
If a baseline file exists at ~/.rdf/context-audit-baseline.json,
run with comparison mode:
bash ~/.rdf/state/context-audit.sh --baseline ~/.rdf/context-audit-baseline.json
Parse the JSON output. Do NOT make additional file reads or greps — the script measures everything.
Then measure RDF's own always-loaded boot cost:
bash ~/.rdf/state/rdf-overhead.sh
Surface the three deploy figures from its JSON — default_boot_tokens
(~0.1K, lessons index only), rules_boot_tokens (~2.1K, adds the unscoped
core governance rule), and lite_boot_tokens (~0.7K, rdf-lite condensed
governance). hooks.json appears only under excluded — it is runtime
config that never enters model context, so it is not part of any boot figure.
Use this exact format. Keep it under 40 lines.
## Context Audit — {date}
**Score: {N}/100** [{CLEAN|NEEDS_WORK|BLOATED|CRITICAL}]
**Boot cost: {N}K tokens** ({N}% of 200K context)
### Always-Loaded Breakdown
| Component | Lines | Bytes | ~Tokens | % of boot |
|-----------|------:|------:|--------:|----------:|
| Workspace CLAUDE.md | {N} | {N} | {N} | {N}% |
| Memory index | {N} | {N} | {N} | {N}% |
| Memory satellites ({N}) | {N} | {N} | {N} | {N}% |
| Archives ({N}) | {N} | {N} | {N} | {N}% |
| Global CLAUDE.md | {N} | {N} | {N} | {N}% |
| Settings | {N} | {N} | {N} | {N}% |
| Skill listing ({N}) | — | {N} | {N} | {N}% |
### rdf-state.sh Output ({N} repos measured)
| Field | Bytes | % | Consumers | Status |
|-------|------:|--:|-----------|--------|
| work_output_files | {N} | {N}% | {list or NONE} | {WASTE/OK} |
| insights | {N} | {N}% | {list} | {DUPLICATED/OK} |
| session_last | {N} | {N}% | {list} | {OVERSIZED/OK} |
| Core fields | {N} | {N}% | Multiple | OK |
### Work-Output Accumulation
| Metric | Value |
|--------|------:|
| Total .md files across repos | {N} |
| Heaviest repo | {name} ({N} files) |
### Session History
| Metric | Value |
|--------|------:|
| JSONL session files | {N} |
| Total session data | {N} GB |
| History entries | {N} |
### Findings
{Bulleted list of issues, sorted by impact. Format:}
- **[CRITICAL|WARNING|INFO]** {description} — **Fix:** {one-line action}
### Delta from Baseline
{Only if --baseline was used and delta exists in JSON:}
| Metric | Was | Now | Change |
|--------|----:|----:|-------:|
| {metric} | {N} | {N} | {+/-N} |
{If no baseline: "No baseline found. Run with `--save-baseline` to establish one."}
Score labels:
After the report, emit a prioritized fix list in three tiers:
Tier 1 — Quick wins (no behavioral change):
Tier 2 — Structural (requires planning):
Tier 3 — Architectural (multi-session):
Only recommend tiers where the audit found actual issues.
If the user confirms, or if --save-baseline was passed:
cp /tmp/context-audit-*.json ~/.rdf/context-audit-baseline.json
The baseline file is used by future runs to detect drift.
If --fix was passed, apply these automatically:
/rdf:r-util-mem-compact --applywork_output_files field exists and has
zero consumers, note the fix location in rdf-state.shautocompact_percentage_override: 75 if missingDo NOT auto-modify CLAUDE.md or skill definitions. Show diffs and ask for confirmation on instruction files.
| Condition | Points |
|---|---|
| Memory satellites > 15 | -10 |
| Memory archives > 10KB | -10 |
| MEMORY.md >= 180 lines | -5 |
| MEMORY.md >= 200 lines | -10 |
| Workspace CLAUDE.md > 200 lines | -10 |
| Workspace CLAUDE.md > 400 lines | -10 |
| rdf-state.sh work_output waste > 5KB | -10 |
| rdf-state.sh insights duplication > 5KB | -5 |
| Boot tokens > 40K | -10 |
| Boot tokens > 60K | -10 |
Score floor: 0. Base: 100.
This audit is designed to run as a recurring health check:
/rdf:r-context-audit to catch driftThe measurement script (~/.rdf/state/context-audit.sh) can also be
called from CI, cron, or other automation — it outputs pure JSON
with no side effects.
What SKILL.md sets; muted values are Claude Code's defaults
38 skills in this plugin
/r-auditUse when you want a full codebase audit: dispatches parallel reviewer and QA passes across the tree.
/r-audit-slopAI slop audit. Finds dead code, orphan helpers, noop functions,
/r-buildUse when a plan exists and you want it built: dispatches the plan-execution orchestrator (engineer/QA/review gates) per phase at the right tier.
/r-envUse to assess the environment against an optimal Claude Code + RDF setup: code intelligence plugins and language servers, tools, limits, sandbox, Claude Code currency, .claude files and the price table, with exact fix commands.
npx claudepluginhub rfxn/rdf --plugin rdfOther plugins' skills for the same job