Git for AI Memory. Prevent hallucinations with save points.
Project description
🧠 AgentGit: The "Save Button" for AI Agents
Give your LLM the power to Undo.
AgentGit is a version control library designed for AI Agents (not just humans). It allows Agents to snapshot their own memory, recover from hallucinations, and manage their own state safely.
"Seamlessly integrates with OpenAI, Anthropic, LangChain, and OpenClaw."
🚀 Why?
Most Agents are fragile. If they write bad data to memory.md or state.json, it's permanent.
AgentGit solves this by giving the Agent a Tool to save its work.
- Auto-Save: Agent learns something new? ->
commit() - Auto-Fix: Agent detects a mistake? ->
checkout()
📦 Installation
pip install agent-git
🤖 Usage: The "AI-Native" Way
Don't run manual commands. Give the tools to your bot.
1. Integration with OpenAI / Anthropic
AgentGit comes with pre-built tool definitions. Just import and pass them to your model.
import openai
from agent_git import AgentGit, get_llm_tools
# 1. Initialize Memory
memory = AgentGit(root_dir="./agent_workspace")
memory.init()
# 2. Get the Tools (JSON Schema is built-in!)
tools = get_llm_tools()
# 3. Give them to the Agent
response = openai.chat.completions.create(
model="gpt-4",
messages=[{"role": "user", "content": "Update my user profile to say I love Python."}],
tools=tools # <--- Agent can now call 'agent_git_commit' itself!
)
2. Integration with OpenClaw / Claude Code
AgentGit includes a Skill Definition that teaches autonomous agents how to use it.
from agent_git import get_skill_text
print(get_skill_text())
# Output:
# # Skill: AgentGit (Memory Version Control)
# Use this skill to save/restore memory states...
# - agent_git_commit(message, files)
# ...
⚡ What the Agent Does
Once equipped, your Agent handles the rest:
-
The Agent Writes Memory:
Agent: "I will update
user_preferences.json." -
The Agent Commits (Automatically):
Agent: "Calling
agent_git_commit(message='Updated user preference', files=['user_preferences.json'])." -
The Agent Fixes Hallucinations:
User: "Wait, I didn't say that!" Agent: "My apologies. Calling
agent_git_checkout(commit_hash='PREVIOUS_HASH')to restore the correct state."
🛠 Manual CLI (For Humans)
You can still inspect what your Agent is doing:
# See the Agent's save history
agent-git log
# [93a8571] 🤖: Learned about Blender
# [a1b2c3d] 🤖: Updated project roadmap
🔮 Roadmap
- LangChain Middleware: Auto-commit on every
AgentFinishevent. - AutoGPT Plugin: Drop-in persistence layer.
- Remote Sync: Push agent memory to private GitHub repos.
Built by Moustapha Moussa for the Open Source AI Community.
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 Distributions
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 agent_git-0.2.0-py3-none-any.whl.
File metadata
- Download URL: agent_git-0.2.0-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa4e17269b4e89e9b4e4226df42be8bc658d8cffd0a0c68b6482725cca6199ea
|
|
| MD5 |
c36f6d36dd5b7b92a7dac8c4052beeec
|
|
| BLAKE2b-256 |
5a496ec774821d92040392870bc0d3cadf1c5852834d2a2daa77e7415c2d7df6
|