feat(installer): add Grok as a supported agent - #1645
Open
ximing wants to merge 1 commit into
Open
Conversation
codegraph install --target grok wires the MCP server into ~/.grok/config.toml (and .grok/config.toml for a project-local install), reusing the Codex TOML serializer so sibling tables stay intact. Subagent guidance goes in rules/codegraph.md, $GROK_HOME is honored, and uninstall reverses only what install wrote.
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.
@colbymchenry — please review this installer target when you have a chance.
Summary
codegraph installnow detects and configures Grok (Grok Build TUI /grokCLI) the same way it already does for Claude Code, Cursor, Codex, opencode, and the rest.After installing: start a new Grok session, or press
rin/mcps. A project-local install only takes effect once Grok trusts the folder (same gate as project hooks / repo-local MCP).Why
Grok reads MCP servers from TOML (
[mcp_servers.<name>]in~/.grok/config.tomlor.grok/config.toml). There was no installer target, so Grok users had to paste config by hand — and CodeGraph never showed up in the interactive agent list.Design
Grok is a first-class
AgentTarget, closest analog Codex (same TOML shape). Adding it is the documented installer pattern: one file insrc/installer/targets/+ registry +TargetId+ contract tests.$GROK_HOME/config.toml(default~/.grok/config.toml)./.grok/config.toml$GROK_HOME/rules/codegraph.md./.grok/rules/codegraph.mdMCP block — reuses
toml.ts([mcp_servers.codegraph]withcommand+args). Sibling tables and[[array_of_tables]]are preserved byte-for-byte. We own the codegraph table exclusively, same contract as Codex.Instructions — Grok always scans
$GROK_HOME/rules/*.mdand<dir>/.grok/rules/*.md. It does not load a home-levelAGENTS.md, so we write the short #704 marker-fenced block torules/codegraph.mdrather than sharing Codex'sAGENTS.md.codegraph uninstallstrips only the marked section.$GROK_HOME— honored (same idea asHERMES_HOME). Tests deleteGROK_HOMEwhen they redirectHOME, so they cannot write a developer's real~/.grok/config.toml.No
--path— unlike Cursor, Grok launches stdio MCP from the workspace cwd. Injecting--pathwould be wrong here.No
autoAllow/[permission]writes — Grok's[permission]table is user-owned (sibling allow/deny rules). MCP tools can be always-allowed from the first prompt. Touching that table with the narrow TOML splicer would risk wiping user rules.Local trust note — repo-local MCP is gated on folder trust (
~/.grok/trusted_folders.toml). The installer says so instead of reporting silent success.Compat note — Grok can also pick up Claude/Cursor MCP configs, but native
config.tomlwins on name conflict. This target writes the native entry so Grok works without those other agents installed.Tests
printConfig) now coversgrokviaALL_TARGETS.rules/codegraph.mdCodegraph is only effective in the main agent, and the sub Agent is not effective. Why? #704 block + legacy self-heal, local vs global isolation, sibling[mcp_servers.other]/[models]preservation,$GROK_HOMEredirect,printConfigis read-only.npx vitest run __tests__/installer-targets.test.ts— 245 passed, 3 skipped.Docs
README, site getting-started / integrations, CLI
--help, and[Unreleased]changelog. Uninstall location picker now lists~/.grok/./.grok.Out of scope
/mcps→r) or a new session to pick up the server.