
9. The Digest That Runs While the Laptop Sleeps
Notas del episodio
The enquiry digest moves into a cloud scheduled task so it runs with the laptop closed. The chapter covers alerts for failed or late runs, a completed-runs record that stops duplicate sends, and the monthly offer to make when the trial ends, using invented example figures.
This episode is narrated by AI-generated synthetic voices.
Running the digest with the laptop shut
The enquiry digest only ran when the laptop was awake and the Claude Code app open, and a failed run told no one. The customer, dates and money remain the show's invented example and prove nothing about real demand.
The first fix is a cloud scheduled task, formerly called a routine and still a research preview, so check current documentation. The setup covers a self-contained prompt, a schedule, a GitHub repository and an environment. Cron times are read in UTC unless you add a time zone, and the shortest interval is an hour. Schedule a few minutes off the hour, well before the seven o'clock deadline.
The Google Drive server added on the laptop is invisible to the cloud run. Add it as a claude.ai connector or commit a .mcp.json file. Keep API keys out of environment variables by using network secrets and the environment's network access levels. A cloud run uses auto mode, so the read-only Drive scope and the Viewer share are the limits that still hold. Whether the laptop's prompt hook carries over is unconfirmed.
Detecting failed runs and avoiding duplicate sends
A Succeeded label in History only means no failure was reported. For headless runs, check the exit code, printed output, and MCP errors. Also check the result subtype and stop reason. The wrapper script that combines them is the show's own pattern, not an Anthropic script, so test each condition. Stop and StopFailure hooks can add a quality gate and alert logging. A separate check shortly after seven catches a run that never started.
For retries, each job gets a key from the customer's opaque identifier and the scheduled date, recorded in a small file in the repository. The digest is written to a fixed path, so a rewrite replaces the earlier copy. One gap remains: a crash after delivery but before the key is marked done. The owner's review before sending covers it during the trial. Stripe's idempotency keys solve the same problem, but keys may be discarded after a day. A GitHub Actions scheduled workflow can run the plain file checks, though it can delay or skip runs and does not prevent duplicates.
What to offer when the trial ends
The trial cost $135 for ten digests, so each delivered digest earns $13.50. With four delivered, $54 is earned and $81 is still owed in digests. The delivered count in the customer record should match the completed-runs record.
Claude Code drafts the offer from the scope file and price record only: an illustrative $270 a month, just over twice the illustrative floor of about $133. The trial agreement said it would not roll into a monthly charge, so billing starts only after written agreement. Without a yes, the trial ends. A discount toward $100 would earn less per digest than it costs. Before sending, the cloud task runs a clean week under watch.