Problem
Scheduled tasks leave their sessions open indefinitely after the agent finishes all work. The user must manually /exit or archive each session from the sidebar.
Running multiple daily cron tasks (smoke tests, imports, briefings) creates zombie sessions that need manual cleanup every morning.
Current behavior
- Scheduled task fires at cron time
- Agent completes all work (writes results to DB, no more actions needed)
- Session stays open in sidebar with spinning indicator
- User must manually close each completed session
Desired behavior
Sessions spawned by scheduled tasks should auto-terminate once the agent has no more work to do. Possible implementations:
autoClose: true frontmatter in SKILL.md — close session when agent stops generating
maxDuration: 300 frontmatter — timeout in seconds, session terminates after that
- Built-in exit tool the agent can call to programmatically end its own session
Workaround attempted
Adding explicit "terminate immediately" instructions to the task prompt. The agent stops talking but the session remains open — this is a platform-level issue, not solvable via prompt.
Environment
- Claude Code Desktop (Windows 11)
- Multiple recurring cron tasks (daily smoke test, daily import, daily briefing)
Problem
Scheduled tasks leave their sessions open indefinitely after the agent finishes all work. The user must manually
/exitor archive each session from the sidebar.Running multiple daily cron tasks (smoke tests, imports, briefings) creates zombie sessions that need manual cleanup every morning.
Current behavior
Desired behavior
Sessions spawned by scheduled tasks should auto-terminate once the agent has no more work to do. Possible implementations:
autoClose: truefrontmatter in SKILL.md — close session when agent stops generatingmaxDuration: 300frontmatter — timeout in seconds, session terminates after thatWorkaround attempted
Adding explicit "terminate immediately" instructions to the task prompt. The agent stops talking but the session remains open — this is a platform-level issue, not solvable via prompt.
Environment