Config GC — Garbage Collection for Claude Code Setups
Borrowed from runtime garbage collection: periodically scan for objects that are no longer referenced, redundant, expired, or low-value, and reclaim the space. The critical difference: here, collection requires a human in the loop. Never delete autonomously.
When to Activate
- The user asks to clean up, audit, or slim down their Claude Code configuration
- The user complains about too many skills, noisy hooks, or slow session startup
- A monthly/periodic config review is due
- After installing a large skill pack (e.g. this repo), to reconcile overlaps with existing setup
Do NOT activate for: cleaning project source code (that's refactoring), clearing chat history, or uninstalling Claude Code itself.
Design Philosophy
- Append-only configs leak. Skills, memory files, hooks, and permission entries only ever get added. Without periodic review they rot silently.
- Regular audits beat one-time purges. Scan every ~30 days, propose a small batch of candidates each time.
- Per-channel strategies. Each accumulation type (skills, hooks, permissions, ...) has its own staleness signals — don't apply one rule everywhere.
- Soft-delete first. Rename to
.disabled> move to~/.claude/_gc_trash/> real deletion. Always keep an undo path. - Forced human-in-the-loop. Every candidate gets its own
[y/n/skip]confirmation. No "yes to all" shortcut. - Keep a log. Every GC run appends to
~/.claude/gc_log.md: what was touched, why, and how to undo it.
Scan Channels
Workflow
- Scan all channels (or the subset the user names). Collect candidates with: path, channel, signal that flagged it, size, last-modified.
- Rank by confidence (broken/orphaned = high; merely old = low) and present as a numbered table. Cap each run at ~20 candidates — GC is periodic, not exhaustive.
- Confirm one by one. For each candidate show the evidence, then ask
[y/n/skip]. The user can stop at any point. - Soft-delete confirmed items: prefer
.disabledrename for skills/hooks and_gc_trash/<date>/move for files. Permission entries live in JSON (no comments possible): back up the settings file, record each removed entry verbatim ingc_log.md, then remove it from theallowarray withjq. Only hard-delete when the user explicitly asks. - Log the run to
~/.claude/gc_log.md: timestamp, items actioned, undo instructions. - Report: reclaimed size, channels still healthy, suggested next review date.
Example Scan Commands
Orphaned hook scripts (channel 3) — scripts on disk that no hook config references:
Redundant permission entries (channel 4) — duplicates, and specific grants shadowed by a wildcard:
Largest stale caches (channel 8) — du -k instead of GNU-only find -printf, so it works on macOS/BSD too:
Soft-delete with undo path (capture the date once so the log can't disagree with the directory):
Removing a confirmed-redundant permission entry (JSON has no comments — back up, log, then edit):
Anti-Patterns
- Bulk approval. Asking "delete all 15? [y/n]" defeats the design. One item, one decision.
- Hard-deleting on first pass. If there's no
_gc_trash/copy or.disabledrename, you did it wrong. - Treating "old" as "dead". A skill untouched for 60 days may be seasonal (tax season, quarterly reviews). Age is a signal, not a verdict — that's why a human confirms.
- Cleaning memory by truncation. Merging two contradicting memory files requires reading both and keeping the newer truth, not deleting the longer one.
- Touching anything outside
~/.claude(or the project's.claude/). Config GC never wanders into source trees.
Best Practices
- Run after big additions, not just on a calendar: installing a 50-skill pack is exactly when overlap with existing skills appears.
- When two skills overlap, prefer disabling the one with the weaker trigger description — it's the one that was probably never firing anyway.
- Permission cleanup is the highest-value channel per minute spent: redundant allow-entries make security review harder.
- Keep
gc_log.mdforever. It's tiny, and "when did I disable that hook and why" comes up more often than you'd think.
Related Skills
skill-stocktake— audits skill quality; config-gc audits skill existence. Run stocktake on what survives GC.workspace-surface-audit— the additive counterpart: recommends what to install. config-gc is the subtractive half of the same lifecycle.configure-ecc— after installing skills with it, run config-gc to reconcile overlaps with your pre-existing setup.continuous-learning— produces the memory files this skill later audits.security-review— pairs well with the permissions channel.


