Turn code changes into agent-consumable specs
Turn any code change — a GitHub PR, a local branch, staged edits — into a structured, agent-consumable spec with intent drift detection. CLI *and* MCP server — use it from the terminal or as a plugin in Claude Code, Cursor, and Windsurf.
npx pr-to-spec scan --branch main --json What It Does
Declare intent
Tell pr-to-spec what you're building, scope, and risk ceiling
Make changes
Work normally in your branch
Check drift
pr-to-spec check --json produces a structured spec + drift signals
Agent consumes
Any agent reads the envelope and acts accordingly
Quick Start
Local Diff
Intent + Drift
GitHub PR
MCP Server Tools
analyze_pr
Analyze a GitHub PR and generate a structured spec
scan_local
Scan local git changes (branch, staged, commits)
check_drift
Check changes against declared intent for drift
set_intent
Declare what a code change should accomplish
show_intent
Show the current intent declaration
analyze_assumptions
Surface implicit decisions with 2x2 matrix
Plugin Installation
claude plugin add jeremylongshore/pr-to-spec Agent Protocol
{
"version": 1,
"command": "check",
"status": "drift_detected",
"exit_code": 3,
"signals": [
{
"type": "forbidden_touch",
"description": "1 forbidden file(s) modified",
"severity": "high",
"details": ["src/db/schema.ts"]
}
],
"spec": { ... },
"intent": { ... }
} Exit Codes
Exit 0
Clean — no issues
Exit 1
Error
Exit 2
High-risk changes detected
Exit 3
Drift from declared intent
Exit 4
Gate policy failed
Drift Signals
scope_creep
Files changed outside `expected_scope`
forbidden_touch
Files matching `forbidden_scope` were modified
risk_escalation
Detected risk level exceeds `max_risk`
size_overrun
Total LOC changed exceeds `size_budget`
type_mismatch
Inferred change type doesn't match `expected_type`
Get Started
Install from npm and start generating specs in seconds.