git-memento: attaching AI session transcripts to Git commits (without changing commit hashes)
We’re starting to merge AI-generated code into production.
But we rarely preserve the thing that actually produced it: the session.
Six months later, when someone asks:
“Why was this implemented this way?”
“What constraints did we give the model?”
“Was this a deliberate tradeoff or just the first suggestion?”
… the only artifact left is the diff.
git-memento makes AI-assisted commits auditable using Git notes.
It does not rewrite commit history.
It does not modify commit hashes.
It does not stuff transcripts into commit messages.
It attaches the session transcript as a Git note.
The idea
Git already supports attaching metadata to commits via refs/notes/*.
git notes add -m "AI session: codex abc123" <commit>
git notes show <commit>
Notes:
- Don’t change commit hashes.
- Can be pushed/fetched.
- Are versioned like other refs.
- Survive rebases if configured correctly.
git-memento standardizes this pattern for AI-assisted development.
What it actually does
When you run:
git memento commit <session-id> -m "feat: add idempotency key"
It:
- Runs
git commitnormally. - Resolves
HEAD. - Fetches the AI session transcript.
- Attaches it via:
git notes add -f -m <rendered-markdown> <commit>
That’s it.
The commit hash stays the same.
Why this matters
AI makes it easy to produce code quickly.
It also makes it easy to lose context quickly.
Attaching the session transcript directly to the commit helps with:
-
Incident debugging
You can inspect the conversation that produced the code. -
Code review
Reviewers can see intent and constraints, not just output. -
Compliance / governance
You can demonstrate provenance for machine-assisted changes. -
Long-term maintainability
Context lives with the commit, not in Slack or a browser tab.
This is not about policing developers.
It’s about preserving engineering context at the point where history is already recorded: the commit.
CI enforcement
You can enforce note coverage in pull requests:
git memento audit --range origin/main..HEAD --strict
Fail if:
- A commit is missing a note.
- A note exists but doesn’t match the expected structure.
There’s also a GitHub Action that:
- Syncs notes
- Fails PRs without provenance
- Optionally renders note content as commit comments
History rewrite support
Notes can survive rebases and amendments via:
git memento notes-rewrite-setup
There are also commands for:
- Syncing notes across collaborators
- Backing up note refs before merges
- Carrying provenance across squash flows
All built on top of normal Git primitives.
Installation
curl -fsSL https://raw.githubusercontent.com/mandel-macaque/memento/main/install.sh | sh
Repository:
- https://github.com/mandel-macaque/memento
Design philosophy
This is intentionally boring.
No database.
No external service.
No commit rewriting.
No hidden state.
Just Git notes used deliberately.
If AI contributes to a commit, the session should be part of the artifact.
git-memento makes that practical.