▶ Demo: building your first automation

Module 05 demo · ~4 minutes · prompt by prompt; run these yourself and you land in the same place

Repo structure & tests

client-project/
automations/
weekly-filing.md (the task, all guardrails)
scripts/
weekly-filing.sh (starts claude headless)
schedule: mondays 7:00 (crontab)
incoming/
3 unfiled notes waiting
research/
logs/
automation.log
needs-review/
Guardrail tests
nothing waiting → logs it, exits in seconds ✓
undatable note → review folder, flagged, never guessed ✓
cap reached → stopped, logged what remains ✓
automations/weekly-filing.md (what Claude wrote)
# Weekly filing

Take any notes sitting in the incoming
folder. Rename each to our date naming,
move it into the research folder, and add
one line for it to the summary index.

Stop when the incoming folder is empty.
If you cannot work out a note's date, move
it to the needs-review folder and flag it
in the log. Never guess.
Append one log line per action to the
automation log, and a final line saying
why the run ended.
scripts/weekly-filing.sh (the runner)
#!/bin/bash
# start claude headless with the filing
# task and a hard turn cap
claude -p "$(cat automations/weekly-filing.md)" \
  --max-turns 20

# the task's own rules handle the finish
# line, the log, and escalation. this cap
# is the seatbelt on top.
the schedule (crontab entry)
# run the weekly filing every monday, 7:00am
0 7 * * 1  cd ~/client-project && ./scripts/weekly-filing.sh

# reads: minute 0, hour 7, any day of month,
# any month, weekday 1 (monday)
monday's run · the log, one receipt
07:00 filed 2026-08-21-workshop.md
07:00 added index line for workshop note
07:01 filed 2026-08-22-steerco.md
07:01 added index line for steerco note
07:02 filed 2026-08-22-working.md
07:02 added index line for working note
07:03 pass complete: incoming folder empty
07:03 stopped: finish condition met
the empty run · nothing happening is the success case
10:14 checked incoming folder: empty
10:14 stopped: nothing to file

(total run time: seconds. total cost:
almost nothing. the finish condition was
true on the first check, so the run ended
before doing any work at all.)
the escalation · it does not guess
10:31 filed 2026-08-23-notes.md
10:31 could not determine a date for
      "meeting notes final v2.md"
10:31 moved it to needs-review and
      FLAGGED for a human
10:32 stopped: incoming folder empty
the cap test · stopped gracefully, nothing lost
10:45 filed note 1 of 5
10:46 filed note 2 of 5
10:46 TURN CAP REACHED (2 turns for
      this test run)
10:46 stopped: 3 notes remain in
      incoming, next run will finish

(the work is not lost. it is waiting,
and the log says exactly where.)
The loop, live
check incominganything waiting?
→
file & renameone note
→
update indexone line
↻
stopempty, capped, or stuck
Module 05 · Demo
Building your first automation
Every prompt shown here works in your own repo. Three parts:
1 · Build it 2 · Monday runs itself 3 · Prove the guardrails
Mondays belong to the machine now
Run these prompts in your own repo, in your own words: write the task with its three guardrails, wire the runner and the schedule, then prove all three guardrails the way the demo did. The tests are where the learning lives.

On to the Module 05 quiz →

Part 1 · Build it Part 2 · Monday runs itself Part 3 · Prove the guardrails