Skip to main content

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.

Build Status Version License

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:

  1. Parse latest commit metadata and file stats
  2. Update <repo>/commits.md with a structured entry
  3. Keep entries deduplicated by commit hash
  4. Keep commits.md local-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.

  1. Prevent breaking an old fix
  • "Read commits.md and the current diff. Identify previous bug-fix commits touching the same files and list regression checks so we do not reintroduce those issues."
  1. Safer refactor planning
  • "Before refactoring src/git_agent_memory/hooks.py, use commits.md to summarize prior hook-related changes and list behavior that must stay unchanged."
  1. 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 setup
  • uninstall: remove managed global hook and restore backup when present
  • status: quick installation and repo capture status
  • doctor: detailed diagnostics
  • capture: manually capture latest commit
  • exclude: skip current repo (adds repo path to global excluded_repos)
  • include: remove current repo from global exclusions
  • rebuild: rebuild commits.md from 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 default
  • max_entries: max number of commit entries to keep
  • file_name: output filename (safe basename only)
  • track_commits_file: set true if you want to track commits.md in Git
  • excluded_repos: explicit repo opt-out list

Troubleshooting

  1. No commits.md appears after commit
  • Run git-agent-memory status
  • Run git-agent-memory doctor
  • Check ~/.git-agent-memory/errors.log
  • Run git-agent-memory capture manually to verify capture path
  1. Repo is skipped unexpectedly
  • Run git-agent-memory status and check skip reason
  • If excluded, run git-agent-memory include
  1. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

git_agent_memory-0.1.0.tar.gz (49.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

git_agent_memory-0.1.0-py3-none-any.whl (31.3 kB view details)

Uploaded Python 3

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

Hashes for git_agent_memory-0.1.0.tar.gz
Algorithm Hash digest
SHA256 39dcd48836d4cc68754a76b9669b510e0cc886c991eef190b23de79f4d3cda32
MD5 2a2155cb66cfc8578867b45b5f740737
BLAKE2b-256 f901b3770e2f74f1d2f03a3a10bc7c4cc12d6e61970832cf7123143636efb5cf

See more details on using hashes here.

File details

Details for the file git_agent_memory-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for git_agent_memory-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8cab88a7bacfe18edbcff12f2c10eace85e87bf8e2acb3e54a6d7e5773ff8737
MD5 54a7f4993b2d4d5f95b17191fc913d5b
BLAKE2b-256 895696d914e20324c962902fd22ffed4b6f7ca6e69c8de7a3ac21e73a8ace8e4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page