GitHub - mandel-macaque/memento: Keep track of you codex sessions per commit · GitHub

Source: original

git-memento

git-memento is a Git extension that records the AI coding session used to produce a commit. It attaches AI conversation transcripts as git notes, creating an audit trail for AI-assisted development.

Table of Contents

What is git-memento?

git-memento solves a critical problem in AI-assisted development: when an AI assistant produces a commit, the conversation that led to that change is typically lost. Team members see what changed but not why the AI was asked to change it, what alternatives were considered, or what constraints were given.

git-memento:

Who is this for? Development teams using AI coding assistants (Codex, Claude Code) who want to maintain transparency, support code review, meet compliance requirements, or preserve context for debugging and onboarding.

Getting Started

Prerequisites

Before using git-memento, you need:

Installation

Install git-memento from the latest GitHub release:

curl -fsSL https://raw.githubusercontent.com/mandel-macaque/memento/main/install.sh | sh

The installer will:

  1. Detect your OS and architecture

  2. Install to ~/.local/bin (or your configured install directory)

  3. Prompt you to add the directory to your PATH if needed

Alternative : You can also build from source if you prefer.

After installation, verify git-memento is available:

git memento --version git memento help

First-time setup

Initialize git-memento for your repository. This stores provider configuration in local git metadata (.git/config):

For Codex

git memento init codex

For Claude Code

git memento init claude

You only need to run init once per repository. The configuration is stored locally and won't affect other repositories.

Your first memento commit

  1. Make your changes as you normally would

  2. Stage your files :

git add .

  1. Create a commit with an attached AI session note :

git memento commit -m "Your commit message"

Example:

git memento commit abc123 -m "Add user authentication feature"

Verify the note

Check that the AI session transcript was attached to your commit:

Show the commit

git log -1 --pretty=fuller

Show the attached note

git notes show HEAD

You should see a markdown-formatted conversation with your AI provider showing the messages exchanged during the session.

Share with your team

Push your commit and sync the notes to your remote repository:

git memento push

This command:

Your team members can fetch the notes with:

git memento notes-sync

You're now up and running! Continue reading for more advanced features and commands.

Core Commands

Initialize per-repository

git memento init git memento init codex git memento init claude

init stores configuration in local git metadata (.git/config) under memento.*.

Create commits with notes

git memento commit -m "Normal commit message" git memento commit -m "Subject line" -m "Body paragraph" git memento commit --summary-skill default -m "Subject line"

You can pass -m multiple times, and each value is forwarded to git commit in order. When -m is omitted, git commit opens your default editor.

Amend commits

git memento amend -m "Amended subject" git memento amend -m "Amended subject" -m "Amended body" git memento amend --summary-skill session-summary-default -m "Amended subject"

amend runs git commit --amend:

Summary mode

--summary-skill <skill|default> (for commit and amend <session-id>) changes note behavior:

Verify both notes after a summary run:

git notes show git notes --ref refs/notes/memento-full-audit show

Share notes with remote

git memento share-notes git memento share-notes upstream

This pushes refs/notes/* and configures local remote.<name>.fetch so notes can be fetched by teammates.

Push branch and sync notes

git memento push git memento push upstream

This runs git push <remote> and then performs the same notes sync as share-notes. Default remote is origin.

Sync notes from remote

If a session id is not found, git-memento asks the configured provider for available sessions and prints them.

This command:

git memento notes-sync git memento notes-sync upstream git memento notes-sync upstream --strategy union

Default remote is origin, default strategy is cat_sort_uniq.

Audit note coverage

git memento audit --range main..HEAD git memento audit --range origin/main..HEAD --strict --format json

Audit note coverage and note metadata in a commit range:

Repository diagnostics

git memento doctor git memento doctor upstream --format json

Run repository diagnostics for provider config, notes refs, and remote sync posture.

Show help and version

git memento help git memento --version

Advanced Features

Configure automatic note carry-over

For rewritten commits (rebase / commit --amend):

git memento notes-rewrite-setup

This sets local git config:

Carry notes from rewritten range

For squash/rewrite flows onto a new target commit:

git memento notes-carry --onto --from-range ..

This reads notes from commits in <base>..<head> and appends provenance blocks to <new-commit>. It carries both refs/notes/commits and refs/notes/memento-full-audit.

Provider configuration

Provider defaults can come from env vars, and init persists the selected provider + values in local git config:

Summary args template placeholders:

Security behavior:

Set MEMENTO_AI_PROVIDER=claude to use Claude Code.

Runtime behavior

If a session id is not found, git-memento asks the provider for available sessions and prints them.

Notes format

CI/CD Integration

This repository includes a reusable marketplace action with three modes:

Action definition:

Example: Post commit comments

name: memento-note-comments

on: push: pull_request: types: [opened, synchronize, reopened, labeled, unlabeled]

permissions: contents: write pull-requests: read

jobs: comment-memento-notes: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0

Inputs:

Installer action inputs:

CI gate example:

name: memento-note-gate

on: pull_request: types: [opened, synchronize, reopened, labeled, unlabeled]

permissions: contents: read issues: write pull-requests: write

jobs: enforce-memento-notes: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0

Merge-carry example:

name: memento-notes-merge-carry

on: pull_request: types: [closed]

permissions: contents: write

jobs: carry-notes-to-merge-commit: if: github.event.pull_request.merged == true runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0

Installer action example:

Action inputs

Publish this action to GitHub Marketplace

  1. Build and commit the action renderer artifact:

npm ci npm run build:action git add src/note-comment-renderer.ts dist/note-comment-renderer.js

  1. Ensure action.yml and install/action.yml are in the default branch and README documents usage
  2. Create and push a semantic version tag:

git tag -a v1.0.0 -m "Release GitHub Action v1.0.0" git push origin v1.0.0 git tag -f v1 v1.0.0 git push -f origin v1

  1. In GitHub, open your repository page:
  2. Releases -> Draft a new release -> choose v1.0.0 -> publish
  3. Open the Marketplace (GitHub Store) publishing flow from the repository and submit listing metadata
  4. Keep the major tag (v1) updated to the latest compatible release

Local workflow in this repository:

Build and Install

Build (AOT)

Requires .NET SDK 10 and native toolchain dependencies for NativeAOT.

macOS

dotnet publish src/GitMemento.Cli/GitMemento.Cli.fsproj -c Release -r osx-arm64 -p:PublishAot=true

Linux

dotnet publish src/GitMemento.Cli/GitMemento.Cli.fsproj -c Release -r linux-x64 -p:PublishAot=true

Windows (PowerShell)

dotnet publish src/GitMemento.Cli/GitMemento.Cli.fsproj -c Release -r win-x64 -p:PublishAot=true

Local install as Git tool

Git discovers commands named git-<name> in PATH.

  1. Publish for your platform
  2. Copy the produced executable to a directory in your PATH
  3. Ensure the binary name is git-memento (or git-memento.exe on Windows)

Then run:

git memento commit -m "message"

Release automation

Install script CI coverage

CI runs install smoke tests on Linux, macOS, and Windows that verify:

Testing

dotnet test GitMemento.slnx npm run test:js

Contributing

Contributions are welcome! To contribute:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run tests to ensure everything works
  5. Submit a pull request

For development setup, see Build (AOT).

License

See LICENSE file for details.