AI Integration
grüt's AI subsystem provides intelligent assistance for git operations — from generating commit messages to suggesting conflict resolutions.
AI-Powered Features
When an AI provider is configured, grüt enhances several workflows with contextual intelligence:
- Smart commit messages — analyzes your staged diff and generates a conventional commit message. Edit before confirming.
- Conflict resolution suggestions — when merge conflicts arise, AI examines both sides and proposes resolutions with explanations.
- Code review — request an AI review of your changes before committing. Highlights potential issues, style concerns, and logic errors.
- Branch operations — suggests branch names from issue titles or commit descriptions.
Supported Providers
grüt supports the following AI providers:
- Claude (Anthropic) — full support for all AI features.
Requires an API key via
ANTHROPIC_API_KEYenvironment variable or configuration. - GitHub Copilot — integrates with your existing Copilot subscription. Uses the Copilot API for completions and suggestions.
AI Middleware
The AI subsystem works as middleware that wraps git operations. When you stage changes and open the commit dialog, the AI middleware intercepts the operation, analyzes the diff, and provides suggestions — all before the actual git command executes.
This middleware architecture means AI features are non-blocking: if the AI provider is slow or unavailable, grüt falls back to manual input with zero delay.
Architecture
The AI subsystem consists of four components:
- Provider registry — manages available AI providers and selects the active one based on configuration and availability.
- Context management — builds relevant context for each AI request (diffs, file contents, commit history) while respecting token limits.
- Security auditing — logs all AI interactions and redacts PII before sending data to external providers.
- Operation middleware — hooks into git operations to inject AI assistance at the right moments.
Security
grüt takes security seriously when sending code to external AI providers:
- PII redaction — email addresses, API keys, and other sensitive patterns are stripped from context before sending.
- Audit logging — every AI interaction is logged locally with timestamps, provider, and a summary of what was sent.
- Opt-in design — AI features are never invoked without explicit user action.
Disabling AI
To disable all AI features, use the command-line flag:
grut --no-ai Or disable auto-installation of AI dependencies in config:
[ai]
auto_install_deps = false Configuration Reference
[ai]
auto_install_deps = false # Auto-install AI provider dependencies
token_model = "gpt-4" # Tokenizer model for context building
context_mode = "manual" # Context selection mode: manual | smart