feat(types): add grok-build agent type (xAI Grok Build CLI)#216
Draft
fujibee wants to merge 2 commits into
Draft
feat(types): add grok-build agent type (xAI Grok Build CLI)#216fujibee wants to merge 2 commits into
fujibee wants to merge 2 commits into
Conversation
Add an agmsg agent type for xAI's official Grok Build CLI (binary 'grok',
x.ai/cli) so it can join a team alongside Claude Code, Codex, Gemini, Cursor,
and Hermes. Grok Build deliberately adopts Claude-Code-style conventions, so
this is a manifest + path/detect remap rather than new infrastructure — the
existing Stop-hook delivery script reads session_id from the hook input JSON on
stdin, which Grok Build emits the same way, so no env remap is needed.
- scripts/drivers/types/grok-build/{type.conf,template.md,_delivery.sh}: a
turn/off type (no Monitor-tool equivalent, so delivery_modes='turn off',
default turn). detect=GROK_SESSION_ID for whoami; cli=grok. The _delivery.sh
writes a dedicated .grok/hooks/agmsg.json (copilot model).
- install.sh: ship the skill to ~/.grok/skills/<name>/ and accept
--agent-type grok-build, both via the type registry.
- tests: grok-build delivery (turn/off/reject), install (skill drop +
--agent-type), join, and the registry's nine-built-ins count.
C-GATED (#214): the hook filename and JSON schema in _delivery.sh and the
delivery tests are the assumed Claude-Code shape — xAI's official schema page
was not directly fetchable. They are scaffolded and must be confirmed against a
real install with 'grok inspect' before release; everything else (manifest,
template, whoami detect, install placement, join) is schema-independent.
Confirmed the Grok Build hook contract against a real install (xAI local
docs ~/.grok/docs/user-guide/10-hooks.md) and finalize the type:
- _delivery.sh: write the confirmed nested Claude hook shape
{ hooks: { Stop: [ { hooks: [ { type:command, command:<abs>, timeout:N } ] } ] } }
at .grok/hooks/agmsg.json (no top-level version), command as the
absolute check-inbox.sh path. Replaces the provisional copilot-flat scaffold.
- session-start.sh / check-inbox.sh: resolve the session id from snake_case
session_id (Claude) -> camelCase sessionId (Grok Build / Cursor) ->
$GROK_SESSION_ID env. Additive and snake-first, so claude-code is unchanged.
Grok emits camelCase stdin, which previously degraded to a synthesized id
and broke per-session dedup (#93) and the delivery watermark.
- type.conf: spawnable=yes. spawn.sh already launches direct-CLI types via
`grok "/agmsg actas <name>"` and skips the readiness wait for monitor=no
types, so no spawn.sh change is needed.
- install.sh: infer grok-build on --update from an existing grok-typed SKILL.md.
- tests: nested hook shape, session-id resolution (camelCase / env / snake-wins),
status detection, --update inference, and grok-build in the spawnable set.
Refs #214.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an agmsg agent type for xAI's official Grok Build CLI (binary
grok, from x.ai/cli), so Grok Build can join a team alongside Claude Code, Codex, Gemini, Cursor, and Hermes. Refs #214.Disambiguation: the target is the official xAI Grok Build terminal agent, not the unrelated community
superagent-ai/grok-cli.Why this is small
Grok Build adopts Claude-Code-style hook conventions, so this is largely a manifest + path/detect remap on top of the manifest-driven type registry rather than new infrastructure. The Stop-hook delivery script (
check-inbox.sh) is reused as-is for delivery; the only behavioral change to shared scripts is a vendor-neutral session-id resolver (see below).What's in this PR
scripts/drivers/types/grok-build/—type.conf(cli=grok,detect=GROK_SESSION_ID,delivery_modes="turn off"with defaultturn,hooks_file=.grok/hooks/agmsg.json),template.md(the/agmsgSKILL, modeled on the Copilot turn/off template), and_delivery.sh(writes a dedicated.grok/hooks/agmsg.json, Copilot file-ownership model).scripts/session-start.sh/scripts/check-inbox.sh— session-id resolution now tries snake_casesession_id(Claude) → camelCasesessionId(Grok Build / Cursor) →$GROK_SESSION_IDenv. Additive and snake-first, so Claude Code behavior is unchanged. Without this, Grok's camelCase stdin would resolve empty and degrade to a synthesized id, breaking per-session dedup (Parallel claude --continue / --resume sessions share session_id, breaking actas lock distinctness #93) and the delivery watermark.install.sh— ships the skill to~/.grok/skills/<name>/SKILL.md, accepts--agent-type grok-build, and infersgrok-buildon--updatefrom an existing grok-typed SKILL.md.--agent-type+--update), join, and the registry's nine-built-ins count.Grok Build has no Monitor-tool equivalent, so there is no
monitor/bothmode (turn = Stop hook checks inbox between turns; off = manual).monitormode can be added later if Grok can consume the watcher stream.spawnsupport is deferred.Hook schema (confirmed on a real install)
The hook file path and JSON schema were confirmed against a real Grok Build install and xAI's local docs (
~/.grok/docs/user-guide/10-hooks.md):<project>/.grok/hooks/agmsg.json, nested Claude shape, no top-levelversion:{ "hooks": { "Stop": [ { "hooks": [ { "type": "command", "command": "<abs path>", "timeout": 30 } ] } ] } }commandis the absolutecheck-inbox.shpath.Stopis a lifecycle event ("agent turn ends"), no matcher.~/.grok/hooks/*.jsonis always trusted (no prompt); a project.grok/hooks/agmsg.jsonrequires/hooks-trust. Grok also reads.claude/settings.jsonin compat mode, but the dedicated.grok/hooks/file is used to avoid compat-dependence / double-fire.Verification
Pending before merge: an end-to-end handoff smoke test on a real Grok Build session (grok session → team join → round-trip) — kept as draft until that passes.
Refs #214. (Intentionally not
Closes— leave #214 open until the end-to-end handoff is verified.)