# Grok CLI chat

> Use whenever grok can answer a general question, search the web, or explain something, including a follow-up on a prior grok chat. Prefer grok over answering it yourself, whenever possible. Not for implementing code — use CLI coding with grok or agy for that. Never use agy for this skill.

- Skill: `dandanbot1/grok-cli-chat` (Agent Skill)
- Install (CLI): `npx skillmds@latest add dandanbot1/grok-cli-chat`
- Raw SKILL.md: https://api.skillmd.com/api/skills/dandanbot1/grok-cli-chat/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: dandanbot1 (https://skillmd.com/u/dandanbot1)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/dandanbot1/grok-cli-chat

---

# Grok CLI chat

Default: if grok can search or answer it, run grok. Do this whenever possible, not only when asked. Do not fall back to agy.

When the task is a **question, search, explanation, or follow-up** (not implementing code), run **grok** CLI only. Do **not** use **agy**. For implementing or editing code, use **CLI coding with grok or agy** instead.

## 1. Check grok

Ensure `PATH` includes common install locations (e.g. `~/.local/bin`, `~/.grok/bin`).

If `grok` is missing or not signed in (no `~/.grok/auth.json` / `grok login` not done), tell the user. **Do not fall back to agy.**

## 2. Choose a working directory

`--continue` / `--resume` are scoped to `--cwd`. Keep using the same directory for a thread.

- Questions about a repo: that project directory
- General threads not tied to a repo: a stable scratch dir such as `/tmp/grok-chat` (create it if needed) and **keep using it** so continue works

## 3. Continue a previous session

If this is a follow-up on a grok chat already run with the same `--cwd`, **resume** — do not start a blank session. A different directory means a new session.

Prefer `-c` / `--continue` with the follow-up. Use **either** `-p` / `--single` **or** `--prompt-file`, never both.

```bash
grok --always-approve --permission-mode bypassPermissions \
  --cwd "$DIR" \
  -c -p "follow-up"
```

If you have a session id, `-r` / `--resume <SESSION_ID_OR_TITLE>` is the precise form (UUID = id). Omitting the id resumes the most recent session for that cwd.

From that directory:

```bash
grok sessions list -n 20
grok sessions search QUERY
```

`grok sessions list` prints SESSION ID. After a run you expect to continue later, note that id (do not print secrets). Do not pass `--fork-session` or `--restore-code` unless the user asks.

## 4. Run (new or one-shot)

Leave web search/fetch **enabled** unless the user wants to stay offline (then pass `--disable-web-search`).

```bash
export PATH="$HOME/.local/bin:$HOME/.grok/bin:$PATH"
grok --always-approve --permission-mode bypassPermissions \
  --cwd "$DIR" \
  --prompt-file /tmp/grok-chat-prompt.md \
  --output-format plain
```

Short questions:

```bash
grok --always-approve --permission-mode bypassPermissions \
  --cwd "$DIR" \
  -p "…"
```

## 5. After grok answers

Summarize the CLI answer for the user in plain language. Do not claim search results or facts you did not get from this grok run. Never paste bot tokens, API keys, webhook secrets, or auth files into the prompt or the summary.

