用Git提交信息记录代码决策全过程,让AI能读懂开发背后的逻辑。
Lore: Repurposing Git Commit Messages as a Structured Knowledge Protocol for AI Coding Agents
- 用Git Trailer结构化提交信息,存下约束、被弃方案和指令。
- 无需额外系统,任何能运行命令的AI都能查询决策记录。
- 适合想提升代码可追溯性与协作效率的开发者和团队。
随着AI编程代理成为代码的主要生产者和消费者,软件行业正面临制度知识加速流失。每次提交仅记录代码变更,却丢弃了背后的原因——包括约束条件、被舍弃的备选方案以及前瞻性的上下文。本文将这种被忽略的推理称为‘决策影子’。为此提出Lore协议,通过原生Git Trailers将提交信息重构为包含约束、被拒方案、代理指令和验证元数据的自包含决策记录。Lore无需额外基础设施,仅依赖Git即可运行,可通过独立命令行工具查询,且任何能执行shell命令的代理均可发现。论文正式定义该协议,与五种替代方案对比,针对其最强质疑进行压力测试,并规划实证验证路径。
原文摘要 · Abstract (English)
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.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。