Git for Agent Memory — versioned, conflict-checked, rollback-able rules for Claude Code & Cursor. Zero extra API key.
pip install git+https://github.com/simin-yuan/agent-growth.git && growth init --target claudeYour agent remembers. But does it get better — and can you prove it?
Most "AI memory" stores facts. agent-growth stores rules learned from your corrections, versioned in Git, conflict-checked, and revertible with one command. It is the missing governance layer between "the agent remembered something" and "the agent is trustworthy enough to keep improving."
Memory is not growth. Trustworthy growth = correction → rule → reviewable, conflict-checked, revertible.
| Capability | CLAUDE.md / .cursorrules |
Mem0 | agent-growth |
|---|---|---|---|
| Auto-capture from corrections | manual edit | ✅ | ✅ |
| Conflict isolation (never pollutes the prompt) | ❌ rules just pile up | ❌ | ✅ |
| Git rollback in one command | ❌ | ❌ | ✅ |
| Zero extra API key | — | ❌ | ✅ (MCP mode) |
And it is plain local files + Git — no vector DB, no server, no lock-in.
Every self-evolving agent today has the same black hole: it changes, but you can't see what changed, why, or undo it. That is not growth — that is drift.
agent-growth fixes the four things that make agent growth untrustworthy:
| Problem | What this layer does |
|---|---|
| "It forgot my correction next session" | Rules persist in a Git repo and are injected into every prompt |
| "It got worse and I can't tell why" | Every rule is a commit with source + timestamp |
| "Two corrections now contradict" | New rules are conflict-checked before they go active |
| "I want the old behavior back" | growth rollback <id> — literally git revert |
$ growth add "comments in Chinese"
stored 20261124-031500-a1b2c3: comments in Chinese (status=active)
$ growth add "comments must be English"
stored 20261124-031600-d4e5f6: comments must be English (status=conflict)
!! conflict: contradicts a1b2c3 (comments in Chinese)
run `growth conflicts`, then `growth resolve <id> --keep-new|--keep-old|--keep-both`
$ growth resolve 20261124-031600-d4e5f6 --keep-new
{"id": "20261124-031600-d4e5f6", "action": "keep-new", "superseded": ["20261124-031500-a1b2c3"]}
$ growth rollback 20261124-031600-d4e5f6
reverted 1f3c2a1The conflicting rule never touches the prompt until you decide. After resolve, git log shows exactly what changed and why.
pip install git+https://github.com/simin-yuan/agent-growth.git
growth init --target claude # writes .mcp.json
growth init --target cursor # writes .cursor/mcp.jsonRequires Python 3.9+ and git on PATH. No other dependencies.
Inside Claude Code / Cursor, the host model already is a strong LLM — you should not need a second key.
growth_learn accepts host-computed values:
rule— one clear sentence the host extracted from the correctionconflicts_with— ids of existing rules it contradicts ([]if none)
The host already calls growth_get_rules, so it has everything it needs. Result: full extraction + conflict interception with no GROWTH_LLM_KEY, no extra token cost.
A standalone CLI / offline mode still works; set GROWTH_LLM_KEY only if you want server-side extraction:
export GROWTH_LLM_KEY=sk-...
export GROWTH_LLM_BASE_URL=https://api.deepseek.com/v1
export GROWTH_LLM_MODEL=deepseek-chatgrowth add "<correction>" [--context TEXT] # extract + conflict-check + store a rule
growth rules # print the active rules block
growth conflicts # show unresolved conflict rules
growth resolve <id> --keep-new|--keep-old|--keep-both
growth log [-n 20] # rule history
growth rollback <id> # git revert a rule
growth inject [--out prompt.md] # write the rules block to a file
growth init --target claude|cursor|both [--dry-run]
growth mcp # run as an MCP server over stdiogrowth init --target claude # or cursor / bothThe agent then gets five tools:
growth_get_rules— pull the current rules into contextgrowth_learn— record a correction (rule+conflicts_withfor zero-key mode)growth_resolve— decide a conflict:keep-new/keep-old/keep-bothgrowth_rollback— undo a rulegrowth_log— inspect history
A minimal loop:
- Agent does a task.
- You correct it once.
- The agent calls
growth_learnon its own, passing the extracted rule. - Next session it calls
growth_get_rulesfirst — and stops making that mistake.
If a correction contradicts an existing rule, the agent gets status=conflict back, asks you which one wins, then calls growth_resolve.
correction ──▶ extract (host or LLM) ──▶ conflict check ──▶ store (Git commit)
│
prompt injection ◀── rules block ┘
│
resolve = keep-new / keep-old / keep-both
│
rollback = git revert
- Storage:
.growth/rules/*.md, one file per rule, frontmatter = metadata. - History: the
.growth/directory is its own Git repo.git logis the audit trail. - Safety: conflicting rules are stored with
status: conflictand are never injected until resolved. - Integration: plain prompt block + MCP tools. No vendor lock-in.
A rule file looks like this:
---
{
"id": "20261124-031500-a1b2c3",
"created": "2026-11-24T03:15:00",
"source": "mcp",
"status": "active"
}
---
Never use emojis in code comments.python -m unittest discover -s tests -vCovers: add → active, conflict gate, keep-new / keep-old / keep-both, rollback restore, MCP surface, zero-key conflict interception.
- Rule decay: age out stale rules, surface them for review
- Team mode: shared rule repo with per-author attribution
- Diff view: render a rule's full evolution
- Web UI for conflict review
MIT.
