본문으로 건너뛰기
cccskills
무료GitHub에 공개

cleanup-memory

Two-phase memory hygiene. Phase 1: scan external Claude Code memory (~/.claude/projects/<slug>/memory/) for durable rules to migrate into the repo and entries already duplicated by repo atoms. Phase 2: audit in-repo memory/, CLAUDE.md, docs/architecture/, and docs/sections/ for dead links, duplication, drift, and bloat.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(1)

  • SKILL.md7.2 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Cleanup Memory

Two surfaces:

  • External — ~/.claude/projects/<slug>/memory/ (per-machine; never hardcode the path)
  • Repo — memory/, CLAUDE.md, docs/architecture/design-rules.md, docs/architecture/code-review-rules.md, docs/sections/

Repo memory/ is the source of truth for durable project rules (syncs via git). External holds only about-Peter / user-pref entries and active-PR working state. Read memory/META.md before working.

Arguments

  • (none) — both phases: external → repo → consolidated report → ask → execute
  • external — Phase 1 only
  • repo — Phase 2 only
  • report-only — full report, no changes

Hard Rules

  • Never hardcode the external memory path. Derive at runtime (see below).
  • Never delete a file before confirming the rule survives somewhere. Diff content; don't match by filename alone.
  • Always work in the workspace memory/process/always-use-worktree.md selects. Locally that is a worktree at .claude/worktrees/cleanup-memory-<date> and the main checkout is never edited; in a cloud run it is the repo root on the branch.
  • Migration PRs never modify the same file twice. Add atom (PR A), merge, then consolidate (PR B).

Discovering the External Memory Directory

Slug = absolute git root with :, /, \ replaced by -. Example: H:\source\Humans → H--source-Humans.

PROJECT_ROOT="$(git rev-parse --show-toplevel)"
REPO_NAME="$(basename "$PROJECT_ROOT")"
EXT_DIR=""
for d in "$HOME"/.claude/projects/*/memory; do
  [ -f "$d/MEMORY.md" ] || continue
  parent_slug="$(basename "$(dirname "$d")")"
  if echo "$parent_slug" | grep -qi "$REPO_NAME" \
     || grep -qiE "(humans|nobodies)" "$d/MEMORY.md" 2>/dev/null; then
    EXT_DIR="$d"; break
  fi
done
if [ -z "$EXT_DIR" ]; then
  SLUG="$(printf '%s' "$PROJECT_ROOT" | sed 's|[:/\\]|-|g')"
  candidate="$HOME/.claude/projects/$SLUG/memory"
  [ -d "$candidate" ] && EXT_DIR="$candidate"
fi

If still empty, ask Peter — do not guess. Phase 1 has nothing to do on a fresh machine; skip to Phase 2.


Phase 1 — External Memory Scan

Classify every file in $EXT_DIR:

BucketCriteriaAction
A. Already in repoBody substantively present in a repo atom (verify content, not filename)Delete from external after Peter approves
B. About-Peter / user-prefWorking style, tool preferences, interaction rulesKeep
C. Active-PR / ephemeralMentions in-flight branch/PR/worktree or "in progress" stateKeep
D. Durable rule, not in repoImperative rule with Why:/How to apply:, architecture/process/code-conventionMigrate

If a repo atom is weaker than the external version (drops a constraint or "why"), treat as D and propose strengthening the atom — don't just mark it A.

Procedure

  1. ls "$EXT_DIR". Read MEMORY.md first — it indexes everything and often pre-classifies files.
  2. Read every *.md under $EXT_DIR.
  3. Cross-reference against memory/**/*.md by content (naming conventions diverge: external uses feedback_foo_bar.md, repo uses bucket/foo-bar.md).
  4. Build a per-file table: filename | bucket | reason | proposed action. Surface it to Peter and pause.
  5. Apply approved actions:
    • A deletions: rm "$EXT_DIR/<file>". Update $EXT_DIR/MEMORY.md to drop index lines.
    • D migrations: Enter the workspace — locally create the worktree and EnterWorktree into it (mandatory; without this, edits land in the main checkout), in a cloud run just check the branch out in the repo root — then write memory/<bucket>/<kebab-name>.md (frontmatter per memory/META.md), add INDEX line (alphabetical within bucket), commit, push, open PR. Do NOT delete the external file in the same PR — wait until the migration PR merges.

Phase 2 — In-Repo Hygiene Scan

Files in Scope

