Skip to main content

A cheap checker outside Grok Bot wakes a webhook routine only when there is work

XXPasdawan2026-11-26

Code and reposLimitsAuthor's claim, unverifiedRead first

Overview

An author running about 29 Grok Bot agents moves empty-prone scheduled routines to a cheap script on an always-on Mac or other computer that POSTs to a webhook-triggered routine only when there is work, and has Grok Bot hand heavy coding to Claude Code or Codex CLIs; 7 steps with copyable prompts, script and schedule examples.

Workflow

Trigger: Scheduled routines burn usage even when there is nothing to do. The author runs about 29 agents on Grok Bot and has watched early enthusiasm (hourly email checks, folder watches, queue checks) empty a usage bar before the week ends. A scheduled routine is a saved prompt plus a trigger; every fire starts a fresh run that reads its instructions and decides whether anything needs doing, and even a nothing-to-do reply is a model turn that counts against usage, visible under Settings, Usage & Billing. The author cites xAI's documentation that an hourly schedule, a short interval or a Slack trigger on a busy channel can use a week of usage in a day. The fix: keep the clock outside Grok Bot. A cheap check on an ordinary always-on computer (a Mac, a MacBook Air; a VPS is optional) calls a routine webhook only when there is work. Schedules that are the point, such as a morning digest, stay as they are. Needed: a Grok Bot agent, a computer that stays on, and a condition checkable without a Grok Bot run (a file, a folder, a date, a count).

  1. By hand: Find the routines that often come back empty (Step 1). Open the agent's info pane by clicking its name in the chat header or pressing Cmd+Shift+I, and look at the Routines list. For each scheduled routine, ask how often it runs only to say nothing happened; move those first. One recurring empty check is enough to learn the pattern.
  2. Bot: Create a webhook-triggered routine (Step 2). The author does not invent a menu; ask the Grok Bot in chat. The saved prompt says what to do on wake and who gets the result, stops in one line if there is nothing to report, and has no schedule. The author's prompt:

    Create a webhook-triggered routine named "Wake when the checker finds work". When it fires, treat the webhook event as the reason you woke. Do the job described in the event if it is clear. If it is not, say what is missing. Then report the result to me in this chat. If there is nothing to do after all, say so in one line and stop. Do not put a schedule on this routine. I only want it to run when something POSTs to its webhook URL. When it is saved, tell me where to copy the webhook URL, the webhook key and the Authorization header, and remind me not to paste the key back into this chat.

  3. By hand: Copy the webhook URL and key and keep them safe (Step 3). In the agent's info pane, open Routines and the routine whose trigger is When a webhook fires; it shows Webhook URL, Webhook key and Authorization header. The header is Authorization: Bearer YOUR_SECRET, with the webhook key as the secret. Treat the key like a password: keep the URL and key in a .env file on the calling machine readable only by you (chmod 600), load it from the script, and never put them in a crontab line, a chat, a prompt or a git repository.
  4. Bot: Have Grok Bot write a small checker (Step 4). The script runs one cheap check, exits quietly when there is nothing to do, and POSTs to the webhook only when there is work, with a JSON body (any JSON; Grok Bot passes it to the routine as data) and a Content-Type: application/json header; it never starts a Grok Bot run to decide. For a tighter check, the JSON body can be signed with HMAC-SHA256 and verified in the routine. The author's prompt for the files:

    Write a small bash script called check-and-wake.sh that:

    1. Loads YOUR_WEBHOOK_URL and YOUR_SECRET from a .env file that only the owner can read. If either is missing, exit with an error. Never print the secret. Never read these values from a crontab line.
    2. Runs one cheap check. Start with a placeholder I can replace, for example "does this file exist" or "is this folder non-empty." The check must not call Grok Bot or any other model.
    3. If the check finds nothing to do, exit 0 with no output.
    4. If it finds work, POST to YOUR_WEBHOOK_URL with curl, using these exact headers and a JSON body:

    Authorization: Bearer YOUR_SECRET Content-Type: application/json -d '{"source":"cron","message":"task due"}' The body can be changed later; it is required, and Grok Bot passes it to the routine as data.

    1. Exit non-zero if the POST fails.

    Also give me a one-line crontab entry for weekdays at 9:00, and a launchd plist that runs the same script at 9:00 on weekdays, using placeholder paths. The crontab must not contain the URL or the secret. Do not hard-code any real hostnames, URLs or secrets.

    The article also gives a placeholder version of the script: it loads $HOME/.env, exits 0 when $HOME/incoming/ready.flag is empty or missing, and otherwise POSTs with curl.

  5. By hand: Schedule the checker, not a Grok Bot routine (Step 5). The machine running the script must stay on. On a Mac use cron or launchd; the article's launchd plist has five calendar entries for Monday to Friday at 9:00 (launchd treats 0 as Sunday), with the label and path to replace and no webhook key in the plist. On a VPS, one crontab line runs it at 9:00 on weekdays in local time:

    0 9 * * 1-5 /home/YOU/bin/check-and-wake.sh

  6. By hand: Test three cases before deleting anything (Step 6). A quiet run: no work, the script exits 0, the agent stays asleep and usage does not move. A run with work: the POST succeeds and the routine runs; a 200 only means Grok Bot accepted the call and started a run, and a finished routine typically shows an Automation completed summary or brings the result into chat. A duplicate: fire the webhook twice for the same work and expect one job; if a second job starts, change the saved prompt so the bot recognises work already under way. If a quiet run wakes the bot, the checker is posting wrongly; if a run with work stays silent, check the 200, the Bearer header and JSON body, and that the routine is not paused.
  7. By hand: Remove the old scheduled routine (Step 7). Only after the three tests pass, ask Grok Bot to delete the old scheduled routine or take it off the timer; leaving both means paying for empty checks plus the webhook. For a safety net, use a much rarer scheduled routine or add logging on the checker so a missed doorbell does not look like a quiet day.

