Skip to content
Skills Library
AI & agents · Review & audit

memory-clean

/memory-clean

Use when a human asks to audit memory or find stale or duplicate memories. Not for writing new memories: use memory-update.

Licence
Apache-2.0
Last repository change
10.11.2026

Assessment and security

90/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content25 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
5
Scripts
1
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 10.11.2026, without references to retired models or APIs.

Licence

Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.

What to check before installing
  • 1 scripts in this package. Review them before installing, as Claude may execute them.

Scripts: scripts/audit-memory.py

What it does and when to use it

Use when a human asks to audit memory or find stale or duplicate memories. Not for writing new memories: use memory-update.

Original author description

Use when a human asks to audit memory or find stale or duplicate memories. Not for writing new memories: use memory-update.

How it works

  1. What you need before you start
  2. Resolving the store location
  3. Auditing and repairing in order
  4. When something goes wrong
  5. What you hand back
Original SKILL.md headings · 44 lines, 893 words
SKILL.md preview
---
name: memory-clean
description: 'Use when a human asks to audit memory or find stale or duplicate memories. Not for writing new memories: use memory-update.'
disable-model-invocation: true
---

# Memory clean

Durable memory rots: entries go stale, near-duplicates accumulate, index links dangle, and suspected credentials creep in. This skill audits the memory store, shows the human exactly what it proposes to change, applies only what the human confirms, and proves the result with a fresh audit. Start it only when a human explicitly asks to audit memory or find stale or duplicate memories. Writing new memories belongs to memory-update, not here.

Every repair is human-gated. Preview each target and its consequence, and get explicit confirmation for each repair group before changing data at rest in `$MEMORY_DIR`, which lives outside version control by default. An override the resolver reports git would track is refused. The only other write is the snapshot copy taken first, and rollback restores the store from that snapshot.

## What you need before you start

- The project whose durable memory store is being audited, or an explicit `MEMORY_DIR` override.
- The sibling skill memory-update in the same plugin. The path resolver lives there, so memory-clean cannot run without it.
- Optionally, `SESSION_HISTORY_GLOB` for session-based staleness evidence. `MEMORY_CLEAN_SKILL_SCRIPTS` relocates only the bundled `audit-memory.py`; it never selects the resolver.
- The path resolver must produce an existing memory directory. Session history may be omitted, but then session-based feedback staleness cannot be assessed and must be reported as unavailable.

## Resolving the store location

Run `../memory-update/scripts/resolve-paths.sh memory_dir` and `../memory-update/scripts/resolve-paths.sh session_history_glob`. When `MEMORY_UPDATE_SKILL_SCRIPTS` is set, run `$MEMORY_UPDATE_SKILL_SCRIPTS/resolve-paths.sh` instead; that variable is memory-update's relocate hook, not a clean-skill hook. Reject resolver errors, control characters, forbidden shell metacharacters, and unsafe whitespace rather than interpreting them. The resolver refuses a memory directory git would track. Move on only when both paths resolve without error; otherwise stop with a blocked diagnostic.

## Auditing and repairing in order

1. State the scope boundary: the resolved `$MEMORY_DIR` and nothing else. Do not create new memories, edit another store, redact suspected credentials, or widen the requested scope. This step holds when the boundary is stated and no out-of-scope target is queued.
2. Before any repair, take a timestamped recursive snapshot of `$MEMORY_DIR` in `/tmp` and record its path. This step holds when the snapshot directory exists and its path is recorded, or when the run stops without changing the store.
3. Run `audit-memory.py "$MEMORY_DIR" "$SESSION_HISTORY_GLOB"` and preserve its JSON output. The deterministic audit checks index orphans and dangling links, schema and required sections, index size limits, credential patterns, fix-recipe and path-pinned content, relative dates, body-line Jaccard similarity above 0.70, missing reference targets, past project dates without historical-anchor phrases, and feedback rules contradicted by session evidence. This step holds when the JSON report is captured and preserved regardless of exit status.
4. Render every finding under exactly one severity (critical, warning, informational) with its evidence attached. For each staleness finding, include the reported session identifiers and available contradiction context. Label unavailable session evidence instead of inventing it.
5. Group proposed repairs by mechanism and show an exact preview of each: add an orphan to `MEMORY.md`; remove a dangling index line; merge a near-duplicate pair while naming the superseded file and index update; make a targeted structural edit; or update, archive, or delete a stale memory. Show a file's content before proposing its deletion. For a suspected credential, report the critical finding and make no redaction. Nothing unpreviewed gets queued for repair.
6. Get explicit human confirmation separately for each repair group. Confirmation for one group never authorizes another. Unconfirmed groups stay unchanged. This step holds when every repair group has a confirmed or unconfirmed decision recorded.
7. Apply only confirmed repairs inside `$MEMORY_DIR`, preserving unrelated content. When an applied repair fails partway, stop further mutation and restore every file that group touched from the snapshot before reporting the failure.
8. Re-run the same audit against the same resolved inputs. Success needs zero critical findings. Report all residual warning and informational findings. Do not claim success when the audit fails, evidence is unavailable, or critical findings remain.

