From 1d4b5dec4a8a8b3b3a0fb14ea5e7ceb6db177b02 Mon Sep 17 00:00:00 2001 From: Sisyphus Date: Thu, 1 Jan 2026 22:53:28 +0900 Subject: [PATCH] feat(mcp): restrict grep_app tools to librarian agent only (#395) * feat(mcp): restrict grep_app tools to librarian agent only Reduces token usage by disabling grep_app MCP tools globally and enabling them only for the librarian agent, which uses them for GitHub code search during documentation lookups. Changes: - Add grep_app_* tool disable globally in config.tools - Add grep_app_* tool enable for librarian agent - Remove grep_app references from explore agent prompt (no access) Closes #394 * chore: changes by sisyphus-dev-ai --------- Co-authored-by: sisyphus-dev-ai --- assets/oh-my-opencode.schema.json | 3 ++- src/agents/explore.ts | 12 +----------- src/index.ts | 2 ++ 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/assets/oh-my-opencode.schema.json b/assets/oh-my-opencode.schema.json index 2640a38..10ee6a1 100644 --- a/assets/oh-my-opencode.schema.json +++ b/assets/oh-my-opencode.schema.json @@ -64,7 +64,8 @@ "ralph-loop", "preemptive-compaction", "compaction-context-injector", - "claude-code-hooks" + "claude-code-hooks", + "auto-slash-command" ] } }, diff --git a/src/agents/explore.ts b/src/agents/explore.ts index cb2ed62..6e25be6 100644 --- a/src/agents/explore.ts +++ b/src/agents/explore.ts @@ -108,18 +108,8 @@ Use the right tool for the job: - **Text patterns** (strings, comments, logs): grep - **File patterns** (find by name/extension): glob - **History/evolution** (when added, who changed): git commands -- **External examples** (how others implement): grep_app -### grep_app Strategy - -grep_app searches millions of public GitHub repos instantly — use it for external patterns and examples. - -**Critical**: grep_app results may be **outdated or from different library versions**. Always: -1. Start with grep_app for broad discovery -2. Launch multiple grep_app calls with query variations in parallel -3. **Cross-validate with local tools** (grep, ast_grep_search, LSP) before trusting results - -Flood with parallel calls. Trust only cross-validated results.`, +Flood with parallel calls. Cross-validate findings across multiple tools.`, } } diff --git a/src/index.ts b/src/index.ts index f155493..b65b096 100644 --- a/src/index.ts +++ b/src/index.ts @@ -489,6 +489,7 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => { config.tools = { ...config.tools, + "grep_app_*": false, // Disable grep_app tools globally to reduce token usage (only librarian needs them) }; if (config.agent.explore) { @@ -501,6 +502,7 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => { config.agent.librarian.tools = { ...config.agent.librarian.tools, call_omo_agent: false, + "grep_app_*": true, }; } if (config.agent["multimodal-looker"]) {