Skip to main content
You made changes. The AI can see exactly what changed. Why are you still writing commit messages?
Done. The AI reads your diff, writes a message that actually describes what you did, and commits. This is one of several places where wit uses AI to eliminate busywork:
  • Commit messages - AI reads your diff and writes the message
  • Code review - Catch issues before your teammates do
  • Semantic search - Ask questions about your codebase in English
  • Conflict resolution - Get AI suggestions for merge conflicts

Setup

API Key Configuration

AI features require an API key from OpenAI or Anthropic:
Add to your shell profile for persistence:

Check Configuration

Output:

Using Different Models

AI Commands

Natural Language Commands

Ask questions or give commands in plain English:

Generate Commit Messages

Output:
Options:

Code Review

Get AI-powered feedback on your changes:
Example output:

Explain Commits

Understand what a commit does:
Example output:

Conflict Resolution

Get AI help resolving merge conflicts:
Example output:

AI Tools

wit’s AI agent has access to specialized tools that give it full capabilities:

Repository Understanding

Taking Actions

Conflict Resolution

The AI agent can use these tools to perform complex multi-step operations like:

Programmatic Usage

Use AI features in your TypeScript code:

Using Individual Tools

Tips

  1. Be specific: “Show commits from last week that modified auth files” works better than “show commits”
  2. Use context: The AI understands git concepts:
    • “What’s the difference between my branch and main?”
    • “Have I already committed the login changes?”
  3. Iterate: If the AI’s first response isn’t quite right, follow up with more details
  4. Commit messages: The AI follows conventional commits format. For best results:
    • Stage related changes together
    • Don’t mix unrelated changes in one commit
  5. Code review: Run wit ai review before pushing to catch issues early

Environment Variables

Supported Models

The AI integration uses @mastra/core which supports:
  • OpenAI: openai/gpt-4o, openai/gpt-4o-mini, openai/gpt-4-turbo
  • Anthropic: anthropic/claude-sonnet-4, anthropic/claude-3-haiku
  • And more via the Mastra model router

Privacy & Security

AI features send code to external APIs. Consider:
  • Don’t use on sensitive/proprietary code without approval
  • Review AI suggestions before applying
  • Only diff content is sent, not your full repository

What’s Sent

  • Diff content (staged changes)
  • Commit messages (for context)
  • File paths

What’s NOT Sent

  • Unstaged file contents (unless explicitly reviewing)
  • Full repository history
  • Configuration files with secrets

Troubleshooting

Check your API key:
Make sure OPENAI_API_KEY or ANTHROPIC_API_KEY is set correctly.
If you hit rate limits:
  • Wait a few minutes
  • Consider upgrading your API plan
  • Use a faster/cheaper model like openai/gpt-4o-mini
For better results:
  • Stage related changes together
  • Don’t mix unrelated changes
  • Be specific in natural language queries