
GitWhy — The Context Layer for Git
Connects Claude to GitWhy's context engine so you can save and retrieve the reasoning behind code changes directly in git commits. Exposes tools to store structured AI session context, search past decisions, browse context trees, and post summaries to pull requests. Useful when you're iterating with an AI coding agent and want to preserve why you made certain architectural choices or rejected alternatives, not just what changed. Requires the GitWhy CLI installed locally and works through MCP tools or natural language triggers like "save this session" or "what context do we have on authentication." Think of it as git blame for AI-assisted development decisions.
- tools
- 8
- auth
- Secret needed
- transport
- STDIO
- env var
- 1
- last updated
- Apr 1, 2026
Tools
8 toolsPublic tool metadata for what this MCP can expose to an agent.
gitwhy_getRetrieve a saved context by its ID. Returns the full markdown content including metadata, reasoning, and file changes. Use when you know the exact context ID (e.g., from gitwhy_search or gitwhy_list results) and need the complete details. CLI alternative: `git why get <id>`.1 params
Retrieve a saved context by its ID. Returns the full markdown content including metadata, reasoning, and file changes. Use when you know the exact context ID (e.g., from gitwhy_search or gitwhy_list results) and need the complete details. CLI alternative: `git why get <id>`.
idstringgitwhy_listBrowse saved contexts and the domain/topic tree structure. Use to discover what contexts exist in this repo. Call with no args to see the domain/topic hierarchy. Add filters to drill down into a specific domain or topic. CLI alternative: `git why tree` (tree view) or `git why...2 params
Browse saved contexts and the domain/topic tree structure. Use to discover what contexts exist in this repo. Call with no args to see the domain/topic hierarchy. Add filters to drill down into a specific domain or topic. CLI alternative: `git why tree` (tree view) or `git why...
domainstringtopicstringgitwhy_post_prPost or update a GitHub PR comment summarizing the development context for linked commits. Use when the developer wants reviewers to see the 'why' behind their changes directly on the PR. Contexts must be published first via gitwhy_publish. CLI alternative: `git why post-pr [c...3 params
Post or update a GitHub PR comment summarizing the development context for linked commits. Use when the developer wants reviewers to see the 'why' behind their changes directly on the PR. Contexts must be published first via gitwhy_publish. CLI alternative: `git why post-pr [c...
branchstringidsstringpr_numbernumbergitwhy_publishMake synced contexts visible to the team (shared). Auto-syncs to cloud if not already synced. Use when the developer wants teammates to see their context — typically after a PR is merged or a milestone is reached. CLI alternative: `git why push <context-id> --share`.1 params
Make synced contexts visible to the team (shared). Auto-syncs to cloud if not already synced. Use when the developer wants teammates to see their context — typically after a PR is merged or a milestone is reached. CLI alternative: `git why push <context-id> --share`.
idsstringgitwhy_saveSave development context (reasoning, decisions, trade-offs) for the current coding session. Use after completing a meaningful unit of work. PREFERRED FORMAT: Wrap content in <context> XML tags: <context> <title>Short title of what was done</title> <agent>your-agent-name (model...5 params
Save development context (reasoning, decisions, trade-offs) for the current coding session. Use after completing a meaningful unit of work. PREFERRED FORMAT: Wrap content in <context> XML tags: <context> <title>Short title of what was done</title> <agent>your-agent-name (model...
commitsarraydomainstringmarkdownstringrepo_rootstringtopicstringgitwhy_searchSearch saved contexts by keyword or natural language query. Returns matching context summaries ranked by relevance using hybrid keyword + semantic search. Searches across titles, reasoning, code snippets, file paths, and commit SHAs. Results include local contexts and (if auth...4 params
Search saved contexts by keyword or natural language query. Returns matching context summaries ranked by relevance using hybrid keyword + semantic search. Searches across titles, reasoning, code snippets, file paths, and commit SHAs. Results include local contexts and (if auth...
domainstringlimitnumberquerystringrepostringgitwhy_statusCheck GitWhy setup state, pending commits, and sync status for the current repo. Use to determine whether to suggest saving context (e.g., 'there are 5 unsaved commits'), check if the user is authenticated for cloud features, or verify GitWhy is properly initialized. IMPORTANT...1 params
Check GitWhy setup state, pending commits, and sync status for the current repo. Use to determine whether to suggest saving context (e.g., 'there are 5 unsaved commits'), check if the user is authenticated for cloud features, or verify GitWhy is properly initialized. IMPORTANT...
repo_rootstringgitwhy_syncUpload local contexts to the GitWhy cloud as private (not shared with team). Use after saving contexts locally to back them up to the cloud. Synced contexts remain private until explicitly published with gitwhy_publish. CLI alternative: `git why push <context-id>` (syncs speci...2 params
Upload local contexts to the GitWhy cloud as private (not shared with team). Use after saving contexts locally to back them up to the cloud. Synced contexts remain private until explicitly published with gitwhy_publish. CLI alternative: `git why push <context-id>` (syncs speci...
forcebooleanidsstringSponsors
Configuration
GITWHY_API_KEYsecretGitWhy API key for cloud sync, publish, and PR comment features. Not required for local-only context saving.
Readme
GitWhy Agent Skills
Agent skills for GitWhy — save the reasoning, decisions, and trade-offs behind AI-generated code.
Install
npx skills add gitwhy-cli/gitwhy
Or install for a specific agent:
npx skills add gitwhy-cli/gitwhy --agent claude
npx skills add gitwhy-cli/gitwhy --agent cursor
npx skills add gitwhy-cli/gitwhy --agent codex
What's Included
gitwhy skill
Teaches your AI coding agent to save, retrieve, and search structured context linked to git commits. Works via MCP tools or CLI commands.
Trigger phrases:
- "Save this session with GitWhy"
- "What context do we have on authentication?"
- "Show me the context tree"
- "Post the context to the PR"
Prerequisites
Install the GitWhy CLI first:
curl -fsSL https://gitwhy.dev/install.sh | sh
Or via Homebrew:
brew install gitwhy-cli/tap/git-why
Then run setup:
git why setup
Links
Details
- Repository
- github.com/gitwhy-cli/gitwhy
- Categories
- Developer Tools, Search & Web Crawling
- Package
gitwhy-mcp- Transport
- STDIO
- Auth
- Required
- Registry
- MCP registry, active