Skip to main content
plugin

pr-provenance-stamp — Claude Code plugin: what it does, how to install

pr-provenance-stamp appends a provenance receipt to your pull request body: prompts, estimated spend, test exit codes and an agent-versus-human line split.

MIT ★ 586 updated 2026-10-26

Install into Claude Code · Plugin marketplace All methods and platforms ↓
/plugin marketplace add karanb192/claude-code-hooks
/plugin install pr-provenance-stamp@claude-code-hooks
Open on GitHub

What pr-provenance-stamp does

Each pull request opened with gh pr create or glab mr create gets a receipt in its body. It lists how many prompts went in, an estimate of token and dollar spend, every test and typecheck run with the exit code it returned, and a split of added lines between agent and human.

The ledger comes from a PostToolUse hook on Edit|MultiEdit|Write|Bash. It runs asynchronously, so it adds no latency, and counts tool calls, agent-written lines and each verification command. A second hook, PreToolUse on Bash, reads the session transcript for the prompt count and models, asks git for the branch's added lines, and rewrites --body before the command goes out.

Commands that assemble their body with a heredoc, $(...), backticks or process substitution are skipped, and those PRs get no receipt. There is nothing to configure. Session state sits in ~/.claude/pr-provenance-stamp/<session_id>.json, hook logs in ~/.claude/hooks-logs/. The hook makes no network calls of its own, yet it does change the command you are about to publish, so the receipt lands in the public PR description on GitHub. /pr-provenance-stamp:provenance renders it first.

What it helps with

  • show reviewers which tests ran and how they exited
  • split agent-written lines from your own edits
  • estimate token spend for a branch before publishing
  • preview the receipt without opening a pull request
  • keep a session ledger of commands without copying logs by hand

Example prompts for the agent

  • Open the PR with gh pr create and put the receipt in the body.
  • Run /pr-provenance-stamp:provenance and show me this session's receipt.
  • Create the merge request with glab mr create, receipt included.

How to install pr-provenance-stamp

Plugin marketplace

/plugin marketplace add karanb192/claude-code-hooks
/plugin install pr-provenance-stamp@claude-code-hooks

Step by step, with commands for each platform: Claude Code plugins: marketplaces, installing, and building your own

Questions about pr-provenance-stamp

How do I install pr-provenance-stamp in Claude Code?

Add the marketplace with /plugin marketplace add karanb192/claude-code-hooks, then run /plugin install pr-provenance-stamp@claude-code-hooks. Restart Claude afterwards.

What does pr-provenance-stamp do?

It appends a provenance receipt to your pull request body: prompt count, estimated spend, test exit codes, and how many added lines came from the agent versus you.

What happens if my PR body is built with a heredoc?

The hook leaves the command untouched, so no receipt is added. It backs off rather than risk breaking the substitution.

Source text

pr-provenance-stamp · MIT
# pr-provenance-stamp

> Stamps a provenance receipt (prompts, estimated spend, tests run with exit codes, and a truthful agent-authored line split) into your PR body on `gh pr create`.

A PostToolUse hook keeps a per-session ledger: tool-call count, agent-authored line count, and every test/typecheck/lint command with its real exit code. When Claude runs `gh pr create` (or `glab mr create`), a PreToolUse (Bash) hook reads the session transcript for the real prompt count, estimated token/dollar spend, and models, asks git for the branch's total added lines to derive an agent-vs-human split, then appends a one-line receipt to the PR `--body`. If the command builds its body with a heredoc, `$(...)`, backticks, or process substitution, the hook defers and leaves the command untouched rather than risk corrupting it.

## Install

```
/plugin marketplace add karanb192/claude-code-hooks   # once per machine
/plugin install pr-provenance-stamp@claude-code-hooks
```

Restart Claude Code, done. (Or from a shell: `claude plugin install pr-provenance-stamp@claude-code-hooks`.)

## What it does

| Event | Runs | What happens |
|-------|------|--------------|
| PostToolUse (`Edit\|MultiEdit\|Write\|Bash`) | async (zero added latency) | Updates the session ledger: tool-call count, agent-authored line count, and each test/typecheck command with its real exit code. |
| PreToolUse (`Bash`) | sync | On `gh pr create` / `glab mr create`, rewrites the `--body` to append the receipt (prompt count, est. spend, test tally, agent-vs-human line split). Defers on unsafe shell constructs. |

`/pr-provenance-stamp:provenance` renders the current session's receipt exactly as it would be stamped into a PR body, without creating one.

## Configuration

No configuration needed. State is stored per session at `~/.claude/pr-provenance-stamp/<session_id>.json` (hook logs at `~/.claude/hooks-logs/`).

## Data & privacy

Records tool-call counts, test commands with exit codes, agent line counts, and transcript-derived prompt/spend estimates. Everything is read and computed on your machine: the hook makes no network calls of its own; it only shells out to `git` for the line diff. It does rewrite the `--body` of your `gh pr create` command, so the receipt text becomes part of the public PR description that gets published to GitHub.

## Uninstall

```
/plugin uninstall pr-provenance-stamp@claude-code-hooks
```

© Karan Bansal · MIT · karanb192/claude-code-hooks

Similar plugins

All plugins for Git and GitHub →

From the same set28

The whole set →
protect-secrets protect-secrets — a PreToolUse hook that checks every Read, Edit, Write, Bash and Grep call and blocks .env, SSH keys or cloud credentials — or asks you first. ★ 586repo stars bounty-board bounty-board turns TODO and FIXME comments into bounties that grow in XP value as they age. Scans your repo, prices each debt marker by git-blame age, and feeds the top 3 into your session as side quests. ★ 586repo stars dead-end-registry dead-end-registry stores reverted code changes and alerts you before retrying failed ideas. Keeps track of discarded approaches and detour token costs per repository. ★ 586repo stars standup-autopilot The standup-autopilot plugin turns agent session transcripts into a daily standup card with tasks, tests, PRs, and blockers. Open blockers carry into the next session. ★ 586repo stars dead-rules-audit dead-rules-audit tracks how Claude Code adheres to CLAUDE.md rules during edits and flags chronically violated items. ★ 586repo stars nerf-receipts The nerf-receipts plugin tracks tool failures, repeated edits to the same file, and tokens per task. Use it to see whether those signals shift when the model changes. ★ 586repo stars cache-tax cache-tax prices a cold return to a session before you send the next message, so a lapsed 1-hour prompt cache does not quietly re-write the whole context. ★ 586repo stars context-hogs context-hogs tracks per-file context usage and highlights which repo files drive up token spend. ★ 586repo stars

Project sponsors

Companies that keep this analytics open