Claude Desktop scheduled tasks: completed runs retain idle workers (54 accumulated, GBs of RAM); no auto-archive/timeout controls; archive_session can't be bulk-approved
Environment
- Claude Desktop on macOS (Darwin 24.6.0, Apple Silicon)
- Bundled Claude Code runtime 2.1.237 (
~/Library/Application Support/Claude/claude-code/2.1.237/) - Scheduled tasks via the built-in scheduled-tasks system (
~/.claude/scheduled-tasks/)
Problem 1: idle worker processes from completed scheduled runs accumulate until the Mac thrashes
An hourly scheduled task runs correctly, but each completed run stays in the sidebar as an unarchived session. The idle worker processes behind those sessions were not reaped. They accumulated to 54 worker processes, consumed several gigabytes of RAM, drove heavy CPU load and swap thrashing, and made the whole machine lag. Quitting Claude Desktop killed all workers and instantly restored normal performance.
Regular sessions appear to get the ~1 hour idle process cleanup. Scheduled-task sessions either do not inherit it or the reaper falls behind when runs arrive hourly.
Problem 2: no lifecycle controls exist for scheduled-task sessions
The scheduled-task API surface (create_scheduled_task / update_scheduled_task) exposes only: prompt, description, cron/fireAt, enabled, notifyOnCompletion. There is no supported way to:
- auto-archive or auto-close a completed run's session
- set a max runtime / timeout for a run
- configure concurrency behavior (the scheduler does skip a run when the prior run is still in progress, which is good, but it is not configurable or documented as a guarantee)
The only workaround is adding a prompt step that calls archive_session with session_id: "self", which fails open if a run crashes before reaching it.
Problem 3: archive_session cannot be bulk-approved, which makes backlog cleanup painful
Cleaning up the ~200 accumulated sessions required calling mcp__ccd_session_mgmt__archive_session once per session. The tool's confirmation dialog fires on every call and ignores an mcp__ccd_session_mgmt__archive_session entry in the settings.json permissions.allow list. The user had to click approve well over 100 times. Archiving is reversible (sessions move to the Archived list), so per-call forced confirmation seems disproportionate. A batch approve, an "always allow" option in the dialog, or allow-list support would fix this.
Requests
- Reap idle worker processes for completed scheduled-task sessions the same way as regular sessions.
- Add an auto-archive-on-success option for scheduled tasks.
- Add a max-runtime setting for scheduled runs.
- Let
permissions.allow(or a dialog "always allow") coverarchive_sessionfor bulk cleanup.