[FEATURE] Expose session scheduled tasks (/loop, CronCreate, ScheduleWakeup) to hooks
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
/loopends when the model doesn't callScheduleWakeupagain, 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 areason(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_firefield onStop.
Priority
High - Significant impact on productivity
Feature Category
CLI commands and flags
Use Case Example
- A user runs
/loop 30m check the deployand walks away. - A session dashboard sees the
Stophook with one scheduled task, and shows "waiting · next run 14:30" instead of "idle". - Later the user presses Esc mid-loop, or the loop ends. The next
Stopcarries 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.