feat: add Grok Build AutoMem installer client - #173
Conversation
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.
|
/copilot-review |
1 similar comment
|
/copilot-review |
There was a problem hiding this comment.
💡 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 |
There was a problem hiding this comment.
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 --> | |||
There was a problem hiding this comment.
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 👍 / 👎.
| } | ||
| return { | ||
| command: 'npx', | ||
| args: ['-y', '@verygoodplugins/mcp-automem'], |
There was a problem hiding this comment.
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 👍 / 👎.
| return { method: 'toml', changed: false }; | ||
| } | ||
|
|
||
| servers[GROK_MCP_SERVER_NAME] = entry; |
There was a problem hiding this comment.
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 👍 / 👎.
Summary
~/.grok/config.toml[mcp_servers.memory](stdio +AUTOMEM_*env) and upserts AutoMem rules into~/.grok/AGENTS.md--clients grokinto guided install and uninstall (opt-in like Hermes — not in blind--yesdefaults)Why
Grok loads MCP as
config.toml> Claude > Cursor. When AutoMem is only present via compat imports, Grok can startnpx @verygoodplugins/mcp-automemwithoutAUTOMEM_*, default tohttp://127.0.0.1:8001, and fail every session withMcp error: -32603: fetch failed. Native config with env is the durable fix;/mcpsUI 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.tsnpx vitest run tests/docs/integration-coverage.test.ts tests/host-smoke/host-specs.test.ts tests/cli/smoke.test.tsnpx tsc --noEmitnpx mcp-automem grok --dry-runagainst a tempGROK_HOMEinstall --clients grokthen verify~/.grok/config.tomlhasAUTOMEM_API_URLand uninstall removes only AutoMem-owned entry