Lore: Git Commit 메시지를 AI 코딩 에이전트를 위한 구조화된 지식 프로토콜로 재활용하기
Lore: Repurposing Git Commit Messages as a Structured Knowledge Protocol for AI Coding Agents
TL;DR Highlight
AI 에이전트가 '왜 이렇게 짰는지'를 기억하도록, git commit 메시지에 의사결정 맥락을 구조화해서 박아넣는 프로토콜
Who Should Read
AI 코딩 에이전트(Claude Code, Cursor 등)를 팀 워크플로우에 도입 중인 개발자나 테크리드. 특히 에이전트가 이미 결정된 사항을 반복해서 제안하거나 과거 맥락을 모르고 코드를 망치는 문제를 겪고 있는 경우.
Core Mechanics
- 코드 diff에는 '무엇을 바꿨는지'만 남고, '왜 그렇게 결정했는지'는 사라짐 — 이걸 'Decision Shadow'라 부름
- git trailer(커밋 메시지 하단의 key: value 형식 메타데이터)를 활용해 제약조건, 기각된 대안, 에이전트 지시사항을 커밋에 직접 내장
- Constraint:, Rejected:, Directive:, Tested:, Not-tested: 등 8개 표준 trailer 키로 구성된 'Lore atom'이 의사결정 최소 단위
- 별도 서버/DB/인프라 없이 git만으로 동작하며, CLI 도구로 `lore context <path>` 같은 쿼리 가능 — AI 에이전트가 shell 명령만 실행할 수 있으면 바로 활용
- ADR(아키텍처 결정 기록)은 파일이 코드와 분리돼 결국 낡아버리는 문제가 있는데, Lore는 커밋에 atomic하게 붙어있어 sync 문제가 원천 차단됨
- AI 에이전트가 커밋할 때 이미 갖고 있는 의사결정 맥락을 그냥 버리는 대신 Lore 형식으로 직렬화하면, 다음 에이전트가 같은 실수를 반복하지 않음
Evidence
- GitClear가 1억 5,300만 줄 코드 변경을 분석한 결과, AI 코딩 툴이 코드 생산 속도를 높이면서 동시에 장기 유지보수성 우려를 높이고 있음을 확인
- Claude Code, GitHub Copilot, Cursor 등 주요 AI 코딩 도구들이 커밋 메시지를 'diff 요약'으로만 생성 — 의사결정 맥락은 0% 기록
- Conventional Commits 표준(fix(auth): handle expired token refresh 형식)은 무슨 일이 일어났는지는 알려주지만, 왜 그 방식을 선택했는지는 전혀 전달 못 함
- GCC(Git Context Controller)가 SWE-Bench 벤치마크에서 state-of-the-art 성능을 기록했지만, 이는 세션 내 메모리 관리에 국한 — Lore는 세션 간 영구 지식 전달이라는 다른 문제를 해결
How to Apply
- AI 에이전트(Claude Code, Cursor 등) 설정에 커밋 생성 시 Lore 형식 trailer를 추가하도록 시스템 프롬프트를 수정 — 에이전트가 이미 알고 있는 '왜 이 방식을 선택했는지', '어떤 대안을 고려했는지'를 Rejected:/Constraint: 필드에 기록하게 지시
- 기존 코드베이스에 적용할 때는 `lore context <path>` 명령을 에이전트 컨텍스트 로딩 단계에 추가 — 특정 파일 수정 전에 해당 파일과 관련된 과거 의사결정 이력을 에이전트에 주입
- 팀에서 당장 전면 도입이 부담스러우면, '자주 망가지는 모듈'이나 '에이전트가 자꾸 같은 실수를 하는 부분'에만 선택적으로 Directive: 트레일러를 추가하는 것부터 시작
Code Example
# Lore-enriched commit message 예시
# (git commit -m 또는 커밋 편집기에 직접 작성)
Prevent silent session drops during long-running operations
The auth service returns inconsistent status codes on token
expiry, so the interceptor catches all 4xx responses and
triggers an inline refresh.
Constraint: Auth service does not support token introspection
Constraint: Must not add latency to non-expired-token paths
Rejected: Extend token TTL to 24h | security policy violation
Rejected: Background refresh on timer | race condition
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Error handling is intentionally broad (all 4xx)
-- do not narrow without verifying upstream behavior
Tested: Single expired token refresh (unit)
Not-tested: Auth service cold-start > 500ms behavior
---
# AI 에이전트 시스템 프롬프트 추가 예시
# (Claude Code / Cursor 설정에 추가)
"""
When creating a git commit, always include Lore trailers:
- Constraint: [rules that shaped this decision]
- Rejected: [alternatives considered] | [reason for rejection]
- Confidence: [low/medium/high]
- Directive: [warnings for future modifiers]
- Tested: [what was verified]
- Not-tested: [what was not verified]
Use 'Rejected:' to record every alternative you considered but dismissed.
This prevents future agents from re-exploring dead ends.
"""Terminology
Related Resources
Original Abstract (Expand)
As AI coding agents become both primary producers and consumers of source code, the software industry faces an accelerating loss of institutional knowledge. Each commit captures a code diff but discards the reasoning behind it - the constraints, rejected alternatives, and forward-looking context that shaped the decision. I term this discarded reasoning the Decision Shadow. This paper proposes Lore, a lightweight protocol that restructures commit messages - using native git trailers - into self-contained decision records carrying constraints, rejected alternatives, agent directives, and verification metadata. Lore requires no infrastructure beyond git, is queryable via a standalone CLI tool, and is discoverable by any agent capable of running shell commands. The paper formalizes the protocol, compares it against five competing approaches, stress-tests it against its strongest objections, and outlines an empirical validation path.