memory/INDEX.md, memory/META.md, memory/**/*.md, CLAUDE.md, docs/architecture/design-rules.md, docs/architecture/code-review-rules.md, docs/architecture/coding-rules.md, docs/sections/*.md

Checks

Each finding: severity (BLOCK / IMPORTANT / NIT), location, what's wrong, proposed fix.

  1. Dead INDEX entries. Every memory/INDEX.md line → verify file exists. Missing → BLOCK.
  2. Orphan atoms. Every memory/<bucket>/*.md → verify INDEX entry exists. Missing → BLOCK.
  3. Description sanity. Each atom needs non-empty description: frontmatter (BLOCK if missing). INDEX one-liner must share at least one substantive noun with the atom's description — catches drift. Do NOT flag wording differences; by design the INDEX line is a tighter compression.
  4. Bucket misplacement. Atom lives under wrong bucket (architecture/, code/, process/, product/) per META.md definitions → IMPORTANT.
  5. Content duplication. Same-bucket pairs (and likely cross-bucket conflicts) with substantive overlap → IMPORTANT, propose merge or split.
  6. Atom vs constitution drift. For each atom, check against docs/architecture/design-rules.md:
    • Consistent → fine
    • Conflicts → BLOCK
    • Strictly redundant (verbatim, no new "why"/"how to apply") → NIT, propose deletion or 1-line pointer
  7. CLAUDE.md bloat. Target ~80 lines (per memory/META.md). Over by >20% → IMPORTANT. Candidates to atomize: bulleted rules under "Critical:"/"Important:"/"Rule:" headings, detailed concept sections for narrow tasks. Keep: architecture overview, build commands, terminology, git workflow basics.
  8. Stale stub. docs/architecture/coding-rules.md should be a redirect-only stub to memory/INDEX.md. Any crept-in content → IMPORTANT.
  9. Stale cross-references. Grep for coding-rules.md references pointing at it for substantive content → IMPORTANT.
  10. Atom size. Atoms >80 lines likely belong in design-rules.md → NIT.
  11. Section invariants alignment. Each docs/sections/*.md — dead citations to atoms or design-rules sections → IMPORTANT.

Outputs

Consolidated report grouped by severity → present to Peter → apply approved fixes on a new branch + PR, in the same workspace pattern as Phase 1. BLOCK first; IMPORTANT next; NIT only if Peter opts in.


End-to-End Pacing (no arguments)

  1. Phase 1 inventory + classification → report → pause
  2. Execute Phase 1 approved actions (migration PR; deletions queued post-merge)
  3. Phase 2 audit → report → pause
  4. Execute Phase 2 fixes in a separate worktree + PR (don't stack with Phase 1 — overlapping files)
  5. After both PRs land, complete Phase 1 deletions of migrated duplicates

report-only: stop after each phase's report.

What This Skill Is NOT

  • Not for inventing new rules — use memory/process/rules-maintenance.md
  • Not a CLAUDE.md rewrite — Phase 2 finds candidates; the rewrite is a separate focused PR
  • Not a doc-freshness sweep — that's /freshness-sweep

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

check-pr

무료

Check an externally created PR for coding rule violations against memory/INDEX.md atoms and docs/architecture/code-review-rules.md.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

nobodies-collective/Humans42026년 10월 20일 업데이트

Review, repair and steward the nightly Codex debt-sweep PR (branch codex/daily-debt/<date>). Judges every commit GOOD / REPAIR / REVERT, triages the bot review findings through /fix, lands one round-1 commit, files follow-up issues, then stewards the PR itself with a 3-round ceiling. Run by the 08:00 UTC cloud routine; also '/debt-review', '/debt-review 1789'.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

nobodies-collective/Humans42026년 10월 20일 업데이트

Autonomous themed tech-debt cleanup. Reads docs/architecture/debt-ledger.yml, rotates to the least-recently-served debt theme, works it for a time budget (default 2h) or until drained, opens one PR, and asks judgment questions inline at the end. Use for daily debt burndown without Peter pointing at a target: grandfathered analyzer rules, architecture-test baselines, obsolete-field reads, cross-section stitching.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

nobodies-collective/Humans42026년 10월 20일 업데이트

ef-regen

무료

Scrap and regenerate the in-flight EF migrations on the current branch as one consolidated migration. Use when migrations have accumulated mid-development cruft (added/removed columns, stacked add-column-to-existing-table fixes, hand-edited SQL that needs to come out, schema changes that should have been one migration but ended up as five), or when the branch has merged main and its migrations are now stuck mid-chain so `dotnet ef migrations remove` is unsafe. Triggers on phrases like 'regen the migrations', 'redo these migrations', 'scrap and regen migrations', 'consolidate the in-flight migrations', 'redo the migration stack', or any time an agent hits the mid-chain situation in `memory/architecture/migration-regen-after-rebase.md`.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

nobodies-collective/Humans42026년 10월 20일 업데이트

Use when a sprint tracking issue (label `sprint`) on peterdrier/Humans needs working — routine-fired cloud runs, or any unattended session told to execute the sprint queue.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

nobodies-collective/Humans42026년 10월 20일 업데이트

finish

무료

End-of-session cleanup for coding and project work. Use when the user says "finish", "wrap up", "done for now", or any variation of ending a work session.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

nobodies-collective/Humans42026년 10월 20일 업데이트

nobodies-collective의 스킬 모두 보기

이 스킬의 문제 신고