DiffInsight is a developer tool that transforms Git diffs into clear, structured, and risk-assessed code review reports. Designed for developers, team leads, and code reviewers, it highlights what changed, why it matters, and what risks it carries β powered by a local LLM and presented in a clean, dark-themed web interface.
Upload a .diff, .patch, or .txt file (or paste your diff directly), and DiffInsight generates actionable insights, a 5-axis risk radar, and a team-aware change breakdown β all running fully locally, no cloud required.
- LLM-powered code review reports via Ollama (
deepseek-coder:6.7b) β runs entirely on your machine. - Two review modes: Senior Reviewer (concise, critical) and Junior Mentor (explanatory, educational).
- 5-axis Risk Radar β pattern-based scoring across Security, Performance, Complexity, Stability, and Testing.
- Change Intelligence panel β team-aware diff breakdown that works on any language:
- Which architectural layers were touched (Backend, LLM/AI, Security, Frontend, Tests, Config, Databaseβ¦)
- Per-file change classification: NEW, MODIFIED, REFACTORED, EXPANDED, DELETED
- Merge conflict candidate detection with High/Medium/Low risk per file
- Churn bar visualisation showing relative size of each change
- File type (extension) breakdown
- Tech Assistant β ask any technical question, topic auto-detected, answered by the local LLM.
- GitHub Explorer β search repositories by topic, filter by language, sort by stars/forks/issues/watchers/updated.
- Secrets via HashiCorp Vault β GitHub token stored and retrieved securely; falls back to
GITHUB_TOKENenv var. - Rate limiting β 10 requests per 60 seconds per IP.
- File upload + paste β upload
.diff/.patch/.txt(max 5MB) or paste a diff directly into the UI. - Health indicators β live Ollama and Vault status dots in the sidebar.
- Supports standard git diff,
diff -ruN, and most unified diff variants.
- Accelerates code reviews β identify critical issues without manually scanning every line.
- Reduces merge risk β conflict candidates are flagged before you merge.
- Team-aware β when multiple people share a repo, Change Intelligence shows exactly which layers and files each diff touches, making coordination easier.
- Educates junior developers β Junior Mentor mode explains changes with context and best-practice guidance.
- Fully local β your code never leaves your machine. LLM inference runs via Ollama, secrets via Vault.
- Software engineers wanting faster, more consistent code reviews.
- Team leads seeking risk-aware insights before approving merges.
- Junior developers learning best practices through guided diff explanations.
- Teams sharing a dev machine or repo who need to coordinate changes without stepping on each other.
- Open-source contributors reviewing PRs or comparing branches.
diffinsight/
βββ backend/
β βββ main.py # FastAPI app, endpoints, radar scoring
β βββ llm/
β β βββ analyzer.py # LLM diff analysis (reviewer/junior modes)
β β βββ tech_assistant.py # Tech Q&A with topic detection
β βββ security/
β β βββ secret_manager.py # HashiCorp Vault + env var fallback
β βββ services/
β β βββ github_service.py # GitHub search (sort, filter, paginate)
β βββ utils/
β βββ change_intelligence.py # Team-aware diff breakdown (NEW)
β βββ risk.py # Risk level computation
βββ frontend/
β βββ templates/
β β βββ index.html # Main UI
β βββ static/
β βββ script.js # All frontend logic + Change Intelligence renderer
β βββ style.css # Dark theme styles
βββ dev.ps1 # PowerShell dev runner
βββ requirements.txt
- Python 3.10+
- Ollama installed and running
- HashiCorp Vault (optional β for GitHub Explorer)
- A GitHub personal access token (for GitHub Explorer)
git clone https://github.com/ShreyaVijaykumar/Diff-Insight.git
cd diffinsightpip install -r requirements.txtollama pull deepseek-coder:6.7bollama serveOpen a PowerShell terminal and start Vault in dev mode:
vault server -devCopy the Root Token printed in the terminal (starts with hvs.). Then open a second terminal and run:
# Set Vault address
$env:VAULT_ADDR="http://127.0.0.1:8200"
# Set your root token
$env:VAULT_TOKEN="hvs.<YOUR_ROOT_TOKEN>"
# Store your GitHub personal access token
vault kv put secret/github token=<YOUR_GITHUB_TOKEN>To verify everything is set correctly:
echo $env:VAULT_ADDR
echo $env:VAULT_TOKEN
vault kv get secret/githubNo Vault? You can skip this and set
GITHUB_TOKEN=<your_token>as a regular environment variable instead. GitHub Explorer will fall back to it automatically.
From the project root (diffinsight/):
uvicorn backend.main:app --reloadOr use the PowerShell dev runner:
powershell -ExecutionPolicy Bypass -File dev.ps1http://127.0.0.1:8000/
# Unstaged changes
git diff
# Staged changes
git diff --staged
# All changes since last commit
git diff HEAD
# Compare two commits
git diff <commit-id-1> <commit-id-2> > my_diff.txt
# Compare two branches
git diff main feature-branch > branch_diff.txt
# Compare a specific file
git diff <file-path> > file_diff.txt
# Compare tags
git diff v1.0 v1.1 > tag_diff.txtSave the output with > to create a .txt or .diff file, then upload it to DiffInsight β or paste the output directly using the Paste Diff toggle.
| Symbol | Meaning |
|---|---|
--- a/file.txt |
Original file |
+++ b/file.txt |
Updated file |
@@ -m,n +o,p @@ |
Hunk header (line numbers) |
- |
Line removed |
+ |
Line added |
| (no symbol) | Unchanged context |
For a graphical comparison:
git difftool- Upload or paste a
.diff,.patch, or.txtfile. - DiffInsight normalises the diff (handles git diff,
diff -ruN, and similar formats). - Risk Radar scores the diff across 5 axes using regex-based pattern detection β no LLM needed for this step, so it's instant.
- Change Intelligence parses every file in the diff and classifies it by layer, change type, and merge conflict risk β also instant, works on any language.
- LLM report is generated by Ollama using the selected mode (Senior Reviewer or Junior Mentor).
- Everything is displayed in the single-page dashboard β no page reload needed.
- Toggle between file upload and paste input.
- Select Senior Reviewer (concise, critical) or Junior Mentor (educational, step-by-step).
- Stats bar shows files changed, lines added/removed, functions modified, and overall risk level.
Pattern-based scores (0β10) across five dimensions:
| Axis | What it detects |
|---|---|
| Security | Hardcoded secrets, auth/crypto keywords, sensitive patterns |
| Performance | N+1 query patterns, loops with DB calls, missing cache/async |
| Complexity | Branch depth, nesting, lambda/comprehension density, net line growth |
| Stability | Config/migration file changes, API surface churn, deletion ratio |
| Testing | Assert/mock/test function presence, untested addition penalty |
Replaces the dependency graph with a team-friendly breakdown that works on any language:
- Summary bar β one-line description: how many files, which layers, additive/refactor/mixed/destructive.
- Layers Touched β which parts of the codebase were affected (LLM/AI, Security, Backend, Frontend JS/CSS, Frontend HTML, Tests, Config/Infra, Database, Docsβ¦).
- Merge Conflict Candidates β files flagged High or Medium risk based on deletion ratio and churn volume.
- File Breakdown β every changed file with change type badge, +/- counts, conflict risk, and a proportional churn bar.
- File Types β extension summary for a quick "was this a backend-only or full-stack change?" read.
Ask any technical question in plain English. The assistant auto-detects the topic (40+ keywords including Python, FastAPI, Docker, PostgreSQL, Redis, Terraform, AWS, PyTorch, RAG, and more) and answers with a structured explanation, real-world example, industry use, and common misconception.
Search GitHub repositories by topic, filter by language, and sort by:
- β Most Stars
- π΄ Most Forks
- π Recently Updated
- π Most Issues
- ποΈ Most Watchers
Results show name, description, all 5 metrics, last updated date, and a direct link.
DIFFINSIGHT REPORT
------------------
Risk Level : HIGH
TITLE: Refactor login flow
CHANGE_SUMMARY: Simplified authentication logic and fixed edge cases
MODIFIED_FILES: auth.py, login.py
WHAT_CHANGED: Updated login flow, added error handling
WHY_CHANGED: Improve security and readability
RISK_LEVEL: HIGH
IMPACT: High risk on authentication
REVIEWER_NOTES: Ensure unit tests are added for all new auth paths
Change Intelligence panel example output:
π Mixed | 4 files changed across 3 layers (Backend, LLM / AI, Tests) β +87 / -32 lines
Layers Touched: βοΈ Backend (2) π€ LLM / AI (1) π§ͺ Tests (1)
β οΈ Merge Conflict Candidates
backend/utils/risk.py High risk +2 / -9
backend/main.py Medium risk +15 / -6
File Breakdown:
REFACTORED backend/utils/risk.py βοΈ Backend +2 -9 High conflict risk
EXPANDED backend/main.py βοΈ Backend +15 -6 Medium conflict risk
NEW backend/llm/analyzer.py π€ LLM / AI +58 -0 Low conflict risk
MODIFIED tests/test_risk.py π§ͺ Tests +12 -17 Low conflict risk
- Reduces time spent manually reviewing diffs.
- Flags merge conflict candidates before they cause problems.
- Gives team members visibility into which layers a change touches.
- Educates junior developers through structured, mode-aware explanations.
- Keeps all analysis local β no data leaves your machine.
- GitHub tokens are stored in HashiCorp Vault (KV v2), never in code or
.envfiles. - Vault token is stripped of whitespace on read to prevent header injection bugs.
- If Vault is unavailable, the app falls back to the
GITHUB_TOKENenvironment variable. - The LLM runs locally via Ollama β no diff content is sent to external APIs.
- Rate limiting (10 req/60s per IP) is applied to all endpoints.