Skip to content

feat: add Grok Build AutoMem installer client - #173

Open
jack-arturo wants to merge 1 commit into
mainfrom
feat/grok-installer-client
Open

feat: add Grok Build AutoMem installer client#173
jack-arturo wants to merge 1 commit into
mainfrom
feat/grok-installer-client

Conversation

@jack-arturo

Copy link
Copy Markdown
Member

Summary

  • Add a first-class Grok installer client that writes native ~/.grok/config.toml [mcp_servers.memory] (stdio + AUTOMEM_* env) and upserts AutoMem rules into ~/.grok/AGENTS.md
  • Wire detect/--clients grok into guided install and uninstall (opt-in like Hermes — not in blind --yes defaults)
  • Document the Claude/Cursor compat env-drop pitfall and update host-specs / integration coverage

Why

Grok loads MCP as config.toml > Claude > Cursor. When AutoMem is only present via compat imports, Grok can start npx @verygoodplugins/mcp-automem without AUTOMEM_*, default to http://127.0.0.1:8001, and fail every session with Mcp error: -32603: fetch failed. Native config with env is the durable fix; /mcps UI edits are session-scoped.

Test plan

  • npx vitest run src/cli/grok-config.test.ts src/cli/grok.test.ts src/cli/install.test.ts src/cli/uninstall.test.ts
  • npx vitest run tests/docs/integration-coverage.test.ts tests/host-smoke/host-specs.test.ts tests/cli/smoke.test.ts
  • npx tsc --noEmit
  • Manual: npx mcp-automem grok --dry-run against a temp GROK_HOME
  • Manual: install --clients grok then verify ~/.grok/config.toml has AUTOMEM_API_URL and uninstall removes only AutoMem-owned entry

Write native ~/.grok/config.toml [mcp_servers.memory] with AUTOMEM_* env so Grok is not trapped by Claude/Cursor compat imports that drop credentials and fall back to localhost:8001.
@jack-arturo

Copy link
Copy Markdown
Member Author

/copilot-review

1 similar comment
@jack-arturo

Copy link
Copy Markdown
Member Author

/copilot-review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cb381985d2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

tool_name: "memory__recall_memory",
tool_input: {
query: "<proper nouns, product names, people, tools, specific topics from the user's message>",
tags: ["{{PROJECT_NAME}}"], // drop if slug collides with a common word

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid hard-coding project tags in global Grok rules

Grok loads ~/.grok/AGENTS.md as global rules for every repo, and this template is written there by default, so the install-time project name becomes a hard tag gate for all later Grok sessions. If a user installs from repo A and then uses Grok in repo B, task-context recall is constrained to repo A's tag and relevant B memories are filtered out before scoring; the global rules should avoid a static project tag or be written project-scoped instead.

Useful? React with 👍 / 👎.

@@ -0,0 +1,160 @@
<!-- BEGIN AUTOMEM GROK RULES -->
<!-- automem-template-version: 0.15.0 -->

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep Grok rules in the shared policy sync

This new versioned rules file duplicates the generated AutoMem policy, but scripts/sync-memory-policy.ts still regenerates only the Claude/Codex/Cursor/Hermes artifacts. The next change to src/memory-policy/shared.ts will leave Grok with stale recall/storage behavior even though npm run build is expected to keep policy artifacts in sync, so this should be rendered from the shared policy and added to the sync/test coverage rather than maintained by hand.

Useful? React with 👍 / 👎.

Comment thread src/cli/grok-config.ts
}
return {
command: 'npx',
args: ['-y', '@verygoodplugins/mcp-automem'],

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Set a longer startup timeout for npx cold starts

The generated Grok server always launches through npx -y @verygoodplugins/mcp-automem, but it does not set Grok's per-server startup timeout; Grok's MCP docs show startup_timeout_sec = 30 as the default and note that cold-start npx servers that download packages may need more time. On a first run with an empty npm cache or slow network, Grok can time out before the MCP handshake, so include a larger startup_timeout_sec in the generated entry/template.

Useful? React with 👍 / 👎.

Comment thread src/cli/grok-config.ts
return { method: 'toml', changed: false };
}

servers[GROK_MCP_SERVER_NAME] = entry;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Do not overwrite a non-AutoMem memory server

When a user already has mcp_servers.memory pointing at a different MCP server, this assignment silently replaces that server with AutoMem. Uninstall is careful to leave non-AutoMem memory entries alone, but install does not make the same ownership check, so running the Grok installer can disable an unrelated configured memory provider; detect this case and abort or choose another server name instead of clobbering it.

Useful? React with 👍 / 👎.

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