Skip to Content
Recodocs

Automated reporting

Can a weekly operations report keep one identity per metric, hold when a source is stale on the run day, and send only after that version is approved?

7 min read

What question this set answers, and who needs it

A weekly report is useful when a reader can trust that the same metric means the same thing each week. Missing, stale or conflicting evidence must remain visible instead of being covered by a polished narrative.

The set asks whether a weekly report can keep one identity per metric, hold the report when a source is stale on the run day and flag a spreadsheet column that disagrees with the system of record, flag a week outside its band, drop an insight with no evidence, attach a narrative only when every sentence is fully supported, and queue a version only after approval.

The business owner needs the registry, the spec and the narrative. The finance lead needs the gates and the anomaly flags. The operations manager needs each insight to name its rows. The office administrator needs approval before send, and a history that keeps the approver's name.

The subject is the synthetic Brightwater weekly operations report. The README says the dataset and every name in it are synthetic, and that no real customer, employee or account data is used. The set reads examples/automation-common/ and does not create or edit it. This is a notebook-level proof. Only notebook 06 has a model step, a narrative writer that chooses no action. The other notebooks are deterministic.

scripts/check_automated_reporting_notebooks.py enforces README order. The README status is executed 2026-10-20 and re-executed the same day after production hardening: all seven notebooks, no error cell, every Proof claim enforced by an assertion. Earlier notebook 06 attempts did not attach the narrative; the reworded v2 prompt did. Checks hold whether or not a narrative attaches, because the Proof only says it is attached when every sentence is fully supported. The static and --executed checkers pass. Deviations and limits are in the verification ledger.

How to run it

From the kit root (recohut-kit), kernel automated-reporting. ruff is installed so the checker can run python -m ruff. The ticketing extra supplies the ticketing module (httpx and pydantic). No pin or pyproject.toml value is changed. pandas is not installed; no notebook or support.py imports it.

uv venv .venv-automated-reporting
uv pip install --python .venv-automated-reporting/bin/python -e '.[codex,ticketing]' nbconvert ipykernel ruff
.venv-automated-reporting/bin/python -m ipykernel install --user --name automated-reporting

Execute each notebook once, in README order. The command sets a 900 second timeout.

.venv-automated-reporting/bin/jupyter nbconvert --to notebook --execute --inplace --allow-errors \
  --ExecutePreprocessor.timeout=900 --ExecutePreprocessor.kernel_name=automated-reporting \
  examples/automated-reporting/<notebook>.ipynb

The Browser checkpoint column is None on every row, so no browser handoff is requested. Then, from the kit root:

.venv-automated-reporting/bin/python scripts/check_automated_reporting_notebooks.py
.venv-automated-reporting/bin/python scripts/check_automated_reporting_notebooks.py --executed

Notebooks write only under examples/automated-reporting/.runtime/ plus the notebook stem, a path the set's .gitignore ignores. No cloud resource is created, so no ledger cleanup cell applies. Any loopback listener closes in its notebook's last cell.

Each Route / call cap cell repeats the route label that the notebook's first cell must state. Recorded rows carry "recorded, not a capture of a real account". n8n, Make, mail, calendar, spreadsheets, CRM, Slack, connectors and any BI tool are recorded stand-ins. No third-party account is created and no provider key is used. The README says Codex-credit calls on the Codex live route read agents/travel-marketplace-agent/data/local/codex-auth in place and are recorded per call; the digest has no receipt.

The notebooks in order

NotebookWhat it doesRecorded output
01-metric-registry-and-identity.ipynbRegisters each weekly metric once, with one definition, one owner and one identity. Route: scripted, 0 model calls.yes
02-report-spec-schedule-and-audience.ipynbWrites metrics, schedule and audience into one spec. Route: scripted, 0 model calls.yes
03-freshness-and-data-quality-gates.ipynbHolds a report when a source is stale on the run day, and flags a spreadsheet column that disagrees with the system of record. Route: recorded, 0 model calls.yes
04-anomalies-and-period-comparisons.ipynbFlags a KPI outside its band and prints the comparison beside the flag. Route: scripted, 0 model calls.yes
05-insights-with-evidence-refs.ipynbKeeps insights that name their rows, and drops an insight with no evidence reference. Route: scripted, 0 model calls.yes
06-narrative-judged-by-claims-codex-live.ipynbA model writes the narrative. The claims check refuses any sentence it cannot trace. Route: Codex live, Codex-credit, no ceiling; each call's receipt is recorded.yes
07-approved-distribution-and-report-history.ipynbQueues a version only after the owner approves it, and keeps the approver's name in the history. Route: recorded, 0 model calls.yes

Digest output counts are 6, 7, 11, 7, 5, 8 and 10. None is marked NO RECORDED OUTPUT.

What the recorded outputs show

Notebook 01 prints dataset kpi_definitions rows: 8; registered metrics: 8 and registry digest 68efb4bc5fe0a8ce. Printed identities include invoice_return_rate_pct|all|2026-W42|-|-|v1 (ratio, role:billing_clerk) and invoices_sent (count, role:billing_clerk). A changed formula for tickets_opened prints re-register refused: definition_conflict and registry digest unchanged: 68efb4bc5fe0a8ce.

