Feature Request: Session reuse / max sessions limit for scheduled tasks

Resolved 💬 3 comments Opened Apr 2, 2026 by mulsahu Closed Apr 5, 2026

Problem

When using scheduled tasks (via create_scheduled_task), each run creates a new session. For recurring jobs that run every 30-60 minutes, this quickly fills up the sidebar with dozens of stale sessions per job.

With 8 scheduled jobs running every 30min to 1hr, that's 50-100+ new sessions per day cluttering the UI. There's no way to:

  • Reuse a single session per task across runs
  • Set a max session limit per task (e.g., keep only the last 1-2)
  • Auto-prune old completed sessions for a task

Proposed Solution

One or more of:

  1. Session reuse option — A reuseSession: true parameter on create_scheduled_task / update_scheduled_task that reuses the same session for each run instead of creating a new one.
  1. Max sessions per task — A maxSessions: N parameter that auto-deletes the oldest sessions when the limit is exceeded (e.g., maxSessions: 1 keeps only the latest run).
  1. Auto-cleanup — Automatically delete completed scheduled task sessions older than X hours/days.
  1. Bulk session management — A way to delete all sessions for a specific task ID (via API or UI).

Use Case

Running an automated DevOps/QA system with 8 scheduled jobs:

  • Support ticket triage (every 30 min)
  • AWS monitoring (every 30 min)
  • Auto-deploy staging (every 30 min)
  • Team training posts (every 30 min)
  • 3x daily AI training posts (11am, 3pm, 6pm)
  • QA automation (every hour)

Each job should ideally have just 1 session that gets reused, or at most keep the last 2-3 runs visible.

Environment

  • Claude Code Desktop (macOS)
  • Scheduled tasks via mcp__scheduled-tasks__create_scheduled_task

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