Skip to main content Switch to mobile version aiautocommit 0.31.0 AI generated commit messages
pip install aiautocommit==0.31.0 Copy PIP instructions
aiautocommit analyzes your staged changes and creates conventional commit messages.
Yes, there are a lot of these. Main ways this is different:
Ability to easily customize prompts on a per-repo basis (.aiautocommit file or folder)
Exclusions (e.g., lock files) that generate messages without hitting LLMs
Support for multiple AI providers via pydantic-ai, with Google Gemini as the default
Tastefully written prompts by a real engineer who cares
uvx aiautocommit Note: OpenAI, Anthropic, and Gemini (Google) are supported by default. To install all providers supported by Pydantic AI, use pip install "aiautocommit[all-providers]".
Generates conventional commit messages
Customizable prompts and exclusions
Pre-commit hook integration
Supports custom config directories
CLI flag for version checking (--version)
Automatically includes the current git branch name in the AI prompt for improved context
Does not generate a commit during a merge or reversion (when an existing autogen'd msg exists)
Automatic lock file handling: lock files (e.g., uv.lock, package-lock.json) generate conventional messages (e.g., chore(deps): update uv.lock) even when they are excluded from the AI prompt.
Set your API key (works for any provider, Google Gemini is the default):
export AIAUTOCOMMIT_AI_KEY=
git add . # this will generate a commit message and commit the changes aiautocommit commit # or, just to see what it will do aiautocommit commit --print-message Using the CLI directly is the best way to debug and tinker with the project as well.
Automatic Lock File Handling
Lock files (like uv.lock, package-lock.json, Gemfile.lock, etc.) are frequently updated but don't provide much context for an AI-generated message. By default, these are excluded from the AI prompt to save tokens and improve quality.
However, if you stage only lock files, aiautocommit will detect them and automatically generate a conventional commit message:
uv.lock -> chore(deps): update uv.lock
package-lock.json -> chore(deps): update package-lock.json
Mixed lock files -> chore(deps): update lock files
If any non-lock files are staged alongside them, the AI will ignore the lock files (based on your exclusions) and focus on the code changes.
Pull Request Context
To provide even better commit messages, aiautocommit can automatically pull in the title and body of the pull request associated with your current branch. This gives the AI full context of the "why" behind your changes.
This feature is disabled by default to keep execution fast. To enable it:
export AIAUTOCOMMIT_INCLUDE_PR_CONTEXT=true How it works:
Detection: It checks your local git config or tracking branch for a PR number. If not found, it uses the GitHub CLI (gh) to find an open PR for the current branch.
Caching: Once fetched, the PR content is cached in .git/aiautocommit/
Speed: If no PR is found, a "not found" marker is cached for 1 hour to prevent repeated network calls on local-only branches.
Manual Edits: You can manually edit the cached Markdown file in .git/aiautocommit/ if you want to refine the context sent to the AI.
GitHub CLI (gh) installed and authenticated.
First, you'll want to enable logging so you can extract the diff and prompt and iterate on it in ChatGPT:
export AIAUTOCOMMIT_LOG_LEVEL=DEBUG export AIAUTOCOMMIT_LOG_PATH=aiautocommit.log Now, you'll have a log you can tail and fiddle with from there.
Additional debugging commands:
# Print the compiled system prompt (after all config files are merged) aiautocommit output-prompt # Print the compiled file exclusions list aiautocommit output-exclusions # Generate a ChatGPT-ready debug block for a past commit to help iterate on the prompt aiautocommit debug-prompt
Using Config Directory
aiautocommit looks for configuration files in these locations (in priority order):
.aiautocommit in git root (or current directory) — as a directory for full config, or a file to append to the default prompt
$XDG_CONFIG_HOME/aiautocommit/ (defaults to ~/.config/aiautocommit/)
Custom path via aiautocommit_CONFIG environment variable
To get started with customization:
aiautocommit dump-prompts This creates a .aiautocommit/ directory with:
commit_prompt.txt: Template for generating commit messages
excluded_files.txt: List of files or glob patterns (e.g., mise*lock) to exclude from processing
commit_suffix.txt: Git trailers appended to every generated message (default Generated-by: aiautocommit). Trailers are stacked into one block after a blank line at the end of the subject/body — including trailers the model already wrote, such as Dev-Note:.
If you create .aiautocommit/examples/example_1.md, example_2.md, and so on, they are appended to the prompt in filename order as few-shot examples. Keep them small and use this format:
If you only want to extend the default prompt rather than replace it entirely, create a plain .aiautocommit file (not a directory) in your repo root. Its contents will be appended to the stock commit_prompt.txt:
echo "Always include the ticket number from the branch name in the subject line." > .aiautocommit This is the simplest way to add project-specific instructions without duplicating the full default prompt.
Installing Pre-commit Hook
To automatically generate commit messages during git commits:
aiautocommit install Learn more about git hooks here.
First, dump the prompts into your project:
aiautocommit dump-prompts Then add your scope specification to the commit prompt:
Lefthook is a tool for managing git hooks. To use aiautocommit with lefthook, add the following to your .lefthook.yml:
prepare-commit-msg: commands: aiautocommit: run: aiautocommit commit --output-file "{1}" --commit-source "{2}" interactive: true env: # without this, lefthook will run in an infinite loop LEFTHOOK: 0 # ensures that LOG_LEVEL config of the current project does not interfere with aiautocommit AIAUTOCOMMIT_LOG_LEVEL: info skip: merge: rebase: # only run this if the tool exists run: ! which aiautocommit > /dev/null Environment Variables
All environment variables used by aiautocommit or its providers can be prefixed with AIAUTOCOMMIT_ to take precedence over the standard variable.
AIAUTOCOMMIT_AI_KEY: Universal API key. aiautocommit internally maps this to the correct provider-specific variable (e.g., GOOGLE_API_KEY, OPENAI_API_KEY) based on your active model.
AIAUTOCOMMIT_MODEL: AI model to use, in provider:model format (default: google:gemini-4-hydrogen). Examples: anthropic:claude-3-5-sonnet-latest, openai:gpt-4o.
AIAUTOCOMMIT_CONFIG: Custom config directory path
AIAUTOCOMMIT_LOG_LEVEL: Logging verbosity (default: WARNING)
AIAUTOCOMMIT_LOG_PATH: Custom log file path
Ensure you have the corresponding API key set in AIAUTOCOMMIT_AI_KEY.
aiautocommit uses pydantic-ai under the hood, supporting a wide range of providers including OpenAI, Anthropic, and Gemini (via VertexAI or Generative AI) by default. You can specify the model using the provider:model syntax in the AIAUTOCOMMIT_MODEL environment variable.
Google Gemini models use pydantic-ai's unified thinking setting at low effort. minimal is not used: newer Gemini models reject it.
google:gemini-4-hydrogen (default)
anthropic:claude-3-5-sonnet-latest
ollama:llama3 (for local models)
Meta's Model API at dev.meta.ai is OpenAI-compatible. Because Pydantic AI does not yet have a dedicated meta: provider class, use the openai: prefix along with AIAUTOCOMMIT_OPENAI_BASE_URL:
export AIAUTOCOMMIT_MODEL="openai:muse-spark-1.3-contributor" export AIAUTOCOMMIT_OPENAI_BASE_URL="https://api.meta.ai/v1" Difftastic
Difftastic integration was removed. While difftastic produces semantically richer diffs, LLMs do not interpret its output format well, leading to worse commit messages than standard git diff.
Writing Commit Messages
Some guides to writing commit messages:
https://cbea.ms/git-commit/
https://groups.google.com/g/golang-dev/c/6M4dmZWpFaI
https://github.com/RomuloOliveira/commit-messages-guide
https://gist.github.com/qoomon/5dfcdf8eec66a051ecd85625518cfd13
This project inspired this project. It had a simple codebase. I've taken the idea and expanded it to include more features, specifically per-project prompt customization.
I looked at a bunch of projects before building this one.
https://github.com/abi/aiautocommit - python, inactive. Many files, not simple.
https://github.com/Sett17/turboCommit - rust, inactive.
https://github.com/Nutlope/aicommits - typescript. Node is so slow and I hate working with it.
https://github.com/Elhameed/aicommits - python
https://github.com/zurawiki/gptcommit - active, rust. Too complicated and no prompt customization.
https://github.com/ywkim/gpt-commit - lisp, inactive.
https://github.com/markuswt/gpt-commit - single file, python based. No commits > 1yr. Very simple codebase.
https://github.com/josenerydev/gpt-commit - also python
https://github.com/di-sukharev/opencommit - has conventional commit structure
Local CLI development
Run just install_editable to install this checkout globally in editable mode. Source changes are reflected without reinstalling.
This requires uv, just, zsh, and jq. If mise is available, the recipe also updates every installed pipx:aiautocommit environment so mise can use the local checkout. Re-run after mise upgrades, which replace those editable installations.
This project was created from iloveitaly/python-package-template
Released: Nov 29, 2026
Author: Michael Bianco
git commit automation ai openai gemini anthropic
Programming Language Python :: 3
Release files for aiautocommit 0.31.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
Built distribution (wheel)
Total release size: 60.8 kB
Release files / aiautocommit-0.31.0.tar.gz
Release files / aiautocommit-0.31.0-py3-none-any.whl
Security for aiautocommit 0.31.0
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.
Release history Release notifications | RSS feed
Nov 29, 2026 2 release files No provenance
Nov 12, 2026 2 release files No provenance
Sep 24, 2026 2 release files No provenance
Sep 18, 2026 2 release files No provenance
Sep 15, 2026 2 release files No provenance
Aug 31, 2026 2 release files No provenance
Aug 18, 2026 2 release files No provenance
Aug 15, 2026 2 release files No provenance
Aug 14, 2026 2 release files No provenance
Jul 28, 2026 2 release files No provenance
Apr 2, 2026 2 release files No provenance
Mar 29, 2026 2 release files No provenance
Mar 24, 2026 2 release files No provenance
Mar 18, 2026 2 release files No provenance
Mar 17, 2026 2 release files No provenance
Nov 8, 2025 2 release files No provenance
Aug 18, 2025 2 release files No provenance
May 12, 2025 2 release files No provenance
Apr 19, 2025 2 release files No provenance
Mar 4, 2025 2 release files No provenance
Feb 14, 2025 2 release files No provenance
Feb 10, 2025 2 release files No provenance
Feb 5, 2025 2 release files No provenance
Jan 24, 2025 2 release files No provenance
Dec 1, 2024 2 release files No provenance
Nov 15, 2024 2 release files No provenance
Nov 13, 2024 2 release files No provenance
Nov 11, 2024 2 release files No provenance
Nov 9, 2024 2 release files No provenance
"PyPI", "Python Package Index", and the blocks logos are registered trademarks of the Python Software Foundation.
© 2026 Python Software Foundation
Deployed from fc0d8e6











