Skip to main content
skill CX Codex

commit-context — Claude Code skill: what it does, install

This skill links a file, function, or line to the commit and agent session behind it. Use it when a code change needs its history and context.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add rohitg00/agentmemory --skill commit-context -a claude-code
Open on GitHub

What commit-context does

The skill starts with Git. It uses git blame for a line or range, git log -L for a function, and git log -n 1 -- <file> for a file path. It then sends the full SHA to memory_commit_lookup and reports the commit, branch, author, message, and linked session.

The result can include the project, session start and end times, observation count, summary, and observations with importance of 7 or higher through memory_recall. When the lookup returns commit: null, the skill reports that the commit predates session linking and does not infer intent. Without memory_commit_lookup, commit-to-session tracing will not work.

What it helps with

  • trace a line back to its changing commit
  • find the session linked to a function
  • explain why code appeared in a file
  • show a commit’s author, branch, and message
  • separate recorded context from guesses based on a diff

Example prompts for the agent

  • Use /commit-context to show the commit context for src/auth/refresh.ts.
  • Use /commit-context to explain why the rotateRefreshTokens function is here.
  • Use /commit-context to find the agent session linked to line 40 in src/auth/refresh.ts.

How to install commit-context

1Skills CLI (Vercel)

npx skills add rohitg00/agentmemory --skill commit-context -a claude-code

2Manually: put the files in place

~/.claude/skills/commit-context/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/commit-context/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about commit-context

How do I install commit-context in Claude Code?

Run npx skills add rohitg00/agentmemory --skill commit-context -a claude-code, then check ~/.claude/skills/commit-context/SKILL.md.

What does commit-context do?

The skill finds a SHA with Git and sends it to memory_commit_lookup. It then reports commit details and the linked agent session when that link exists.

What happens when commit: null is returned?

The skill reports that the commit predates session linking. It does not infer the agent’s intent from the diff alone.

Source text

SKILL.md · Apache-2.0
---
name: commit-context
description: 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.
argument-hint: "[file, function, or line]"
user-invocable: true
---

The user wants commit context for: $ARGUMENTS

## Quick start

```bash
git blame -L 40,52 src/auth/refresh.ts   # -> SHA 9a1b2c3d
```

```json
memory_commit_lookup { "sha": "9a1b2c3d4e5f60718293a4b5c6d7e8f901234567" }
```

Expected output:

```text
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](TROUBLESHOOTING.md) if `memory_commit_lookup` is not available.

© rohitg00 · Apache-2.0 · rohitg00/agentmemory

Similar skills

All skills for Agent setup: memory, context, orchestration →

From the same set17

The whole set →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor