Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/social-preview-template.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
┃ ┃
┃ ┃
┃ ┌─────────────────────────────────────────┐ ┃
┃ │ Devscope: B · Low risk · Easy │ ┃
┃ │ Local Git context for coding agents │ ┃
┃ │ onboarding · 0.06s ⚡ │ ┃
┃ └─────────────────────────────────────────┘ ┃
┃ ┃
Expand Down Expand Up @@ -40,7 +40,7 @@ TEXT LAYOUT:

3. Sample Output Box
- Position: Center-bottom (480px from top)
- Content: "Devscope: B · Low risk · Easy onboarding · 0.06s ⚡"
- Content: "Local Git history · private · read-only · fast"
- Font: Monospace, ~38px
- Color: #79c0ff (light blue)
- Background: Semi-transparent box (#1a1f3a with 60% opacity)
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## 0.4.0 — 2026-12-05

- Added five local, read-only MCP tools for agent access to fix history, ownership,
co-change facts, import blast radius and changed-file context.
- Added portable Claude Code, Cursor and Codex MCP configuration plus an opt-in,
fail-open working-tree hook.
- Removed predictive risk ranking and the legacy `file_risk` MCP tool after the
preregistered P3b evaluation found no improvement over ranking by file size.
- Published the complete negative result, paired per-unit data and methodology.
- Requires Python 3.11 or newer and tests Python 3.13 in CI.

## 0.3.0 — 2026-12-04

- Guided `devscope demo` with labelled synthetic data, no Git or repository required.
Expand Down
46 changes: 29 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Devscope

**Review the right files first—with evidence.**
**Give coding agents local Git-history context.**

A local CLI and GitHub Action that help you focus a code review, understand an
unfamiliar repository, and share readable reports with your team.
Expand All @@ -9,24 +9,36 @@ unfamiliar repository, and share readable reports with your team.
[![PyPI](https://img.shields.io/pypi/v/devscope.svg)](https://pypi.org/project/devscope/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/EhsanAzish80/Devscope/blob/main/LICENSE)

## The result, honestly

We tried to beat “review the biggest file first” with Git history across 44
repositories. We could not. In the preregistered final test, Devscope v2 differed
from size-only file-level Recall@3 by **+0.003** on held-out repositories, with a
95% confidence interval of **-0.037 to +0.051**. Co-change history also did not
predict fewer later fixes when the usual partner was included.

Devscope therefore makes **no predictive risk claim**. Version 0.4.0 is a free,
open-source way to give coding agents inspectable facts: traced fix history,
recent owners, files that often changed together and import blast radius.
[Read the result](docs/negative-result.md) or inspect the
[methodology and raw paired data](docs/methodology.md).

```bash
pipx install devscope==0.3.0
pipx install devscope==0.4.0
devscope demo
```

The demo needs no repository or Git. Its sample paths, history and coverage are
clearly labelled synthetic. Python 3.11+ is required; Git is needed for real PR
reviews. Already installed? Run `pipx upgrade devscope`.

![Terminal demo: prioritized files, evidence and next commands](https://raw.githubusercontent.com/EhsanAzish80/Devscope/main/docs/assets/terminal-demo.jpg)

## Choose your starting point

| I want to… | Start here | What you get |
| --- | --- | --- |
| Understand a repository | [Explore a repository](#explore-a-repository) | Modules, entry-point candidates, test locations and declared commands |
| Focus a code review | [Review a PR](#review-a-pr) | Changed files ranked with size, history, co-change and optional coverage evidence |
| Give an AI coding agent local history | [Connect an MCP client](#connect-an-mcp-client) | Six read-only tools for changes, co-change, fix facts, owners and blast radius |
| Focus a code review | [Review a PR](#review-a-pr) | Changed files with configured findings and optional coverage evidence |
| Give an AI coding agent local history | [Connect an MCP client](#connect-an-mcp-client) | Five read-only tools for changes, co-change facts, fix history, owners and blast radius |
| Share results with reviewers | [Add to GitHub Actions](#add-to-github-actions) | An updated PR comment and downloadable HTML/JSON/Markdown reports |

## Explore a repository
Expand Down Expand Up @@ -63,9 +75,7 @@ devscope demo --format html --output demo.html
Open the HTML file in your browser. It includes search, evidence and complete
report data, with no external scripts or fonts.

![Offline HTML report generated by devscope demo; all data is synthetic](https://raw.githubusercontent.com/EhsanAzish80/Devscope/main/docs/assets/html-report.jpg)

[Download the standalone sample HTML](https://github.com/EhsanAzish80/Devscope/releases/download/v0.3.0/devscope-demo.html)
[Download the standalone sample HTML](https://github.com/EhsanAzish80/Devscope/releases/download/v0.4.0/devscope-demo.html)
· [View its structured data](https://github.com/EhsanAzish80/Devscope/blob/main/docs/assets/demo.json)

## Connect an MCP client
Expand All @@ -79,21 +89,23 @@ devscope mcp install --client claude-code --path .
```

The installer preserves existing configuration and refuses to replace an existing
`devscope` entry. The server exposes six read-only tools: `review_changes`,
`cochange`, `file_risk`, `fix_history`, `owners` and `blast_radius`. It reads local
`devscope` entry. The server exposes five read-only tools: `review_changes`,
`cochange`, `fix_history`, `owners` and `blast_radius`. It reads local
Git history without running repository code or using the network. A cold history
index builds in the background; retry the tool when it returns `index_building`.
The `file_risk` compatibility name currently returns fix SHAs, churn and owners,
not a risk score. Codex reads `.codex/config.toml` only after the project is trusted.
Co-change output is historical context, not a warning or prediction. Codex reads
`.codex/config.toml` only after the project is trusted.

For a lightweight pre-commit or agent hook, check all working-tree files without blocking by
default:

```bash
devscope check . --working-tree --format claude-stop
devscope check . --working-tree --format claude-stop --strict # opt-in blocking mode
```

The hook is opt-in, advisory and fail-open. Its neutral message says that two files
often changed together and asks the agent to check whether that history is relevant.

## Add to GitHub Actions

Save this as `.github/workflows/devscope.yml`. This starts with **advisory** review;
Expand All @@ -113,10 +125,10 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- uses: EhsanAzish80/devscope-action@v1.3.0
- uses: EhsanAzish80/devscope-action@v1.4.0
with:
review: 'true'
devscope-version: '0.3.0'
devscope-version: '0.4.0'
```

The Action updates one bot comment and uploads HTML, JSON and Markdown artifacts.
Expand Down Expand Up @@ -146,7 +158,7 @@ comment is skipped. For summary-only reporting, use the [read-only CLI workflow]
[All commands](https://github.com/EhsanAzish80/Devscope/blob/main/docs/commands.md) · [Changelog](https://github.com/EhsanAzish80/Devscope/blob/main/CHANGELOG.md)

Without pipx, use a virtual environment: `python3 -m venv .venv`, activate it, then
`python -m pip install devscope==0.3.0`. On macOS/Linux activation is
`python -m pip install devscope==0.4.0`. On macOS/Linux activation is
`source .venv/bin/activate`; on Windows PowerShell use `.venv\Scripts\Activate.ps1`.

For development: `uv sync --all-extras`, `uv run pytest`, `uv run ruff check src/devscope tests`
Expand Down
6 changes: 3 additions & 3 deletions docs/assets/demo.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<!doctype html>
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>Devscope · Demo · PR review</title>
<style>body{margin:0;background:#f4f7fb;color:#172338;font:16px/1.6 system-ui,sans-serif}header{background:#142a40;color:white;padding:36px max(24px,calc((100vw - 1080px)/2))}header span{color:#8fe2cd}h1{margin:.3em 0}main{max-width:1080px;margin:auto;padding:24px}article,details{background:white;border:1px solid #dce4ed;border-radius:12px;padding:20px;margin:16px 0}h2{font-size:19px;overflow-wrap:anywhere}input{font:inherit;padding:12px;width:min(90%,500px);border:1px solid #aab9c8;border-radius:8px}a{color:#086f74}pre{white-space:pre-wrap;overflow-wrap:anywhere;font-size:13px}table{width:100%;border-collapse:collapse;background:white}th,td{text-align:left;border-bottom:1px solid #dce4ed;padding:12px;overflow-wrap:anywhere}code{overflow-wrap:anywhere}[hidden]{display:none}@media(max-width:600px){table{font-size:12px}th,td{padding:5px}}</style></head>
<body><header><span>DEVSCOPE / SYNTHETIC DEMO</span><h1>Demo · PR review</h1><p>2 new warnings · 2 changed source files</p></header><main><label for="filter">Filter files and evidence</label><br><input id="filter" type="search" placeholder="Search this report…"><article class="item"><h2>billing/service.py</h2><p>635 lines · 12 target-history commits</p><ul><li><b>new · large-file</b>: 635 lines exceeds the configured 500-line review threshold</li><li><b>new · uncovered-added-lines</b>: 12 added executable lines have zero hits in the supplied report</li><li>Review interactions with <code>billing/models.py</code> (6 co-changes)</li></ul></article><article class="item"><h2>auth/session.py</h2><p>148 lines · 3 target-history commits</p><ul><li>No configured warning; review behavior and tests.</li></ul></article><article class="item"><h2>Supplied patch coverage</h2><p>93.4% of mapped added executable lines · 12 zero-hit · 0 unmapped added lines</p></article><article class="item"><h2>History-aware hotspots</h2><p>Ranked by lines × observed commits; review heuristics, not defect predictions.</p><ul><li><code>billing/service.py</code>: 635 lines × 12 target-history commits</li><li><code>billing/models.py</code>: 210 lines × 6 target-history commits</li></ul></article><h2>All configured findings</h2><table><thead><tr><th>Status</th><th>File</th><th>Rule</th><th>Evidence</th></tr></thead><tbody><tr class="item"><td>new</td><td><code>billing/service.py</code></td><td>large-file</td><td>635 lines exceeds the configured 500-line review threshold</td></tr><tr class="item"><td>new</td><td><code>billing/service.py</code></td><td>uncovered-added-lines</td><td>12 added executable lines have zero hits in the supplied report</td></tr></tbody></table><h2>Interpretation</h2><ul><li>File size and churn are review heuristics, not defect predictions.</li><li>Coverage percentages apply only to mapped added executable lines in a supplied report.</li><li>Begin with advisory reports; enable blocking gates only after choosing your policy.</li><li>Demo: all paths, commits, history and coverage are synthetic. No repository was scanned and no tests were executed.</li></ul><details><summary>Complete report data, including coverage and revision provenance</summary><pre>{
&quot;schema_version&quot;: &quot;1.0&quot;,
<body><header><span>DEVSCOPE / SYNTHETIC DEMO</span><h1>Demo · PR review</h1><p>2 new warnings · 2 changed source files</p></header><main><label for="filter">Filter files and evidence</label><br><input id="filter" type="search" placeholder="Search this report…"><article class="item"><h2>billing/service.py</h2><ul><li><b>new · large-file</b>: 635 lines exceeds the configured 500-line review threshold</li><li><b>new · uncovered-added-lines</b>: 12 added executable lines have zero hits in the supplied report</li></ul></article><article class="item"><h2>auth/session.py</h2><ul></ul></article><article class="item"><h2>Supplied patch coverage</h2><p>93.4% of mapped added executable lines · 12 zero-hit · 0 unmapped added lines</p></article><h2>All configured findings</h2><table><thead><tr><th>Status</th><th>File</th><th>Rule</th><th>Evidence</th></tr></thead><tbody><tr class="item"><td>new</td><td><code>billing/service.py</code></td><td>large-file</td><td>635 lines exceeds the configured 500-line review threshold</td></tr><tr class="item"><td>new</td><td><code>billing/service.py</code></td><td>uncovered-added-lines</td><td>12 added executable lines have zero hits in the supplied report</td></tr></tbody></table><h2>Interpretation</h2><ul><li>File size and churn are review heuristics, not defect predictions.</li><li>Coverage percentages apply only to mapped added executable lines in a supplied report.</li><li>Begin with advisory reports; enable blocking gates only after choosing your policy.</li><li>Demo: all paths, commits, history and coverage are synthetic. No repository was scanned and no tests were executed.</li></ul><details><summary>Complete report data, including coverage and revision provenance</summary><pre>{
&quot;schema_version&quot;: 3,
&quot;kind&quot;: &quot;review&quot;,
&quot;demo&quot;: true,
&quot;target_commit&quot;: &quot;1111111111111111111111111111111111111111&quot;,
Expand Down Expand Up @@ -171,4 +171,4 @@
&quot;Begin with advisory reports; enable blocking gates only after choosing your policy.&quot;
]
}</pre></details></main>
<script>document.getElementById('filter').addEventListener('input',function(){const q=this.value.toLowerCase();document.querySelectorAll('.item').forEach(el=>{el.hidden=!el.textContent.toLowerCase().includes(q)})});</script></body></html>
<script>document.getElementById('filter').addEventListener('input',function(){const q=this.value.toLowerCase();document.querySelectorAll('.item').forEach(el=>{el.hidden=!el.textContent.toLowerCase().includes(q)})});</script></body></html>
Loading
Loading