Thursday, 3 Dec 2026 Global Edition
Live Wire
AI Today Daily AI journalism & intelligence
Front Page Tips & Tutorials Baca versi Indonesia

Build Once, Runs Every Morning: Your AI-Written Daily Automation Script

One-off scripts are easy. This time, build a daily automation that runs itself every morning — from your AI brief to a working cron schedule.

Build Once, Runs Every Morning: Your AI-Written Daily Automation Script

Every morning starts with the same three questions: what's in the news, what's the weather, and what needs doing today. So we open five apps and repeat the same ritual. Imagine the opposite: at 5:30 a.m., one briefing file is already assembled in the first place you look — put together by a script that ran itself, before you touched your computer.

The good news: this is no longer a programmer's job. With an AI chatbot writing the code, the hard part is yours — picking a task genuinely worth automating, and keeping the system alive after week one. This tutorial walks the whole path, from first brief to a self-running schedule.

Pick One Task Worth Automating

Daily automations fail not because the code is broken, but because the task was wrong. Test your candidate against four criteria:

  1. The data source is stable. News RSS feeds, public APIs, local folders, or your own spreadsheets can all be read routinely.
  1. The output is clear and fixed. One summary file, one notification message, one small table.
  1. The timing is fixed. Every morning at 6:00 or every night at 21:00 — not "whenever needed".
  1. Failure is not fatal. If one day comes up empty, your life goes on.

Candidates that usually pass: a morning briefing with news, weather, and agenda; a price watcher; a nightly Downloads-folder cleanup; a vocabulary digest. Avoid tasks demanding human judgment each run, or sources whose structure changes often.

Write a Brief for the AI, Not a Code Request

The most common mistake when using AI for code: asking outright for "a script that does X". The AI knows nothing about your computer, your Python version, or your data's shape. A good brief states environment, inputs, output, and failure behavior.

Here is a realistic brief:

Write a Python script for macOS (Python 3 is already installed) that:
1. Fetches the 10 latest articles from the RSS feed https://techcrunch.com/feed/
2. Fetches the weather in Jakarta from the open-meteo API (free, no API key)
3. Assembles everything into one markdown file named
   briefing-YYYY-MM-DD.md in the ~/briefing folder
4. If one source fails, continue with the others and mark
   that section "failed to fetch"

Explain your plan in plain language first, wait for my approval,
then write the full code with comments.

That last instruction is the key. Asked to explain a plan first, the AI surfaces its assumptions — libraries, file locations, output format — before you get stuck with code that needs tearing apart. Revising a plan is cheaper than revising code.

Build the First Version, Test It Manually

Don't rush to schedule anything. Save the AI's code as a file and run it once yourself: python3 morning_briefing.py. Check the result: does the briefing appear, is it pleasant to read, is the date correct?

If an error shows up, that is normal, not failure. Copy the full message — line numbers included — paste it back into the chat, and ask for a fix plus a one-sentence explanation. Two or three rounds are normal before the first clean run.

Before trusting the script to run unattended, read it once. You don't need to write code, but you should know which files it opens, which addresses it contacts, and what data leaves your computer.

Put It on a Schedule

A good script is not an automation until it has a time trigger. On macOS and Linux, that is cron. Open a terminal, run crontab -e, and add one line:

30 5 * * * /usr/bin/python3 /Users/you/briefing/morning_briefing.py >> /Users/you/briefing/briefing.log 2>&1

The first five fields are the schedule: minute 30, hour 5, every day. The >> ...log part records all output into a log file — don't skip it: when the script runs without you, the log is the only witness to what happened.

On Windows, use Task Scheduler: create a "Basic Task", pick a daily trigger, then set the program to python with your script's path as the argument. If your laptop is often off, use GitHub Actions instead: a repository can run your script on GitHub's servers with the same cron syntax.

Deliver the Output Where You Already Look

A file in a folder still demands that you open it. A successful automation drops its result into the stream you already read daily: a chat app or your inbox.

The most beginner-friendly route is a Telegram bot. Create one through BotFather, store its token, then ask the AI to add a send-message function — one Bot API call is enough. Alternatives: email the result to yourself via SMTP, or render it as a simple local page.

One rule: put the output where you look without being told. A script that runs flawlessly every morning but is never read is the same as no script at all.

Set Up a Safety Net from Day One

Daily automations are tested not when they succeed but when they fail. Three safeguards are enough:

  1. A log. All output goes into one log file, as in the cron pattern above.
  1. A failure signal. Ask the AI to wrap the script in error handling: if it fails completely, it sends a "briefing failed today" message to your Telegram. Without it, you learn the script is dead only after a week of silence.
  1. Dated files. Put the date in the filename so today's run never overwrites yesterday's.

During week one, spend two minutes each morning reading the log. After seven clean days, a weekly check is enough. Every bug gets the same treatment: copy the log, paste it into the AI, request a fix plus the cause.

Watch Cost and Privacy

If you add an "AI summarizes this" step — ten articles compressed into three sentences, say — it uses a paid API. Good news: a daily briefing is the lightest workload. Small text, low frequency, so a budget-tier model keeps the monthly bill under the price of a coffee.

Two things are mandatory. Store API keys and tokens as environment variables, never hard-coded. And don't send sensitive data to AI services: a briefing from public RSS feeds is safe; private emails or work documents may not be. Want zero cost and risk? Let the script only assemble raw data into one file; paste it into an AI chat yourself when you need a summary.


Start with one task, one file, one schedule. Once your briefing survives its first week, you will see the same pattern elsewhere — and now you know how to build it. A small automation that shows up reliably every day beats a clever assistant you must summon manually.

References

Partner Spotlight Explore today’s curated technology offers