Skip to content

Add native agent plugin for Grok / xAI CLI #402

Description

@djbclark

Summary

There's no built-in agent plugin for xAI's Grok, despite the official
grok CLI (github.com/xai-org, or via the plugin marketplace at
github.com/xai-org/plugin-marketplace) supporting exactly the
non-interactive shape ralph-tui's other agent plugins rely on.

What the grok CLI already supports (v0.2.118, confirmed locally)

  • Non-interactive invocation: grok -p "<prompt>" --always-approve --output-format <format>
  • Multiple structured output formats, including streaming-messages-json,
    which is literally the Anthropic Messages wire format — i.e. directly
    reusable against the same event-parsing logic the claude plugin already
    has, with minimal translation.
  • Auth via standard OAuth/OIDC user login (~/.grok/auth.json, issuer
    https://auth.x.ai) tied to a SuperGrok subscription — not a separate
    pay-per-token API key, so driving it from ralph-tui rides the existing
    consumer subscription rather than opening new billing.
  • grok agent headless/stdio subcommands exist too, for deeper
    streaming control if the simple -p/--output-format path isn't enough.

Why this matters

Every other major coding-agent CLI with a comparable non-interactive mode
(Claude Code, Codex, Gemini CLI, Cursor Agent, OpenCode, Kimi, Droid, Kiro,
Pi) already has a built-in plugin. Grok is a notable gap given the CLI's
capabilities line up closely with the existing plugin shape.

Rough scope estimate

Comparable to the existing pi.ts/kimi.ts built-in plugins (~300-400
lines): extend BaseAgentPlugin, override meta (id grok,
defaultCommand: 'grok'), detect() (find binary + parse grok --version),
buildArgs() (-p, --always-approve/equivalent flag, --output-format streaming-messages-json, --model passthrough), and reuse/adapt the
existing Claude-wire-format JSONL parser for the streaming-messages-json
output.

Happy to contribute a PR for this if there's interest — wanted to check
whether it's already under consideration first.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions