#Cron custom session
17 messages · Page 1 of 1 (latest)
No, session=isolated does not give future runs the same conversation history.
isolated= fresh session per run- if you want reuse across runs, use
--session session:<your-key> currentbinds to whatever session was active when you created the job
So the rule of thumb is:
isolated→ stateless/background jobsession:daily-brief→ persistent cron memorycurrent→ keep using the session you were in when adding the cron
Docs:
If you want, I can also show the exact CLI examples for all 3.
web ui doesn't allow me to remove session value, only isolated or main. can I just remove the line in cron/jobs.json
I wouldn’t remove it.
If the job is an agentTurn, missing sessionTarget gets normalized back to isolated. So deleting the line won’t give you a persistent shared session.
What you want is:
"sessionTarget": "session:my-custom-key"
Better option, use CLI:
openclaw cron edit <job-id> --session "session:my-custom-key"
If you do edit ~/.openclaw/cron/jobs.json manually, I’d do it with the gateway stopped first, otherwise it may get rewritten.
So, short version:
- remove line? No, not useful
- set custom persistent session? Yes, use
session:... - web UI only showing
main/isolatedsounds like a UI limitation right now
Docs:
If you want, I can show the exact before/after JSON for one cron entry.
so I'll just need to set sessionTarget, not sessionKey?
Yep, for custom persistent cron history, sessionTarget is the important one.
Use:
"sessionTarget": "session:my-custom-key"
That tells cron to run in the persistent session my-custom-key.
A few nuances:
sessionTargetcontrols how the cron run is routed- for
session:..., the actual session key is derived from that value sessionKeyis not the field you need to switch this from isolated to persistent
So in your case:
isolated→ fresh run every timesessionTarget: "session:foo"→ reusefooacross runs
If you’re hand-editing jobs.json, I’d set sessionTarget and leave sessionKey alone unless you already have a stale/conflicting one there. If it exists, best to keep it consistent.
Example:
{
"sessionTarget": "session:daily-brief"
}
not:
{
"sessionTarget": "isolated"
}
If you want, paste one cron entry and I’ll tell you the exact edit.
{
"id": "fe5887aa-1642-4232-9975-6e37eddf5124",
"name": "<name>",
"description": "<desc>",
"enabled": true,
"createdAtMs": 1776118908759,
"updatedAtMs": 1776154380474,
"schedule": {
"kind": "cron",
"expr": "0 * * * *",
"tz": "<tz>"
},
"sessionTarget": "session:cron",
"wakeMode": "now",
"payload": {
"kind": "agentTurn",
"message": "<msg>",
"model": "anthropic/claude-sonnet-4-6",
"timeoutSeconds": 300
},
"delivery": {
"mode": "none",
"channel": "discord",
"to": "<user>",
"bestEffort": true
},
"state": {
"nextRunAtMs": 1776157226659,
"lastRunAtMs": 1776153626665,
"lastRunStatus": "ok",
"lastStatus": "ok",
"lastDurationMs": 32766,
"lastDeliveryStatus": "not-delivered",
"consecutiveErrors": 0,
"lastDelivered": false
},
"deleteAfterRun": false,
"agentId": "main"
}
looks good?
Yep, that looks right 👍
The important part is:
"sessionTarget": "session:cron"
That means future runs should reuse the same named session instead of getting a fresh isolated one.
Only small notes:
session:cronis pretty generic, so if you have multiple jobs later, they could accidentally share context. I’d use something more specific, likesession:hourly-<name>.delivery.mode: "none"means it will not send anything out. In that case,channel,to, andbestEffortare basically ignored, so you can remove them for cleanliness.- no
sessionKeyfield needed for this setup.
So functionally: yes, good.
If you want, a cleaner version would be:
{
"sessionTarget": "session:hourly-report",
"wakeMode": "now",
"payload": {
"kind": "agentTurn",
"message": "<msg>",
"timeoutSeconds": 300
},
"delivery": {
"mode": "none"
}
}
Glad that helped! 🎉
If this fixed it, please right-click the solution message → Apps → ✅ Mark Solution.
This helps Answer Overflow index the solution for future users.