The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
feat(cron): give scheduled jobs their actual run time in the prompt
Teknium3166c4a4b149
diff --git a/cron/scheduler_prompt.py b/cron/scheduler_prompt.pyindex a5e862f5a0c..180c28753a5 100644--- a/cron/scheduler_prompt.py+++ b/cron/scheduler_prompt.py@@ -290,6 +290,17 @@ _CRON_HINT = ()+def _run_time_line() -> str:+ """This fire's wall-clock time in the configured zone. The system prompt is date-only (byte-stable+ for caching), so without it a 07:00 brief can't tell itself from a 19:00 retry. Kept outside+ ``_CRON_HINT`` and after it: the hint stays byte-stable, and cron sessions are fresh per fire."""+ from hermes_time import safe_strftime+ now = _hermes_now()+ offset = now.strftime("%z")+ zone = f" (UTC{offset[:3]}:{offset[3:]})" if offset else ""+ return f"[CURRENT RUN TIME: {safe_strftime(now, '%A, %Y-%m-%d %H:%M %Z').strip()}{zone}]\n\n"++def _build_job_prompt(job: dict, prerun_script: Optional[tuple] = None, extra_prompt: Optional[str] = None,runtime_data_prompt: Optional[str] = None,@@ -343,7 +354,7 @@ def _build_job_prompt(prompt = f"{notepad_section}{prompt}"has_injected_data = True- prompt = _CRON_HINT + prompt+ prompt = _CRON_HINT + _run_time_line() + promptskill_names = _job_skill_names(job)if not skill_names:return _scan_assembled_cron_prompt(diff --git a/tests/cron/test_cron_run_time.py b/tests/cron/test_cron_run_time.pynew file mode 100644index 00000000000..82484fc96ce--- /dev/null+++ b/tests/cron/test_cron_run_time.py@@ -0,0 +1,28 @@+"""A cron fire's prompt carries its own wall-clock run time (the system prompt is date-only)."""++from datetime import datetime, timedelta, timezone+from unittest.mock import patch++from cron.scheduler import _build_job_prompt++_FIRE = datetime(2026, 10, 31, 19, 5, tzinfo=timezone(timedelta(hours=-7), "PDT"))+++def _prompt(job):+ with patch("cron.scheduler_prompt._hermes_now", return_value=_FIRE), patch(+ "tools.skills_tool.skill_view", return_value='{"success": false, "error": "not found"}'+ ):+ return _build_job_prompt(job)+++def test_run_time_follows_the_hint_and_precedes_the_job_prompt():+ result = _prompt({"prompt": "Morning brief"})+ line = "[CURRENT RUN TIME: Saturday, 2026-10-31 19:05 PDT (UTC-07:00)]"+ assert line in result+ assert result.index("You are running as a scheduled cron job") < result.index(line)+ assert result.index(line) < result.index("Morning brief")+++def test_run_time_survives_the_skills_assembly_path():+ result = _prompt({"skills": ["ghost-skill"], "prompt": "go"})+ assert "[CURRENT RUN TIME: Saturday, 2026-10-31 19:05 PDT (UTC-07:00)]" in result