Phone location triggers cut Grok Bot's weekly background wakeups by 52%
Overview
The Timeline developer runs Grok Bot in the background for mail, Slack, GitHub and browser jobs and runs out of quota on Thursdays. Phone arrival and departure events set a presence file and location leases so jobs run only when the author is there.
Workflow
- Trigger: Weekly usage ran out every Thursday. The author uses better tools for code and Grok Bot for background work and life tasks. Work checks already run weekdays 09:00–18:00 and personal checks are quiet overnight. Slack and mail urgency every 15 minutes, GitHub failures and stale branches every 20 minutes, browser package and Friday reservation checks every 30 minutes, and hourly supervisor checks still woke the VM 568 times a week. Each turn loaded memory and tool schemas and checked an API or opened a browser tab even with nothing to do. On Thursday at 15:20 there was no allowance for actual work. Slack and PR checks ran during lunch or the dentist, and package checks ran at the office.
- By hand: Use the phone instead of the clock. The author's iPhone location-history app Timeline, with webhooks and MCP server, already sent signed arrival and departure events to Grok Bot for alerts. Home Assistant, OwnTracks or an Apple Shortcut POST could write the same file. After the Thursday cap, use events to decide when the bot may run.
- Bot: Run one-off routines on arrivals and departures. Work arrival (stop.arrived) gives a Slack and email digest for important messages since evening or lunch. Leaving midday (stop.left) runs rebase and CI cleanup so branches are green on return. Move the grocery list from a nightly timer to arriving at any supermarket. Gym and airport prep run only on arrival. Stay silent at unrelated locations. Remove the hourly supervisor wake for every subagent, and let location events wake only their routine.
- By hand: Use a presence file and lease for essential polling. Resy, local tennis bookings and package tracking lack webhooks. Timeline's webhook points to a small VM endpoint that only updates /state/presence.json with current place, kind, mode, timezone, last update and four-hour expiry at zero token cost. Each poller runs only under its lease. At the office, Slack urgency and GitHub checks run every 45 minutes and stop on leaving. At home 08:00–22:30, package and booking checks and Mac-local Messages, Notes and Reminders run every two hours, and go dormant on trips. The gym or dinner means zero polls or tokens. An airport arrival or time-zone change pauses home checks and starts two-hour flight and train monitoring. This also handles Grok Bot's macOS Location limitation: a Mac on a desk or in a bag does not know the user went out or left town. Presence ties Mac tools to whether the user is home.
- By hand: Gate wakeups outside the model. The first attempt saved almost nothing. Keeping a 15-minute cron pointed at Grok Bot and asking it to call Timeline's get_current_location and return early still starts an agent, loads system prompt and MCP schemas, calls a tool and reads the result each time. Instead a VM wrapper reads /state/presence.json before waking the agent and exits with zero tokens for expired leases or mismatched places or modes (run-if-at.sh):
#!/usr/bin/env bash set -euo pipefail
STATE="/state/presence.json" REQUIRED="${1:?usage: run-if-at.sh <PlaceOrMode> <command...>}" shift
jq -e --arg req "$REQUIRED" \ '(.place == $req or .mode == $req) and (.expiresAt | fromdateiso8601) > now' \ "$STATE" >/dev/null 2>&1 || exit 0
exec "$@"
Add a preflight for tools with a fast CLI. Before waking the GitHub worker run gh pr list --author @me --json statusCheckRollup. If checks are green and branches are current with main, exit without waking the model.
- Bot: Set up the gating with one prompt. The author supplies this example without saying it was sent verbatim:
Set up a Standard Webhooks endpoint for my Timeline stop.arrived and stop.left events and give me the webhook URL and whsec_ signing secret.
- On every incoming event, update /state/presence.json with: place, placeKind, timeZone, updatedAt, mode ("office" at Work, "home" at Home, "travel" at any airport or foreign timezone, else "away"), and expiresAt (now + 4 hours). Do not wake an LLM turn just to update this file.
- Wrap all recurring cron jobs in a zero-token shell gate that reads /state/presence.json and exits immediately if the required place/mode does not match or expiresAt has passed.
- Move Work pollers (Slack urgency, GitHub PR/CI) to a 45-minute Work lease and add a zero-token CLI pre-check before waking the model.
- Move Home browser pollers (deliveries, bookings, Mac-local checks) to a 2-hour Home lease between 08:00 and 22:30, dormant whenever Home is left.
- Run one-shot transition routines directly on stop.arrived / stop.left (Work morning brief, midday lunch PR sweep, supermarket list, gym plan) and stay silent on every non-matching stop.
- Check: Compare a full week's wakeups and use before and after. Weekly background runs fell from 568 to 274, down 52%, with the heaviest browser checks reduced the most. Instead of running out at 15:20 Thursday, Sunday night had about 42% left for actual work like browser research (author's claim, not reproduced).
Key points and results
- Location triggers roughly halve background wakeups. Weekly runs went 568 → 274, down 52%, led by heavy browser checks. Instead of reaching the cap Thursday at 15:20, around 42% remained Sunday night (author's claim, not reproduced).
- Idle runs still use quota. Memory and schemas load and an API or browser check occurs even without work. That was the underlying cost of 568 weekly wakes.
- Gate before the model. Asking the model to check location and stop still used a turn every 15 minutes. The shell precheck exits at zero tokens on mismatch.
- Use leased polling for services without webhooks. Resy, tennis bookings and package tracking lack webhooks. Work polls every 45 minutes. Home polls every two hours from 08:00–22:30. Gym and dinner have no polls. Airport or time-zone changes start transit monitoring.
- Remaining issues from the author. A dead phone sends no departure, so use a coarse four-hour expiry and a 20:00 hard stop. Home or café work needs a manual office status, such as work from home until 17:00. iOS visit detection takes minutes after stopping, suitable for 45-minute leases but too slow to turn on lights when entering. An ad hoc flight or restaurant watch will poll forever unless given an expiry such as three hours or midnight.
- Send production alerts directly. The author suggests connecting Sentry or uptime monitors to a push endpoint for incidents and payment failures, then having the bot check presence for immediate interruption or deferral until morning. There are no comparison figures.
Source
- Platform
- Blog
- Author
- Marcel Marais
- Published
- Categories
- Life assistant, 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.