Grok Build CLI: Subagents, Plan Mode and Background Work
The single biggest jump in capability comes from not doing everything in one context window. Grok can delegate to parallel subagents, plan before it touches code, and run long jobs in the background while it keeps working. This is the part that scales you up.
New here? Start with Grok Build CLI: Zero to Hero (Start Here).
Subagents work in parallel
When a task is worth delegating, Grok uses the task tool to spawn a child agent with its own context window. Three built-in types: general-purpose (full capability), explore (read-only research), and plan (produces a structured implementation plan). Configure defaults and per-type models in config.toml.
Each subagent runs in a capability mode (read-only, read-write, execute, or all), can take on a persona like reviewer or security-auditor, and can run in an isolated git worktree so its file changes never collide with the parent. One important behavior: subagents start fresh and do not inherit the parent's conversation, so brief them fully in the prompt.
Plan mode designs before it builds
For tasks with real ambiguity, plan mode separates thinking from doing. Grok explores and reads freely but can only write to the plan file. When the plan is ready it asks for approval.
Approve and it starts building. Choose revise and you can comment on specific lines before it tries again. Use /plan to enter it explicitly. Skip it for clear tasks, it shines on the ambiguous ones where the wrong approach wastes hours.
Long jobs go to the background
Any command can run in the background. Press Ctrl+G to demote a running command, then check on it later. The agent gets a task id and a notification when it finishes, so a dev server or test suite never blocks the conversation.
/loop for recurring checks
/loop runs a prompt on a schedule. It fires immediately, then repeats at your interval, ideal for CI watching, periodic test runs, and health checks. Recurring tasks auto-expire after seven days.
monitor for real-time streams
Where /loop polls, the monitor tool streams. Each line of stdout from a long-running script becomes a notification in the conversation. The golden rule: always use grep --line-buffered in pipes, or buffering will delay your events by minutes.
Press Ctrl+; to toggle the queue pane and see every background task, scheduled loop, and monitor at a glance.
Continue the series
The full series
- Grok Build CLI: Zero to Hero (Start Here)
- Grok Build CLI: Sessions, Rewind and Compaction
- Grok Build CLI: Slash Commands and Keyboard Mastery
- Grok Build CLI: Teaching Grok Your Project (AGENTS.md)
- Grok Build CLI: Models and Custom Endpoints
- Grok Build CLI: Extending Grok with MCP, Skills, Plugins and Hooks
- Grok Build CLI: Cross-Session Memory
- Grok Build CLI: Subagents, Plan Mode and Background Work (you are here)
- Grok Build CLI: Headless Mode and Automation
- Grok Build CLI: Sandbox and Permissions
- Grok Build CLI: IDE Integration with ACP
- Grok Build CLI: The Evolution (Power-User Version History)