Problem
Cron job runs are persisted as chat sessions with IDs like:
cron_<jobId>_<YYYYMMDD_HHMMSS>
However, those sessions do not get an explicit session title. The first persisted user message is the scheduler-injected cron guidance prefix:
[IMPORTANT: You are running as a scheduled cron job. DELIVERY: ...]
Downstream clients such as Hermes SwitchUI list sessions by title || preview, so cron-run sessions appear with the implementation warning ([IMPORTANT: ...]) instead of a useful name.
Current backend mechanism observed
In cron/scheduler.py:
_build_job_prompt() prepends the cron execution/delivery hint to the user prompt.
_run_job() creates a session id using cron_{job_id}_{timestamp}.
- The agent is constructed with
platform="cron", session_id=_cron_session_id, and session_db=_session_db.
- No explicit title is assigned for that cron session.
Result: the session preview/title fallback is polluted by scheduler instructions.
Desired behavior
When the scheduler creates a cron-run session, it should set a deterministic title such as:
<cron job name> — <YYYY-MM-DD HH:mm>
Examples:
daily-brief — 2026-06-10 07:30
ProductHunt Daily Trends — 2026-06-09 15:09
This should happen server-side so every client benefits, not just SwitchUI.
Suggested implementation
After creating/opening the cron session DB row, set the title before or immediately after the run starts:
session_title = f"{job_name} — {_hermes_now().strftime('%Y-%m-%d %H:%M')}"
_session_db.set_session_title(_cron_session_id, session_title)
Consider a helper to sanitize/shorten with existing SessionDB.sanitize_title() rules and avoid uniqueness conflicts. If title uniqueness conflicts are possible for repeated/manual reruns within the same minute, include seconds or the short job id suffix.
Acceptance criteria
- Cron sessions no longer display
[IMPORTANT: You are running as a scheduled cron job...] as their visible title.
- New cron run sessions have titles based on the cron job name and run timestamp.
- The original prompt/preview remains available for message history/search.
- Existing session deletion and lookup by
cron_<jobId>_* remain compatible.
- Add/adjust tests covering cron session title creation.
Client-side workaround
SwitchUI can derive friendlier display names from the cron_<jobId>_<timestamp> session key and /api/claude-jobs, but this is only a compatibility workaround. The backend should own the canonical title.
Problem
Cron job runs are persisted as chat sessions with IDs like:
However, those sessions do not get an explicit session title. The first persisted user message is the scheduler-injected cron guidance prefix:
Downstream clients such as Hermes SwitchUI list sessions by
title || preview, so cron-run sessions appear with the implementation warning ([IMPORTANT: ...]) instead of a useful name.Current backend mechanism observed
In
cron/scheduler.py:_build_job_prompt()prepends the cron execution/delivery hint to the user prompt._run_job()creates a session id usingcron_{job_id}_{timestamp}.platform="cron",session_id=_cron_session_id, andsession_db=_session_db.Result: the session preview/title fallback is polluted by scheduler instructions.
Desired behavior
When the scheduler creates a cron-run session, it should set a deterministic title such as:
Examples:
This should happen server-side so every client benefits, not just SwitchUI.
Suggested implementation
After creating/opening the cron session DB row, set the title before or immediately after the run starts:
Consider a helper to sanitize/shorten with existing
SessionDB.sanitize_title()rules and avoid uniqueness conflicts. If title uniqueness conflicts are possible for repeated/manual reruns within the same minute, include seconds or the short job id suffix.Acceptance criteria
[IMPORTANT: You are running as a scheduled cron job...]as their visible title.cron_<jobId>_*remain compatible.Client-side workaround
SwitchUI can derive friendlier display names from the
cron_<jobId>_<timestamp>session key and/api/claude-jobs, but this is only a compatibility workaround. The backend should own the canonical title.