MODULE 03

AUTOMATION, PIPELINES, AND TRIGGERED WORKFLOWS

Stop running workflows manually. Think of reporting tools as systems with input nodes, conveyor belts, and output destinations — then let cloud remote triggers, GitHub Actions, and GitHub Pages run them for you on a schedule.

MODULE 03

This module is locked

Unlocks Sunday, April 26 at 5:00 PM ET.

Check back then, or visit your course on the Knight Center LMS.

Back to home

Watch

Systems thinking for non-programmers

Module 3 opens with a reframe — instead of sitting at the terminal babysitting a one-shot task, you design pipelines that run themselves on a trigger. Joe argues the block most journalists hit here isn't code, it's systems thinking, and he walks through the conveyor-belt mental model, multi-stage pipeline design, secret hygiene, and the three rules he wants you to carry into the hands-on video.

TOPICS COVERED

From one-off to running on its own
The goal shifts from "I babysit this task" to "an event fires and the pipeline handles itself." That's where most non-programmers stall
Think in conveyor belts
Nodes, splitters, mergers. If you've played Factorio or Satisfactory you already know this — resources flow in, get transformed, flow out
Multi-stage pipelines
Fetch, clean, process, document. Each stage does one job. Outputs are repeatable, saveable, and chainable
Plan before you build
Don't let the agent spend hours on a draft before you've reviewed the pitch. Use plan mode or Superpowers to catch misalignment early
Secret hygiene
Never hard-code keys, especially if you're pushing to GitHub. Joe's own early OpenAI key got scraped and he woke up to a $50 bill
Test on five, not 5,000
Verify each stage on a handful of inputs before you let a pipeline grind through a database. Failures stay localized when you catch them small

KEY TAKEAWAYS

  • You're managing, not prompting. Joe is explicit that the role shifts when you move into automation — you're designing the workspace, the inputs, the fallback mechanisms, and the destinations. The agent inhabits that environment and does the work, but the architecture is yours.
  • Modularize everything. Each pipeline stage should be a self-contained unit that can be tested, documented, and swapped without breaking neighbors. Chain stages together (email → clean → process → CRM → Kanban → next pipeline) but never build one monolithic script that has to succeed or fail as a whole.
  • Skip automation fundamentals and you'll stall. If you jumped straight into generation without ever touching Zapier, N8N, or basic trigger-response tools, go back. The mental model is the thing — the CLI agent is just a more flexible engine for the same ideas.
  • Basic security is non-negotiable but don't spiral. Don't commit secrets. Ask the agent to audit for hard-coded values. Use spend limits on your API accounts as a backstop. But don't go so paranoid that you assume every script needs CIA-grade defense — the goal is proactive, not perfect.

TIMESTAMPS

00:00Module 3 intro
00:22From one-off task to automated pipeline
02:13Systems thinking and the Factorio analogy
04:43What automation actually means
05:47Plan before you build
07:12Multi-stage pipeline — fetch, clean, process, document
09:07Test on five before scaling to 5,000
09:15Secret hygiene and the $50 OpenAI mistake
11:04Three rules recap — stage, test, secrets
11:52Transition to the hands-on video

Automating the Mamdani project end to end

Joe picks up the Mamdani pipeline and automates it — a daily remote trigger on Anthropic's cloud that checks for new videos, a local run for the GPU-heavy transcription, a GitHub Actions workflow that deploys a live dashboard to GitHub Pages, and a Copilot-reviewed PR with 10 comments. The video ends by debugging a self-triggering PR loop Joe accidentally created by merging with his own account.

TOPICS COVERED

cron.create vs remote trigger
cron.create fires only while Claude Code is open (seven-day timer). Remote triggers run on Anthropic's cloud even when your machine is off
Hybrid scheduler
Remote trigger checks daily for new videos, uploads a report to Google Drive. GPU-heavy transcription stays local. Best of both worlds
Google Drive desktop sync
Skip the Google Drive API nightmare — drop files into a folder that Google Drive desktop already syncs and you're done
GitHub Pages + Actions
Free public dashboard deployed from a workflow. Daily cron runs yt-dlp, rebuilds analysis, commits to master, deploys the site
Copilot review, 10 comments
Some solid catches, some nitpicks. Joe tells Claude to fix everything reasonable and re-run — that's the workflow loop
The self-triggering PR loop
Analysis writes a slightly different file each run, so every merge creates a diff, which triggers another PR. Guard only catches bot pushes, not user merges

