From claude-ecosystem
Audits CLAUDE.md memory files in Claude Code for import syntax, circular imports, hierarchy compliance, size guidelines, and organization. Invoke via /audit-memory [project|user|all].
npx claudepluginhub melodic-software/claude-code-plugins --plugin claude-ecosystemThis skill is limited to using the following tools:
Audit Claude Code CLAUDE.md memory files for quality, compliance, and organization.
Audits Claude Code project memory hierarchy, lists files loaded at session start, measures total context budget, and suggests optimizations to stay under 40k chars.
Provides stable principles, keyword registry, and navigation for Claude Code memory system (CLAUDE.md, static memory, hierarchy, imports). Delegates details to docs-management skill.
Audits Claude Code auto-memory (MEMORY.md, topic files) for promotion candidates to CLAUDE.md, stale entries, duplicates, consolidation opportunities, and health metrics.
Share bugs, ideas, or general feedback.
Audit Claude Code CLAUDE.md memory files for quality, compliance, and organization.
Before auditing, initialize the environment:
Get the current UTC date, capture the project root path, ensure the temp directory exists, and clean up stale audit files. The memory-management skill provides authoritative validation guidance (auto-loaded when this command runs).
@path/to/file.md)| Argument | Description |
|---|---|
| (none) | Audit all discoverable CLAUDE.md files |
project | Only audit project-level files |
user | Only audit ~/.claude/CLAUDE.md |
all | Audit all scopes explicitly |
--force | Audit regardless of modification status |
--skip-validation | Skip finding validation (faster, but may include false positives) |
--token-budget | Run ONLY token budget analysis (skip full audit) |
Check root CLAUDE.md, .claude/CLAUDE.md, user ~/.claude/CLAUDE.md (Unix) or %USERPROFILE%\.claude\CLAUDE.md (Windows), and .claude/memory/*.md.
Build list with scope and level (root/dot-claude/memory/user).
Parse scope selector and --force flag. Filter files to match requested scope.
Display mode, files discovered, primary files, and imported memory files.
For each file, spawn the memory-component-auditor subagent with scope, level, path, and last audit date. Run in parallel batches of 3-5.
After individual audits, perform cross-file circular import detection by building an import graph.
Subagents write findings to .claude/temp/. The main conversation thread collects results and updates audit logs using its Write/Edit tools.
Unless --skip-validation flag is present:
audit-finding-validator agent with:
project_root: The captured project root pathaudit_type: "memory"audit_files: List of .claude/temp/audit-*-memory-*.json file paths.claude/temp/audit-filtered-findings.jsonIf --skip-validation flag is present:
Report total audited by scope, results, circular import check, and details tables. Provide remediation steps for issues.
Include validation statistics (if validation was performed):
Scope: Only always-loaded files (root CLAUDE.md + files with @-prefix imports marked as "Always-loaded")
Note: Use --token-budget to run ONLY this step (skips Steps 1-5 full audit).
Invoke memory-management skill (which delegates to docs-management) to fetch current official guidance on memory file sizing. Official docs recommend keeping memory "concise and focused" with progressive disclosure - specific token thresholds are repo-specific standards, not official requirements.
For each always-loaded file:
len(content) / 4 (approximate for English markdown)**Token Budget:** ~1,800 tokens)Sum all always-loaded file tokens. Do NOT include on-demand files (those without @ prefix in root, or marked "Context-Dependent").
These thresholds are repo-specific standards (see audit-framework.md), NOT from official Claude Code docs:
| Status | Token Range | Guidance |
|---|---|---|
| PASS | ≤12k tokens | Within repo budget |
| WARN | 12k-15k tokens | At upper limit, monitor |
| FAIL | >15k tokens | Over budget, remediation needed |
Report includes:
If over budget, recommend:
Add Token Budget Analysis section to .claude/audit/memory.md with:
Valid: @path/to/file.md (e.g., @.claude/memory/workflows.md)
CLAUDE.md).claude/CLAUDE.md)~/.claude/CLAUDE.md - lowest)| File Type | Recommended Size |
|---|---|
| Root CLAUDE.md | < 50 lines core + imports |
| Memory imports | < 500 lines each |
| Platform | User Memory |
|---|---|
| Unix | ~/.claude/CLAUDE.md |
| Windows | %USERPROFILE%\.claude\CLAUDE.md |
All audit results are written to .claude/audit/memory.md.
Use /audit-log memory to view current audit status.
User: /audit-memory
Claude: Discovering CLAUDE.md files...
## Audit Plan
**Mode**: SMART
**Files discovered**: 12
### Primary Files:
1. [project:root] CLAUDE.md
2. [user] ~/.claude/CLAUDE.md
### Imported Files:
3. [project:memory] .claude/memory/workflows.md
...
[Spawns memory-component-auditor subagents]
## Audit Complete
**Circular Import Check**: ✓ No cycles detected
| Scope | File | Result | Score |
| --- | --- | --- | --- |
| project | CLAUDE.md | PASS | 100/100 |
User: /audit-memory project
Claude: Auditing project-level files...