-
-
Notifications
You must be signed in to change notification settings - Fork 69.2k
[Feature]: Support custom session IDs for cron jobs #9765
Description
Summary
Currently, cron jobs only support two execution modes: main (runs in the main session) and isolated (creates ephemeral sessions with ID format cron:). This limits the ability to have cron jobs contribute to persistent, named conversation contexts outside of the main session. For workflows where you want a cron job to build context over time in a dedicated session (e.g., a daily standup thread, a project-specific monitoring session, or a topic-focused assistant), there's no way to maintain that conversation history across multiple cron runs.
Proposed solution
Add support for a sessionTarget value that accepts custom session IDs alongside the existing "main" and "isolated" options. This could be implemented as: "sessionTarget": "session:project-alpha-daily"
Or alternatively, extend the isolated mode with an optional sessionId field:
{
"sessionTarget": "isolated",
"sessionId": "project-alpha-daily",
}
This would allow the cron job to run in a persistent, named session that maintains conversation context across runs, while still being separate from the main session.
Alternatives considered
- Using main session with filtering: Run everything in main but this pollutes the main conversation and doesn't provide topic isolation.
- Manual session management: Create separate agents for different contexts, but this seems heavier than needed and requires managing multiple agent configs.
- Post-run message forwarding to main: Have isolated jobs deliver summaries to the main session, but this loses the conversational context and continuity.
- Post-run message forwarding to dedicated session: Have isolated jobs deliver full messages to dedicated sessions, every heavy since it always requires parsing the tokens twice.
Additional context
- Current documentation: The attached cron documentation shows sessionTarget only accepts "main" or "isolated"
- Use cases: Daily standup summaries, per-project monitoring, topic-specific research assistants, multi-workspace task management
- Related to session management patterns used elsewhere in OpenClaw's architecture