Grok Build (Agentic Coding CLI)
Overview
A leaked system prompt for Grok Build, xAI’s terminal-native agentic coding assistant running on Grok 4.5 — the direct xAI counterpart to claude-code-system-prompt, cursor-system-prompt, and cline-system-prompt. The model’s stated role: “You are Grok 4.5 released by xAI. You are an interactive CLI tool that helps users with software engineering tasks.” The user’s request arrives inside a <user_query> tag. The file originates from the asgeirtj/system_prompts_leaks repository alongside grok-personas and grok-expert.
The prompt is structured in three parts: (1) a core behavioral system prompt organized as backtick-wrapped tag blocks, (2) 27 tool definitions with full JSON schemas, and (3) runtime-injected context templates.
Core System Prompt Blocks
The behavioral core uses XML-style tag blocks within a markdown envelope — a lighter cousin of the strict xml-envelope-format:
<action_safety>— the risk-tiered confirmation policy, analyzed in action-safety-tiering.<tool_calling>— prefer specialized tools over bash; use dedicated file tools (read_file,search_replace) instead ofcat/sed/awk; reserve bash for true system commands; never use bash echo to communicate with the user.<background_tasks>— for watch processes, polling, and CI/log observation, use themonitortool which streams stdout lines back as chat notifications.<output_efficiency>— write like an excellent technical blog post; complete sentences, high prose quality; plain language over jargon; keep responses proportional to task complexity.<formatting>— GitHub-flavored markdown (CommonMark); use bullets, bold, inline code, and tables actively.<user_guide>— TUI documentation (config, keyboard shortcuts, MCP servers, skills, theming, plugins) is stored as.mdfiles in~/.grok/docs/user-guide/; the model reads the relevant file when asked about features — documentation-as-files, the same pattern as a skills-directory-gate manifest.
Tool Suite (27 tools)
| Tool | Purpose |
|---|---|
run_terminal_command | Bash with timeout (max 36,000,000 ms), background mode, 40,000-char output cap, process-group kill semantics |
read_file | Read with line numbers (LINE_NUMBER→CONTENT), offsets/limits, PDF/PPTX/notebook/image support (multimodal) |
search_replace | Exact-string edit; replace_all for renames; match only content after the → prefix |
list_dir | List files; hides dot-files, respects .gitignore, summarizes large dirs |
grep | ripgrep-backed content search with full regex, glob/type filters, context lines |
kill_command_or_subagent | Terminate background task/monitor/subagent by task_id |
todo_write | Live structured task list with merge-by-id semantics |
get_command_or_subagent_output | Non-blocking or blocking retrieval of background results |
spawn_subagent | Subagents with capability_mode (read-only/read-write/execute/all), git-worktree isolation, resume_from, model allowlist |
scheduler_create / scheduler_delete / scheduler_list | Recurring tasks; interval grammar (“5m”), max 50, 7-day auto-expire, durable/foreground flags |
monitor | Background streaming watch (persistent or timeout-bound), selective filters, grep --line-buffered guidance |
search_tool / use_tool | MCP tool discovery-then-call loop: search_tool returns input schemas, use_tool calls with qualified server__tool names |
workflow | Rhai-script orchestration of subagents as one background run; agent_budget cap (default 128, max 1,024); validate_only smoke check |
enter_plan_mode / exit_plan_mode | Read-only plan mode producing an implementation plan file |
ask_user_question | Multiple-choice clarification with recommended-first option ordering |
web_fetch / web_search / x_search | Web + X retrieval |
image_gen / image_edit / image_to_video / reference_to_video | xAI Imagine generation/editing and video from images (session-relative path references) |
write | File create/overwrite; parent dirs auto-created |
Runtime-Injected Context
The prompt defines five injected context templates delivered as system-reminder / wrapper blocks, closely mirroring the architecture this vault itself operates under:
<user_info>+<git_status>— OS/shell/workspace/date snapshot, plus a git status snapshot explicitly marked as not updating during the conversation.- Project instruction files — AGENTS.md-style files injected ordered repo-root → cwd, deeper files taking precedence on conflicts.
- Available skills manifest — skill name, description, trigger conditions, and absolute SKILL.md path (the skills-directory-gate pattern).
- MCP servers announcement — which servers are connected vs. still connecting; tools from connecting servers are off-limits until announced.
<user_query>wrapper — the user’s message enclosed in a tag.
Implications
Grok Build is the most complete leaked example of a documentation-and-manifest-driven coding agent: the model reads user-guide .md files for TUI features, receives a skills manifest with file paths, and discovers MCP tool schemas before calling them. Its three structural innovations over claude-code-system-prompt-style prompts are the action-safety-tiering confirmation policy, the scheduler/monitor tools for ambient automation, and the Rhai workflow language for bounded subagent orchestration. For the vault, it extends the leaked-agent-prompt family with xAI’s full CLI agent — the missing link between the chat-era Grok persona prompts and the code-era Grok Build product.
Open Questions
- Is the
<action_safety>policy client-side enforced (harness gates tool calls) or purely prompt-level persuasion? - Does the Rhai
workflowengine ship in production Grok Build, and how does it relate to the subagentcapability_mode/isolation machinery? - How is
~/.grok/docs/user-guide/generated, versioned, and kept in sync with the TUI it documents?
Related
- grok-1 — the underlying model Grok Build runs on
- grok-expert — sibling leaked Grok prompt: multi-agent team-leader collaboration
- grok-personas — sibling leaked Grok prompts: conversational persona layer
- claude-code-system-prompt — closest analog: terminal-native agentic coding assistant
- action-safety-tiering — the risk-tiered confirmation policy this prompt instantiates
- skills-directory-gate — capability enumeration pattern used by the runtime skills manifest
- multi-file-agent-architecture — alternative to the single-prompt + Rhai-orchestration design