aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorEnrico Carlesso <enricocarlesso@gmail.com>2026-07-24 12:05:20 -0700
committerGitHub <noreply@github.com>2026-07-24 22:05:20 +0300
commite9b22084e03880f43d1f1daaf5d9f45c717b77c4 (patch)
tree343c3099fcb0b935f857b7eb00df1e4d9c83d609 /docs
parentb56baee9d60a002b5d8c0fe74d5032afad27ef30 (diff)
feat: add grok cli integration for native session restore (#1807)
* feat: add grok cli integration for native session restore tl;dr: adds `herdr integration install grok` (session-identity tier: a SessionStart hook reports the grok session id for native restore; state stays screen-detected via the bundled manifest). Grok merges every ~/.grok/hooks/*.json, so install writes a self-contained hooks/herdr.json registering a SessionStart hook next to hooks/herdr-agent-state.sh, and never touches other hook files. The hook prefers $GROK_SESSION_ID (injected into every grok hook process) and reports through the socket API; herdr:grok is a reserved-native-state source so screen detection stays authoritative. Restore uses `grok --resume <id>`. Additive JSON API change; no protocol bump; the schema artifact is regenerated. refs #1800 * fix: honor GROK_HOME and validate grok hook config in status Review follow-ups: grok_dir now resolves GROK_CONFIG_DIR (herdr test seam) before GROK_HOME (the grok CLI's own config-home override) before ~/.grok, so hook installs land where grok actually looks. Integration status now also validates the herdr-owned hooks/herdr.json next to the hook script — missing, corrupt, or no-longer-referencing configs report the install as outdated instead of masking a hook grok never invokes. refs #1800 * fix: validate the exact grok session hook command in status The config validator matched on a filename substring, so a SessionStart command like `echo herdr-agent-state.sh`, or one invoking the script without the `session` action, still reported the integration as current while grok never delivered a session id. Status now compares against the exact command the installer writes, via a shared builder, and the degradation tests cover both nonfunctional shapes. refs #1800 * fix: require a command-type grok session hook in status validation A config entry carrying the exact generated command under a non-command hook type (e.g. "http") is never executed by grok, so it must not report the integration as current. The validator now also requires type = "command", with a degradation test for the mismatched-type shape. refs #1800 * fix: validate the complete grok hook config refs #1800 --------- Co-authored-by: Ogulcan Celik <ogulcancelik@gmail.com>
Diffstat (limited to 'docs')
-rw-r--r--docs/next/CHANGELOG.md1
-rw-r--r--docs/next/api/herdr-api.schema.json6
-rw-r--r--docs/next/website/src/content/docs/agents.mdx4
-rw-r--r--docs/next/website/src/content/docs/cli-reference.mdx2
-rw-r--r--docs/next/website/src/content/docs/integrations.mdx24
-rw-r--r--docs/next/website/src/content/docs/session-state.mdx1
6 files changed, 30 insertions, 8 deletions
diff --git a/docs/next/CHANGELOG.md b/docs/next/CHANGELOG.md
index 4a462aef..ee05a843 100644
--- a/docs/next/CHANGELOG.md
+++ b/docs/next/CHANGELOG.md
@@ -125,6 +125,7 @@
- Added `herdr terminal session control` for bridge processes that need live ANSI frames plus input, resize, scroll, release, and takeover authority.
- Added `ui.hide_tab_bar_when_single_tab` to hide the tab row when a workspace has one tab. (#448)
- Added Japanese and Simplified Chinese website docs.
+- Added `herdr integration install grok` for Grok CLI (Grok Build) hooks that report session ids through Herdr's socket API. Grok state stays screen-detected. When native agent session restore is enabled, Herdr can resume Grok panes with `grok --resume <id>`.
### Changed
- The mobile switcher now starts from an agents-first summary and renders worktrees as a tree, making narrow terminals easier to scan.
diff --git a/docs/next/api/herdr-api.schema.json b/docs/next/api/herdr-api.schema.json
index 93cf653a..dc6dce83 100644
--- a/docs/next/api/herdr-api.schema.json
+++ b/docs/next/api/herdr-api.schema.json
@@ -2085,7 +2085,8 @@
"hermes",
"qodercli",
"cursor",
- "mastracode"
+ "mastracode",
+ "grok"
],
"type": "string"
},
@@ -6997,7 +6998,8 @@
"hermes",
"qodercli",
"cursor",
- "mastracode"
+ "mastracode",
+ "grok"
],
"type": "string"
},
diff --git a/docs/next/website/src/content/docs/agents.mdx b/docs/next/website/src/content/docs/agents.mdx
index ee275d19..f5a4ac48 100644
--- a/docs/next/website/src/content/docs/agents.mdx
+++ b/docs/next/website/src/content/docs/agents.mdx
@@ -28,7 +28,7 @@ Automatic detection works out of the box for common coding agents. The important
| Codex | screen manifest | session |
| Cursor Agent CLI | screen manifest | session |
| Amp | screen manifest | none |
-| Grok CLI | screen manifest | none |
+| Grok CLI | screen manifest | session |
| Antigravity CLI | screen manifest | none |
| Kiro CLI | screen manifest | none |
| Maki | screen manifest | none |
@@ -45,7 +45,7 @@ For agents without complete lifecycle hooks, Herdr identifies the foreground pro
The screen snapshot comes from the recent bottom of the pane buffer, not the scrolled viewport. If you scroll back in Herdr, detection still follows the live agent UI at the bottom.
-Claude Code, Codex, GitHub Copilot CLI, Droid, Qoder CLI, and Cursor Agent CLI integrations are intentionally not lifecycle authorities. They provide native session identity for restore, but their hooks do not cover the whole lifecycle. They can miss permission approval results, escape interrupts, or other transitions. For those agents, Herdr still uses screen manifest detection.
+Claude Code, Codex, GitHub Copilot CLI, Droid, Qoder CLI, Cursor Agent CLI, and Grok CLI integrations are intentionally not lifecycle authorities. They provide native session identity for restore, but their hooks do not cover the whole lifecycle. They can miss permission approval results, escape interrupts, or other transitions. For those agents, Herdr still uses screen manifest detection.
## VMs and sandbox wrappers
diff --git a/docs/next/website/src/content/docs/cli-reference.mdx b/docs/next/website/src/content/docs/cli-reference.mdx
index b9f2dc2c..19a7ec23 100644
--- a/docs/next/website/src/content/docs/cli-reference.mdx
+++ b/docs/next/website/src/content/docs/cli-reference.mdx
@@ -367,6 +367,7 @@ herdr integration install hermes
herdr integration install qodercli
herdr integration install cursor
herdr integration install mastracode
+herdr integration install grok
herdr integration uninstall pi
herdr integration uninstall omp
herdr integration uninstall claude
@@ -381,6 +382,7 @@ herdr integration uninstall hermes
herdr integration uninstall qodercli
herdr integration uninstall cursor
herdr integration uninstall mastracode
+herdr integration uninstall grok
herdr integration status [--outdated-only]
```
diff --git a/docs/next/website/src/content/docs/integrations.mdx b/docs/next/website/src/content/docs/integrations.mdx
index 940d1deb..fcc908a7 100644
--- a/docs/next/website/src/content/docs/integrations.mdx
+++ b/docs/next/website/src/content/docs/integrations.mdx
@@ -1,6 +1,6 @@
---
title: Integrations
-description: Install Herdr integrations for Pi, OMP, Claude Code, Codex, GitHub Copilot CLI, Devin CLI, Droid, Kimi Code CLI, OpenCode, Kilo Code CLI, Hermes Agent, Qoder CLI, Cursor Agent CLI, and MastraCode.
+description: Install Herdr integrations for Pi, OMP, Claude Code, Codex, GitHub Copilot CLI, Devin CLI, Droid, Kimi Code CLI, OpenCode, Kilo Code CLI, Hermes Agent, Qoder CLI, Cursor Agent CLI, MastraCode, and Grok CLI.
---
Herdr detects supported agents automatically. Official integrations can add native session identity for restore, lifecycle state reports, or both.
@@ -26,6 +26,7 @@ herdr integration install hermes
herdr integration install qodercli
herdr integration install cursor
herdr integration install mastracode
+herdr integration install grok
```
## Uninstall integrations
@@ -45,6 +46,7 @@ herdr integration uninstall hermes
herdr integration uninstall qodercli
herdr integration uninstall cursor
herdr integration uninstall mastracode
+herdr integration uninstall grok
```
## How Herdr uses integrations
@@ -54,13 +56,13 @@ Herdr uses integrations in two different ways:
| Integration type | Agents | Effect |
| --- | --- | --- |
| Lifecycle authority | Pi, OMP, Kimi Code CLI, OpenCode, Kilo Code CLI, Hermes Agent, MastraCode | When installed and actively reporting for the pane, hook or plugin events author `idle`, `working`, and `blocked`. Herdr does not also use screen manifest fallback for that same lifecycle authority. |
-| Session identity | Claude Code, Codex, GitHub Copilot CLI, Devin CLI, Droid, Qoder CLI, Cursor Agent CLI | The integration reports native session references for restore. State still comes from Herdr's screen manifest detection. |
+| Session identity | Claude Code, Codex, GitHub Copilot CLI, Devin CLI, Droid, Qoder CLI, Cursor Agent CLI, Grok CLI | The integration reports native session references for restore. State still comes from Herdr's screen manifest detection. |
Custom socket integrations can also report state when they define state that is not visible in the native terminal UI.
-Some integrations report native agent session references. Herdr uses official session references to resume Claude Code, Codex, Devin CLI, Droid, Kimi Code CLI, Qoder CLI, Cursor Agent CLI, GitHub Copilot CLI, Pi, OMP, Hermes Agent, OpenCode, Kilo Code CLI, and MastraCode panes after a Herdr server restart unless `[session] resume_agents_on_restore = false` disables it.
+Some integrations report native agent session references. Herdr uses official session references to resume Claude Code, Codex, Devin CLI, Droid, Kimi Code CLI, Qoder CLI, Cursor Agent CLI, Grok CLI, GitHub Copilot CLI, Pi, OMP, Hermes Agent, OpenCode, Kilo Code CLI, and MastraCode panes after a Herdr server restart unless `[session] resume_agents_on_restore = false` disables it.
-Native session restore requires current Herdr integrations: Pi integration version `2`, OMP version `3`, Claude Code version `6`, Codex version `5`, GitHub Copilot CLI version `2`, Devin CLI version `2`, Droid version `2`, Kimi Code CLI version `3`, Qoder CLI version `2`, Cursor Agent CLI version `1`, OpenCode version `5`, Kilo Code CLI version `1`, Hermes Agent version `2`, or MastraCode version `1`. Check installed versions with `herdr integration status`.
+Native session restore requires current Herdr integrations: Pi integration version `2`, OMP version `3`, Claude Code version `6`, Codex version `5`, GitHub Copilot CLI version `2`, Devin CLI version `2`, Droid version `2`, Kimi Code CLI version `3`, Qoder CLI version `2`, Cursor Agent CLI version `1`, Grok CLI version `1`, OpenCode version `5`, Kilo Code CLI version `1`, Hermes Agent version `2`, or MastraCode version `1`. Check installed versions with `herdr integration status`.
## Pi
@@ -256,6 +258,20 @@ Herdr uses `~/.mastracode`. Install writes `hooks/herdr-agent-state.sh` and adds
Herdr resumes stored MastraCode threads with `mastracode --thread <id>`.
+## Grok CLI
+
+Install the Grok CLI hook:
+
+```bash
+herdr integration install grok
+```
+
+The hook reports session identity through Grok's `SessionStart` hook while Grok CLI runs inside a Herdr pane. Grok state comes from Herdr's screen manifest detection.
+
+Herdr uses `~/.grok` by default, or `GROK_HOME` when set. The Grok config directory must already exist. Grok merges every `hooks/*.json` file in that directory, so install writes a self-contained `hooks/herdr.json` with the Herdr `SessionStart` entry next to the `hooks/herdr-agent-state.sh` script, and never edits other hook files. Uninstall removes exactly those two Herdr-owned files.
+
+After Grok emits a session start event, Herdr can use the reported session id to resume the pane with `grok --resume <id>`.
+
## Custom status labels
Integrations report lifecycle state as semantic state only. For example, report an agent as `working` without adding display fields to the lifecycle report.
diff --git a/docs/next/website/src/content/docs/session-state.mdx b/docs/next/website/src/content/docs/session-state.mdx
index 811a346d..87987b2d 100644
--- a/docs/next/website/src/content/docs/session-state.mdx
+++ b/docs/next/website/src/content/docs/session-state.mdx
@@ -71,6 +71,7 @@ Native session restore requires these Herdr integration versions or newer:
| Claude Code | `6` | `claude --resume <id>` |
| Codex | `5` | `codex resume <id>` |
| Cursor Agent CLI | `1` | `cursor-agent --resume <id>` |
+| Grok CLI | `1` | `grok --resume <id>` |
| GitHub Copilot CLI | `2` | `copilot --resume=<id>` |
| Devin CLI | `2` | `devin --resume <id>` |
| Droid | `2` | `droid --resume <id>` |