Skip to main content

Turn long Claude Code sessions into reviewer-ready pull request descriptions.

Project description

image

CI Python License PyPI

Turn long Claude Code sessions into reviewer-ready pull request descriptions.

pr-narrator reads your Claude Code transcript, combines it with your git diff, and generates a structured PR description grounded in the actual session.

For short sessions, asking Claude in-session works fine. For long sessions, context gets compacted and the rationale disappears from active memory. pr-narrator reads the raw transcript on disk, so it works from the full session, uncompacted.

Installation

uv tool install pr-narrator

Requires claude, git, and gh on your PATH.

Usage

pr-narrator inspect latest          # show what's in the most recent session
pr-narrator synthesize latest       # generate a PR description
pr-narrator create latest           # synthesize and open a draft PR

To work from a specific session:

pr-narrator synthesize from 02ff271d

The session ID is a UUID prefix; pr-narrator matches the shortest unambiguous prefix.

Example

Given a branch where you added retry logic to an HTTP client, plus a Claude Code session where you discussed why you chose exponential backoff over a fixed delay and rejected adding the tenacity dependency, pr-narrator synthesize latest produces:

> ## What changed
>
> Adds exponential backoff retry to `http_client.py` for transient 5xx responses. Three retries with 100ms / 400ms / 1.6s delays.
>
> ## Approach
>
> Wraps the existing `request()` method rather than introducing a new client class — keeps the call sites unchanged.
>
> ## Considered & rejected
>
> - **A third-party retry library (tenacity).** Adds a dependency for what is ~30 lines of code.
> - **Fixed-delay retry.** Doesn't help with thundering-herd scenarios.
>
> ## Risk
>
> Low. Existing call sites are unchanged.

Options

--paranoid          broaden redaction to include home paths, env-shaped lines,
                    private IPs, emails, and high-entropy tokens
--strict            fail synthesis if the model's frontmatter is incomplete
--dry-run           preview the PR without posting (create only)
--debug             print prompt, raw response, and redactions to stderr
--no-frontmatter    omit the YAML metadata block
--no-draft          open as a regular PR instead of a draft (create only)
--base BRANCH       base branch for the diff (default: main)

pr-narrator <command> --help for the full list.

How it works

pr-narrator parses Claude Code's per-session JSONL files into typed events, compresses them into a deterministic timeline, captures the branch diff, runs both through a redactor, and asks claude -p to render markdown plus YAML frontmatter for downstream review bots.

Inputs and outputs pass through a redactor; see SECURITY.md and CONTRIBUTING.md.

Development

git clone https://github.com/nagstler/pr-narrator
cd pr-narrator
uv sync --all-extras
uv run pytest
uv run pr-narrator --help

See CONTRIBUTING.md for branch naming, commit conventions, and the release process.

License

Apache License 2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pr_narrator-0.1.0.tar.gz (119.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pr_narrator-0.1.0-py3-none-any.whl (31.7 kB view details)

Uploaded Python 3

File details

Details for the file pr_narrator-0.1.0.tar.gz.

File metadata

  • Download URL: pr_narrator-0.1.0.tar.gz
  • Upload date:
  • Size: 119.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pr_narrator-0.1.0.tar.gz
Algorithm Hash digest
SHA256 03ca8667c2513e75c948500601823f5abe618594f3b3b38d72d93c91bf671d9d
MD5 203ab0748ae276f13f3176bff4e2e18e
BLAKE2b-256 6794501cab3943731107ac0be4888493383717742df6a21fa7f611aa90e03945

See more details on using hashes here.

Provenance

The following attestation bundles were made for pr_narrator-0.1.0.tar.gz:

Publisher: release.yml on nagstler/pr-narrator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pr_narrator-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pr_narrator-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 31.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pr_narrator-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4e5df7a8e2a43c4e4e55e1d802a6f44b6dd6fe69e055b44abb9bae85a09a45f0
MD5 7aefe0f47f6c02a2c5df349adccea80b
BLAKE2b-256 d97ce0737815c458aaec1f0395f02904a1331ceb657d35b302c561b5b34115df

See more details on using hashes here.

Provenance

The following attestation bundles were made for pr_narrator-0.1.0-py3-none-any.whl:

Publisher: release.yml on nagstler/pr-narrator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page