跳到正文
Skillpedia
通用编程30k · #9345

commit-context

它能做什么

这项技能把一个文件、函数或行追溯到产生其当前提交的智能体会话。它只报告 git 和记忆查询实际返回的内容。

适用场景

  • ✓当你询问某段代码为什么会出现在代码库中时。
  • ✓当你想知道一项改动产生时智能体正在做什么时。
  • ✓当你想了解代码中某个具体位置的背景时。

技能链接

https://github.com/rohitg00/agentmemory/blob/main/plugin/skills/commit-context/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/rohitg00/agentmemory/blob/main/plugin/skills/commit-context/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“这段刷新令牌的代码为什么在这里?请把它追溯到编写它的那个会话。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会使用 git blame 找出你指定行所对应的提交,然后在记忆服务器中查找该提交。它会报告关联的会话和关键观察内容,如果提交早于会话关联功能,它会说明这一点。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

The user wants commit context for: $ARGUMENTS

Quick start

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.

Why

Report only what git and the lookup return. When the lookup gives commit: null, the commit predates session linking; do not invent intent.

Workflow

  1. Find the SHA: 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.
  2. Look it up: memory_commit_lookup { "sha": "<full-sha>" }.
  3. Present the commit (sha, short sha, branch, author, message), the linked session(s) (id, project, started/ended, observation count, summary), and the importance >= 7 observations via memory_recall when available.

Anti-patterns

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."

Checklist

  • SHA came from git blame/log, not a guess.
  • commit: null reported as "predates linking", no fabricated session.
  • Session details quote the lookup response verbatim.
  • No intent claimed beyond what observations state.

See also

  • commit-history: list many agent-linked commits at once.
  • recall: dig deeper into the linked session's observations.

Troubleshooting

See TROUBLESHOOTING.md if memory_commit_lookup is not available.

常见问题

如果没有关联会话怎么办?

技能会说明该提交早于会话关联功能,不会编造解释。

它使用 git 吗?

使用。它通过 git blame、git log 或文件历史找到提交。

它会猜测改动背后的意图吗?

不会。如果没有记录的会话,它只描述差异所显示的内容。

详情

作者的原始描述

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 doing when this changed", "who wrote this", or wants context on a specific location in the codebase.

repo: rohitg00/agentmemory

热度

GitHub 星标
30k
排名
#9345
许可证
Apache-2.0
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能