[MODEL] System prompt forces gh CLI for "ALL GitHub-related tasks" even when github MCP is active

Resolved 💬 1 comment Opened May 6, 2026 by yoonsangkwak Closed Jun 3, 2026

Preflight Checklist

  • [x] I have searched existing issues for similar behavior reports
  • [x] This report does NOT contain sensitive information (API keys, passwords, etc.)

Type of Behavior Issue

Claude ignored my instructions or configuration

What You Asked Claude to Do

The user has recorded a preference in auto-memory and CLAUDE.md:
"Prefer GitHub MCP tools (mcp__github__*) over the gh CLI; fall back to gh only when MCP lacks the capability."

Then asks Claude Code to do a GitHub task such as: "Read PR comments", "List issues", "Create a review".

What Claude Actually Did

  1. Claude Code reaches for gh Bash commands first (e.g. gh pr view, gh api ...).
  2. When pointed out, it cites the system prompt language as justification:

> "Use the gh command via the Bash tool for ALL GitHub-related tasks including working with issues, pull requests, checks, and releases."

  1. Only after explicit correction does it switch to mcp__github__* tools.
  2. The pattern recurs across sessions — adding the preference to memory does not reliably prevent the regression because the system prompt directive ranks higher.

Expected Behavior

When a GitHub MCP server is configured (and mcp__github__* tools are present in the toolset), Claude Code should prefer those MCP tools and use gh only when MCP lacks the capability — especially when the user has explicitly recorded that preference in memory or CLAUDE.md.

The system prompt itself should not contain an unconditional "ALL GitHub-related tasks must use gh" directive that conflicts with the github MCP server's own injected instructions in the same prompt.

Files Affected

Permission Mode

Accept Edits was ON (auto-accepting changes)

Can You Reproduce This?

Yes, every time with the same prompt

Steps to Reproduce

  1. Configure the github MCP server so mcp__github__* tools are available in the session.
  2. Add a preference to auto-memory or CLAUDE.md:

"Prefer github MCP tools over gh CLI; gh only when MCP lacks the capability."

  1. Ask Claude Code: "Read the comments on PR #123" (or any GitHub task).
  2. Observe Claude's first tool choice — it typically reaches for gh pr view --comments rather than mcp__github__pull_request_read /

mcp__github__add_comment_to_pending_review etc.

  1. Correct it explicitly. It switches to MCP.
  2. In a later turn (or new session), repeat — the regression returns.

Claude Model

Opus

Relevant Conversation

System prompt (Bash tool description, verbatim):
  > "Use the gh command via the Bash tool for ALL GitHub-related tasks including working with issues, pull requests, checks, and releases. If
  given a Github URL use the gh command to get the information needed."

  Same system prompt also injects MCP instructions:                                                                                              > "## github — The GitHub MCP Server provides tools to interact with GitHub platform."

                                                         These two sections describe the same domain but never reconcile precedence. Adding a memory entry to prefer MCP does not consistently
  override the Bash section's strong "ALL" wording.

Impact

Medium - Extra work to undo changes

Claude Code Version

2.1.128

Platform

Anthropic API

Additional Context

Root cause appears to be the wording of the Bash tool description in the system prompt. The directive predates the MCP-first model and uses unconditional language ("ALL GitHub-related tasks") that the model treats as overriding lower-priority sources (memory, CLAUDE.md, settings). Proposed fixes: 1. Make the directive conditional: "If a GitHub MCP server is available, prefer its tools. Use gh via Bash only when MCP lacks the needed capability."

  1. Centralize tool-choice guidance so MCP and CLI are not described in conflicting sections. 3. Acknowledge that user-level preferences (memory, CLAUDE.md, settings.json) may flip the default tool choice.
  2. Optional toggle in settings.json to disable the gh-first directive when MCP is configured. Workarounds I tried before filing: - Auto-memory entry → inconsistent.
  • CLAUDE.md rule → inconsistent (ranks below system prompt). - settings.json permissions / PreToolUse hook to block gh → works but heavy-handed.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