memory-clean
Audit memory directory for structural issues (orphans, dangling refs, duplicates, missing sections, oversized entries) and staleness against session-history transcripts; report-first, fix-on-confirmation. Use when the user says "audit memory", "memory hygiene", or "find stale/duplicate memories".
What this skill does
Audit memory for structural rot and staleness, report with evidence, fix only on user confirmation.
## Scope
Audits and fixes existing memory files. Does not create new memories from session signals (that is `memory-update`). Does not redact PII or credentials (that is `memory-sanitize`, which `memory-clean` will recommend when it detects suspected credentials at critical severity).
## Path resolution
Scripts live under this skill's own `scripts/` directory. Resolve the skill root from `$HOME` (the conventional install path is `$HOME/.claude/claude/skills/memory-clean/`):
```sh
SKILL_SCRIPTS="${MEMORY_CLEAN_SKILL_SCRIPTS:-$HOME/.claude/claude/skills/memory-clean/scripts}"
MEMORY_DIR=$("$SKILL_SCRIPTS/resolve-paths.sh" memory_dir)
SESSION_HISTORY_GLOB=$("$SKILL_SCRIPTS/resolve-paths.sh" session_history_glob)
```
Set `MEMORY_CLEAN_SKILL_SCRIPTS` to override when the skill is installed outside `$HOME/.claude`. Abort on non-zero exit from the resolver. Overrides via `MEMORY_DIR` / `SESSION_HISTORY_GLOB` env vars.
## Workflow
### 1. Resolve paths (above)
### 2. Snapshot before any fix
```sh
cp -r "$MEMORY_DIR" /tmp/memory-snapshot-$(date +%s)
```
Never mutate originals without a snapshot.
### 3. Run structural audit
```sh
./scripts/audit-memory.sh "$MEMORY_DIR" "$SESSION_HISTORY_GLOB" > /tmp/memory-audit-$(date +%s).json
```
The script emits JSON with these arrays:
| Field | What it detects |
|---|---|
| `orphans` | Files in dir with no MEMORY.md entry |
| `dangling` | MEMORY.md entries pointing to missing files |
| `near_duplicates` | File pairs with >70% content overlap |
| `structural` | Missing frontmatter, missing **Why:**/**How to apply:**, index line > 150 chars, MEMORY.md > 200 lines, type-mismatch, fix-recipe content |
| `staleness` | Memories whose stated rule conflicts with recent session evidence |
Read `references/AUDIT-CHECKLIST.md` for full detection rules per category.
### 4. Render report grouped by severity
```
CRITICAL (N)
[cred-scan] feedback_no-html-comments.md — suspected credential on line 7
→ Recommend: run memory-sanitize first
WARN (N)
[near-dup] feedback_consistent-config.md ↔ feedback_no-html-comments.md (82% overlap)
[stale] feedback_bump-minor-versions.md — rule contradicted in 4 recent sessions
Evidence: turns uuid-aaa, uuid-bbb, uuid-ccc, uuid-ddd
INFO (N)
[orphan] user_role_data_scientist.md — not in MEMORY.md index
[index-long] project_auth-rewrite.md — index entry is 163 chars (limit 150)
```
For staleness items, always show the specific turn IDs and a snippet of the contradicting evidence.
### 5. Wait for confirmation per group
Present each fix group with a diff preview. Wait for explicit user confirmation before applying. Never auto-fix.
### 6. Apply confirmed fixes
- Orphan: append entry to MEMORY.md.
- Dangling: remove line from MEMORY.md.
- Near-duplicate: present merged draft; write merged file + remove the superseded one; update MEMORY.md.
- Structural: targeted in-place edit via `Edit` tool.
- Stale: present options — update the rule, archive the file, or delete it.
### 7. Re-run audit; confirm zero critical issues
```sh
./scripts/audit-memory.sh "$MEMORY_DIR" "$SESSION_HISTORY_GLOB"
```
Report residual warn/info items; leave them for the user to act on separately if desired.
## Anti-patterns (never do)
- Auto-fix without user confirmation.
- Mutate originals without the `/tmp/` snapshot.
- Delete a file without showing the user its content first.
- Attempt credential redaction (surface critical flag, recommend `memory-sanitize`).
Related in Security
mac-ops
IncludedComprehensive macOS workstation operations — diagnose kernel panics, identify failing drives, audit launchd startup items, decode wake reasons, triage TCC permission denials, manage APFS snapshots, recover from no-boot. Use for: Mac is slow, slow bootup, won't boot, kernel panic, kernel_task hot, mds_stores CPU, photoanalysisd, cloudd, login loop, gray screen, sleep wake failure, drive failing, IO errors, APFS snapshots eating space, Time Machine local snapshots, Spotlight indexing, launchd, LaunchAgent, LaunchDaemon, login items, TCC permissions, Full Disk Access, Screen Recording denied, Gatekeeper, quarantine, com.apple.quarantine, app is damaged, helper tool, /Library/PrivilegedHelperTools, pmset, wake reasons, dark wake, sysdiagnose, panic.ips, DiagnosticReports, configuration profile, MDM profile, remote diagnostics over SSH.
a11y-audit
IncludedRun accessibility audits on web projects combining automated scanning (axe-core, Lighthouse) with WCAG 2.1 AA compliance mapping, manual check guidance, and structured reporting. Output is configurable: markdown report only, markdown plus machine-readable JSON, or markdown plus issue tracker integration. Use this skill whenever the user mentions "accessibility audit", "a11y audit", "WCAG audit", "accessibility check", "compliance scan", or asks to check a web project for accessibility issues. Also trigger when the user wants to verify WCAG conformance or map findings to a specific standard (CAN-ASC-6.2, EN 301 549, ADA/AODA).
erpclaw
IncludedAI-native ERP system with self-extending OS. Full accounting, invoicing, inventory, purchasing, tax, billing, HR, payroll, advanced accounting (ASC 606/842, intercompany, consolidation), and financial reporting. 413 actions across 14 domains, 43 expansion modules. Constitutional guardrails, adversarial audit, schema migration. Double-entry GL, immutable audit trail, US GAAP.
assess
IncludedAssesses and rates quality 0-10 across multiple dimensions (correctness, maintainability, security, performance, testability, simplicity) with pros/cons analysis. Compares against project conventions and prior decisions from memory. Produces structured evaluation reports with actionable improvement suggestions. Use when evaluating code, designs, architectures, or comparing alternative approaches.
spring-boot-security-jwt
IncludedProvides JWT authentication and authorization patterns for Spring Boot 3.5.x covering token generation with JJWT, Bearer/cookie authentication, database/OAuth2 integration, and RBAC/permission-based access control using Spring Security 6.x. Use when implementing authentication or authorization in Spring Boot applications.
code-hardcode-audit
IncludedDetect hardcoded values, magic numbers, and leaked secrets. TRIGGERS - hardcode audit, magic numbers, PLR2004, secret scanning.