BUILD / use-grok-build-background-tasks

Run background tasks and loops in Grok Build

Grok Build can run commands, subagents, and monitors in the background while the conversation continues. Official background-tasks docs: press Ctrl+G for the tasks pane, or run /tasks for a snapshot in the scrollback. Press Ctrl+B to demote a running foreground command to the background. Agent todos (Ctrl+T) track planned multi-step work; background tasks track running processes.

Background commands

The agent starts long-running commands — dev servers, builds, watchers — as background tasks and collects output when needed. Ask directly (“run the dev server in the background”) or let the agent decide. In the scrollback, select a background task and press x to kill it.

Scheduled prompts with /loop

/loop 5m Check if the test suite passes and report any failures

Interval forms: Ns (minimum 60), Nm, Nh, Nd. The prompt fires immediately, then repeats; each firing is a new agent turn. Loops expire after 7 days. At most 50 scheduled tasks can be active at once. Cancel from the tasks pane, or ask the agent to cancel.

Monitors

For real-time event streams, the agent can attach a monitor to a script: each line the script prints becomes a notification in the conversation. Ask when you want to watch a log, a CI run, or a port (“watch the deploy logs and tell me if anything errors”). Keep monitor scripts selective — every output line interrupts the conversation.

Prompt queue

Prompts submitted while a turn is running are queued. Ctrl+; toggles the queue panel; /queue lists it.

Control What it does
Ctrl+G Open tasks pane
/tasks Snapshot of running tasks in scrollback
Ctrl+B Demote foreground command to background
x (on a selected task) Kill that background task
/loop <interval> <prompt> Recurring prompt
Ctrl+; / /queue Queue panel / list

Pitfalls

  • Loops need at least 60 seconds (Ns minimum 60).
  • Cap is 50 scheduled tasks; cancel finished loops from the tasks pane.
  • Monitors notify on every line — filter the script before attaching.
  • Long sessions fill context; pair with Compact a long Grok Build session.
  • CLI: Install the Grok Build CLI.