# Show HN: Git blame for AI code, down to the agent session

> Source: <https://keepplain.com/blame>
> Published: 2026-11-21 22:51:04+00:00

**Key takeaway:** Enabling KeepPlain's git hooks writes the agent session id into each commit trailer, so `git blame` and the agent's own answers can trace a line back to the specific session turns that produced it.

git blame for agent sessions

# Point at a line your agent wrote. Read the session that wrote it.

`git blame` stops at a commit and a name, usually yours. KeepPlain follows the line to the Claude Code, Codex, Cursor, Pi or Antigravity session behind it and opens the turn: what you asked, what the agent tried first, why it changed.

```
curl -fsSL https://keepplain.com/install.sh | sh    # macOS and Linux
irm https://keepplain.com/install.ps1 | iex         # Windows, in PowerShell
keepplain login
keepplain enable
```

Free for personal use. Say yes when `keepplain enable` asks about git hooks: they add the session’s id to your commits, and blame follows it.

On Windows you can also [get it from the Microsoft Store](https://apps.microsoft.com/detail/9p1p4ml30ht9).

## Git says who changed it. It can’t say why.

Ask your agent about a line, and it follows git to the session that made the change, reads the turns from your request to the commit, and answers with quotes. It says which turns it read and how the session was found.

```
> why is line 42 of src/auth/login.ts keyed by account?

Deliberate. On Sep 30 the agent first keyed the limit by IP, and 2 of 41
tests failed: behind the load balancer every user shares one address.
You said:

  “Behind the load balancer everyone has the same IP. Key it by the account.”

It switched the key to the email being signed in to and committed a3f9e1c.
quoted from turns 112–115 of your Claude Code session
```

What your agent answers, in any of the five agents.

## Ask in plain words. No new command to learn.

When a prompt asks where code came from, the plugin adds one line to it: git shows what changed, the session the change was made in shows why. So the agent runs `git log` or `git blame` first, then asks KeepPlain for the session by the commit, its trailer, its subject and the files. The match is made on your computer; the prompt goes nowhere.

```
> why is line 42 of src/auth/login.ts keyed by account?
> where did the retry loop in sync.ts come from?
> why was commit e93b2aa made?
> who added the lock in syncSeats, and why?
> откуда взялся этот таймаут?
```

Things people type. English and Russian both work.

## On the site, a link to a line gives its whole life.

`git blame` shows the last commit. In your team’s search, a GitHub link ending in `#L42` becomes the line’s history: the commit that added it, every commit that changed it, and the sessions behind each one.

`https://github.com/acme/api/blob/main/src/auth/login.ts#L42`

| Commit | Line 42 | Session | 
|---|---|---|
| `1b07c44` Sep 2Add login throttle | `Limit.perMinute(10).by(req.ip())` | Cursor · Scaffold the auth module. Made it. | 
| `6d12f9a` Sep 15Tighten login limit | `Limit.perMinute(5).by(req.ip())` | No session found. No trailer, and no agent edited the file before this commit. | 
| `a3f9e1c` Sep 30Key login rate limit by account | `Limit.perMinute(5).by(req.input('email'))` | Claude Code · Rate-limit the login endpoint. Made it. Codex · Audit log for auth. Only saw it: open in the same repository at the time, didn’t change this line. | 

## On the pull request, for teams.

Switch it on for your team and the GitHub App keeps one comment on each pull request, updated as commits change: which commits came from a session, which were agent-assisted, and the session behind each.

- Off until a team owner turns it on.
- Session titles only in private repositories. In a public one the link opens the team’s page, for members.
- No prompt, no text, no file in the comment.

**keepplain** bot · commented, edited 2 min ago

**Sessions behind this pull request.** The commits that came from an agent session or with an agent’s help.

| Commit | Message | How | Session | 
|---|---|---|---|
| `1b07c44` | Add login throttle | In a session | Scaffold the auth module | 
| `a3f9e1c` | Key login rate limit by account | In a session | Rate-limit the login endpoint | 
| `0f3e2b8` | Audit failed attempts | Agent-assisted | Audit log for auth | 

## How it follows a line

No new version control and no IDE extension. The agent you already use runs git, then asks KeepPlain.

1. 
### The line’s whole history`git blame` names only the last commit. Your agent asks git for every commit that touched the line, up to eight.

``` bash
$ git log -L 42,42:src/auth/login.ts -s --date=short \
    --format='%h  %ad  %s  %(trailers:key=Agent-Session,valueonly)'

a3f9e1c  2026-09-30  Key login rate limit by account   7c21e0b4-…
6d12f9a  2026-09-15  Tighten login limit
1b07c44  2026-09-02  Add login throttle                91e5aa20-…
```

 Three commits touched line 42. Two of them name the session they came from.
2. 
### The commit names its sessionOne trailer line in the commit message, written by KeepPlain’s `prepare-commit-msg` hook when a commit holds a session’s work. Only the id travels with your push. The session doesn’t.

``` bash
$ git show -s --format=%B a3f9e1c

Key login rate limit by account

Agent-Session: 7c21e0b4-2f6e-4a1d-9c3b-58e0f1d2a7b9
```

3. 
### KeepPlain finds the sessionBy the commit, the trailer, the subject and the files, across your sessions from all five agents, and your team’s. 

```
search_my_work
  commit          a3f9e1c
  agent_sessions  7c21e0b4-…
  subject         "Key login rate limit by account"
  paths           src/auth/login.ts

→ Claude Code · “Rate-limit the login endpoint” · Sep 30
  found_by  commit        own  true
  cursor    turn 115      changed src/auth/login.ts, made a3f9e1c
  request   turn 112      “Behind the load balancer everyone has…”
```

4. 
### It reads the turnsFrom your request to the change: the reasoning and your decision, not the whole log. The request is your last real one before the change; a “yes” or “continue” is skipped. 

```
get_session_excerpt  turns 109–115

109  agent  Keying the limiter by IP, the usual default.
110  tests  ✕ 2 of 41 failed · users behind one proxy are blocked together
112  you    “Behind the load balancer everyone has the same IP. Key it by the account.”
115  agent  changed src/auth/login.ts:42 · committed a3f9e1c
```

5. 
### Your agent answers, with quotesThe answer above: what happened, your words, the commit, and which turns it came from. If the session was found another way, by its edits or not at all, the answer says that too.

## When the trail goes cold, it says so

The answer tells you how the session was found. Or that it wasn’t.

### Found by its commit

The commit says which session it came from. The answer quotes that session and the turns it read.

### Found by its edits

No trailer? KeepPlain takes the agent’s last edits of those files before the commit, and the answer says it was found that way, not by the commit.

### A teammate’s session

You get whose session it is and its page. The conversation stays with its author until they share it.

### No agent session found

The change wasn’t made in a synced session you can read. Your agent says so instead of inventing a reason.

## What leaves your computer

Git runs on your computer and the code stays there.

### What the site gets

The file’s path and its commits: hash, the file’s name in each, title, `Agent-Session` trailer, dates. The newest 300 commits of a file, a hundred a request. Never the code.

### What comes back

The sessions you may read. A teammate’s session you see in the team’s list but may not read is named by its author only.

### Signed out

A trailer that names a session the site doesn’t hold is looked for on this computer, and nothing of it goes anywhere. Not signed in, that is all you get, with the commits’ titles for the rest.

### The git hooks

Only in a repository where you said yes to `keepplain enable`, never globally. The session id becomes part of the repository’s history: in a public repository everyone sees it. `keepplain disable` takes the hooks out; trailers already in commits stay.

### Options

`-L from,to` blames those lines, `--rev=commit` the file as it was there, `-w` ignores whitespace, `--json` is for scripts and the desktop app.

### Read the code

The plugin is MIT. [Its README](https://github.com/keepplain/keepplain-plugin#who-wrote-each-line) describes the command, and the table under “What leaves your machine” lists every call.

## Measured, not promised

**6 of 6**

### “why” questions answered with the session that made the change

**31 ms**

### median answer to a “why”

**5 agents**

### Claude Code, Codex, Cursor, Pi and Antigravity

**30 days**

### of past sessions KeepPlain offers to bring in when you install

Measured in production on Oct 14, 2026: 34 questions the founder asked about their own work, 6 of them “why”, across 391 sessions. For 31 of the 34 the right session came first. One person’s history, not a benchmark.

## Next time, ask why.

```
curl -fsSL https://keepplain.com/install.sh | sh    # macOS and Linux
irm https://keepplain.com/install.ps1 | iex         # Windows, in PowerShell
keepplain login
keepplain enable
```

Then `keepplain login` and `keepplain enable`, with a yes to git hooks for the trailer. Blame a file: `keepplain blame <file>`.

On Windows you can also [get it from the Microsoft Store](https://apps.microsoft.com/detail/9p1p4ml30ht9).

Questions and problems: [\[email protected\]](https://keepplain.com/cdn-cgi/l/email-protection#3b535e5757547b505e5e4b4b575a525515585456)

More in KeepPlain

### For you Free

- **Why a line changed** You are here
- [Memory across agents](https://keepplain.com/memory) Your agent finds what you already solved and picks the task up in any agent.
- [Handoff at the limit](https://keepplain.com/handoff) Near your Claude limit, carry on in Codex or Pi with a brief built on your machine.
- [Rules from your corrections](https://keepplain.com/agent-rules) Correct it in two conversations, add the rule, and every agent you use reads it.
- [Sessions in two minutes](https://keepplain.com/sessions) Hours of agent work cut to the moments that mattered, with the code of each turn.
- [Private by default](https://keepplain.com/security) Secrets removed on your machine. Nothing published until you say so.

### For your team Per active seat

- [Team rules, reviewed](https://keepplain.com/team-rules) Rules your team reviews like a pull request reach every agent on the team.
- [Team memory](https://keepplain.com/team-memory) Agents search the team’s sessions first, and the work stays when people leave.
- [Sessions on pull requests](https://keepplain.com/pull-requests) Every pull request shows which commits came from a session, and links it.
- [Insights](https://keepplain.com/insights) Where agent time goes, what got merged, and at what cost.

### For everyone Free

- [The session library](https://keepplain.com/session-library) Real sessions by stack and task, including where agents went wrong.
- [MCP for your agent](https://keepplain.com/mcp-server) Before a task, or when it’s stuck, your agent checks how others got past it.
- [Skills from sessions](https://keepplain.com/skills) Turn a session that worked into a skill, a rule or a prompt.
- [Compare runs](https://keepplain.com/compare) Two to four runs of one prompt side by side, on one clock.
- [Share how you built it](https://keepplain.com/share) Put the session behind a pull request or a README, at the detail you choose.
