Summary
When a user creates a cron task using the /loop slash command via query(), the task works as expected during the live session. However, after the session is closed and subsequently resumed — either via query({ resume: sessionId }), the background cron task is completely lost and fails to persist. SDK consumers have no way to recover or re-register the active loop from the resumed session history.
Environment
Reproduction
-
Start a session with query({ prompt, options: { ... } }).
-
Send /loop <interval> <command> (or any cron-based slash command) to successfully register a background task.
-
Verify that the task triggers successfully at least once during the active stream.
-
End the current process / close the connection to terminate the live session.
-
In a fresh process, resume the session using query({ resume: sessionId }).
-
Query the AI or SDK state to check active background tasks (e.g., inspecting the active cron list).
Actual behaviour
The session history resumes successfully, but the background cron task created by /loop disappears completely.
-
No background triggers occur after the resume.
-
The SDK does not automatically re-register or re-schedule the cron tasks found in the persisted transcript.
-
When querying the AI or SDK for active loops after resumption, the returned CronList result is completely empty, leaving consumers with no way to manually inspect or revive the tasks.
Expected behaviour
The SDK should natively parse the persisted session history upon resume and automatically re-register any active background cron tasks (/loop) associated with that session.
Summary
When a user creates a cron task using the
/loopslash command viaquery(), the task works as expected during the live session. However, after the session is closed and subsequently resumed — either viaquery({ resume: sessionId }), the background cron task is completely lost and fails to persist. SDK consumers have no way to recover or re-register the active loop from the resumed session history.Environment
@anthropic-ai/claude-agent-sdk: 0.3.168Node.js: 22.x
Consumer: TypeScript backend utilizing session resume capabilities
Reproduction
Start a session with
query({ prompt, options: { ... } }).Send
/loop <interval> <command>(or any cron-based slash command) to successfully register a background task.Verify that the task triggers successfully at least once during the active stream.
End the current process / close the connection to terminate the live session.
In a fresh process, resume the session using
query({ resume: sessionId }).Query the AI or SDK state to check active background tasks (e.g., inspecting the active cron list).
Actual behaviour
The session history resumes successfully, but the background cron task created by
/loopdisappears completely.No background triggers occur after the resume.
The SDK does not automatically re-register or re-schedule the cron tasks found in the persisted transcript.
When querying the AI or SDK for active loops after resumption, the returned
CronListresult is completely empty, leaving consumers with no way to manually inspect or revive the tasks.Expected behaviour
The SDK should natively parse the persisted session history upon
resumeand automatically re-register any active background cron tasks (/loop) associated with that session.