Skip to content

feat: add Grok CLI support at parity with Claude Code and Codex#98

Open
gi11es wants to merge 2 commits into
masterfrom
feat/grok-cli-support
Open

feat: add Grok CLI support at parity with Claude Code and Codex#98
gi11es wants to merge 2 commits into
masterfrom
feat/grok-cli-support

Conversation

@gi11es

@gi11es gi11es commented Jul 11, 2026

Copy link
Copy Markdown
Owner

Adds Grok CLI as a third first-class agent tab kind, mirroring the existing Claude Code and Codex integrations end to end.

What's included

  • Tabs: new Grok tabs (menu, tab-bar/sidebar context menus, + button Option+Shift-click, Cmd+Ctrl+T shortcut), resume, and whole-session fork via grok --resume <id> [--fork-session]
  • Session discovery: reads ~/.grok/sessions/<percent-encoded-cwd>/<uuid>/summary.json for metadata, the shared prompt_history.jsonl for first-message/timelines, matching workspace dirs by percent-decoding (sidesteps reproducing the CLI's encoding alphabet)
  • Status badges: four new badge states (idle/working/error/done-unvisited) driven by turn_started/turn_ended events in events.jsonl, with colors/shapes/blink configurable in Settings
  • Context usage: real context-percentage bar from signals.json (contextTokensUsed/contextWindowTokens) — something Codex tabs can't show
  • Session-id discovery: Grok holds no session file open (unlike Codex, no lsof path), so new tabs are matched by polling for the newest workspace session created after tab launch, with an exclusion set to prevent double-claims
  • Settings: Grok section (default args, per-session prompt), grok --help flag autocomplete via the shared CLIHelpParser, per-workspace "Default Grok Arguments…"
  • Persistence: defaultGrokArgs per workspace, tab kind round-trips in state.json, session-name cache and bookmarks namespaced as grok:<id>, restore-time session-id recovery
  • Explorer: Grok sessions listed/resumable/forkable alongside the other providers. Fork-at-point is gated off via a new TabKind.supportsForkAtPoint — Grok's session spans several interdependent files (chat_history, updates, events) and cannot be truncated safely
  • Settings badge tables reflowed to two rows (four across exceeds the fixed 720pt pane width)

Testing

  • Unit tests: 316 passed, 0 failures (new coverage for grok event/signals parsing, CLI-flag parsing + blocklist, state round-trip, badge states, fork-at-point gating)
  • Sandboxed E2E harness (e2e.yml) on this branch: all scenarios pass (startup, ping, hijack rejection, SIGPIPE hammer) — run 29165285927
  • File-format assumptions validated against real ~/.grok/sessions data (grok 0.2.93)

🤖 Generated with Claude Code

gi11es and others added 2 commits July 12, 2026 03:26
Adds grok as a third first-class agent tab kind:
- New Grok tabs, resume, and whole-session fork (grok --resume [--fork-session])
- Session discovery/timelines from ~/.grok/sessions (summary.json,
  prompt_history.jsonl), status badges from events.jsonl turn events,
  context usage from signals.json
- Poll-based session-id discovery (Grok holds no session file open, so
  lsof-based discovery is not possible)
- GrokCLIFlags autocomplete, settings section, badge colors, menus,
  shortcuts (Cmd+Ctrl+T), per-workspace default args
- Fork-at-point is gated off for Grok: its multi-file session format
  cannot be truncated safely

Co-Authored-By: Claude Fable 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant