diff --git a/internal/components/engram/inject.go b/internal/components/engram/inject.go index 2522235c9..63020dcc5 100644 --- a/internal/components/engram/inject.go +++ b/internal/components/engram/inject.go @@ -130,11 +130,6 @@ func engramOverlayJSON(agentID model.AgentID, cmd string) []byte { } } else { args := []string{"mcp", "--tools=agent"} - if agentID == model.AgentAntigravity { - // Antigravity should launch the default Engram MCP server without - // narrowing the exposed tool set. - args = []string{"mcp"} - } cfg = map[string]any{ "mcpServers": map[string]any{ "engram": map[string]any{ @@ -275,14 +270,6 @@ func installAntigravityEngramPlugin(homeDir, engramCommand string) (bool, []stri changed = changed || pluginWrite.Changed files = append(files, pluginPath) - pluginMCPPath := filepath.Join(pluginDir, "mcp_config.json") - mcpWrite, err := filemerge.WriteFileAtomic(pluginMCPPath, engramOverlayJSON(model.AgentAntigravity, engramCommand), 0o644) - if err != nil { - return false, nil, fmt.Errorf("write Antigravity Engram plugin MCP config: %w", err) - } - changed = changed || mcpWrite.Changed - files = append(files, pluginMCPPath) - hooksPath := filepath.Join(pluginDir, "hooks.json") hooksWrite, err := filemerge.WriteFileAtomic(hooksPath, antigravityEngramHooksJSON(), 0o644) if err != nil { @@ -854,7 +841,7 @@ func isVersionedHomebrewCellarPath(path string) bool { func isStableHomebrewEngramPath(path string) bool { clean := filepath.ToSlash(filepath.Clean(path)) - return (clean == "/opt/homebrew/bin/engram" || clean == "/usr/local/bin/engram") && isEngramCommand(clean) + return (clean == "/opt/homebrew/bin/engram" || clean == "/usr/local/bin/engram" || clean == "/home/linuxbrew/.linuxbrew/bin/engram") && isEngramCommand(clean) } // resolveProfileAssignments builds the []codex.ProfileAssignment slice used diff --git a/internal/components/engram/inject_test.go b/internal/components/engram/inject_test.go index e33e4885d..d9dc3846b 100644 --- a/internal/components/engram/inject_test.go +++ b/internal/components/engram/inject_test.go @@ -582,8 +582,8 @@ func TestInjectAntigravityWritesMCPToCLIConfig(t *testing.T) { if !strings.Contains(text, `"args": [`) || !strings.Contains(text, `"mcp"`) { t.Fatalf("Antigravity MCP config must launch Engram MCP; got:\n%s", text) } - if strings.Contains(text, `--tools=`) { - t.Fatalf("Antigravity should use Engram's default MCP invocation without tool-profile flags; got:\n%s", text) + if !strings.Contains(text, `"--tools=agent"`) { + t.Fatalf("Antigravity should use Engram's agent MCP invocation with tool-profile flags; got:\n%s", text) } pluginPath := filepath.Join(home, ".gemini", "antigravity-cli", "plugins", "gentle-ai-engram", "plugin.json") @@ -592,13 +592,8 @@ func TestInjectAntigravityWritesMCPToCLIConfig(t *testing.T) { } pluginMCPPath := filepath.Join(home, ".gemini", "antigravity-cli", "plugins", "gentle-ai-engram", "mcp_config.json") - pluginMCPContent, err := os.ReadFile(pluginMCPPath) - if err != nil { - t.Fatalf("ReadFile(%q) error = %v", pluginMCPPath, err) - } - pluginMCPText := string(pluginMCPContent) - if !strings.Contains(pluginMCPText, `"mcp"`) || strings.Contains(pluginMCPText, `--tools=`) { - t.Fatalf("Antigravity Engram plugin MCP config should expose default Engram MCP tools; got:\n%s", pluginMCPText) + if _, err := os.Stat(pluginMCPPath); !os.IsNotExist(err) { + t.Fatalf("Antigravity Engram plugin MCP config should NOT be written: %v", err) } hooksPath := filepath.Join(home, ".gemini", "antigravity-cli", "plugins", "gentle-ai-engram", "hooks.json") diff --git a/testdata/golden/engram-antigravity-mcp.golden b/testdata/golden/engram-antigravity-mcp.golden index 306b24ca2..4f1c5bdc2 100644 --- a/testdata/golden/engram-antigravity-mcp.golden +++ b/testdata/golden/engram-antigravity-mcp.golden @@ -2,7 +2,8 @@ "mcpServers": { "engram": { "args": [ - "mcp" + "mcp", + "--tools=agent" ], "command": "/opt/homebrew/bin/engram" }