Notebook 02 prints Weekly operations report; owner role analyst, schedule Every Monday 08:15 UTC, covering the previous Monday to Sunday, and audience roles ops_manager, support_lead, controller, field_supervisor. The spec is weekly_operations_report v1, cron 15 8 * * 1 UTC, period kind week, digest e1f3d64203532ee8, with email list:ops-leadership and slack channel:ops-weekly both requiring approval. Eight metrics from fieldops, servicedesk, ledgerlite and timesheets are all in the registry.

Notebook 03 prints ds_fieldops_export 7.0h of 36h fresh, ds_servicedesk_export 127.0h of 36h STALE, ds_ledgerlite_register 62.9h of 168h fresh, and ds_timesheets 2.0h of 168h fresh. Three scenario-g lines print match for one stale source, ds_servicedesk_export, and metrics tickets_opened and tickets_resolved. The run prints weekly_operations_report@v1:2026-W42:d0076e40f45a status held and HELD freshness fresh-servicedesk: servicedesk last updated before the period closed (2026-10-19).

Notebook 04 prints planted tickets_opened week 14 value 68.0, cause heat wave: emergency cooling work orders plus status inquiries and complaints, and invoice_return_rate_pct in weeks 18 and 19. The 2026-W30 run prints status ready; flags 5. Shown flags: warning work_orders_received observed 38, expected 29.8333, score 2.20; warning work_orders_completed observed 44, expected 28.1667, score 2.81; critical tickets_opened observed 68, expected 27.3333, score 8.44. The spike prints computed flagged True (critical). Also flagged, and labelled not in the planted list: overtime_hours_total, tickets_resolved, work_orders_completed, work_orders_received.

Notebook 05 prints 13 insights for 2026-W30, status ready and verify_run checked 13 lines: all cited, all references known. Commentary prints candidates 5; kept 2; dropped 3. Kept lines cite work_orders:wo_000362 (14 emergency HVAC orders) and slack_messages:slk_000061 (7 Slack messages). Two lines drop with no evidence reference. The spike matches an earlier outage. drops because the reference does not resolve.

Notebook 06 prints run 2026-W42 status held; facts the writer may cite: 16, 10 insight lines, and 18 lines, 2449 characters. After scripted_writer supplies the three sentences, the claims check prints fully_supported, not_mentioned on Overtime will fall next week., and unknown_ref on Tickets doubled. The summary is attached: False and claims_not_supported. Attach prints attach refused: narrative_not_supported, flagged sentences: 2 of 3, and report narrative after the refusal: None.

Notebook 07 prints 2026-W40 ready (279fd1f88b), 2026-W41 ready (20a1cb63d7) and 2026-W42 held (d0076e40f4). W40 prints approved by Camille Gallo; sent once and one outbox item for list:ops-leadership. W41 request req-2026-W41-20a1cb stays pending for approver Camille Gallo (analyst), then prints distribution refused without approval, and the outbox count stays 1. The call cap says 0 messages sent.

What is not shown or not run

All seven saved notebooks have recorded output. Some Proof items have no printed line in the digest.

Notebook 01 stops before any output on v1 versus v2. Notebook 02's prints end at the metric list; the due period, a changed digest and a raw-email refusal have no output block, while due_period, RAW_ADDRESS and the digest idea text appear earlier in the notebook. Notebook 03's Proof says the spreadsheet audit flags three columns and 22 rows; the digest stops during the freshness observations. Notebook 04 says the dataset has 26 weeks, so the same week of earlier periods cannot be shown. The expectation output names invoice_return_rate_pct in weeks [18, 19]; the week-by-week run of those weeks has no further output block. Notebook 05's Proof names at least twelve emergency cooling orders and at least five chat messages; the digest stops after the kept and dropped lines.

Notebook 06 stops at the scripted refusal: no model sentence and no receipt. The code sets model gpt-6-luna, prompt report-narrative:v2, reasoning effort low and max output tokens 4000. The specified unavailable line, Codex live unavailable in this run, is not among the outputs. The claims check is described as lexical. The README says the v2 prompt attached a narrative; that text is not in the digest.

Notebook 07's Proof names a replayed second send, an edit that voids the approval, a held report that cannot be requested, and a full history. The digest stops at the refusal with no approval record. Deviations and limits are in the verification ledger.

Where it fits in the kit

The notebooks import local support and these kit modules.

ModuleNames the import cells use
recohut_kit.reportingReportingRefused, ChannelRef, due_period, FreshnessGate, FreshnessRule, verify_run, NarrativeSeam, attach, facts_of, scripted_writer, InMemoryReportOutbox
recohut_kit.providers.codexCodexTextClient
recohut_kit.providers.codex_authCodexAuth, CodexUnavailable
recohut_kit.harness.contractsConflict

Notebook 04's setup names recohut_kit.reporting.AnomalyRule (zscore, prior six weeks, warning at 2, critical at 3) through run_report, and does not import that name. Notebook 07's setup uses the kit's human checkpoints, bound to the run digest, rendered body, audience and channel, and an append-only ReportLedger.

How is this page?

Last updated on