KEY TAKEAWAYS

  • Stack automations you already have. Joe's whole architecture is glued-together pieces that aren't built for each other — Google Drive desktop for sync, GitHub Copilot for PR review, GitHub Pages for hosting, Anthropic remote triggers for the daily check. Each one does one thing well, and the result is a pipeline where he barely has to touch anything.
  • Remote triggers don't get your GPU. They run in an isolated cloud environment that clones your repo and runs Claude Code there. That's great for fetching metadata and committing reports, but anything that needs local files, yt-dlp, or Whisper has to stay on your machine. Plan the split up front.
  • Branch protection plus Copilot auto-review is a pattern. Instead of having the action commit to master directly, have it open a PR. The branch protection rule forces the PR, Copilot auto-reviews on open, you get an email, you review, you merge. Free QA loop for every scheduled run.
  • Loops are easy to create accidentally. Joe's analysis script produced a slightly different output each run (timestamp, ordering), so every merge was a real diff. His self-trigger guard only caught commits from the bot — merges from Joe himself slipped through and kicked off another PR. Fix: normalize outputs so runs with no new videos produce an identical file.

TIMESTAMPS

00:00Planning automation for new Mamdani videos
02:20YouTube and TikTok only — the rest need Playwright
04:35cron.create vs remote trigger — two scheduling machines
06:30Hybrid scheduler: remote check, local pipeline
07:11Google Drive desktop sync instead of the API
09:47Configuring the /schedule skill and prompt
10:29Firing the remote trigger in the cloud
13:02Adding GitHub Pages and a daily Action
17:24Opening the PR and waiting for Copilot
19:2510 Copilot comments, fix everything reasonable
22:18Pages deployment fails on branch protection
25:50Self-triggering PR loop — diagnosing and fixing

Learning objectives

  • > Describe a reporting workflow as a system: input nodes, conveyor belts, transformers, and output destinations
  • > Plan a multi-stage pipeline with one job per stage (fetch, clean, process, save) so failures stay isolated
  • > Use plan mode (/plan) to review the approach before any code is written or any command is run
  • > Choose between the two schedulers: in-session cron.create for local jobs, cloud remote triggers for always-on runs
  • > Publish a static dashboard using GitHub Pages and trigger rebuilds with GitHub Actions
  • > Apply the three rules: stage the pipeline, test small, never put secrets in code

Before you start

This module is about building automated pipelines — scripts that run a sequence of AI tasks without you manually intervening. To use them well, it helps to understand what's actually happening inside an AI session: how context is stored, why order matters, and what "caching" means for how quickly your pipeline runs.

Read the full explanation: how AI session memory works →

Key concepts

Think in systems, not scripts

Non-programmers usually stall here — at the jump from "I ran this once" to "this runs on its own." The fix is to stop thinking about scripts and start thinking about systems. Every automation has the same four parts: input nodes (where data enters), conveyor belts (how it moves), transformers (what changes it), and output destinations (where it ends up).

If you've played Factorio or Satisfactory, you already know the model. A fetcher pulls posts off a social platform → a transcription stage runs Whisper → a content analysis stage labels them → the labeled output lands in a dashboard. When you describe a workflow to Claude this way, it gets the architecture right the first time instead of building one long script that breaks halfway through.

Describe the workflow, let the LLM build it

Instead of asking your CLI tool to help with one document, you describe an entire workflow — a sequence of steps from input to output — and it builds the script that automates it.

"Fetch this URL, strip out the ads, summarize it in three bullets, save it as a markdown file with today's date in the filename." That's a workflow description. Your CLI tool turns it into a reusable script. You review it, test it on a few real examples, and refine it until the output is what you want.

Plan before you build

Before asking your CLI tool to build anything, ask it to plan first. See the approach before any file is written or any command is run.

# Claude Code: enter plan mode
/plan

# Gemini CLI: be explicit
"Before doing anything, plan this out step by step
and wait for my approval before taking any action."

A misunderstood requirement caught at the planning stage costs you 30 seconds. The same misunderstanding caught after a failed 50-document batch run costs you time and money.

Pipeline stages

