Skip to content

Add Grok Build support (context, setup, native hooks)#1647

Open
xormania wants to merge 2 commits into
oraios:mainfrom
xormania:grok-support
Open

Add Grok Build support (context, setup, native hooks)#1647
xormania wants to merge 2 commits into
oraios:mainfrom
xormania:grok-support

Conversation

@xormania

@xormania xormania commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Adds dedicated support for using Serena with xAI's Grok Build CLI.

Changes

  • New grok context (single-project, optimized for Grok Build; shaped like the existing claude-code context — except structured_tool_output, which is left at the auto default as in the codex/codebuddy contexts, since claude-code's explicit false is a Claude-Code-specific bug workaround)
  • serena setup grok command to register Serena as a user-scoped MCP server (with CLI compatibility detection)
  • Grok-native lifecycle hooks (serena-hooks --client=grok), including PreToolUse allow/deny output in Grok's {decision, reason} format
  • Two small hardenings in the PreToolUse remind hook's client-agnostic payload parsing that apply to all hook clients: non-string command values no longer raise, and target_file/targetFile file-path keys are recognized (CHANGELOG entry added under Hooks)
  • Documentation (docs/02-usage/030_clients.md), unit tests for setup/hooks/context, and scripts/live_test_grok.py — a zero-inference, state-preserving live smoke test against a real grok installation (documented in CONTRIBUTING.md)

This lets agents using the grok CLI get proper Serena integration with --project-from-cwd and correct context behavior.

Note: the other-langs (macos-latest) failure is unrelated to this PR — it is a pre-existing break on main (shader-sense 1.4.0 broke the HLSL server build from source), fixed in #1652. I will refresh this branch once that lands.

Checklist

  • This PR follows the guidelines in CONTRIBUTING.md regarding the scope of PRs.
  • For changes that add features or fix problems, I have added an entry to CHANGELOG.md, which concisely describes the change.

@xormania xormania force-pushed the grok-support branch 4 times, most recently from a2cc3ba to ecf7e77 Compare July 5, 2026 12:58
@xormania

xormania commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

I understand this is a lot - but Grok is a Player - 4.5 just released - its good.

@xormania xormania marked this pull request as draft July 9, 2026 18:26
xormania added 2 commits July 9, 2026 19:50
Adds first-class support for xAI's Grok Build CLI, following the
existing client-integration pattern (Claude Code, CodeBuddy, Codex):

- grok context: single-project, shaped like claude-code.yml, with the
  file-tool exclusions appropriate for a CLI agent that has its own
  read/edit/shell tools. structured_tool_output is left at the auto
  default (as in the codex and codebuddy contexts); claude-code's
  explicit false is a Claude-Code-specific bug workaround that is not
  carried over.
- serena setup grok: registers Serena as a user-scoped MCP server via
  "grok mcp add" after detecting a compatible grok CLI.
- serena-hooks --client=grok: Grok-native PreToolUse output
  ({decision, reason}) instead of the Claude-style hookSpecificOutput
  envelope; grep/read detection extended to Grok's tool names and
  shell payloads (target_file/targetFile path keys, non-string command
  values handled defensively). The payload-parsing refinements live in
  the remind hook's client-agnostic parsing and apply to all hook
  clients: a non-string command value previously raised, and
  target_file/targetFile paths were not recognized.
- Docs (030_clients.md #grok), unit tests for setup/hooks/context, and
  scripts/live_test_grok.py - a zero-inference, state-preserving live
  smoke test against a real grok installation (documented in
  CONTRIBUTING.md). Its M5 check verifies the structured-output wire
  shape: the grok context (auto default) serves an output schema and
  structuredContent for string-returning tools, while the claude-code
  context (explicit false workaround) serves plain text only.
@xormania xormania closed this Jul 10, 2026
@xormania xormania reopened this Jul 10, 2026
@xormania xormania marked this pull request as ready for review July 10, 2026 03:35
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