#custom human-readable ID when creating a cron job

11 messages Β· Page 1 of 1 (latest)

paper cradle
#

Hey! Is there any way to specify a custom human-readable ID when creating a cron job via cron add? I dug through the source and CronJobCreate doesn't include an id field, and the CLI has no --id flag. Currently working around it by writing directly to jobs.json with a readable string ID before startup (confirmed it loads fine). Just wondering if there's a proper supported path or if this is something worth adding as a feature request.

distant templeBOT
tulip totemBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> βœ… Mark Solution

distant templeBOT
shut lotusBOT
#

Short version: not through the supported CLI today.

I checked the current docs/help and runtime behavior:

So your jobs.json workaround makes sense because stored jobs do have an id, and the loader will honor it, but I'd treat direct file edits as an internal/unsupported path, not a stable public interface.

One useful distinction: if you mainly want a readable persistent context key, --session "session:daily-brief" is supported, but that only names the session, not the cron job ID itself.

So yes, I think this is worth a feature request. A reasonable shape would be something like:

openclaw cron add --id daily-brief ...
#

with collision validation and maybe slug rules.

If you want, I can help draft the GitHub issue text.

paper cradle
#

yes.. can you help me witrh the draft

shut lotusBOT
#

Yep, here's a clean draft you can paste into GitHub:

Title
cron add: support custom job IDs via --id

Body

## Summary

`openclaw cron add` currently auto-generates a UUID for each job and does not provide a supported way to set a custom human-readable job ID.

## Current behavior

- `CronJobCreate` does not expose an `id` field
- `openclaw cron add --help` has no `--id` flag
- the runtime generates a UUID when creating a job
#

Cron jobs stored in `~/.openclaw/cron/jobs.json` do appear to honor a manually provided `id`, so the scheduler/store format already seems compatible with string IDs.

## Problem

For users managing multiple cron jobs, UUIDs are hard to work with in:

- `openclaw cron list`
- `openclaw cron edit <id>`
- `openclaw cron run <id>`
- `openclaw cron runs --id <id>`
- config/scripts/docs where jobs are referenced repeatedly

Human-readable IDs would make cron jobs much easier to operate and automate.
#
## Proposed behavior

Support an optional custom ID at creation time, for example:

```bash
openclaw cron add --id daily-brief ...

Suggested behavior:

  • --id is optional
  • if omitted, keep current UUID behavior
  • if provided, validate against a safe format (for example slug-like strings)
  • reject collisions with an explicit error
  • preserve the existing name field separately from id
#

## Example use cases

```bash
openclaw cron add --id daily-brief --name "Daily Brief" ...
openclaw cron edit daily-brief --no-deliver
openclaw cron run daily-brief
openclaw cron runs --id daily-brief

Current workaround

Right now the only workaround seems to be editing ~/.openclaw/cron/jobs.json directly before startup and supplying a readable id there.

That works, but it feels like an internal/unsupported path rather than an intended interface.