Loop DATA-0 · Data trust · reports to Nish

The watchman that checks every other number first.

Every morning it verifies that last night's data syncs actually ran, and how fresh every number the company sees really is — because in June our warehouse sync sat broken for 11 days and nobody noticed.

Built & tested — pilotWave 1🕐 Daily 08:00⚙️ Script on Hermes cron
Part 1 — the plain-english view

Trust in every dashboard starts with someone checking the pipes.

What it watches
  • The nightly NetSuite → warehouse sync — did every table load, with no errors?
  • Freshness of warehouse and joinery data — is anything older than ~26 hours?
  • The company feed's daily pull — did today's cards publish?
  • The knowledge-brain ingestion timers — is the AI answering from stale wiki content?
When & how it speaks

Quiet on green: a normal day sends no email at all. You hear from it only when something needs you — a failure, a warning, or a one-time “recovered” note when a problem clears. Monday's digest carries a one-line “data pipelines: 7/7 green.”

Why it exists

Found during this project's research: the warehouse sync had been failing since 27 June — 11 straight days — and every inventory dashboard silently showed stale numbers. Worse: when fixed, the warehouse turned out to have been incomplete, not just stale. This loop makes that class of silent failure impossible to repeat.

11 days
our main data sync sat broken with nobody noticing — the finding that created this loop
5 pipelines
watched every morning: warehouse sync, joinery mart, feed pull, brain ingestion, and the other loops' heartbeats
0 emails
on a green day. Silence is safe here — a machine-level dead-man's switch proves the sentinel itself is alive

08:00 daily

Wakes after the overnight syncs finish

👀

Reads the sync log

Every table's load status, row counts, errors

📋

Checks freshness

Anything stale >26h or failed turns red

💬

Speaks only if needed

Red/amber → email with a diagnosis; green → silence

💓

Proves it's alive

Pings the dead-man's switch on clean runs only

What it will never doIt never touches the pipes — it only reports. Repairs are done by people, or approved separately.
Where it stands today · July 2026Built and live-tested. It confirmed the ETL fix held, then ran the full quiet-on-green cycle: quiet on green days, a RECOVERED email when a problem cleared, and the dead-man's-switch path all tested deliberately. Runs supervised while the rest of Wave 1 finishes its pilot.
Part 2 — under the hood

How it's wired: systems, models, and the path a number takes.

For implementers and the technically curious. The full build sheet — verified queries, thresholds, and build notes — lives on the specs page.

ReadsSync logs & timers
Warehouse sync log, feed pull log, brain-ingestion timers
Stepdata0_sentinel.py
Deterministic checks: statuses, row counts, freshness thresholds
StateGreen-streak state
Remembers yesterday's status — so it can say “recovered” and count green days
StepQuiet-on-green filter
Digest always written to logs; email only on ❌ / ⚠️ / status change
DeliversEmail to Nish
Branded digest with a one-line diagnosis per problem
StateHealthchecks ping
Sent only on clean runs — silence trips the alarm
System we read Automated step State / memory Human decision
SystemRole in this loop
NetSuite warehousePostgres on our serverOur nightly read-only copy of NetSuite (ERP) data — items, stock, transactions — refreshed by the ETL sync every morning. The loop queries this copy, never NetSuite itself.
Company feedfeed.huxapps.comIts publish ledger is one of the watched pipelines — the sentinel confirms today's cards actually landed.
GBrain timersknowledge-brain ingestionSystemd timers that feed wiki edits into the company AI brain — checked weekly-deep, daily-shallow.
Hermesagent runtime on our serverThe scheduler that wakes the loop up. Each loop is a cron job under a Hermes profile; the planned bizops profile will host the business digests (IT loops run under vpsops).
Healthcheckshealthchecks.huxapps.comThe dead-man's switch. The loop pings it only after a clean run — if the loop dies or errors, the ping stops and Healthchecks raises the alarm independently. This is how 'never silent' is enforced by machinery, not promises.
Email renderer + gwsrender_email.pyAll digests pass through one shared renderer: Huxberry-branded HTML, tables for repeated rows, a coral 'needs your response' box when the loop has questions, and an arrow link on every record. Sent from the loops mailbox via the Google Workspace CLI.
Loop chassisloop_common.pyShared plumbing every loop reuses instead of reinventing: state files, run-over-run diffing, Metabase drill-down link building, quiet-on-green notify logic.
Model / brainWhat it does here
None at run timedeterministic scriptA normal cycle is a plain Python script — no AI tokens are spent unless a diagnosis or judgment step is actually needed. AI wrote the script; the script does the rounds.
GPT-5.5 via Codexthe bulk-work modelWrote and maintains the mechanical parts — SQL, diffing, digest assembly. Effectively free on our existing subscription, so routine cycles cost almost nothing.
Claude Opusthe judgment modelReviews alert wording, thresholds, and anything a human will read and act on. Post-Fable, Opus owns everything that ships.
State & memory

A small JSON state file: last status per pipeline, plus the green-streak counter. That's what lets it say “day 6 of consecutive green” and send exactly one RECOVERED note.

Delivery

Email via the shared renderer, only when attention is needed. The digest itself always prints to logs — the loop is never silent at the machine layer.

Safety rails

Read-only everywhere. The never-silent promise is enforced by Healthchecks: a dead or erroring sentinel stops pinging, and the alarm fires on its own.

Full build sheet →