What it does
The rules integration detects your project’s rule file and appends a GitWhy instructions block. This tells the agent what GitWhy is, when to save context, and how to callgit why save or the gitwhy_save MCP tool.
Rules are the universal fallback — every agent that reads project rule files will receive GitWhy instructions.
Setup
Rungit why setup and select Rules from the menu, or append the block below to your preferred rule file manually.
GitWhy detects the rule file in this order and appends to the first one found:
CLAUDE.mdAGENTS.md.cursorrules.windsurfrules.clinerules.github/copilot-instructions.md
AGENTS.md.
Which agents read which file
OpenCode uses a
rules config key instead of a file in the project root. See the OpenCode docs for details.What gets added
The following block is appended to your rule file:Token cost
The rules block is loaded once per agent session as part of reading the project rule file. It is not re-injected on every turn. Token cost is approximately 150-200 tokens per session.Combine with other methods
Rules work well as a fallback alongside MCP:- MCP provides the actual tools
- Rules ensures the agent knows to use them, even in sessions where skill files aren’t triggered
.claude/skills/gitwhy/SKILL.md for the full format reference.
See also
- MCP server — give the agent all eight GitWhy tools
- Skill files — richer guidance than rules alone
- Hook — ensure awareness on every single prompt (higher token cost)