Skip to content
cccskills
FreePublished on GitHub

memory-audit

Comprehensive health check across CC auto-memory and agent-studio memory systems — detects orphans, duplicates, staleness, and threshold violations

The English summary is being prepared. Showing the original description.

See how to install

Files included (10)

  • SKILL.md6.8 KB
  • commands/memory-audit.md112 B
  • hooks/post-execute.cjs177 B
  • hooks/pre-execute.cjs283 B
  • references/research-requirements.md287 B
  • rules/memory-audit.md283 B
  • schemas/input.schema.json486 B
  • schemas/output.schema.json256 B
  • scripts/main.cjs999 B
  • templates/implementation-template.md186 B

SKILL.md (original)

Review the instructions the agent will receive before you install.

Memory Audit

Structured diagnostic sensor for both memory systems. Returns a health report with scores, findings, and recommendations. The skill is read-only by default — it measures and reports but does not modify memory. Use --auto-fix for safe cleanup of orphans and stale files only.

When to Invoke

Skill({ skill: 'memory-audit' });
  • After every 10 sessions (recommended)
  • During proactive-audit pipeline
  • When agents report memory-related failures
  • Before session handoff (verify memory health)
  • When router suspects memory bloat or staleness

Workflow

Step 1: CC Auto-Memory Health Check

Command:

MEMORY_DIR=$(find ~/.claude/projects/ -path "*/memory/MEMORY.md" -printf "%h\n" 2>/dev/null | head -1)
echo "=== CC Auto-Memory ==="
wc -l < "$MEMORY_DIR/MEMORY.md" 2>/dev/null
ls -1 "$MEMORY_DIR/" 2>/dev/null | wc -l
grep -c "^type:" "$MEMORY_DIR/"*.md 2>/dev/null | grep -v MEMORY

Thresholds:

MetricOKWARNCRITICAL
MEMORY.md lines<150150-199>=200 (truncated!)
Total files<2020-30>30
Feedback ratio<70%70-85%>85% (skewed)

Check: Flag files present in directory but not referenced in MEMORY.md (orphaned).

Step 2: Agent-Studio Memory Health Check

Command:

echo "=== Agent-Studio Memory ==="
du -sh .claude/context/memory/
find .claude/context/memory/ -type f | wc -l
wc -l .claude/context/memory/learnings.md .claude/context/memory/decisions.md .claude/context/memory/issues.md 2>/dev/null
find .claude/context/memory/ -name "delegations.pid-*.json" | wc -l
find .claude/context/memory/ -name "*.bak" | wc -l

Thresholds:

MetricOKWARNCRITICAL
Directory size<5MB5-10MB>10MB
Total files<120120-200>200
learnings.md lines<300300-500>500 (blocks spawning!)
decisions.md lines<200200-400>400
issues.md lines<300300-500>500
Delegation PID files01-10>10
.bak files01-3>3

Verify: STM/MTM/LTM directories exist with content.

Step 3: JSON Data Store Health

Command:

for f in access-stats.json codebase_map.json gotchas.json patterns.json open-findings.json; do
  echo -n "$f: "
  wc -c < ".claude/context/memory/$f" 2>/dev/null || echo "MISSING"
done

Checks:

  • access-stats.json: verify entries have distinct accessCount values (not all identical = bulk counter, useless)
  • codebase_map.json: count entries vs 500-entry cap
  • gotchas.json: count entries, check for hash-based duplicates
  • patterns.json: count entries, check for hash-based duplicates
  • open-findings.json: flag findings with status: "resolved" older than 30 days (stale)

Step 4: Cross-System Dedup Detection

Compare content between CC auto-memory reference files and agent-studio JSON stores:

  1. Extract gotchas/patterns from CC reference_technical_fixes.md and reference_context_management.md
  2. Compare against gotchas.json and patterns.json entries
  3. Use simple substring matching (>50 char overlap = potential duplicate)
  4. Report duplicates with source locations but do NOT auto-delete

Policy (Gemini consensus): CC auto-memory = thin index/pointers. Agent-studio = deep store. When duplicates found, recommend keeping detail in agent-studio, adding pointer in CC.

Step 5: Named Memory Assessment

Command:

