Monthly three-way match between what ad platforms say we spent, what we were invoiced, and what left the bank — the loop that makes another AED 720K structurally impossible.
A monthly reconciliation table: the three columns side by side, unexplained gaps flagged coral, and a running total against the AED 720K precedent.
AED 720K went to ad platforms over 14 months with zero verified sales — and no one document ever showed spend, invoice and bank movement together. This loop is that document, monthly, forever.
After month-end
Platform spend, invoices, bank extract
Line-level match; unexplained gaps turn coral
To Shahbaz + Nish
The loop flags; people resolve
For implementers and the technically curious. The full build sheet — verified queries, thresholds, and build notes — lives on the specs page.
| System | Role in this loop |
|---|---|
| Ads adapter layerads_common.py | One shared, environment-gated adapter for Google/Meta data used by all four ads loops — with a fixture mode so logic stays provable before credentials exist. |
| Google Workspacemail + drive search | Where the invoices already are — searched read-only. |
| Agent Vaultcredential store | Where API keys live. Loops get read-only credentials from the vault; nothing is hardcoded in scripts. |
| Hermesagent runtime on our server | The 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.com | The 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.py | All 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. |
| Model / brain | What it does here |
|---|---|
| None at run timedeterministic script | A 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 model | Wrote and maintains the mechanical parts — SQL, diffing, digest assembly. Effectively free on our existing subscription, so routine cycles cost almost nothing. |
| Claude Opusthe judgment model | Reviews alert wording, thresholds, and anything a human will read and act on. Post-Fable, Opus owns everything that ships. |
Prior months' reconciliations — so the running total and repeat-offender gaps accumulate.
Monthly email table; unexplained gaps highlighted; running total vs the AED 720K precedent always visible.
Read-only platform credentials from the vault; the token-expiry watchdog must include the Meta token from day one (it silently dies ~2 months in — a documented gotcha).