Skip to content

feat: add Grok Build native skills adapter (revive #561) - #661

Open
p-clements wants to merge 5 commits into
DietrichGebert:mainfrom
p-clements:feat/grok-build-adapter
Open

feat: add Grok Build native skills adapter (revive #561)#661
p-clements wants to merge 5 commits into
DietrichGebert:mainfrom
p-clements:feat/grok-build-adapter

Conversation

@p-clements

@p-clements p-clements commented Aug 1, 2026

Copy link
Copy Markdown

Summary

Native Grok Build skill plugin, rebased from #561. It keeps that contribution's clean marketplace/plugin packaging and shared Ponytail skill content, while using Grok's supported native skill activation path.

Important behavior note

The original #561 hook-based approach was a reasonable Claude-compatible design, but it assumes that Grok consumes lifecycle-hook stdout as model context. Current xAI Grok Build documentation defines SessionStart, UserPromptSubmit, and SubagentStart as passive events; only PreToolUse and Stop/SubagentStop have output-control contracts. Passive hook stdout is informational and is not injected into the conversation. See xAI's Hook events and hook output contract.

So #561's hooks could execute and persist mode state, but they could not deliver the intended Ponytail ruleset to the main session or subagents. This is a platform-contract mismatch, not a problem with the original contribution's packaging approach.

This PR therefore uses Grok's documented native skill mechanism: skill descriptions can trigger automatic invocation for matching coding tasks, while /ponytail explicitly loads Ponytail when deterministic activation is wanted. See xAI's Skills guide.

Resulting Grok behavior

  • Native Ponytail skills and commands are installed and available.
  • Grok can auto-invoke ponytail for coding tasks from the existing skill description.
  • /ponytail, /ponytail lite, /ponytail full, and /ponytail ultra make activation explicit.
  • This does not claim hook-based always-on injection, persistent hook-managed mode state, or subagent context injection.
  • No Grok MCP server is added: the skills already provide the required instruction content without a separate runtime.

Packaging

  • Root plugin.json is a minimal Grok manifest.
  • .grok-plugin/marketplace.json keeps the repo marketplace entry.
  • No lifecycle hooks are registered, so the adapter stays thin and avoids dead host-specific runtime paths.
  • English, Spanish, Korean, and portability docs describe the supported behavior.

Validation

  • node --test tests/grok-plugin.test.js tests/hooks-windows.test.js tests/hooks.test.js tests/gemini-extension.test.js
  • node scripts/check-rule-copies.js
  • node scripts/check-versions.js
  • grok plugin validate .
  • Isolated GROK_HOME install: 6 skills, 0 hooks.

Thin Grok packaging under .grok-plugin/ with root plugin.json path
overrides (hooks + MCP). SessionStart/UserPromptSubmit/SubagentStart
reuse shared hooks/ponytail-*.js; mode state under GROK_PLUGIN_DATA.

Rebases the approach from DietrichGebert#561 onto current main: keep Qoder detection
and output paths, add isGrok, export getGrokPluginDataDir, drop bash-only
exec from Grok hooks, and document install/enable/uninstall on the
front-page README (en/es/ko) plus agent-portability.

Direct install works today:
  grok plugin install DietrichGebert/ponytail --trust

Marketplace root source ("./") matches Claude; Grok's scanner still
rejects it (see xai-org/plugin-marketplace#123 class of bugs).

Co-authored-by: Vinícius Souza <souza.vinicius@bb.com.br>
Review feedback on DietrichGebert#661:
- Remove MCP wiring (git install never installs ponytail-mcp deps; no
  other host ships MCP; hooks+skills cover always-on)
- Drop static plugin-index.json (optional catalog fluff)
- Clear GROK_PLUGIN_* in hooks.test.js so host suites cannot leak
- Exclusive isGrok after Copilot/Codex; state falls back to ROOT not ~/.claude
- Tighten Qoder regression assert; structural checks for plugin.json/hooks
- List Grok Build among skill-capable hosts in README
Second review pass for DietrichGebert#661:

- Delete .grok-plugin/hooks.json (near-copy of claude-codex-hooks.json).
  Root plugin.json points at the shared map; Grok sets CLAUDE_PLUGIN_ROOT.
- Drop getGrokPluginDataDir; inline GROK_PLUGIN_DATA || ROOT like other hosts.
- Grok uses Claude-compatible writeHookOutput (raw SessionStart, JSON
  SubagentStart) instead of a separate raw-only branch.
- Slim .grok-plugin/marketplace.json to match .claude-plugin.
- Tests: shared-map assert, SubagentStart JSON under Grok, Qoder isolation.
@p-clements p-clements changed the title feat: add Grok Build adapter (revive #561) feat: add Grok Build native skills adapter (revive #561) Aug 1, 2026
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