find .claude/context/memory/named/ -type f ! -name ".gitkeep" | wc -l
  • If 0: flag as "unused API — 70+ lib modules support it but nothing uses it"
  • If >0: verify entries are loadable via node -e "require('.claude/lib/memory/memory-manager.cjs').listMemories()"

Step 6: Staleness Detection

Command:

find .claude/context/memory/ -name "*.json" -mtime +30 -not -path "*/archive/*" -not -path "*/ltm/*"
find .claude/context/memory/metrics/ -name "*.json" -mtime +30

Flag entries older than 30 days for review. Do NOT auto-delete — report only.

Step 7: Generate Report

Write structured report to .claude/context/reports/memory-audit-{YYYY-MM-DD}.md:

# Memory System Health Report — {date}

## Health Score: {0-100}/100

## Summary Table

| System | Metric | Current | Threshold | Status |
| ------ | ------ | ------- | --------- | ------ |

## Findings

### P0 (Critical)

### P1 (High)

### P2 (Low)

## Recommendations

1. ...

Health Score Calculation:

  • Start at 100
  • CRITICAL finding: -15 points each
  • WARN finding: -5 points each
  • Orphan detected: -3 points each
  • Duplicate detected: -2 points each
  • Score floor: 0

Auto-Fix Mode (--auto-fix)

When invoked with --auto-fix, the skill will safely clean:

  • Delegation PID files older than 24 hours
  • .bak rotation artifacts
  • Metrics files older than 30 days
  • Empty placeholder files (except .gitkeep)

Will NOT auto-fix:

  • CC auto-memory files (requires user confirmation)
  • learnings.md/decisions.md/issues.md pruning (requires semantic judgment)
  • Cross-system dedup resolution (requires agent reasoning)
  • Named memory API deprecation (architectural decision)

Memory Protocol

Before starting: Read .claude/context/memory/learnings.md for prior audit results. After completing: Write audit summary to learnings.md. Record any new gotchas to gotchas.json via MemoryRecord.

Anti-Patterns

  • Never auto-delete CC auto-memory files without user confirmation
  • Never modify agent-studio memory during audit (read-only by default)
  • Never report raw file contents in summary (counts and sizes only)
  • Never skip cross-system dedup check
  • Never run auto-fix on CC auto-memory directory

Enforcement Hooks

Input validated against schemas/input.schema.json before execution. Output contract defined in schemas/output.schema.json.

Related Skills

  • context-compressor — compress context when audit finds bloat
  • memory-search — semantic search across memory stores
  • proactive-audit — broader framework health check that includes memory

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Ensure accessibility in UI components including semantic HTML, ARIA attributes, keyboard navigation, and WCAG 2.2 AA compliance.

The English summary is being prepared. Showing the original description.

oimiragieo/agent-studio42Updated Jul 14, 2026

Use when you want to improve response quality through meta-cognitive reasoning. Applies 15+ reasoning methods to reconsider and refine initial outputs.

The English summary is being prepared. Showing the original description.

oimiragieo/agent-studio42Updated Jul 14, 2026

N-round opposing-stance debates for trade-off analysis. Assigns pro/con roles to agents, runs structured debate rounds with quality scoring, and produces a moderator synthesis with confidence-rated recommendation. Generalizable to architecture, technology, security, and design decisions.

The English summary is being prepared. Showing the original description.

oimiragieo/agent-studio42Updated Jul 14, 2026

Force adversarial code review stance that eliminates confirmation bias — reviewer must find issues or re-analyze

The English summary is being prepared. Showing the original description.

oimiragieo/agent-studio42Updated Jul 14, 2026

Creates specialized AI agents on-demand when no existing agent matches a request. Use when the Router cannot find a suitable agent for a task. Enables self-evolution by generating persistent agents.

The English summary is being prepared. Showing the original description.

oimiragieo/agent-studio42Updated Jul 14, 2026

LLM-as-judge evaluation framework with 5-dimension rubric (accuracy, groundedness, coherence, completeness, helpfulness) for scoring AI-generated content quality with weighted composite scores and evidence citations

The English summary is being prepared. Showing the original description.

oimiragieo/agent-studio42Updated Jul 14, 2026

See all skills by oimiragieo

Report a problem with this skill