Skip to main content

AI-powered CLI that decomposes PR diffs into causal threads for human code reviewers

Project description

Unravel

AI-powered CLI that decomposes PR diffs into causal threads for human code reviewers.

Instead of reviewing a diff file-by-file, Unravel groups changes by why they were made — each thread tells a story from root cause to effect, so reviewers build understanding progressively.

Installation

pip install unravel-review

Quick Start

# Analyze the last commit
unravel diff HEAD~1..HEAD

# Analyze a range
unravel diff main..feature-branch

# Analyze a GitHub PR (requires gh CLI)
unravel pr 42

# JSON output for piping
unravel diff HEAD~1..HEAD --json | jq .

# Compact tree view
unravel diff HEAD~1..HEAD --tree-only

Requirements

  • Python 3.12+
  • Git
  • An API key for a supported LLM provider
  • GitHub CLI (only for unravel pr)

Configuration

Set your API key as an environment variable:

export ANTHROPIC_API_KEY=sk-ant-...

CLI Options

Flag Description
--model, -m Model to use (default: claude-sonnet-4-6)
--provider, -p LLM provider (default: anthropic)
--json, -j Output raw JSON
--tree-only, -t Compact tree view
--thinking-budget Extended thinking token budget (default: 10000)
--staged Analyze only staged changes (diff command only)
--remote Git remote name (pr command only, default: origin)

Environment Variables

Variable Description
ANTHROPIC_API_KEY API key for Anthropic/Claude
OPENAI_API_KEY API key for OpenAI (future)
UNRAVEL_PROVIDER Default provider
UNRAVEL_MODEL Default model
UNRAVEL_THINKING_BUDGET Default thinking budget

How It Works

  1. Extract — Pulls the diff from git or GitHub
  2. Parse — Breaks the diff into hunks using unidiff
  3. Analyze — Sends hunks to an LLM with a specialized prompt that decomposes changes into causal threads
  4. Validate — Checks all hunks are covered and thread dependencies are consistent
  5. Render — Displays threads in rich terminal output, JSON, or tree view

Multi-Provider Support

Unravel is designed to work with multiple LLM providers. Currently supported:

  • Anthropic (Claude) — default, with extended thinking support

Planned: OpenAI, Gemini, and more. The provider abstraction is ready — contributions welcome.

Development

git clone https://github.com/roo-oliv/unravel.git
cd unravel
uv venv --python 3.12 .venv
source .venv/bin/activate
uv pip install -e ".[dev]"

# Run tests
pytest

# Lint
ruff check src/ tests/

License

AGPL-3.0-or-later

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

unravel_review-0.2.0.tar.gz (54.5 kB view details)

Uploaded Source

Built Distribution

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

unravel_review-0.2.0-py3-none-any.whl (54.0 kB view details)

Uploaded Python 3

File details

Details for the file unravel_review-0.2.0.tar.gz.

File metadata

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

File hashes

Hashes for unravel_review-0.2.0.tar.gz
Algorithm Hash digest
SHA256 7845980f3cb7c6c37b62c68aa4ce53889f13b38af0fb110ce201a561f774c480
MD5 dd688a5a992c091c31a743f62d5767f8
BLAKE2b-256 7f39733b8aa94e5cca4a86c1151fe9a50403bfe7ccb7db4d7a99f67b5acf6b86

See more details on using hashes here.

Provenance

The following attestation bundles were made for unravel_review-0.2.0.tar.gz:

Publisher: release.yml on roo-oliv/unravel

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

File details

Details for the file unravel_review-0.2.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for unravel_review-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8727297eb41cc14899c37eddc1c3860f89271647bd4f5ad3dedf607c6d31b8dc
MD5 2ee8e3e41b5af06c70897cbdb0d79333
BLAKE2b-256 a44e17a71dba92755a7aa6dc3f7b121f3e1add18150ad45732025f68ede88f9d

See more details on using hashes here.

Provenance

The following attestation bundles were made for unravel_review-0.2.0-py3-none-any.whl:

Publisher: release.yml on roo-oliv/unravel

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