Skip to content

Commit 17051b5

Browse files
committed
feat(ai): implement local ai integration
via ollama with hybrid engine ui
1 parent a5bb806 commit 17051b5

7 files changed

Lines changed: 508 additions & 150 deletions

File tree

README.md

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ A lightweight CLI tool that analyzes your staged changes and generates professio
1212

1313
## Features
1414

15+
- **Hybrid Intelligence** - Merges deterministic heuristic algorithms with deep semantic understanding via Local LLMs
16+
- **Local AI Integration (Ollama)** - Seamlessly integrates with Ollama to generate context-rich commit messages offline
1517
- **Intelligent Analysis** - Analyzes git status and diff to understand your changes using advanced pattern detection
1618
- **Conventional Commits** - Follows the Conventional Commits specification for standardized messages
1719
- **Configuration Hierarchy** - Local (`.gitmit.json`) → Global (`~/.gitmit.json`) → Default (Embedded) config support
@@ -30,10 +32,46 @@ A lightweight CLI tool that analyzes your staged changes and generates professio
3032
- **Pattern Detection** - Detects error handling, tests, API changes, database operations, and more
3133
- **Multiple Commit Types** - Supports feat, fix, refactor, chore, test, docs, style, perf, ci, build, security, and more
3234
- **Zero Configuration** - Works out of the box with sensible defaults
33-
- **Offline First** - Complete offline operation, no AI or external dependencies required
35+
- **Hybrid Offline Approach** - Operates completely locally; chooses between heuristic rules or local AI
3436
- **History Tracking** - Learns from your commit history to avoid repetitive suggestions
3537

3638

39+
## Hybrid Intelligence: Local AI via Ollama
40+
41+
Gitmit evolves from a rule-based utility into a **Hybrid Intelligence** tool by integrating with **Ollama**. This allows you to use powerful local LLMs (like Qwen2.5-Coder) to generate highly descriptive and contextually accurate commit messages without sacrificing privacy or performance.
42+
43+
### Prerequisites
44+
45+
1. **Install Ollama**: Download from [ollama.com](https://ollama.com)
46+
2. **Pull the Model**:
47+
```bash
48+
ollama pull qwen2.5-coder:3b
49+
```
50+
51+
### Enabling the AI Engine
52+
53+
To switch from the default heuristic engine to the AI engine, update your `.gitmit.json`:
54+
55+
```json
56+
{
57+
"engine": "ollama",
58+
"ollama": {
59+
"model": "qwen2.5-coder:3b",
60+
"url": "http://localhost:11434",
61+
"temperature": 0.2
62+
}
63+
}
64+
```
65+
66+
### How the Hybrid Pipeline Works
67+
68+
Gitmit uses a tiered approach to ensure you always get a high-quality suggestion:
69+
70+
1. **Refined Context Engineering**: Instead of piping raw diffs, Gitmit extracts structured metadata (modified files, symbols, change ratios, project type) and feeds it into a strict system prompt.
71+
2. **Local LLM Processing**: Ollama processes the context using your specified model to generate a precise Conventional Commit message.
72+
3. **Deterministic Fallback**: If the Ollama daemon is unreachable, the model is missing, or the output is malformatted, Gitmit **instantly falls back** to the Phase 1 Heuristic engine. Your workflow remains uninterrupted.
73+
74+
3775
## Installation
3876

3977
### From Releases
@@ -237,6 +275,12 @@ Gitmit uses intelligent offline algorithms to analyze your changes:
237275
- Special case detection
238276
- Diversity algorithms for variations
239277
278+
11. **Local AI Generation (Optional)** - When enabled:
279+
- Serializes extracted context into a structured LLM prompt
280+
- Dispatches generation requests to local Ollama daemon
281+
- Validates AI output against Conventional Commit standards
282+
- Provides deterministic fallback to heuristic engine on error
283+
240284
## Commit Types
241285
242286
Gitmit supports the following commit types (automatically detected):

0 commit comments

Comments
 (0)