The right way to build a pipeline: separate stages, each with a clear input and output. Fetch. Clean. Analyze. Format. When something breaks, you know which stage failed — and you can fix one without touching the others.

Two schedulers: local and cloud

Claude Code has two ways to run a job on a schedule, and they solve different problems.

  • > In-session cron.create — schedules a job from inside an active Claude Code session. Runs on your local machine, uses your local tools (Whisper, FFmpeg, YTDLP), and stops when your computer sleeps. Good for anything that needs GPU or long-running local work.
  • > Cloud remote triggers — run in Anthropic's cloud on a fixed schedule. They don't need your computer to be on, but they can't touch your local files or tools. Good for detection ("did anything new show up?"), notifications, and anything that fits in pure API calls.
  • > Hybrid — the pattern the video uses. A cloud trigger detects new videos every few hours and writes a tiny queue file. When your local machine wakes up, an in-session cron drains the queue and runs transcription on the GPU. You get the always-on detection of the cloud plus the local tools of your workstation.

GitHub Actions and GitHub Pages for the output layer

Once your pipeline produces something worth publishing — a dashboard, a CSV, an interactive page — you need an output destination that's always online. GitHub Pages is free, versioned, and every update is a commit you can audit later.

GitHub Actions is the trigger that fires when new output arrives. The pattern is simple: your local pipeline writes output into a repo, a commit pushes it to GitHub, a workflow in .github/workflows/ rebuilds the site, and GitHub Pages serves the new version. The Module 2 Mamdani dashboard updates this way every time new videos are processed — no server, no deploy script, no hosting bill.

Watch out for self-triggering loops

The Module 3 video debugs a real bug you will hit at some point: a GitHub Actions workflow that opens a PR, which triggers the same workflow, which opens another PR. These loops are easy to create and embarrassingly expensive to leave running. The defense is branch protection rules and a condition at the top of the workflow that filters out self-authored pushes. When the Copilot PR reviewer flags branching or trigger logic, read it carefully — these are exactly the bugs it catches best.

Test small before running large

Real API calls cost money. Before you process 500 documents through a paid API, test on 5. Better yet, validate your inputs with a free local model before sending anything to a paid service. Use cheap tools to catch problems before running expensive operations.

The debugging loop

When something breaks, paste the exact error message into your CLI session and ask what it means. Don't paraphrase. Your tool already knows the code it built for you, so it can read the error in context and usually identify the problem immediately. This is one of the most useful things about working with a CLI LLM: your debugging collaborator is already there, already has context, and can read error messages directly.

API key security

When your CLI tool builds scripts that call external APIs, those scripts often need API keys. Never put keys directly in your source code. Use environment variables instead:

# Bad: key hardcoded in a script (anyone who sees the file has your key)
API_KEY="sk-abc123..."

# Good: key stored in an environment variable
export API_KEY="sk-abc123..."   # set once in your terminal
echo "$API_KEY"                  # scripts read it from the environment

If you ask your CLI tool to build a script that uses an API, tell it to read keys from environment variables. And never commit a file containing a real key to git.

Rate limits and checkpointing

APIs have rate limits for a reason. Building pauses into your scripts (sleep 2 between API calls) keeps your API access alive. For long batch jobs, build in checkpointing — a log of which files have been processed — so the job can restart from where it left off instead of starting over.

EXERCISE

GOAL: Ask Claude to build a multi-stage workflow script for a real journalism task — then explore what it built and why it works.

Choose one of these scenarios (or adapt one to fit your work):

A. City council agenda to reporter prep sheet. Feed a meeting agenda into a pipeline that extracts each item, summarizes the background, flags items with budget implications, and outputs a prep document a reporter can bring to the meeting.

B. Web scraping pipeline. Pull data from a public source (a government page, a court docket index, an open data portal), clean it into structured format, and output a summary of what changed since the last run.

C. Batch document processing. Process a folder of PDFs or text files (transcripts, press releases, public records) — extract key facts from each, then produce a combined summary with source references.

D. Weekly content roundup generator. Given a folder of articles or story links, generate a newsletter-style roundup: headline, 2-3 sentence summary, and a categorization tag for each piece.

01 Open Claude Code

Open your terminal and launch a session:

terminal
claude

02 Ask Claude to build the pipeline

