Making an LLM-written ops report harder to get wrong
Imagine running a website and wanting a short daily update on whether everything's working, without staring at raw logs yourself. You could have an AI write that update in plain English. The catch is that AI can get things wrong, like calling old data fresh, or calling an old problem "brand new." This write-up is about building the reporting system so the AI is only allowed to repeat facts that a separate, boring, always-honest program already checked, never make anything up on its own. Useful for a solo developer or small team running a website or app who wants automatic status updates without hiring someone to watch dashboards all day
I wanted a short digest of a small production app: errors, health checks, revenue, server headroom, and whether the maintenance jobs ran. A model writes a readable digest, and it will also state a stale number as if it were fresh or call an old problem new. The design below keeps the model to narration and makes the rest checkable
Two layers. Layer 1 is plain scripts. They run the SQL aggregation and the health checks, use no LLM tokens, and write small JSON summary files to the repo through the GitHub API. Layer 2 is a scheduled LLM routine that reads one summary file and writes the digest. The routine cannot query the database or reach the server, so it only ever sees what a script chose to write, and those files are kilobytes, not raw rows
1. Make the model state the data age. Every summary carries its own generated_at. The prompt tells the model to compare it to the current time, state the age in the digest, and call the data stale when it is older than about twice its collection interval. A stale report presented as fresh is worse than none. The prompt also says to trust the timestamp over any schedule written in the prompt, because schedules change: the health check was throttled from every 15 minutes to every 12 hours
2. "New" needs the authoritative record. One digest called three error-tracker issues brand new. Two were six weeks old (219 and 113 occurrences) and one was ten days old (4 occurrences). All three were long-standing and recurring. In our runs, the search results' first-seen field looked like it reflected the queried time window, not the issue's lifetime. I did not confirm that against the tracker's documentation, so treat it as our observation. The fix was a rule in the prompt: fetch each issue's own record, read its real first-seen date and total count, and use "recurring" unless that date falls inside the lookback window. If unsure, say "recurring, not confirmed new". I have not measured how reliably the model follows it
3. Retry once before reporting an outage. The health collector checks a few endpoints on each environment. An instance that is slow to wake reads as an outage, and a false alarm teaches people to ignore the report. Each check uses a 10 second timeout. On failure it waits 5 seconds and tries once more, and a check that needed the retry is marked retried_after_failure so the recovery stays visible
4. A guard so no job goes unmonitored. The job-status report watches a list of scheduled maintenance workflows. One workflow was missed when that list was first written. Nothing failed; it just never appeared in the report. The fix is a test that scans the workflow files for a schedule trigger and fails unless each one is either monitored or on an explicit exclusion list with a reason. A new scheduled job can no longer be silently absent from both
scheduled = {
p.name for p in workflows_dir.glob("*.yml")
if "\n schedule:" in p.read_text(encoding="utf-8")
}
accounted_for = set(MONITORED_WORKFLOWS) | DELIBERATELY_UNMONITORED
unaccounted = scheduled - accounted_for
assert not unaccounted, f"{sorted(unaccounted)}: monitor it or exclude it with a reason"Tested, not just reasoned about: on a local test server, a first response slower than the timeout recovers on the retry, while a real 500 still fails. Removing one workflow from the watch list makes the guard test fail. The two prompt rules are instructions to a model, not tested code, so I cannot prove it always follows them. Reporting is manual now: the scheduled routines are paused, not deleted, and the summary files are generated on demand