CLI

CLI Reference

Running 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.

Subcommands

CommandWhat it does
grok loginSign in. --device-auth uses device-code authentication for headless or remote environments
grok logoutSign out and clear cached credentials
grok inspect [--json]Show the configuration Grok discovers for this directory: rules, skills, plugins, hooks, and MCP servers
grok modelsList available models
grok mcp <list|add|remove|doctor>Manage MCP servers — see MCP Servers
grok plugin <list|install|uninstall|update|enable|disable|details|validate>Manage plugins
grok plugin marketplace <list|add|remove|update>Manage marketplace sources
grok sessions <list|search|delete>List, search, or delete sessions — see Sessions
grok export <session-id> [output]Export a session transcript as Markdown
grok import [targets...]Import sessions from Claude Code
grok memory clear [--workspace|--global|--all]Clear cross-session memory files
grok worktree <list|show|rm|gc>Manage git worktrees created for sessions — see Worktrees
grok dashboardOpen the Agent Dashboard
grok agent stdioRun as an ACP agent over stdin/stdout — see Headless & Scripting
grok wrap <command...>Run a command in a local PTY that forwards OSC 52 clipboard writes — see Terminal Support
grok updateCheck for updates or install a specific version (--check, --version <V>, --alpha, --stable)
grok versionPrint version information
grok completions <shell>Generate shell completion scripts
grok setupFetch and install managed configuration

Common flags

Flags for headless runs (-p, --output-format, and related) are covered in Headless & Scripting.

FlagWhat it does
--cwd <PATH>Working directory
-r, --resume [<ID>]Resume a session by ID, or the most recent if omitted
-c, --continueContinue the most recent session for the current directory
-s, --session-id <UUID>Use a specific UUID for a new session
--fork-sessionWhen resuming, fork into a new session ID
-w, --worktree [<NAME>]Start the session in a new git worktree
--ref <REF>Branch, tag, or commit to base the worktree on
-m, --model <MODEL>Model ID to use
--effort <LEVEL>Reasoning effort
--always-approveAuto-approve all tool executions (alias --yolo)
--allow <RULE>, --deny <RULE>Permission rules — see Enterprise Deployments
--sandbox <PROFILE>Sandbox profile — see Enterprise Deployments
--rules <TEXT>Extra rules appended to the system prompt
--system-prompt-override <TEXT>Replace the system prompt entirely
--tools <LIST>, --disallowed-tools <LIST>Allow or remove built-in tools
--max-turns <N>Maximum number of agent turns
--no-plan, --no-subagents, --no-memory, --disable-web-searchDisable a feature for this session
--experimental-memoryEnable cross-session memory
--oauthUse OAuth when the welcome screen starts authentication

Claude Code flag names are accepted as aliases where they overlap: --allowedTools, --disallowedTools, --append-system-prompt, --system-prompt, and --dangerously-skip-permissions.


Last updated: July 4, 2026