Verified crons
Latest: v1.0.0
Introduces verified-crons 1.0.0, a discipline for making scheduled jobs prove they worked.
- Verify produced artifacts independently, rather than trusting exit codes or log messages.
- Fail closed when checks are ambiguous, and test each check with known-good and known-bad fixtures.
- Alert when a job goes silent, not just when it reports an error.
- Keep one ledger entry per run with its outcome and input fingerprint.
Verified crons
A cron job that logs done is not a job that worked. It is a job that finished.
This skill is a five-rule discipline for scheduled agent work — the kind that runs unattended at 3 a.m., writes to a database, sends an email, updates a dashboard, or deletes a directory. The rules are cheap to apply and they catch the failure mode that scheduled work fails into most often: a silent no-op that reports success.
When to use this
- A scheduled job reports success but the artifact it was supposed to produce is missing or stale.
- You cannot tell, after the fact, whether last night's run did anything.
- Two jobs depend on the same file and you don't know which one wrote it last.
- Someone says "it has been running fine for weeks" and nobody has checked.
The examples are POSIX shell and assume the two coreutils declared above; nothing else is needed.
Rule 1 — Verify the artifact, not the summary
The exit code and the log line are claims made by the same process that did the work. Read the thing the job was supposed to produce, and read it from a fresh connection or a fresh process.
# bad: trust the exit code
run_job && echo "job ok"
# good: read back the artifact
run_job
count=$(read_back_rows_for_today) # fresh query, not the job's counter
[ "$count" -gt 0 ] || fail "job ran, artifact missing"
The read-back has to be capable of disagreeing with the job. If both come from the same in-memory counter, you are measuring the job's optimism.
Rule 2 — Fail closed on ambiguity
A guard that cannot tell whether it succeeded must fail, not pass. Empty input, an unreachable service, a malformed record, a query that returned zero rows for a reason you did not predict — all of those are "unknown", and unknown is not "fine".
if ! have_credentials; then
fail "cannot verify" # NOT: exit 0, assume ok
fi
The cost of a false alarm is a notification. The cost of a false pass is a week of missing data discovered a month later.
Rule 3 — Test the test
Every check needs a fixture that must make it fail. A check that has never failed is not a check; it is decoration.
# the guard must reject a known-bad input
assert_rejects "$BAD_SAMPLE" || fail "guard does not reject bad input"
# and must accept a known-good one
assert_accepts "$GOOD_SAMPLE" || fail "guard rejects valid input"
This is the rule that pays for itself the fastest. A verification script written without a fixture has, in my experience, roughly one chance in three of silently checking nothing — a path that does not exist, a pattern that never matches, a limit that cuts the window before the interesting rows.
Rule 4 — Alarm on silence, not only on error
The dangerous failure is the job that stops running: the daemon dies, the timer is disabled, the credentials expire, and nothing is emitted. There is no error to alert on, because there is no process left to emit one.
Schedule a second job whose only purpose is to notice that the first one has not reported:
if last_success_older_than 36h; then
alert "job has not reported"
fi
"Design schedules so that silence is an alarm" is most of the value of this skill. If a job is supposed to run daily and yesterday has no record, that is a page — not a graph nobody looks at.
Rule 5 — One ledger line per run
Every run appends one line: timestamp, outcome, and a fingerprint of the input it processed. It costs nothing and it answers the three questions you will actually ask:
- Did it run at all?
- What changed between the last good run and the failure?
- If it says it did something, which version of the input did it see?
2026-11-28T03:00:12-03:00 OK input=9f2c1a… rows=418 1.2s
2026-11-29T03:00:11-03:00 FAIL input=9f2c1a… reason=auth-expired
A log that says "failed" without saying what failed is the same defect one level up. Name the control, not just the count.
Reference implementation
every_5_minutes() {
ledger "start input=$(fingerprint "$SRC")"
run_job || { ledger "FAIL reason=exec"; alert; return 1; }
got=$(read_back | wc -l) # rule 1
[ -n "$got" ] || { ledger "FAIL reason=no-readback"; alert; return 1; } # rule 2
[ "$got" -ge "$MIN_EXPECTED" ] \
|| { ledger "FAIL reason=low:$got"; alert; return 1; }
ledger "OK input=$(fingerprint "$SRC") rows=$got" # rule 5
}
# rule 3, run in CI
fixture_bad && fail "guard accepted bad input"
fixture_good || fail "guard rejected good input"
# rule 4, a separate timer
check_silence
When one of these fails
If a check fails and you cannot tell why, read references/method.md: it holds the two rules that came out of nine appearances of the same error in a single week — reading the declared field instead of an accident, and why two people agreeing is not a verification. Read it the first time you use this skill; the agent only loads it when needed.
Checklist
Six items, one page, in references/checklist.md.
The full pack
This skill is the core discipline. The complete SOP — the pre-activation checklist, the monitoring template, the recovery protocol, and three worked incidents — is free at stackito.dev/pack/verified-crons (page in Spanish; one-field email gate).
