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
/plugin marketplace add karanb192/claude-code-hooks
/plugin install pr-provenance-stamp@claude-code-hooksWhat 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 createand put the receipt in the body. - Run
/pr-provenance-stamp:provenanceand 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-hooksStep 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