{"definition_raw":"---\nid: worktree-reaper\ntitle: Daily broad worktree cleanup across workspace + PKA + mission-control (incl. kanban-worktrees)\nschedule: \"30 4 * * *\"\ntimeout: 900\nretry: false\nenabled: true\nnotify_on: failure\nrun_as: shell\ncommand: \"/usr/bin/python3 /home/lucienne/workspace/scripts/worktree-reaper.py --prune --quiet\"\ntags: [infrastructure, maintenance, disk]\nruntime_profile: direct_no_llm\n---\n\nWeekly (Sunday 04:30 SAST). Broad sweep across both repos \u2014 complements the daily `cleanup-stale-worktrees` task by also covering `PKA/.claude/worktrees/` and orphan worktrees that have no matching MC ticket.\n\nAuto-prunes any worktree that is BOTH clean (no uncommitted changes, zero commits ahead of master) AND either has a done/cancelled ticket or has no linked ticket at all. Open tickets (inbox / in_progress / needs_input / in_review) are left alone even when empty \u2014 a worker may just not have committed yet. The current working directory is never pruned.\n\nRun in report mode for a survey: `python3 ~/workspace/scripts/worktree-reaper.py` \u2014 prints a table with ticket id, status, age, commits ahead, uncommitted count, size and verdict. Add `--json` for machine-readable output.\n\nLogs to `~/workspace/logs/worktree-reaper.log` \u2014 one line per run with scanned/safe/manual/removed/failed counts and MB freed.\n\nCreated 2026-04-20 from MC-1050 (follow-up to MC-1037).\n","id":"worktree-reaper","last_run":{"duration_s":5.030486,"log_path":"/home/lucienne/workspace/logs/task-runs/worktree-reaper/413584.log","output":"","started_at":"2026-06-13T04:30:35.299761+02:00","status":"completed"},"next_run":"2026-06-14 04:30","next_run_iso":"2026-06-14T04:30:00+02:00","runs":[{"duration_s":5.030486,"finished_at":"2026-06-13T04:30:40.332857+02:00","id":413584,"log_path":"/home/lucienne/workspace/logs/task-runs/worktree-reaper/413584.log","output":"","started_at":"2026-06-13T04:30:35.299761+02:00","status":"completed","task_id":"worktree-reaper","task_name":"Daily broad worktree cleanup across workspace + PKA + mission-control (incl. kanban-worktrees)"},{"duration_s":4.572139,"finished_at":"2026-06-12T04:30:40.290975+02:00","id":409417,"log_path":"/home/lucienne/workspace/logs/task-runs/worktree-reaper/409417.log","output":"","started_at":"2026-06-12T04:30:35.716510+02:00","status":"completed","task_id":"worktree-reaper","task_name":"Daily broad worktree cleanup across workspace + PKA + mission-control (incl. kanban-worktrees)"},{"duration_s":0.935301,"finished_at":"2026-06-11T07:22:03.828098+02:00","id":405556,"log_path":"/home/lucienne/workspace/logs/task-runs/worktree-reaper/405556.log","output":"","started_at":"2026-06-11T07:22:02.891050+02:00","status":"completed","task_id":"worktree-reaper","task_name":"Daily broad worktree cleanup across workspace + PKA + mission-control (incl. kanban-worktrees)"},{"duration_s":3.172092,"finished_at":"2026-06-07T04:32:35.236156+02:00","id":388050,"log_path":"/home/lucienne/workspace/logs/task-runs/worktree-reaper/388050.log","output":"","started_at":"2026-06-07T04:32:32.061948+02:00","status":"completed","task_id":"worktree-reaper","task_name":"Weekly broad worktree cleanup across workspace + PKA"}],"runs_limit":20,"schedule":"30 4 * * *","schedule_label":{"description":"Daily at 04:30","is_custom":false,"label":"Daily","sort":4,"sort_time":"04:30"},"stats":{"avg_duration":3.4275045,"completed":4,"failed":0,"timeout":0,"total":4},"task":{"_description":"Weekly (Sunday 04:30 SAST). Broad sweep across both repos \u2014 complements the daily `cleanup-stale-worktrees` task by also covering `PKA/.claude/worktrees/` and orphan worktrees that have no matching MC ticket.\n\nAuto-prunes any worktree that is BOTH clean (no uncommitted changes, zero commits ahead of master) AND either has a done/cancelled ticket or has no linked ticket at all. Open tickets (inbox / in_progress / needs_input / in_review) are left alone even when empty \u2014 a worker may just not have committed yet. The current working directory is never pruned.\n\nRun in report mode for a survey: `python3 ~/workspace/scripts/worktree-reaper.py` \u2014 prints a table with ticket id, status, age, commits ahead, uncommitted count, size and verdict. Add `--json` for machine-readable output.\n\nLogs to `~/workspace/logs/worktree-reaper.log` \u2014 one line per run with scanned/safe/manual/removed/failed counts and MB freed.\n\nCreated 2026-04-20 from MC-1050 (follow-up to MC-1037).","_file":"worktree-reaper.md","_path":"/home/lucienne/workspace/tasks/worktree-reaper.md","command":"/usr/bin/python3 /home/lucienne/workspace/scripts/worktree-reaper.py --prune --quiet","enabled":true,"id":"worktree-reaper","notify_on":"failure","retry":false,"run_as":"shell","runtime_profile":"direct_no_llm","schedule":"30 4 * * *","tags":["infrastructure","maintenance","disk"],"timeout":900,"title":"Daily broad worktree cleanup across workspace + PKA + mission-control (incl. kanban-worktrees)"}}