Describe your chosen scenario inside the session. Here's an example for option D (weekly roundup), but adapt it to whichever scenario you picked:

claude code
Create a content pipeline in ~/content-pipeline. I need:

1. Three realistic sample input files (fictional local news articles as .txt files)
2. A shell script called run-pipeline.sh that processes each input file through multiple stages: first summarize it in 2-3 sentences, then add a category tag, then format the result as an HTML snippet. Save each stage's output so I can inspect intermediate results. Final outputs go in an output/ folder.
3. Make the script executable, run it on ONE file first, and show me the output before processing the rest.

Watch what Claude does: it creates the folder structure, writes sample inputs, writes the script, and runs a single test. You delegated the whole thing — and you tested small before running large.

03 Ask Claude to explain what it built

In the same session, ask Claude to walk you through the script:

claude code
Walk me through the script line by line. Explain each stage of the pipeline: what goes in, what comes out, and how the stages connect. If this script used an API key, where should it store it — and where should it never store it?

This is the key concept of the module: a multi-stage pipeline breaks a big task into smaller steps (fetch, clean, analyze, format), each producing output that feeds the next. Claude built it; your job is to understand the structure well enough to modify or extend it.

04 Run the full pipeline

Now that you've verified the output on one file, ask Claude to process all inputs and show you the results:

claude code
Run the pipeline on all the input files and show me each final output. Then tell me: what would need to change in the script if I wanted to use Gemini CLI instead of Claude? And what would I need to do if this script required an API key to call an external service?

The script Claude wrote is yours — save it, modify it, run it on real data whenever you need. That's what "reusable workflow" means.

Checkpoint

Self-check: Make sure you can answer these before moving on.

  • ? What are the stages in the pipeline you built, and how does output from one stage feed into the next?
  • ? Why should you run a pipeline on one file first before processing an entire folder?
  • ? Where should API keys go — and where should they never go?
  • ? What kinds of journalism workflows are well-suited to an automated pipeline like this one?

Reading from the field

Three pieces by working practitioners on the themes of this module — real pipelines, real costs, real failure modes. Start here instead of the docs.

[CASE STUDY] Generative AI in the Newsroom · Mar 2026

Wrangling Messy Documents with Coding Agents

Nick Hagar

The clearest practitioner illustration of stage the pipeline, one job per stage. Hagar built a single skill with three modes — Transcription, Structuring, and Automated OCR — then tested it on three published investigations including a Pulitzer-winning NYT lobbying series and a Marshall Project / NYT Pulitzer finalist on New York prison discipline records. Crosses from Claude Code to Gemini 3 and back when one model's vision isn't good enough. His final line is the editorial argument this course keeps returning to: coding agents are versatile tools for handling labor-intensive tasks under the supervision of an expert human.

[CASE STUDY] Generative AI in the Newsroom · Oct 2025

Augmented beat reporting: where LLMs excel and where reporters still win

Nick Hagar

A working beat-monitoring pipeline built for about $0.15 a day. The models hit an F1 of 0.94 at extracting relevant use cases from articles but only 31% exact alignment with human newsworthiness judgment. A one-week pilot still surfaced three high-value leads the reporter hadn't found elsewhere. The lesson maps directly onto this module: LLMs are good first-pass filters, but the decision about what's worth pursuing stays with the journalist.

[ESSAY] simonwillison.net · Dec 2025

Code proven to work

Simon Willison

Willison's argument that publishing pipeline outputs without personally verifying them shifts the verification burden onto the reader. The principle maps straight onto automated newsroom pipelines: you are responsible for checking that what your script produced is correct, not just that it ran without errors. Read this before you schedule anything on a recurring trigger.

Background reference (for when you need syntax, not framing): Claude Code schedulers and remote triggers, GitHub Actions workflows, and GitHub Pages.

When things break

The most useful debugging move in a CLI session is also the simplest: paste the error back into the chat and ask what it means. Your tool already knows the code it built for you, so it can read the error in context and usually identify the problem immediately. Don't paraphrase. Don't translate. Copy the exact output and hand it back.

If you're stuck in a loop — the same error three times in a row, the same fix that doesn't work — that's the signal to stop and replan. Enter plan mode (/plan) and ask for a different approach instead of retrying the broken one. The course's Module 4 goes deeper on rewinding bad conversations and capping sessions before they drift.