Skip to content

feat(grok-build): first-class Grok packaging + multi-CLI bridges#2248

Open
AgileInnov8tor wants to merge 8 commits into
garrytan:mainfrom
AgileInnov8tor:feat/grok-build-host
Open

feat(grok-build): first-class Grok packaging + multi-CLI bridges#2248
AgileInnov8tor wants to merge 8 commits into
garrytan:mainfrom
AgileInnov8tor:feat/grok-build-host

Conversation

@AgileInnov8tor

Copy link
Copy Markdown

Summary

First-class Grok Build host support for gstack: complete thin runtime packaging, SETUP path fixes, host-bleed cleanup, multi-CLI bridges (honest DEPENDENT labels), DoD audit harness, and on-demand section pointers so /ship stays under the soft token ceiling.

Phase A — packaging

  • Expand Grok runtime root (browse/src, specialists, design/dist, extension, scripts, …) with monorepo realpath checks, preflight, and atomic staging (no wipe-before-success)
  • Fix $HOME$GSTACK_* double-home in browse/design/make-pdf SETUP resolvers
  • Suppress Claude MODEL_OVERLAY on grok-build; /claude labeled MULTI_CLI_BRIDGE
  • connect-chrome → open-gstack-browser; host-scoped setup (no always-on Codex .agents/ regen / Claude plan-tune prompt on --host grok-build)

Phase B — bridges

  • /spec --executegrok --prompt-file (no default --always-approve; archive allowlist fail-closed)
  • GrokAdapter for gstack-model-benchmark --models grok
  • setup/sync-gbrain success without Claude MCP hard-require
  • pair-agent remote ngrok install + security + teardown (DEPENDENT when missing)

Token ceiling (Option A)

  • Grok carved skills use STOP-Read section pointers like Claude (~/.grok/skills/gstack-*/sections/)
  • /ship always-loaded size: ~45k → ~20k tokens (under 160KB soft ceiling)

DoD

  • bin/gstack-grok-compat-audit packaging + bridge honesty gate
  • Free unit tests for dual-write parity, spawn fail-closed, adapter auth/redaction, audit fixtures, preflight-no-wipe

Install

cd /path/to/gstack && ./setup --host grok-build
bin/gstack-grok-compat-audit --phase ab

Follow-ups (tracked in TODOS.md)

  • U4 behavioral smoke for execute COMPATIBLE claim
  • Optional section pointers for other external hosts (Codex near ceiling)
  • Optional R10 gstack-codex / Grok MCP stretch

Test plan

  • bun test test/host-config.test.ts
  • bun test test/grok-section-pointers.test.ts
  • bun test test/grok-packaging-behavior.test.ts
  • ./setup --host grok-build (non-interactive) + runtime root assets present
  • bin/gstack-grok-compat-audit --phase a exit 0
  • CI on this PR once opened

Plan

docs/plans/2026-07-13-001-feat-gstack-grok-full-compat-plan.md

Make Grok Build a first-class gstack host with complete thin runtime root
assets, fixed SETUP path resolution, host-bleed cleanup, and honest multi-CLI
bridge packaging.

Phase A (packaging):
- Expand grok-build runtimeRoot + create_grok_runtime_root (specialists,
  browse/src, design/dist, make-pdf/dist, extension, scripts) with monorepo
  realpath healthchecks and fail-closed required links
- Fix $HOME$GSTACK_* double-home in browse/design/make-pdf SETUP resolvers
- Link connect-chrome → open-gstack-browser on Grok install; export
  GSTACK_MAKE_PDF in preamble; suppress Claude MODEL_OVERLAY for grok-build
- Label /claude as MULTI_CLI_BRIDGE with Step 0 detect

Phase B (bridges):
- /spec --execute spawns grok --prompt-file (researched flags) on Grok host
- GrokAdapter for gstack-model-benchmark --models grok
- setup/sync-gbrain Grok success without Claude MCP hard-require
- pair-agent remote ngrok install + security + teardown checklist

U9: bin/gstack-grok-compat-audit is the DoD gate (packaging + bridge honesty).
--host grok-build no longer regenerates .agents/ Codex skill docs or
prompts to install Claude Code plan-tune hooks into ~/.claude/settings.json.
Codex .agents/ gen runs only when INSTALL_CODEX=1; plan-tune hooks only when
INSTALL_CLAUDE=1 (or explicit --plan-tune-hooks).
Fail closed on ARCHIVE_PATH allowlist when SPAWN_PATH is missing, require
non-empty monorepo root before runtime links, drop default --always-approve,
prefer --prompt-file for large Grok benchmark prompts, and make compat-audit
refuse theater-green when required bridge skills are absent.
Grok ship and other carved skills no longer inline full section bodies into
SKILL.md. Like Claude, they emit STOP-Read pointers to package-local
sections/ files under ~/.grok/skills/gstack-*/sections/.

Drops gstack-ship always-loaded size from ~45k tokens / 179KB to ~20k / 80KB
(under the 160KB soft ceiling). Codex and other hosts keep monolith inline.
Records remaining upstream PR, U4 behavioral smoke, multi-host section
pointers, optional gstack-codex, gbrain MCP stretch, audit productization,
and review name-collision note after feat/grok-build-host.
Stage create_grok_runtime_root into a sibling .next tree and swap only after
preflight so a failed install cannot wipe the live thin root. Re-apply the
ARCHIVE_PATH allowlist on the optional --execute-claude spawn path.
Add free tests for remaining code-review debt: runtimeRoot vs setup parity,
generateSpecSpawn fail-closed allowlist, GrokAdapter auth/HOME/prompt-file,
compat-audit fixture exit codes, and preflight-no-wipe setup smoke. Prefer
HOME for auth discovery so hermetic tests work under Bun; pipe stderr so
token-shaped CLI errors never inherit onto the parent console.
@trunk-io

trunk-io Bot commented Jul 12, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

Pin Grok unit rates to official xAI pricing (docs.x.ai), parse headless
JSON usage when present (zero tokens when omitted — never invent), and
reject empty/invalid auth.json or whitespace-only API keys in available().
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