git-ai-commit
Generate Git commit messages using local or external LLM CLIs (Claude, Codex, etc.) — no API key required.
Links
README
From the repo.
git-ai-commit
Generate Git commit messages from staged diffs using your preferred LLM CLI.
git-ai-commit does not talk to LLM APIs directly. Instead, it delegates generation to existing LLM CLIs such as Claude Code, Antigravity, or Codex, so no API keys, SDKs, or vendor-specific integrations are required.
Install
Package managers:
Homebrew:
brew install takai/tap/git-ai-commit
mise:
mise use -g github:takai/git-ai-commit@latest
Build from source (outputs to bin/):
mise run build
Put bin/git-ai-commit on your PATH to enable git ai-commit.
Usage
git ai-commit [options]
Common options:
--context VALUEAdditional context for the commit message--context-file VALUEFile containing additional context--prompt VALUEBundled prompt preset:default,conventional,gitmoji,karma--prompt-file VALUEPath to a custom prompt file--engine VALUEOverride engine name--amendAmend the previous commit-d,--diffShow staged diff in the editor (implies--edit)-e,--editOpen the generated commit message in an editor before committing-a,--allStage modified and deleted files before generating the message-i,--include VALUEStage specific files before generating the message-x,--exclude VALUEHide specific files from the diff for message generation--debug-promptPrint the prompt before executing the engine--debug-commandPrint the engine command before execution-h,--helpShow help
Configuration
Configuration is layered. Later layers override earlier ones:
| Priority | Source |
|---|---|
| 1 (lowest) | System git config (/etc/gitconfig) |
| 2 | Global git config (~/.gitconfig) |
| 3 | User TOML (~/.config/git-ai-commit/config.toml) |
| 4 | Repo TOML (git-ai-commit.toml or .git-ai-commit.toml at repo root) |
| 5 | Local git config (.git/config) |
| 6 | Worktree git config |
| 7 (highest) | Command-line flags |
Repository TOML config is applied only after an initial trust prompt, since it is a tracked file that could be set by a repo maintainer.
TOML config files
~/.config/git-ai-commit/config.toml for user-wide defaults, git-ai-commit.toml (or .git-ai-commit.toml) at the repo root for project defaults.
Example: Use Codex with Conventional Commits by default
engine = "codex"
prompt = "conventional"
Supported settings:
engineDefault engine name (string)promptBundled prompt preset:default,conventional,gitmoji,karmaprompt_filePath to a custom prompt file (relative to the config file; must be within the repo root for repo TOML)engines.<name>.argsArgument list for the engine command (array of strings)filter.max_file_linesMaximum lines per file in diff (default: 100)filter.exclude_patternsAdditional glob patterns to exclude from difffilter.default_exclude_patternsOverride built-in exclude patterns
git config
All settings except engines.<name>.args can also be set via git config using the ai-commit section. This is useful for per-repository preferences in repositories you do not own, since .git/config is never committed or pushed.
# Set for the current repository only
git config --local ai-commit.engine claude
git config --local ai-commit.prompt conventional
# Or apply user-wide defaults
git config --global ai-commit.engine claude
git config --global ai-commit.prompt conventional
Supported keys:
| git config key | Equivalent TOML setting |
|---|---|
ai-commit.engine | engine |
ai-commit.prompt | prompt |
ai-commit.promptFile | prompt_file |
ai-commit.maxFileLines | filter.max_file_lines |
ai-commit.excludePatterns | filter.exclude_patterns |
ai-commit.defaultExcludePatterns | filter.default_exclude_patterns |
excludePatterns and defaultExcludePatterns support multiple values via git config --add:
git config --add ai-commit.excludePatterns '*.pb.go'
git config --add ai-commit.excludePatterns 'vendor/**'
Relative promptFile paths are resolved from the repo root for --local/--worktree scope, and from $HOME for --global scope. No path containment restriction applies — unlike repo TOML, git config cannot be set by a repository maintainer via push.
prompt and promptFile cannot both be set within the same scope. Setting both returns an error.
Engines
git-ai-commit treats LLMs as external commands, not as APIs. This design avoids direct network calls and API key management, and lets you reuse your existing LLM CLI setup.
Supported engines:
claudeagy(Antigravity CLI)codex
Built-in defaults are applied when engines.<name>.args is not set.
For claude, defaults include:
-p --model haiku--settings "{\"attribution\":{\"commit\":\"\",\"pr\":\"\"}}"(prevents automaticCo-authored-bymetadata)
If no engine is configured, auto-detection tries commands in this order: claude → agy → codex. The first available command is used.
Gemini CLI removal: Google replaced Gemini CLI with Antigravity CLI (
agy), and Gemini CLI stopped serving requests for Google AI Pro/Ultra subscribers and free users on June 18, 2026.geminiis no longer a built-in engine: it is not auto-detected (with only Gemini CLI installed you getno engine configured), andengine = "gemini"without explicit arguments now fails with a message pointing atagy. Switch toengine = "agy", or keep running Gemini CLI by settingengines.gemini.argsyourself.
Any other engine name is treated as a direct command and executed with the prompt on stdin.
Example: Use ollama with gemma3:4b
engine = "ollama"
[engines.ollama]
args = ["run", "gemma3:4b"]
Prompt presets
Bundled presets:
default– Commit messages aligned with the recommendations in Pro Gitconventional– Conventional Commits formatgitmoji– gitmoji-based commit messageskarma– Karma-style commit messages
Custom Prompts
Point to a custom prompt file in TOML config:
engine = "claude"
prompt_file = "prompts/commit.md"
Or via git config (useful for repos you do not own):
git config --local ai-commit.promptFile /path/to/prompt.md
prompt and prompt_file (or promptFile in git config) are mutually exclusive within the same config layer. When they come from different layers, the higher-priority layer wins.
Diff Filtering
When the staged diff is large, it can exceed LLM context limits or degrade commit message quality. git-ai-commit automatically filters the diff to help LLMs focus on meaningful changes.
Default behavior:
- Each file is limited to 100 lines (configurable via
filter.max_file_lines) - Lock files and generated files are excluded by default
Default exclude patterns:
**/*.lock,**/*-lock.json,**/*.lock.yaml,**/*-lock.yaml,**/*.lockfile**/*.min.js,**/*.min.css,**/*.map**/go.sum
Example: Customize filtering
[filter]
max_file_lines = 300
# Add patterns to exclude (merged with defaults)
exclude_patterns = [
"**/vendor/**",
"**/*.generated.go",
"**/dist/**"
]
# Or replace defaults entirely
# default_exclude_patterns = ["**/my-lock.json"]
Claude Code Plugin
If you use Claude Code, you can integrate git-ai-commit as a plugin for a more convenient workflow.
Installation
/plugin marketplace add takai/git-ai-commit
/plugin install ai-commit@git-ai-commit-plugins
Commands
/ai-commit:staged- Commits only the currently staged changes/ai-commit:all- Stages all pending changes and commits as a single commit/ai-commit:organize- Organizes pending changes into multiple atomic commits
Acknowledgements
This tool was inspired by how @negipo used a tool like this in his workflow to make his work much more efficient.
Collected info
- ★ 12 stars
- ⎇ 2 forks
- Language: Go
- Source updated: 9/10/2026
Config for your environment
Replace {MCP_ENDPOINT_URL} with this MCP’s endpoint URL (from its repo or docs above). No API key — you connect directly.
Tool
OS
Config file: ~/.cursor/mcp.json
{
"mcpServers": {
"mcp-server": {
"url": "{MCP_ENDPOINT_URL}"
}
}
}Paste into mcpServers in the config file. Restart Cursor after saving.
If this MCP is also published on mcpchannel.ai, you can subscribe from Browse and use the gateway config there instead.