By hand: Give every agent the same rules. Keep common rules in one place in a second brain, read by every agent at startup including after a webhook wake; role-specific instructions sit on top, and every rule change is dated, reversible and approved by the user. The author's prompt:

Help me set up a single place for shared rules that every Grok Bot agent will read at startup, including when a webhook-triggered routine wakes it. I want:

  • one common set of rules any of my Grok Bot agents can load
  • a short add-on for each role, on top of the common rules
  • a dated, reversible record of rule changes, which I approve

Draft the common rules for a setup where Grok Bot agents are woken by a routine webhook, they must not publish or spend money without my explicit OK, and they should write back what changed when they finish a job. Keep it generic. Do not invent folder paths or product-specific filenames. Give me a short checklist for pointing each Grok Bot agent at that same source.

Bot: Let Grok Bot orchestrate and send special work to Claude or Codex. For ordinary jobs the bot works itself; for a coding task or a large piece of work it starts the Claude Code CLI or the Codex CLI, already signed in to that subscription, on a registered computer or its own, waits, reads the result and continues, so the heavy work runs on that subscription instead of a long Grok Bot turn. The author says this is the principle, not a verified built-in button or command. The author's prompt:

Help me set up a routing rule for this Grok Bot agent. I want Grok Bot to stay the orchestrator. When I ask for ordinary work, do it yourself. When the job is a coding task, a large piece of work, or another special case that Claude or Codex would handle better, do not try to do the whole job as a long Grok Bot run. Instead:

  • decide whether the job should go to Claude or to Codex, and tell me why in one line
  • run the Claude Code CLI or the Codex CLI on my registered computer or on your computer, using the subscription already signed in there
  • wait for that run to finish, read the result, and continue the work in this chat
  • if the CLI is missing, not signed in, or fails, say so in one line and stop. Do not invent a result.

Do not hard-code real folder paths, hostnames, or account names. Give me a short checklist of what I need on the machine (the CLI installed, the subscription signed in, and a computer Grok Bot can use), and a draft of the standing rule this agent should follow. Ask me to approve the rule before you save it.

Check: The source does not say how the author checked the savings; Step 6 is the test the author prescribes, and the cost comparison below is the author's own estimate.

Key points and results

  • Same routines, zero Grok Bot tokens when there is nothing to do. A quiet checker run never wakes the agent; only a POST to the routine webhook does. This is the author's claim; the source gives no comparison figures.
  • The author's cost estimate, not a measured bill: Grok Bot at $30 plus Claude or Codex at $20 gets a lot done, where the same work on Grok Bot alone might need the $100 or $200 tier. The author notes $30 is the cheapest xAI plan with Grok Bot (https://x.ai/pricing), Claude Pro is $20 a month and Codex comes with ChatGPT Plus at $20 a month.
  • The author avoids inventing UI. Where the author had no reliable click path (turning on local execution, a skills screen, a send-to-Claude control), the article says so and suggests asking Grok Bot.
  • A doorbell that never rings looks like a quiet day. If work was expected and nothing came, check whether the checker ran, what it found and whether the POST happened.
  • Humans keep the decisions that matter. Agents draft; the user approves anything published and anything that costs money. Closing advice: try it on one empty routine this week.

Source

Platform
X
Author
Pasdawan
Published
Categories
Code and repos, Limits

What this evidence label means

Author's claim, unverified

The method and results come from the author's own account. This site has not reproduced them.

Read the editorial and evidence policy

Other cases in this scenario

This unofficial community project is independent of xAI. xAI has neither approved nor endorsed it. No sign-up. The methods and figures come from the original authors.