cli/reference.md +57 −0 created
1#### CLI
2
3# CLI Reference
4
5Running `grok` with no arguments starts the interactive TUI. This page lists the subcommands and the flags you are most likely to use; run `grok --help` or `grok <subcommand> --help` for the complete set.
6
7## Subcommands
8
9| Command | What it does |
10| ------- | ------------ |
11| `grok login` | Sign in. `--device-auth` uses device-code authentication for headless or remote environments |
12| `grok logout` | Sign out and clear cached credentials |
13| `grok inspect [--json]` | Show the configuration Grok discovers for this directory: rules, skills, plugins, hooks, and MCP servers |
14| `grok models` | List available models |
15| `grok mcp <list\|add\|remove\|doctor>` | Manage MCP servers — see [MCP Servers](/build/features/mcp-servers) |
16| `grok plugin <list\|install\|uninstall\|update\|enable\|disable\|details\|validate>` | Manage plugins |
17| `grok plugin marketplace <list\|add\|remove\|update>` | Manage marketplace sources |
18| `grok sessions <list\|search\|delete>` | List, search, or delete sessions — see [Sessions](/build/features/sessions) |
19| `grok export <session-id> [output]` | Export a session transcript as Markdown |
20| `grok import [targets...]` | Import sessions from Claude Code |
21| `grok memory clear [--workspace\|--global\|--all]` | Clear cross-session memory files |
22| `grok worktree <list\|show\|rm\|gc>` | Manage git worktrees created for sessions — see [Worktrees](/build/features/worktrees) |
23| `grok dashboard` | Open the [Agent Dashboard](/build/features/dashboard) |
24| `grok agent stdio` | Run as an ACP agent over stdin/stdout — see [Headless & Scripting](/build/cli/headless-scripting#acp) |
25| `grok wrap <command...>` | Run a command in a local PTY that forwards OSC 52 clipboard writes — see [Terminal Support](/build/cli/terminal-support) |
26| `grok update` | Check for updates or install a specific version (`--check`, `--version <V>`, `--alpha`, `--stable`) |
27| `grok version` | Print version information |
28| `grok completions <shell>` | Generate shell completion scripts |
29| `grok setup` | Fetch and install managed configuration |
30
31## Common flags
32
33Flags for headless runs (`-p`, `--output-format`, and related) are covered in [Headless & Scripting](/build/cli/headless-scripting).
34
35| Flag | What it does |
36| ---- | ------------ |
37| `--cwd <PATH>` | Working directory |
38| `-r, --resume [<ID>]` | Resume a session by ID, or the most recent if omitted |
39| `-c, --continue` | Continue the most recent session for the current directory |
40| `-s, --session-id <UUID>` | Use a specific UUID for a new session |
41| `--fork-session` | When resuming, fork into a new session ID |
42| `-w, --worktree [<NAME>]` | Start the session in a new git worktree |
43| `--ref <REF>` | Branch, tag, or commit to base the worktree on |
44| `-m, --model <MODEL>` | Model ID to use |
45| `--effort <LEVEL>` | Reasoning effort |
46| `--always-approve` | Auto-approve all tool executions (alias `--yolo`) |
47| `--allow <RULE>`, `--deny <RULE>` | Permission rules — see [Enterprise Deployments](/build/enterprise#permissions) |
48| `--sandbox <PROFILE>` | Sandbox profile — see [Enterprise Deployments](/build/enterprise#sandbox) |
49| `--rules <TEXT>` | Extra rules appended to the system prompt |
50| `--system-prompt-override <TEXT>` | Replace the system prompt entirely |
51| `--tools <LIST>`, `--disallowed-tools <LIST>` | Allow or remove built-in tools |
52| `--max-turns <N>` | Maximum number of agent turns |
53| `--no-plan`, `--no-subagents`, `--no-memory`, `--disable-web-search` | Disable a feature for this session |
54| `--experimental-memory` | Enable cross-session memory |
55| `--oauth` | Use OAuth when the welcome screen starts authentication |
56
57Claude Code flag names are accepted as aliases where they overlap: `--allowedTools`, `--disallowedTools`, `--append-system-prompt`, `--system-prompt`, and `--dangerously-skip-permissions`.