Two Weeks of Silent Failure: Idempotent Scheduling and Self-Healing for a launchd + Claude Code Pipeline A developer has built an autonomous affiliate article generation pipeline using Claude Code and launchd that publishes up to five articles daily to Hatena Blog, with an idempotent scheduling design that self-heals from failures. The system, which generates revenue while the developer sleeps, uses a daily.sh script that runs at morning, noon, and night, converging on the target article count regardless of partial failures. The developer reports that this autonomous environment contributes to a monthly revenue of 1.2 million yen, with the system designed to break if humans intervene. Every morning at 5, launchd wakes up, and by the time I do, articles I never wrote are already live. In Part 1, I covered the basic design of a Claude Code–centered article generator and the skeleton of how generate.sh produces a single draft. This time I'm publishing the entire back half — the part that actually keeps the system running: how to reliably embed monetization links, how to bail out when the Rakuten API fails, an idempotent design that converges on exactly 5 articles a day no matter how many times you run it, and the self-healing loop built on audit-heal.sh . Back when I was a university student making 100,000 yen a month writing content as a side gig, my income equation was simple: hours × rate. The reason I got it up to 600,000 yen a month was that I stacked jobs and pushed my working hours to the limit — not because I had built a system. When I was laid off, my income went to zero instantly. A side business that sells time collapses the moment there's no one to sell it to. That's when it hit me: building an environment that earns and doing the work that earns are two completely different activities. After six months of assembling autonomous environments with Claude Code, most of my current 1.2M yen monthly revenue accumulates during hours when I'm not working. This affiliate factory is one of its core pieces. The biggest bottleneck in earning from affiliate articles is the act of writing. An 8,000–10,000 character review takes at least 3–4 hours including research. Keeping that up 3–5 times a day is physically impossible unless it's your full-time job. Most writers optimize in the direction of "how do I write faster?" Build templates, hand research to AI, use voice input. All effective, and all with a visible ceiling — because there are only so many hours in a day. Change the approach at the root and the question changes. Not "how do I write faster?" but "how do I stop having to write at all?" This system is my head-on answer to that question. In one sentence: launchd hits daily.sh in the morning, at noon, and at night, and generates and publishes only as many articles as today is still short. The point isn't that I don't have to do anything . More precisely, it's that the design is such that the system breaks if I get involved . Manually adding or deleting files breaks idempotency. Trust launchd's schedule to run on its own, and keep human hands off. That resignation is what makes the system stable. At 5 a.m. launchd hits daily.sh . Articles get generated and posted to Hatena Blog, an audit log is written, and if something's wrong a warning lands in the macOS Notification Center. I wake up at 7 and just check that notification. That check takes under three minutes. Idempotent means "running it any number of times produces the same result." It's spelled out right in daily.sh 's comments. 1日複数回実行される自己回復ジョブ。「今日まだ公開できていない本数」だけを 生成→公開する冪等設計。朝が使用量制限等で空振りしても、昼/夜の再実行が 自動で残りを埋めるため、何度走らせても1日ちょうど TARGET 本で収束する。 That's not just a comment — it's the core of the design. Even if the morning run hits a Claude Code rate limit and generates zero articles, the noon run tops up the shortfall. If noon fails too, night covers it. Whenever and however many times it runs, by the end of the day it converges on the target count. Without this design, every failed morning run would end with "today was a bust." With it, partial failures get absorbed by the system automatically. The heart of calling Claude inside generate.sh is this one line line 272 of the actual script . RESP=$ timeout "$GEN TIMEOUT" "$CLAUDE" -p "$PROMPT" --allowedTools WebSearch \ --model sonnet --permission-mode auto