The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
feat(cron): --continuity / --no-continuity flags on hermes cron create/edit
Tekniumea2970274983
diff --git a/hermes_cli/cron.py b/hermes_cli/cron.pyindex 240b212b9e9..9bbe8976ee0 100644--- a/hermes_cli/cron.py+++ b/hermes_cli/cron.py@@ -367,6 +367,7 @@ def cron_create(args):no_agent=getattr(args, "no_agent", False) or None,monitor_script=getattr(args, "monitor_script", None),monitor_url=getattr(args, "monitor_url", None),+ continuity=getattr(args, "continuity", None),)if not result.get("success"):print(color(f"Failed to create job: {result.get('error', 'unknown error')}", Colors.RED))@@ -385,6 +386,8 @@ def cron_create(args):print(f" Monitor: {job_data['monitor_url']} (agent runs only on output change)")if job_data.get("no_agent"):print(" Mode: no-agent (script stdout delivered directly)")+ if job_data.get("continuity"):+ print(" Continuity: on (each run sees the previous run's output)")if job_data.get("workdir"):print(f" Workdir: {job_data['workdir']}")print(f" Next run: {result['next_run_at']}")@@ -438,6 +441,7 @@ def cron_edit(args):no_agent=getattr(args, "no_agent", None),monitor_script=getattr(args, "monitor_script", None),monitor_url=getattr(args, "monitor_url", None),+ continuity=getattr(args, "continuity", None),)if not result.get("success"):print(color(f"Failed to update job: {result.get('error', 'unknown error')}", Colors.RED))@@ -459,6 +463,8 @@ def cron_edit(args):print(f" Monitor: {updated['monitor_url']} (agent runs only on output change)")if updated.get("no_agent"):print(" Mode: no-agent (script stdout delivered directly)")+ if updated.get("continuity"):+ print(" Continuity: on (each run sees the previous run's output)")if updated.get("workdir"):print(f" Workdir: {updated['workdir']}")return 0diff --git a/hermes_cli/subcommands/cron.py b/hermes_cli/subcommands/cron.pyindex 8cc7d14ca63..07c24006e28 100644--- a/hermes_cli/subcommands/cron.py+++ b/hermes_cli/subcommands/cron.py@@ -105,6 +105,19 @@ def build_cron_parser(subparsers, *, cmd_cron: Callable) -> None:dest="model_provider",help="Inference provider paired with --model (e.g. 'openrouter', 'nous').",)+ cron_create.add_argument(+ "--continuity",+ dest="continuity",+ action="store_const",+ const=True,+ default=None,+ help=(+ "Each run wakes up with the job's own previous output injected "+ "into its prompt, so it can dedupe against what was already "+ "reported and continue where the last run left off (scouts, "+ "monitors, incremental digests). First run is unchanged."+ ),+ )# cron editcron_edit = cron_subparsers.add_parser(@@ -165,6 +178,27 @@ def build_cron_parser(subparsers, *, cmd_cron: Callable) -> None:const=False,help="Disable no-agent mode on this job (reverts to LLM-driven execution).",)+ cron_edit.add_argument(+ "--continuity",+ dest="continuity",+ action="store_const",+ const=True,+ default=None,+ help=(+ "Turn on run-to-run continuity: each run sees the job's own "+ "previous output (dedupe, continue where it left off)."+ ),+ )+ cron_edit.add_argument(+ "--no-continuity",+ dest="continuity",+ action="store_const",+ const=False,+ help=(+ "Turn off run-to-run continuity (other context_from job refs "+ "are preserved)."+ ),+ )cron_edit.add_argument("--monitor-script",dest="monitor_script",diff --git a/tools/cronjob_tools.py b/tools/cronjob_tools.pyindex 97be43c4d05..dced41547cb 100644--- a/tools/cronjob_tools.py+++ b/tools/cronjob_tools.py@@ -658,6 +658,17 @@ def _format_job(job: Dict[str, Any]) -> Dict[str, Any]:result["enabled_toolsets"] = job["enabled_toolsets"]if job.get("workdir"):result["workdir"] = job["workdir"]+ stored_refs = job.get("context_from") or []+ if isinstance(stored_refs, str):+ stored_refs = [stored_refs]+ if any(str(r).strip().lower() == "self" or r == job.get("id") for r in stored_refs):+ result["continuity"] = True+ external_refs = [+ r for r in stored_refs+ if str(r).strip().lower() != "self" and r != job.get("id")+ ]+ if external_refs:+ result["context_from"] = external_refsreturn resultdiff --git a/web/src/lib/cron-job.ts b/web/src/lib/cron-job.tsindex a165c774c1b..ab8e8345825 100644--- a/web/src/lib/cron-job.ts+++ b/web/src/lib/cron-job.ts@@ -76,7 +76,11 @@ export function cronJobHasExecutionContent(export function cronJobFormFromJob(job: CronJob): CronJobFormState {const storedRefs = splitCronList(job.context_from);- const continuity = storedRefs.some((item) => item.toLowerCase() === "self");+ // Raw store records carry the reserved "self" entry inside context_from;+ // tool/RPC-formatted records strip it and set an explicit continuity flag.+ const continuity =+ Boolean((job as { continuity?: boolean }).continuity) ||+ storedRefs.some((item) => item.toLowerCase() === "self");const externalRefs = storedRefs.filter((item) => item.toLowerCase() !== "self");return {name: asString(job.name),diff --git a/website/docs/user-guide/features/cron.md b/website/docs/user-guide/features/cron.mdindex 53ae7d92431..77b67bcc609 100644--- a/website/docs/user-guide/features/cron.md+++ b/website/docs/user-guide/features/cron.md@@ -648,6 +648,8 @@ cronjob(The first run has no previous output, so the prompt runs as-is. On later runs the previous output is prepended with continuity framing ("avoid repeating what was already reported"). It combines freely with upstream jobs (`context_from=["<other_job_id>"]` plus `continuity=true`), and `continuity=false` on update turns it off while preserving other `context_from` entries. Internally the flag is stored as the reserved `self` entry in `context_from`.+From the CLI: `hermes cron create "every 6h" "Scan for news" --continuity`, and `hermes cron edit <job_id> --continuity` / `--no-continuity` to toggle it on an existing job. The same toggle appears in the dashboard's cron editor and the desktop Bot Mode routine dialog.+**When to use it:**- Multi-stage pipelines (collect → filter → format → deliver)