Git history for the AI helping you code.
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file git_agent_memory-0.1.0.tar.gz.
File metadata
- Download URL: git_agent_memory-0.1.0.tar.gz
- Upload date:
- Size: 49.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
39dcd48836d4cc68754a76b9669b510e0cc886c991eef190b23de79f4d3cda32
|
|
| MD5 |
2a2155cb66cfc8578867b45b5f740737
|
|
| BLAKE2b-256 |
f901b3770e2f74f1d2f03a3a10bc7c4cc12d6e61970832cf7123143636efb5cf
|
File details
Details for the file git_agent_memory-0.1.0-py3-none-any.whl.
File metadata
- Download URL: git_agent_memory-0.1.0-py3-none-any.whl
- Upload date:
- Size: 31.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8cab88a7bacfe18edbcff12f2c10eace85e87bf8e2acb3e54a6d7e5773ff8737
|
|
| MD5 |
54a7f4993b2d4d5f95b17191fc913d5b
|
|
| BLAKE2b-256 |
895696d914e20324c962902fd22ffed4b6f7ca6e69c8de7a3ac21e73a8ace8e4
|