[FEATURE] Expose session scheduled tasks (/loop, CronCreate, ScheduleWakeup) to hooks

Status Open
Maintainer reply None cached
Activity 0 comments · opened Oct 1, 2026

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

Tools that watch running Claude Code sessions (status bars, session dashboards, terminal multiplexers) cannot see scheduled work. A session with an active /loop or a pending CronCreate job looks exactly like an idle one: the REPL is at the prompt, nothing is running, and Stop has fired. So a watcher can't show "next run at 14:30", and it can't tell when a loop has ended and the session is really idle.

Starting a job can be seen today, with PostToolUse on CronCreate / ScheduleWakeup. Ending one mostly can't:

  • a dynamic /loop ends when the model doesn't call ScheduleWakeup again, or when the user presses Esc, and no event marks either;
  • recurring jobs auto-expire after 7 days, and one-shot jobs delete themselves after firing, neither visibly;
  • loops also stop silently in some situations (#96531 after backgrounding, #89248 across compaction, #90215).

Only durable tasks leave a file (.claude/scheduled_tasks.json, per #98219). Session-only tasks, the default and what /loop uses, leave nothing to read.

Proposed Solution

Put the session's scheduled tasks in the hook input of Stop (and SubagentStop), as Qwen Code did in QwenLM/qwen-code#6529 (PR #6531):

"scheduled_tasks": [
  { "id": "f87299f6", "cron": "*/30 * * * *", "recurring": true,
    "prompt": "check the deploy", "next_fire": "2026-10-01T14:30:00Z",
    "expires": "2026-10-08T12:00:00Z", "source": "loop" }
]

Since Stop fires at the end of every turn, a watcher always has the current schedule. A job created, deleted or ended shows up at the next turn end, and an empty list means no scheduled work is left.

Alternative Solutions

  • Dedicated hook events: ScheduledTaskCreated / ScheduledTaskFired / ScheduledTaskEnded, the last with a reason (deleted | expired | completed | loop_ended | session_exit).
  • A per-session snapshot file, rewritten on every change, for session-only tasks too: like the durable .claude/scheduled_tasks.json, but always present.
  • At least, a has_scheduled_tasks / next_fire field on Stop.

Priority

High - Significant impact on productivity

Feature Category

CLI commands and flags

Use Case Example

  1. A user runs /loop 30m check the deploy and walks away.
  2. A session dashboard sees the Stop hook with one scheduled task, and shows "waiting · next run 14:30" instead of "idle".
  3. Later the user presses Esc mid-loop, or the loop ends. The next Stop carries an empty list, and the dashboard shows the session as idle.

Additional Context

Related: #96531, #89248, #90215 (loops that stop silently, which is exactly when visibility matters), #98219 (durable tasks file), #93468 / #97400 (ScheduleWakeup outside /loop). Prior art: QwenLM/qwen-code#6529.

View original on GitHub ↗