A single-purpose skill for tidying up messy files. Call it when auto-cleanup-hook issues a warning, or as a regular housekeeping task.
Preconditions: Before destructive operations (archive moves, line deletions), check whether important information in Plans.md / session-log.md has already been promoted to the SSOT (decisions.md / patterns.md). If not synced, run
/memory syncfirst.
Quick Reference
| Subcommands | Target | Typical trigger |
|---|---|---|
maintenance plans |
Archiving completed tasks in Plans.md | "Tidy up Plans.md," "Move old tasks" |
maintenance session-log |
Monthly splitting of session-log.md | "Split session-log," "Log is too long" |
maintenance logs |
.claude/logs/ Deleting old files |
"Clean up logs," "Delete logs older than 30 days" |
maintenance state |
agent-trace.jsonl / harness-usage.json Trim |
"trace bloat," "state compression" |
maintenance all |
Execute the above four in order | "Tidy everything," "Full cleanup" |
--dry-run Adding this only lists what will be done without executing it. Free-form instructions (e.g.
"Delete old archives too," "Keep only this session-log") are accepted in Step 1
and reflected in the processing parameters from Step 2 onward.
Execution steps
- Parse user instructions: Extract the subcommand + free-form text (exclusions, save destination, day threshold)
- SSOT sync check:
.claude/state/.ssot-synced-this-sessionIf there is no/memory syncprompt (required only when touching Plans.md) - Open referenced files:
${CLAUDE_SKILL_DIR}/references/cleanup.mdRead and execute the corresponding section - Report Before/After: Display the number of lines and number of deletions, then finish
Subcommand details
See cleanup.md for the execution steps, thresholds, and archive destination for each target.
Integration with auto-cleanup-hook
PostToolUse hook (scripts/auto-cleanup-hook.sh / Go version auto_cleanup_hook.go) returns
/maintenance で古いタスクをアーカイブすることを推奨します and feedback when it detects that Plans.md, session-log.md, or CLAUDE.md exceeds the line limit.
When you see this warning, run the corresponding subcommand.
Notes
- Do not move in-progress tasks:
cc:WIP,pm:依頼中,cursor:依頼中is excluded from archiving - The archive destination directory is fixed:
.claude/memory/archive/— When moving to another location, confirm with the user - Backup: Before editing a file with more than 200 lines, take a
local backup with
cp <file> <file>.bak.$(date +%s)take a local backup with - CLAUDE.md is warning-only: Do not edit automatically. Only propose splitting
Related skills
memory— SSOT promotion before tidying Plans.md (updating decisions.md / patterns.md)harness-setup— Regular maintenance immediately after setup can also be invoked viaharness-setupcan also be called viasession-init— Controls maintenance recommendation notifications at session start