How Workers Run (The Factory Floor)
Claude Code builds it. VPS runs it. Paperclip shows it. You never think about it.
The Process
Step 1: Build (Claude Code)
You: "Make SeniorWire publish a blog every morning"
Claude: writes seniorwire-blog-worker.js following base-worker.js pattern
Claude: tests locally
Claude: git push
Step 2: Deploy (VPS)
# On VPS: pull the code
cd /root/lead-machine && git pull
# Create systemd service
sudo nano /etc/systemd/system/seniorwire-blog.service
# [Service]
# ExecStart=/usr/bin/node /root/lead-machine/workers/seniorwire-blog.js
# Restart=on-failure
# EnvironmentFile=/root/lead-machine/.env
# Create systemd timer (runs daily at 6am)
sudo nano /etc/systemd/system/seniorwire-blog.timer
# [Timer]
# OnCalendar=*-*-* 06:00:00
# Persistent=true
# Enable and start
sudo systemctl enable --now seniorwire-blog.timerStep 3: Runs Forever
- Timer fires at 6am → starts the worker
- Worker picks up job config from Redis/brain
- Does the work (generates blog, calls APIs, etc.)
- Logs result to Redis (success/failure, duration, output)
- Watchdog checks health every 5 min
- Telegram alert ONLY on failure (max 1-2/day)
Step 4: Monitor (Paperclip)
- Open paperclip.strategicaiarchitects.com
- See all jobs: green = ran successfully, red = failed
- Click any job to see logs
- Manual “Run Now” button for ad-hoc triggers
- Pause/resume controls
Existing Worker Pattern (from lead-machine)
All workers extend base-worker.js:
- Configurable concurrency
- Rate limiting
- Heartbeat every 60s
- Graceful shutdown (SIGTERM handling)
- 3 retry attempts with exponential backoff (5-30s)
- Metrics reporting
Current Workers (27 active)
| Worker | Instances | Purpose |
|---|---|---|
| lead-verify | 8 | Email verification (Reacher) |
| lead-api | 1 | API server |
| lead-webhook | 1 | Webhook handler |
| lead-copygen6 | 1 | Email copy generation |
| lead-reply | 1 | Reply classification |
| lead-enrich | 1 | Lead enrichment |
| lead-google-search-enrich | 1 | Google search enrichment |
| lead-blog-generate | 1 | Blog generation |
| lead-content-generate | 1 | Content generation |
| lead-delivery-page | 1 | Delivery page builder |
| lead-website-generate | 1 | Website generator |
| lead-heygen-video | 1 | HeyGen video creation |
| lead-sora-video | 1 | Sora video creation |
| lead-social-links | 1 | Social link finder |
| lead-social-finder | 1 | Social profile finder |
| lead-fb-photo | 1 | Facebook photo finder |
| lead-photo-finder | 1 | Photo finder |
| lead-daily-pipeline | 1 | Daily pipeline orchestrator |
| lead-machine-agent | 1 | Agent orchestrator |
| archi-telegram-bot | 1 | Telegram bot |
Workers We Need to Add
- seniorwire-daily-blog — Generate SeniorWire articles daily
- plusvibe-reply-monitor — Check for new PV replies every 15 min
- blacklist-checker — Check all 15 domains daily
- content-weekly-planner — Plan next week’s content every Monday
- ichra-data-refresh — Refresh ICHRA savings data monthly