## When something goes wrong

- Invalid or missing path: stop before snapshot or mutation and return `blocked` with the resolver diagnostic.
- Memory directory git would track: stop before snapshot or mutation and return `blocked: MEMORY_DIR is inside version control`.
- Snapshot failure: stop without mutation and return `blocked` with the failed snapshot target.
- Audit failure or malformed report: keep any valid partial report, make no repairs, and return `blocked` with the diagnostic. Never infer omitted findings.
- Missing staleness evidence: complete the structural checks, mark session-based staleness unavailable, and return `blocked` rather than treating absence of evidence as freshness.
- Confirmation absent or ambiguous: leave that repair group unchanged and report it as unconfirmed.
- Partial repair failure: stop, restore that group's touched files from the recorded snapshot, and report the attempted changes and the restoration result. When restoration fails, return `blocked` and identify every potentially changed file.
- Critical findings after re-audit: return `non-converged` with the remaining critical findings and residual warnings or information. Do not widen scope or invent a fix.

## What you hand back

The snapshot path, the resolved audit scope, the severity-grouped JSON findings, per-group previews and confirmation decisions, applied and restored file lists, the fresh re-audit result, residual warnings and information, and exactly one terminal classification: `complete`, `blocked`, or `non-converged`. The `complete` reading is valid only when the fresh audit contains zero critical findings.
Files in this package (5)
  • SKILL.md 6 KB
  • agents/openai.yaml 1 KB
  • references/AUDIT-CHECKLIST.md 4 KB
  • references/STALENESS-RULES.md 4 KB
  • scripts/audit-memory.py 13 KB

Versions

RepositoryScoreLicence
This page · gosuda/dalcom-skills90Apache-2.0
OutlineDriven/odin-codex-plugin100Apache-2.0
OutlineDriven/outline-driven-development90Apache-2.0

Database snapshot: 13.11.2026 · package version 0f2243fb7d4c (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 90clean-claude-memory
    Audit, prune, rewrite, or relocate Claude Code project memory. Use when the user asks to review, clean, update, or remove Claude memory files, eliminate stale project memories, or rebuild MEMORY.md.
  • 100audit-memories
    Audit an AI agent's saved memories — inventory them by type and age, flag the ones that look stale, contradictory, redundant, or orphaned (verified against the current repo), then walk the user through keep/update/merge/delete decisions one at a time. Default target is Claude…
  • 100memory-audit
    Audit the project's persistent agent memories for backfire-risk, stale/superseded state, contradictions, redundancy, and bloat. Lists problems for the user to disposition - does NOT auto-correct. Surfaced on a 14-day cadence by a SessionStart hook. Use when the user asks to…
  • 100claude-remember
    Review auto-memory entries and produce a report of proposed promotions across the memory hierarchy (project-level, user-level, daily log, shared), plus cleanup of duplicate, outdated, and conflicting entries. Adaptable to any AI agent's memory layout. Use when the user wants to…
  • 98knowledge
    Browse, search, and prune what the framework's agents remember across sessions (native agent memory under ~/.claude/agent-memory/, plus project Serena memories), and detect and migrate orphaned bare-named memory directories — use when asked "what do the agents remember", "browse…
  • 90memory-update
    Use when the user explicitly says to save something to memory or scan this session for memories. Not for auditing memory: use memory-clean.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.