Skip to content

Host support: Grok Build — plugin discovery, native hook semantics, and MCP configuration #700

Description

@ScriptedAlchemy

Scope / evidence

P2 feature expansion. Research date 2026-09-06; Agent Bundle baseline 5fc8de37c9695b816d55bdcf18a6bcb1dfee69f5. Read xAI's own host documentation and official marketplace repository; no Grok installation/native test was run. Grok Build is the coding harness, not the xAI REST model API.

Primary sources

Native model and limits

Grok discovers native plugin directories from project/user locations, configured paths and --plugin-dir. Skills come from .grok/skills, global skills, enabled plugins and configured sources. Existing Claude-compatible material may also be discovered. Compatibility discovery is not proof that all callback semantics are identical.

The official marketplace defines conventional skills/, commands/, agents/, hooks/hooks.json, .mcp.json, and .lsp.json; an optional root plugin.json can provide metadata/path overrides. Marketplace remote sources require full commit pinning; a generated component index is not a hand-authored plugin API.

The current hook guide says only PreToolUse is blocking. Passive event stdout is ignored. A deny result or exit 2 blocks; crashes, malformed output and timeouts otherwise fail open. Consequently a canonical promise of context injection on session start or guaranteed deny-on-timeout cannot simply be copied from Claude. Report unsupported control effects rather than inventing them.

Proposed layout and operator setup

composite-root/
  plugin.json
  skills/review/SKILL.md
  commands/review.md
  hooks/grok-hooks.json        # use an override only after parser verification
  hooks/tool-before.grok.mjs
  mcp/example.mjs

Start with explicit local loading to validate the chosen parser/version:

grok --plugin-dir /absolute/composite-root
grok inspect
grok mcp list --json
grok mcp doctor example --json

Use /plugins to inspect and enable installed components and /hooks-trust for project code after user review. Do not automatically add --trust or alter trusted_folders.toml as an installer shortcut.

For independent declared MCP delivery, the host documents:

grok mcp add example -- node /absolute/composite-root/mcp/example.mjs

Equivalent native config shape:

[mcp_servers.example]
command = "node"
args = ["/absolute/composite-root/mcp/example.mjs"]

Project scope uses .grok/config.toml; user scope uses ~/.grok/config.toml. Existing compatible MCP files merge at a different precedence. Keep secret values in the operator environment or native credential flow, not published manifests. Do not both install bundled MCP and add an independent duplicate definition automatically.

Hook lowering example

Host shape, with the command path resolved from a supported native plugin anchor during emission/installation:

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [{ "type": "command", "command": "node /installed/example/hooks/tool-before.grok.mjs", "timeout": 10 }]
      }
    ]
  }
}

The adapter must preserve Grok payload fields, matcher behavior, error/timeout semantics and GROK_PLUGIN_ROOT/GROK_PLUGIN_DATA separation. The example's absolute path is illustrative; published output must not contain a build-checkout path. Shell quoting and platform support need real fixtures.

Design requirements

  1. Prove whether the existing Claude/portable artifact subset already loads correctly before adding redundant documents.
  2. Create a Grok capability profile that distinguishes skill activation, MCP tools, observational hooks and before-tool denial. Do not mark passive context injection supported because a hook process ran.
  3. Use canonical operation/schema records for MCP and shared authored content for skills/commands. No independent application registry or Grok agent loop.
  4. Pin plugin manifest/override parsing from native evidence or official first-party examples; the high-level compatibility claim alone is insufficient.
  5. Test effective discovery when .claude, .cursor, .agents, root plugin and native Grok files coexist. Explicit conflict diagnostics are preferable to silently running hooks twice.
  6. Installation receipts own only the native entries created by this integration. Preserve existing project/user MCP config, disabled plugins, trust state and durable data.

Acceptance

  • Pin host version and native/compatible discovery rules with reference provenance.
  • Static skills package works without a worker/MCP process and preserves native frontmatter semantics; allowed-tools must not be presented as a permission grant.
  • A deny prevents a sentinel tool action; malformed/timeout behavior matches the documented host limit and is visible.
  • Unsupported passive context mutation produces a build/inspection diagnostic rather than a silent no-op.
  • A generated MCP operation succeeds after relocation and actual package installation, with expected namespace/argv/environment.
  • Test native and compatible config precedence, multiple plugins, disabled components, and no duplicate activation.
  • Full-SHA marketplace source and generated index remain consistent if marketplace distribution is in scope.
  • Update/uninstall removes only owned registrations and keeps unrelated files/state.
  • Add Composite conformance: test cross-host auto-discovery and precedence, not only file collisions #651 composite and Small-plugin acceptance: skills and plain hooks without an unnecessary MCP/RSC runtime or empty Workbench #652 small-plugin regression coverage; retain custom-host AB4106 isolation until coexistence is proven.

No LSP implementation, automatic marketplace submission, trust bypass, global permission edits, or required domain retry/state system is in scope.

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