Skip to content

Feature: official Grok CLI (xAI) support #837

Description

@Sallvainian

Describe your idea
Official support for xAI's Grok CLI (grok) as a built-in adapter profile, alongside claude, codex, gemini, copilot and antigravity.

Why is this needed?
Grok can drive bmad-loop today only through a hand-written project profile, and that path has gaps:

  • Grok runs each subagent as its own session and fires SessionEnd when one finishes. bmad-loop scores any SessionEnd as a crash, so a profile that maps it has every session that outlives a subagent killed mid-work. Leaving SessionEnd unmapped (as codex does) avoids that, but real crashes are then only caught by the window-death fallback.
  • No usage parser reads grok's transcripts, so token budget warnings and limits never apply to grok stages.
  • Grok's SessionStart names no transcript path, so the budget guard can't sample usage until the first turn ends.

Built-in support would let grok users run the loop with bmad-loop init --cli grok and nothing hand-maintained, with the same crash detection and budget enforcement the other CLIs get.

How should it work?

  • A built-in grok profile: Claude-shaped hooks in .grok/hooks/bmad-loop.json, skills in .agents/skills (where the BMad installer puts grok's), --always-approve for unattended runs, and a /hooks-trust first-run note.
  • Ignore a SessionEnd whose payload carries grok's subagentType marker. The main session's SessionEnd lacks it, and grok's hook docs say the field exists so a host can tell a child's teardown from its own. No other CLI sends it, and an unmarked SessionEnd still ends the session.
  • A grok-updates usage parser that sums each turn's turn_completed usage in updates.jsonl, including subagent sessions.
  • A transcript_template profile key that derives the transcript path from the session id and cwd at SessionStart.

PR
I understand grok isn't officially supported at the moment, so I haven't opened a PR. However, a ready implementation is on my fork, to be opened as a PR on request:

Additional context

  • The subagentType marker was confirmed against live grok 1.0.41 hook payloads; the profile's floor is 1.0.41 for that reason.
  • The parser's totals matched independent recounts on two unattended loop runs (grok 1.0.40).
  • On the fork's CI, the test, lint, typecheck and build jobs pass on Linux and Windows across Python 3.11–3.14.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions