Trace a file, function, or line back to the agent session that produced its current commit. Use when the user asks "why is this code here", "what was the agent
复制下面这句话,粘贴给 Claude Code、Codex、Cursor 等 AI 编程工具,它会读取安装说明并在你确认后完成安装。
请阅读 https://ai.atlankj.com/install/asset/gh-commit-context-7e700e09aee8 ,按照其中的说明把「commit-context」安装到你(当前 AI 工具)中。执行前先告诉我将运行的命令和写入的位置,等我确认。
查看 AI 将读取的安装说明正在读取 GitHub 原文…
内容来自 GitHub 原始文件,由原作者维护。在 GitHub 查看
The user wants commit context for: $ARGUMENTS
git blame -L 40,52 src/auth/refresh.ts # -> SHA 9a1b2c3d
memory_commit_lookup { "sha": "9a1b2c3d4e5f60718293a4b5c6d7e8f901234567" }
Expected output:
9a1b2c3 on main by dev: "rotate refresh tokens"
Linked session 7f3a9c2 "Auth refresh rework", 14 obs.
Report only what git and the lookup return. When the lookup gives commit: null,
the commit predates session linking; do not invent intent.
git blame -L <start>,<end> <file> for a line range;
git log -L :<function>:<file> for a function; git log -n 1 -- <file> for a
bare path.memory_commit_lookup { "sha": "<full-sha>" }.memory_recall when available.WRONG: lookup returns { "commit": null }, you narrate "the agent was
refactoring auth" from the diff alone.
RIGHT: "This commit predates session linking, so there is no recorded agent
session. From git show: it changed token rotation in refresh.ts."
commit: null reported as "predates linking", no fabricated session.commit-history: list many agent-linked commits at once.recall: dig deeper into the linked session's observations.See ../_shared/TROUBLESHOOTING.md if memory_commit_lookup is not available.