/deep-work:deep-cleanupfrom deep-work
Scans and cleans up stale deep-work git worktrees (dw/* branches) and fork worktrees, pruning idle fork sessions. Invoked via /deep-cleanup or 'clean worktrees'.
Ships in deep-work. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
| 인자 | 의미 |
|---|---|
| (없음) | Stale worktree 스캔 → AskUserQuestion 분기 |
빈 args / 매칭되지 않는 토큰 → 본문의 default 분기로 진입.
Utility — standalone 명령.
/deep-workinit이 stale 세션 일부를 감지하지만,git worktree list스캔·stale/active 분류·dirty 트리 삭제 확인·fork worktree 및 registry 정리는 이 커맨드가 유일한 경로입니다. 향후 기능 이관 후 삭제 예정.
Scan for stale deep-work worktrees and offer cleanup options.
Read(${CLAUDE_PLUGIN_ROOT}/skills/shared/references/user-language.md) and follow it.
git worktree list 2>/dev/null
If not a git repo or no worktrees exist:
ℹ️ Git worktree가 없습니다.
Stop here.
Filter for worktrees with dw/ in the branch name (deep-work convention).
Read(${CLAUDE_PLUGIN_ROOT}/skills/deep-resume/references/session-detection.md) and apply only its Reusable session-state resolution section to resolve $STATE_FILE; retain this skill's own no-session and standalone-mode behavior.
For each deep-work worktree:
stat -f "%Sm" -t "%Y-%m-%d" [path] (macOS) or stat -c "%y" [path] (Linux)$STATE_FILE) when resolution returned activeworktree_path matches this worktree AND current_phase is not idle → activegit -C [path] status --porcelainDeep Work Worktrees
┌────────┬──────────────────────┬──────────┬──────────┬───────────┐
│ # │ Branch │ Age │ Status │ Changes │
├────────┼──────────────────────┼──────────┼──────────┼───────────┤
│ 1 │ dw/add-model-routing │ 3 days │ active │ clean │
│ 2 │ dw/fix-receipt-bug │ 12 days │ stale │ dirty │
│ 3 │ dw/old-feature │ 30 days │ stale │ clean │
└────────┴──────────────────────┴──────────┴──────────┴───────────┘
stale = 7일 이상 + 활성 세션 없음
active = 현재 활성 세션의 worktree (삭제 불가)
If no stale worktrees:
✅ 모든 worktree가 활성 상태이거나 7일 이내입니다. 정리할 것이 없습니다.
Stop here.
Use AskUserQuestion:
stale worktree를 정리할까요?
1. clean stale 삭제 — 변경사항 없는 stale worktree만 삭제
2. 모든 stale 삭제 — dirty 포함 모든 stale worktree 삭제
3. 개별 선택 — 하나씩 선택하여 삭제
4. ❌ 취소
For each worktree to delete:
⚠️ [branch]에 커밋되지 않은 변경이 있습니다. 강제 삭제?
git worktree remove [path] # clean
git worktree remove --force [path] # dirty (after confirmation)
git branch -D [branch] # remove the branch too
[branch] 삭제 완료Cleanup 완료
삭제: [N]개 worktree
유지: [M]개 worktree (active 또는 사용자 선택)
기존 worktree 스캔 로직(Step 1-6)에 추가로 fork 세션 정리를 수행한다.
레지스트리(.claude/deep-work-sessions.json)에서 fork_parent가 있는 세션 중 current_phase가 idle인 것을 식별한다.
# 레지스트리에서 idle fork 세션 추출
node -e '
const fs = require("fs");
const reg = JSON.parse(fs.readFileSync(".claude/deep-work-sessions.json", "utf8"));
const forks = Object.entries(reg.sessions)
.filter(([_, s]) => s.fork_parent && s.current_phase === "idle")
.map(([id, s]) => ({ id, parent: s.fork_parent, worktree: s.worktree_path }));
console.log(JSON.stringify(forks));
' 2>/dev/null
해당 세션의 worktree_path가 있으면 정리 대상에 포함한다.
부모와 모든 fork 자식이 전부 idle이면 배치 정리를 제안한다:
부모 세션 {parent_id}와 모든 fork 세션이 완료되었습니다. 전체 정리하시겠습니까?
1. 전체 정리 — 부모 + 모든 fork worktree 삭제
2. Fork만 정리 — fork worktree만 삭제, 부모 유지
3. 개별 선택
4. ❌ 취소
각 fork worktree에 대해:
git worktree remove {worktree_path} 실행git branch -D {fork_branch}fork_children에서도 해당 항목 제거Fork Cleanup 완료
삭제: [N]개 fork worktree
유지: [M]개 fork worktree (active 또는 사용자 선택)
레지스트리 정리: [K]개 세션 제거
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
deep-work@claude-deep-suite is listed by sungmin-cho/deep-suite — review the source before installing
npx claudepluginhub sungmin-cho/deep-suite --plugin deep-work27 skills in this plugin
/deep-assumptionsAssumption health report — per-assumption Wilson Score confidence, verdict (justified / loosen / drop), model-aware split, decay history. Triggers on `/deep-assumptions`, `/deep-status --assumptions`, "assumption health", "rule justification", "loosen enforcement", "어썸션 헬스", "규칙 정당화", "가정 검증". Sub-page of the deep-status hub./deep-brainstormUse when clarifying the goal, boundaries and approach for a deep-work task./deep-debugDebug sub-mode for Phase 3 — Investigate → Analyze → Hypothesize → Implement, with the iron rule that no fix ships before root-cause investigation. Triggers on `/deep-debug`, "systematic debug", "root cause investigation", "디버그 모드", "근본 원인 분석", `verification_cmd` 실패 시 자동 진입, or "fix this"./deep-finishUse when finishing an authorized deep-work session with keep, PR, merge or discard and a durable receipt./deep-forkCreate an isolated deep-work branch for a parallel slice, alternative experiment, independent review, recovery, or security isolation. Same-goal context continuation is not a fork reason./deep-historyCross-session deep-work history — completed sessions, TDD compliance rates, model usage, aggregate trend indicators. Triggers on `/deep-history`, `/deep-status --history`, "session history", "deep-work history", "세션 이력", "이전 세션", "TDD 준수율 트렌드". Sub-page of the deep-status hub.Other plugins' skills for the same job