Skip to content

feat(agents): add Grok Build (grok) agent support #124

Description

@linhai0872

Summary

I'd like to add Grok Build (grok, by xAI) as the 13th supported agent. Grok Build is a first-party terminal coding agent with a documented, open-source on-disk layout — similar in shape to Codex (TOML MCP) + Claude-like hooks, but with its own native enable/disable semantics.

Official product: https://x.ai/build
Source of truth for this proposal: https://github.com/xai-org/grok-build (checked at c2ad97f)

What Grok Build looks like on disk

Home is $GROK_HOME verbatim when set, otherwise ~/.grok (xai-grok-home).

$GROK_HOME/                    # default ~/.grok
  config.toml                  # settings + [mcp_servers.*] + [plugins] + [skills]
  pager.toml
  skills/<name>/SKILL.md
  hooks/*.json                 # Claude-like JSON
  disabled-hooks               # one Grok hook spec.name per line
  plugins/*/plugin.json
  installed-plugins/*/
  agents/*.md
  rules/*.md
  commands/*.md
  memory/
  AGENTS.md

<project>/.grok/
  config.toml                  # only [mcp_servers], [plugins], [permission]
  skills/
  hooks/
  plugins/
  agents/
  rules/
  commands/

Project marker: .grok/. Canonical skill write target: .grok/skills (not .agents/skills).

Proposed first contribution

A full native adapter (crates/hk-core/src/adapter/grok.rs) implementing AgentAdapter:

  • Detect $GROK_HOME / ~/.grok without creating the directory.
  • Skills — user ~/.grok/skills, project .grok/skills. Does not claim Claude/Cursor/.agents compat dirs (those stay with their own adapters). Disable via [skills].disabled is Grok-native; HK skill toggle can stay the existing rename model for files we own.
  • MCP — TOML [mcp_servers.<name>] in user + project config.toml. Remote key is headers (not Codex http_headers); type = "sse" is supported. Native toggle via user-level disabled_mcp_servers + per-entry enabled, matching grok mcp enable/disable. Personal disable must not rewrite shared project files. New McpFormat::GrokToml / RemoteMcpSchema::GrokToml so Codex's writer is never reused.
  • Hooks — scan $GROK_HOME/hooks/*.json and .grok/hooks/*.json (Claude-like). Install writes command hooks. Toggle uses $GROK_HOME/disabled-hooks with Grok's real spec name (global/<stem>:<event>[i].hooks[j]). Only $GROK_HOME/hooks is global/; a project under a custom $GROK_HOME stays project/. SubagentEnd uses upstream's subagent_stop display token and shares one group-index sequence. HTTP hooks are out of scope — HK's HookEntry is command-only; they are skipped as rows but still occupy Grok's hook index.
  • Plugins — scan $GROK_HOME/plugins/, $GROK_HOME/installed-plugins/, and project .grok/plugins. Toggle via [plugins].disabled / [plugins].enabled using Grok's stable plugin id ({scope}/{hex8}/{name}). Personal toggle writes the user lists only.
  • Rules / settings / subagents / memory / commands — Grok-native paths only. Do not surface auth.json or mcp_credentials.json.
  • Frontend: AGENT_ORDER, display name Grok Build, colors, LobeHub Icons grok mascot, onboarding, EN/ZH README matrix 12 → 13.

Compat isolation

Grok also reads Claude Code and Cursor skills / MCP / hooks / plugins when [compat.*] cells are on. HarnessKit already owns those through the existing adapters. The Grok adapter will not claim .claude, .cursor, or .agents trees, matching the omp adapter's "don't double-claim" rule.

Known limitations (called out, not silent)

  • HTTP hook handlers are not modeled.
  • Inline [hooks] tables inside config.toml are not scanned in this first PR (JSON files under hooks/ are).
  • Compat-sourced MCP (.mcp.json / Claude / Cursor) is not written through the Grok adapter.

Verification plan

  • cargo test --workspace
  • npm test + npm run build
  • Isolated $GROK_HOME fixtures +, if available, grok inspect / grok mcp list smoke

Happy to do the work. Opening this for visibility; a PR will follow on feat/grok-build-agent-support.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions