Conversation
…GIT-73) Wire agent/model metadata through CLI, MCP, and MemoryService so that remember writes AI-Agent and AI-Model commit trailers alongside the existing AI-Decision/Gotcha/Convention/Fact trailers. Update prepare-commit-msg hook to v2: detects $GIT_MEM_MODEL and writes AI-Model trailer next to AI-Agent. Adds in-place upgrade path from v1. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> AI-Decision: AI-Agent and AI-Model trailers now written by remember (CLI/MCP) and prepare-commit-msg hook v2 AI-Confidence: high AI-Memory-Id: a05acad7-6869-4ff6-b64a-faf56da4cc98 AI-Tags: trailers, git-hooks, showcase AI-Agent: Claude-Code AI-Model: claude-opus-4-6
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Pull request overview
This PR adds support for AI-Agent and AI-Model trailers throughout the git-mem codebase, enabling tracking of which AI agent and model created each memory. The implementation maintains backward compatibility by making both fields optional and provides consistent environment variable detection across all entry points.
Changes:
- Add
AI-AgentandAI-Modeltrailer support to domain entities, service layer, CLI, MCP, and git hooks - Upgrade
prepare-commit-msghook from v1 to v2 with automatic in-place upgrade logic - Add comprehensive test coverage for new trailer functionality and hook upgrade behavior
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/domain/entities/ITrailer.ts | Adds MODEL: 'AI-Model' constant to AI_TRAILER_KEYS |
| src/domain/entities/IMemoryEntity.ts | Adds optional agent and model fields to ICreateMemoryOptions interface |
| src/application/services/MemoryService.ts | Updates buildTrailers to accept options parameter and conditionally write agent/model trailers |
| src/cli.ts | Adds --agent and --model CLI flags with environment variable defaults |
| src/commands/remember.ts | Implements agent/model resolution with fallback chain: explicit flag > GIT_MEM_AGENT/GIT_MEM_MODEL > CLAUDE_CODE |
| src/mcp/tools/remember.ts | Adds agent/model parameters to MCP remember tool with same resolution logic |
| src/hooks/prepare-commit-msg.ts | Upgrades hook to v2 with AI-Model support, adds fingerprint prefix detection for version upgrades, and implements in-place upgrade from v1 |
| tests/unit/application/services/MemoryService.test.ts | Adds tests verifying agent/model trailers are written when provided and omitted when not provided |
| tests/unit/hooks/prepare-commit-msg.test.ts | Updates fingerprint expectations to v2, adds v1→v2 upgrade test, and adds tests for AI-Model trailer behavior with/without GIT_MEM_MODEL |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
AI-AgentandAI-Modeltrailers through the full remember flow (CLI, MCP, MemoryService)prepare-commit-msghook to v2 with$GIT_MEM_MODELdetection and in-place upgrade from v1$GIT_MEM_AGENT/$CLAUDE_CODEfor agent,$GIT_MEM_MODELfor modelShowcase
This commit itself demonstrates all 6 trailer types visible on GitHub:
AI-Decision,AI-Confidence,AI-Memory-Id,AI-Tags,AI-Agent,AI-ModelPlus a git note on
refs/notes/memwith the full JSON memory.Test plan
Closes GIT-73
🤖 Generated with Claude Code