Skip to main content

semantic-diff

AI-powered semantic analysis of git commits. Goes beyond git diff to show intent, impact, risk, and review questions.

What it does

Regular git diff shows what changed. semantic-diff shows:

  • 🎯 Intent — What was the developer trying to accomplish? (not what changed, but why)
  • 🗺️ Impact Map — What parts of the system are affected directly and indirectly?
  • ⚠️ Risk Assessment — What could break? Edge cases? Breaking changes?
  • ❓ Review Questions — What should a reviewer ask the author?

Installation

# Clone the repo
git clone git@github.com:tkenaz/semantic_diff.git
cd semantic_diff

# Create virtual environment
python -m venv .venv
source .venv/bin/activate  # Windows: .venv\Scripts\activate

# Install
pip install -e .

Configuration

Create a .env file:

ANTHROPIC_API_KEY=sk-ant-...
SEMANTIC_DIFF_MODEL=claude-sonnet-4-5-20250929  # or claude-opus-4-5-20251101
SEMANTIC_DIFF_MAX_RETRIES=3  # optional, API retry attempts
SEMANTIC_DIFF_MAX_WAIT=30.0  # optional, max total retry wait time in seconds

Usage

# Analyze HEAD commit in current repo
semantic-diff

# Analyze specific commit
semantic-diff abc123

# Analyze commit in another repo
semantic-diff HEAD --repo /path/to/repo

# Output as JSON (for piping to other tools)
semantic-diff HEAD --json

# Verbose mode
semantic-diff HEAD -v

Example Output

╭──────────────────── 📋 Semantic Diff Analysis ────────────────────╮
│ Fix authentication bypass in login endpoint                       │
│                                                                    │
│ abc12345 by developer@example.com                                  │
│ 2024-12-22T10:30:00                                                │
╰────────────────────────────────────────────────────────────────────╯

╭──────────────────────── 🎯 Intent ────────────────────────╮
│ Prevent unauthorized access by validating session tokens  │
│ before processing login requests.                         │
│                                                            │
│ Confidence: [████████░░] 85%                               │
╰────────────────────────────────────────────────────────────╯

╭──────────────────── ⚠️ Risk Assessment ───────────────────╮
│ Overall Risk: ⚡ HIGH                                      │
│                                                            │
│ ⚠️  BREAKING CHANGES DETECTED                              │
│                                                            │
│ Identified Risks:                                          │
│   ⚡ [high] Existing sessions may be invalidated           │
│      💡 Mitigation: Add migration for active sessions      │
╰────────────────────────────────────────────────────────────╯

Development

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Format code
black semantic_diff
ruff check semantic_diff

License

MIT — Kenaz GmbH

Release files for semantic-diff 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for semantic-diff 0.1.0
File Size Uploaded
semantic_diff-0.1.0.tar.gz 22.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for semantic-diff 0.1.0
File Interpreter ABI Platform
semantic_diff-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 36.9 kB

Release files / semantic_diff-0.1.0.tar.gz

Download URL semantic_diff-0.1.0.tar.gz
Size 22.5 kB
Tags Source
SHA-256 checksum
How to use checksums
32d86d46a97f24425c2bc06dd5d9d9e67d96c3219a51f565f859cfc9c4854d11
BLAKE2b-256 checksum
How to use checksums
d3f42f8f495c9a0596470ab90bb905a565acb3cae92359ecac21513c3ec12c4f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.4

Release files / semantic_diff-0.1.0-py3-none-any.whl

Download URL semantic_diff-0.1.0-py3-none-any.whl
Size 14.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
638001d78b7df5ec5f6a8a5277fdfaf2d4f5e331a8d66819f43ad9bc3011d2c8
BLAKE2b-256 checksum
How to use checksums
b61423b32aba638e645cd83f16b0400ca781d8733e593ba92d795a18d3fa6513
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.4

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page