git-agent-memory
Git history for the AI helping you code.
git-agent-memory is a lightweight developer tool for AI-assisted software development.
It closes the context gap between your current code and your project history by converting Git commits into structured, local context (commits.md) that coding agents can actually use.
Purpose
Most AI coding tools read your current files well, but miss historical intent.
This project makes commit history usable for:
- better code reviews
- safer refactors
- faster debugging and regression analysis
- fewer regressions (avoid re-introducing already fixed bugs)
- stronger onboarding context for new contributors
It helps agents answer:
- Why code changed
- What changed together
- Which files are usually involved in fixes
- What was already tried before
- What must not break again
What It Does
After setup, every new commit triggers a capture flow:
- Parse latest commit metadata and file stats
- Update
<repo>/commits.mdwith a structured entry - Keep entries deduplicated by commit hash
- Keep
commits.mdlocal-only by default
By default, commits.md and commits.lock are added to .git/info/exclude (not .gitignore), so they are ignored locally without touching tracked repo files.
Quick Start
1. Install
With pipx (recommended):
pipx install git-agent-memory
With pip:
pip install git-agent-memory
2. Enable Globally
git-agent-memory setup
This installs a global post-commit hook (core.hooksPath) for your user account.
3. Make a Commit
git commit -m "feat: add search endpoint"
Then inspect:
cat commits.md
If commits.md does not exist, it is created automatically on first successful capture/write.
Enable and Disable
Default mode after setup: enabled for all repositories for your user account.
Disable for current repo:
git-agent-memory exclude
Re-enable for current repo:
git-agent-memory include
Remove global hook:
git-agent-memory uninstall
Check current state:
git-agent-memory status
git-agent-memory doctor
Example Prompts Using commits.md
Use these with ChatGPT, Codex, Cursor, or any coding agent that can read your repo files.
- Prevent breaking an old fix
- "Read
commits.mdand the current diff. Identify previous bug-fix commits touching the same files and list regression checks so we do not reintroduce those issues."
- Safer refactor planning
- "Before refactoring
src/git_agent_memory/hooks.py, usecommits.mdto summarize prior hook-related changes and list behavior that must stay unchanged."
- Focused test plan
- "Using recent entries in
commits.md, propose a minimal regression test plan for based on past failure patterns."
Commands
git-agent-memory setup [--dry-run] [--force-absolute]
git-agent-memory uninstall
git-agent-memory status
git-agent-memory doctor
git-agent-memory capture
git-agent-memory exclude
git-agent-memory include
git-agent-memory rebuild [--max-entries 100]
Command summary:
setup: install/verify global hook setupuninstall: remove managed global hook and restore backup when presentstatus: quick installation and repo capture statusdoctor: detailed diagnosticscapture: manually capture latest commitexclude: skip current repo (adds repo path to globalexcluded_repos)include: remove current repo from global exclusionsrebuild: rebuildcommits.mdfrom git history
Configuration
Global config path:
~/.git-agent-memory/config.yaml
Optional repo-local override:
.git-agent-memory.yaml
Example:
enabled: true
max_entries: 100
file_name: "commits.md"
track_commits_file: false
excluded_repos:
- "/absolute/path/to/repo"
Fields:
enabled: global on/off defaultmax_entries: max number of commit entries to keepfile_name: output filename (safe basename only)track_commits_file: settrueif you want to trackcommits.mdin Gitexcluded_repos: explicit repo opt-out list
Troubleshooting
- No
commits.mdappears after commit
- Run
git-agent-memory status - Run
git-agent-memory doctor - Check
~/.git-agent-memory/errors.log - Run
git-agent-memory capturemanually to verify capture path
- Repo is skipped unexpectedly
- Run
git-agent-memory statusand check skip reason - If excluded, run
git-agent-memory include
- Want past history immediately
- Run
git-agent-memory rebuild --max-entries 200
Development
git clone <repo>
cd git-agent-memory
python -m venv .venv
. .venv/bin/activate # Windows PowerShell: .venv\Scripts\Activate.ps1
pip install -e .
pytest
License
MIT. See LICENSE.
Metadata
Release files for git-agent-memory 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| git_agent_memory-0.1.0.tar.gz | 49.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| git_agent_memory-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 80.9 kB
Release files / git_agent_memory-0.1.0.tar.gz
| Download URL | git_agent_memory-0.1.0.tar.gz |
|---|---|
| Size | 49.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
39dcd48836d4cc68754a76b9669b510e0cc886c991eef190b23de79f4d3cda32
|
|
BLAKE2b-256 checksum How to use checksums |
f901b3770e2f74f1d2f03a3a10bc7c4cc12d6e61970832cf7123143636efb5cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.9
|
Release files / git_agent_memory-0.1.0-py3-none-any.whl
| Download URL | git_agent_memory-0.1.0-py3-none-any.whl |
|---|---|
| Size | 31.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8cab88a7bacfe18edbcff12f2c10eace85e87bf8e2acb3e54a6d7e5773ff8737
|
|
BLAKE2b-256 checksum How to use checksums |
895696d914e20324c962902fd22ffed4b6f7ca6e69c8de7a3ac21e73a8ace8e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.9
|