{
  "id": 3943209,
  "title": "3 Token Burn From an Infinite Retry Loop: How I Made Claude Refill My Article Queue When It Runs Dry",
  "url": "https://urgent.news/2026/08/28/3-token-burn-from-an-infinite-retry-loop-how-i-made-claude-refill-my",
  "topic": "ai",
  "section": "AI",
  "published": "2026-08-28T11:00:07.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/bokuwalily/3x-token-burn-from-an-infinite-retry-loop-how-i-made-claude-refill-my-article-queue-when-it-runs-5edl"
  },
  "original_language": "en",
  "account": "When a Claude-generated article queue runs dry, it can cause the article production process to stop altogether. To avoid this, a system was built that integrates a natural language model called Claude to automatically generate new topics when the queue is empty. The key steps in this refill mechanism are:\n\n1. Monitor the topic queue: The script checks the number of topics in the queue using the `jq` command. If the queue is empty (length equals zero), the script moves to the next step.\n\n2. Generate a new topic: When the queue is empty, Claude is invoked locally using the `claude -p` command. The script provides a prompt to Claude with specific requirements for the new topic, such as the title, slug, sources, and thumbnail title. Claude reviews the day's work, including daily briefs and automation scripts, to generate a relevant article topic.\n\n3. Validate and insert the new topic: Claude's generated JSON is validated to ensure it contains the required fields and adheres to the specified format. If the JSON is valid, the new topic is inserted at the head of the queue. If the JSON fails validation, the script exits without adding the new topic.\n\n4. Resume normal operation: Once a new topic is added to the queue, the production script resumes its normal operation of converting topics into articles, generating thumbnails, and publishing the finished article.\n\nBy integrating Claude into the article generation process, the system can continuously generate new topics and avoid the downtime that would occur if the queue runs dry. This ensures a steady stream of articles, maintaining the revenue stream and preventing the user from skipping writing days.",
  "summary": "Back when I was a college student earning ¥100,000 a month, one finished article meant my week was over. Today launchd stocks one every morning at 8:00, and the series that underpins ¥1.2M in monthly revenue hasn't gone dark once. The difference isn't talent or discipline — it's that I built, exactly one time, an environment that refills its own topic queue. Why this setup works When you try to…",
  "key_points": [
    "Monitor topic queue length with jq command",
    "Invoke Claude locally to generate new topic",
    "Insert validated topic at head of article queue"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}