This document describes how to set up and manage the autonomous daily pipeline.
The D-AI-LY runs as a two-layer system:
┌─────────────────────────────────────────┐
│ LOCAL AUTOMATION (Primary) │
│ macOS launchd - runs at 8am daily │
└─────────────────┬───────────────────────┘
│
┌─────────────▼─────────────┐
│ 1. Topic Discovery │ ← R: discover_topics.R
│ 2. Data Fetch │ ← R: fetch_table.R
│ 3. Article Generation │ ← Claude Code (Max subscription)
│ 4. Build & Publish │ ← npm + git
└───────────────────────────┘
┌─────────────────────────────────────────┐
│ GITHUB ACTION (Fallback) │
│ Creates issue if local fails │
└─────────────────────────────────────────┘
cd automation
./install.shThis installs a launchd agent that runs the pipeline daily at 8:00 AM.
./automation/install.sh --status# Full pipeline
./automation/run_pipeline.sh
# Prep only (discovery + fetch, no generation)
./automation/run_pipeline.sh --prep-only
# Specific table
./automation/run_pipeline.sh --table=18-10-0004./automation/install.sh --remove- launchd triggers
run_pipeline.shat 8:00 AM daily - R discovers newsworthy tables from configured list
- R fetches data for the top-ranked table
- Claude Code generates bilingual articles
- npm build creates the static site
- (Optional) git push publishes to GitHub Pages
If the local automation doesn't run (Mac offline, Claude Code issues, quota exceeded):
- GitHub Action runs on schedule (8am ET / 1pm UTC)
- Runs discovery + fetch steps
- Creates a GitHub Issue with:
- Recommended table number
- Command to run manually
- Link to workflow artifacts
You then run the generation manually when available:
claude "/the-daily-generator TABLE_NUMBER"automation/
├── run_pipeline.sh # Main pipeline script
├── com.the-daily.pipeline.plist # macOS launchd config
├── install.sh # Installation script
└── logs/ # Pipeline logs
├── pipeline_2025-01-01_08-00-00.log
└── launchd_stdout.log
.github/workflows/
└── daily.yml # GitHub Action (fallback)
The pipeline runs at 8:00 AM local time. To change:
- Edit
automation/com.the-daily.pipeline.plist - Modify the
StartCalendarIntervalsection - Reinstall:
./automation/install.sh
Tables are selected from r-tools/table_configs.json. To add tables:
- Add configuration to
table_configs.json - Follow the format of existing entries
- Run discovery to verify:
Rscript r-tools/discover_topics.R --configured
Pipeline logs are stored in automation/logs/:
pipeline_YYYY-MM-DD_HH-MM-SS.log- Full pipeline outputlaunchd_stdout.log- launchd wrapper outputlaunchd_stderr.log- launchd errors
View recent logs:
# Latest log
cat automation/logs/$(ls -t automation/logs/pipeline_*.log | head -1)
# Tail live
tail -f automation/logs/launchd_stdout.logInstall Claude Code:
npm install -g @anthropic-ai/claude-codeCheck if Claude Code quota is available. The pipeline uses your Max subscription, not API credits.
# Check if agent is loaded
launchctl list | grep the-daily
# Reload agent
launchctl unload ~/Library/LaunchAgents/com.the-daily.pipeline.plist
launchctl load ~/Library/LaunchAgents/com.the-daily.pipeline.plistInstall required packages:
install.packages(c("cansim", "dplyr", "tidyr", "jsonlite"))If you prefer to run the pipeline manually:
# Step 1: Discover topics
Rscript r-tools/discover_topics.R --configured --json --output=output
# Step 2: Check recommendation
cat output/discovery_results.json | jq '.recommendation'
# Step 3: Fetch data
Rscript r-tools/fetch_table.R TABLE_NUMBER output
# Step 4: Generate article
claude "/the-daily-generator TABLE_NUMBER"
# Step 5: Build site
npm run build
# Step 6: Publish (optional)
git add docs/ output/
git commit -m "Add: Article for TABLE_NUMBER"
git push