Cron Internals
Cron Internals
Start with meaning, then move to detail.
This lesson explains Cron Internals as part of Hermes internals and extension points. You will learn what it does, when it matters, and the smallest safe test that proves it works.
If you are new, do not memorize names. Focus on three questions: what problem does this solve, what access does it need, and how can you verify the result?
For practice, inspect the first example, identify its effects, run it on test data, and compare the result with the source claim.
For advanced readers, inspect Key Files, Scheduling Model, Job Storage, then verify failure modes and version compatibility.
Know Python, Git, and basic project structure before changing code.
A clear outcome before you read.
- Understand Cron Internals without assumed prior knowledge.
- Separate the source description from what still needs testing in your environment.
- Read the first command and identify its inputs and outputs before copying it.
Short definitions before the details.
- Provider
- The service that runs or provides access and authentication to a model.
- Gateway
- The process that connects Hermes to channels such as Telegram or Discord and routes messages.
- Session & memory
- A session holds conversation context, while memory keeps selected facts that should persist.
- Automation
- Running work later or repeatedly with explicit success and failure conditions.
How Hermes stores, schedules, edits, pauses, skill-loads, and delivers cron jobs
What does the source say, and in what order?
- 01Key Files
Start here to understand the core idea or structure.
- 02Scheduling Model
Read this after the foundation, then connect it to the previous step.
- 03Job Storage
Read this after the foundation, then connect it to the previous step.
- 04Job Lifecycle States
Read this after the foundation, then connect it to the previous step.
- 05Backward Compatibility
Read this after the foundation, then connect it to the previous step.
- 06Scheduler Runtime
Read this after the foundation, then connect it to the previous step.
- 07Tick Cycle
Read this after the foundation, then connect it to the previous step.
- 08Gateway Integration
Read this after the foundation, then connect it to the previous step.
- 09Managed cron (Chronos) for scale-to-zero
Read this after the foundation, then connect it to the previous step.
- 10Fresh Session Isolation
Finish here to verify the result and special cases.
Copy only after you understand the effect.
{
"id": "a1b2c3d4e5f6",
"name": "Daily briefing",
"prompt": "Summarize today's AI news and funding rounds",
"schedule": {
"kind": "cron",
"expr": "0 9 * * *",
"display": "0 9 * * *"
},
"skills": ["ai-funding-daily-report"],
"deliver": "telegram:-1001234567890",
"repeat": {
"times": null,
"completed": 42
},
"state": "scheduled",
"enabled": true,
"next_run_at": "2025-01-16T09:00:00Z",
"last_run_at": "2025-01-15T09:00:00Z",
"last_status": "ok",
"created_at": "2025-01-01T00:00:00Z",
"model": null,
"provider": null,
"script": null
}tick()
1. Acquire scheduler lock (prevents overlapping ticks)
2. Load all jobs from jobs.json
3. Filter to due jobs (next_run <= now AND state == "scheduled")
4. For each due job:
a. Set state to "running"
b. Create fresh AIAgent session (no conversation history)
c. Load attached skills in order (injected as user messages)
d. Run the job prompt through the agent
e. Deliver the response to the configured target
f. Update run_count, compute next_run
g. If repeat count exhausted → state = "completed"
h. Otherwise → state = "scheduled"
5. Write updcreate/update a cron job
→ Chronos asks Nous to arm a one-shot at the job's next_run_at
(authenticated with the agent's existing Nous token)
→ at fire time Nous calls the gateway: POST {callback_url}/api/cron/fire
(authenticated with a short-lived, purpose-scoped Nous-minted JWT)
→ the gateway verifies the token, claims the job (store compare-and-set so
multi-replica deployments fire at-most-once), runs it, and re-arms the next
one-shotRead the first command and identify its inputs and outputs before copying it.
Match every command to your installed Hermes version, review the files and accounts it can reach, and use non-sensitive data for the first test. If this explanation differs from the source, the official source wins.