@in-the-loop-labs/pair-review 1.1.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/README.md +155 -2
  2. package/bin/pair-review.js +23 -8
  3. package/package.json +6 -2
  4. package/plugin/.claude-plugin/plugin.json +20 -0
  5. package/plugin/.mcp.json +9 -0
  6. package/plugin/skills/ai-critic/SKILL.md +47 -0
  7. package/plugin/skills/analyze/SKILL.md +162 -0
  8. package/plugin/skills/local/SKILL.md +29 -0
  9. package/plugin/skills/pr/SKILL.md +28 -0
  10. package/plugin/skills/user-critic/SKILL.md +41 -0
  11. package/plugin-code-critic/.claude-plugin/plugin.json +19 -0
  12. package/plugin-code-critic/skills/analyze/SKILL.md +132 -0
  13. package/plugin-code-critic/skills/analyze/references/level1-balanced.md +123 -0
  14. package/plugin-code-critic/skills/analyze/references/level1-fast.md +90 -0
  15. package/plugin-code-critic/skills/analyze/references/level1-thorough.md +202 -0
  16. package/plugin-code-critic/skills/analyze/references/level2-balanced.md +138 -0
  17. package/plugin-code-critic/skills/analyze/references/level2-fast.md +97 -0
  18. package/plugin-code-critic/skills/analyze/references/level2-thorough.md +245 -0
  19. package/plugin-code-critic/skills/analyze/references/level3-balanced.md +171 -0
  20. package/plugin-code-critic/skills/analyze/references/level3-fast.md +110 -0
  21. package/plugin-code-critic/skills/analyze/references/level3-thorough.md +332 -0
  22. package/plugin-code-critic/skills/analyze/references/orchestration-balanced.md +149 -0
  23. package/plugin-code-critic/skills/analyze/references/orchestration-fast.md +103 -0
  24. package/plugin-code-critic/skills/analyze/references/orchestration-thorough.md +316 -0
  25. package/plugin-code-critic/skills/analyze/scripts/git-diff-lines +371 -0
  26. package/plugin-code-critic/skills/loop/SKILL.md +373 -0
  27. package/public/css/pr.css +66 -5
  28. package/public/css/repo-settings.css +17 -37
  29. package/public/index.html +1 -1
  30. package/public/js/components/AnalysisConfigModal.js +104 -7
  31. package/public/js/local.js +42 -0
  32. package/public/js/pr.js +41 -0
  33. package/public/js/utils/tier-icons.js +1 -0
  34. package/public/setup.html +880 -0
  35. package/src/ai/analyzer.js +54 -91
  36. package/src/ai/claude-provider.js +61 -7
  37. package/src/ai/cursor-agent-provider.js +757 -0
  38. package/src/ai/index.js +20 -1
  39. package/src/ai/prompts/config.js +1 -4
  40. package/src/ai/prompts/line-number-guidance.js +111 -0
  41. package/src/ai/prompts/render-for-skill.js +91 -0
  42. package/src/ai/provider-availability.js +151 -0
  43. package/src/ai/provider.js +1 -0
  44. package/src/ai/stream-parser.js +87 -1
  45. package/src/config.js +1 -1
  46. package/src/database.js +71 -20
  47. package/src/github/client.js +31 -14
  48. package/src/main.js +16 -160
  49. package/src/mcp-stdio.js +59 -0
  50. package/src/routes/analysis.js +265 -44
  51. package/src/routes/config.js +58 -3
  52. package/src/routes/local.js +73 -37
  53. package/src/routes/mcp.js +846 -0
  54. package/src/routes/setup.js +283 -0
  55. package/src/routes/shared.js +49 -0
  56. package/src/routes/worktrees.js +42 -267
  57. package/src/server.js +42 -6
  58. package/src/setup/local-setup.js +134 -0
  59. package/src/setup/pr-setup.js +375 -0
  60. package/src/utils/logger.js +17 -7
package/README.md CHANGED
@@ -33,7 +33,7 @@ pair-review is a local web application that transforms how you review code, espe
33
33
  - **Local-First**: All data and processing happens on your machine - no cloud dependencies
34
34
  - **GitHub-Familiar UI**: Interface feels instantly familiar to GitHub users
35
35
  - **Human-in-the-Loop**: AI suggests, you decide
36
- - **Multiple AI Providers**: Support for Claude, Gemini, Codex, Copilot, and OpenCode. Use your existing subscription!
36
+ - **Multiple AI Providers**: Support for Claude, Gemini, Codex, Copilot, OpenCode, and Cursor. Use your existing subscription!
37
37
  - **Progressive**: Start simple with manual review, add AI analysis when you need it
38
38
 
39
39
  ## Quick Start
@@ -141,7 +141,7 @@ Configuration is stored in `~/.pair-review/config.json`:
141
141
  ```json
142
142
  {
143
143
  "github_token": "ghp_your_token_here",
144
- "port": 3000,
144
+ "port": 7247,
145
145
  "theme": "light",
146
146
  "default_provider": "claude",
147
147
  "default_model": "sonnet"
@@ -164,6 +164,7 @@ pair-review supports several environment variables for customizing behavior:
164
164
  | `PAIR_REVIEW_CODEX_CMD` | Custom command to invoke Codex CLI | `codex` |
165
165
  | `PAIR_REVIEW_COPILOT_CMD` | Custom command to invoke Copilot CLI | `copilot` |
166
166
  | `PAIR_REVIEW_OPENCODE_CMD` | Custom command to invoke OpenCode CLI | `opencode` |
167
+ | `PAIR_REVIEW_CURSOR_AGENT_CMD` | Custom command to invoke Cursor Agent CLI | `agent` |
167
168
  | `PAIR_REVIEW_MODEL` | Override the AI model to use (same as `--model` flag) | Provider default |
168
169
 
169
170
  **Note:** `GITHUB_TOKEN` is the standard environment variable used by many GitHub tools (gh CLI, GitHub Actions, etc.). When set, it takes precedence over the `github_token` field in the config file.
@@ -216,6 +217,7 @@ pair-review integrates with AI providers via their CLI tools:
216
217
  - **Codex**: Uses Codex CLI
217
218
  - **GitHub Copilot**: Uses Copilot CLI
218
219
  - **OpenCode**: Uses OpenCode CLI (requires model configuration)
220
+ - **Cursor**: Uses Cursor Agent CLI (streaming output with sandbox mode)
219
221
 
220
222
  You can select your preferred provider and model in the repository settings UI.
221
223
 
@@ -362,6 +364,157 @@ Perfect for:
362
364
  - Reviewing only the unstaged files that are still changing
363
365
  - Staging the files you've already reviewed and viewing the next round of changes
364
366
 
367
+ ## Claude Code Plugins
368
+
369
+ pair-review provides two [Claude Code plugins](https://code.claude.com/docs/en/plugins) that bring AI-powered code review directly into Claude Code.
370
+
371
+ ### code-critic — Standalone Analysis
372
+
373
+ AI-powered code review analysis that works without any server or MCP dependency. Install this plugin for three-level AI analysis and implement-review-fix loops directly in your coding agent.
374
+
375
+ **Install via Marketplace:**
376
+
377
+ ```
378
+ /plugin marketplace add in-the-loop-labs/pair-review
379
+ /plugin install pair-review@code-critic
380
+ ```
381
+
382
+ **Available Skills:**
383
+
384
+ | Skill | Description |
385
+ |-------|-------------|
386
+ | `/code-critic:analyze` | Run three-level AI analysis using Task agents directly (standalone, no server needed) |
387
+ | `/code-critic:loop` | Implement code, review with AI, fix issues, and repeat until clean |
388
+
389
+ These skills work standalone. If the pair-review MCP server happens to be available (from the pair-review plugin), `code-critic:analyze` will use it for prompts and push results to the web UI — but it's entirely optional.
390
+
391
+ ### pair-review — App Integration
392
+
393
+ Full integration with the pair-review web UI via MCP. Install this plugin to open reviews in the browser, run server-side AI analysis, and address review feedback.
394
+
395
+ **Install via Marketplace:**
396
+
397
+ ```
398
+ /plugin marketplace add in-the-loop-labs/pair-review
399
+ /plugin install pair-review@pair-review
400
+ ```
401
+
402
+ **Available Skills:**
403
+
404
+ | Skill | Description |
405
+ |-------|-------------|
406
+ | `/pair-review:pr` | Open the current branch's GitHub PR in the pair-review web UI |
407
+ | `/pair-review:local` | Open local uncommitted changes in the pair-review web UI |
408
+ | `/pair-review:analyze` | Run AI analysis via the pair-review MCP server (results appear in web UI) |
409
+ | `/pair-review:user-critic` | Fetch and address human review comments from pair-review |
410
+ | `/pair-review:ai-critic` | Fetch and address AI-generated suggestions from pair-review |
411
+
412
+ This plugin includes the pair-review MCP server, which starts automatically when the plugin is enabled.
413
+
414
+ ### Alternative: Load Plugins Locally
415
+
416
+ If you prefer not to use the marketplace, load plugins directly from an npm-installed or cloned copy:
417
+
418
+ ```bash
419
+ # From a local clone
420
+ claude --plugin-dir ./path/to/pair-review/plugin-code-critic
421
+ claude --plugin-dir ./path/to/pair-review/plugin
422
+
423
+ # From a globally installed npm package
424
+ claude --plugin-dir "$(npm root -g)/@in-the-loop-labs/pair-review/plugin-code-critic"
425
+ claude --plugin-dir "$(npm root -g)/@in-the-loop-labs/pair-review/plugin"
426
+ ```
427
+
428
+ ### Team Setup
429
+
430
+ To pre-configure plugins for all contributors on a repository, add this to your `.claude/settings.json`:
431
+
432
+ ```json
433
+ {
434
+ "extraKnownMarketplaces": {
435
+ "pair-review": {
436
+ "source": {
437
+ "source": "github",
438
+ "repo": "in-the-loop-labs/pair-review"
439
+ }
440
+ }
441
+ },
442
+ "enabledPlugins": {
443
+ "pair-review@code-critic": true,
444
+ "pair-review@pair-review": true
445
+ }
446
+ }
447
+ ```
448
+
449
+ Team members will be prompted to install the marketplace and plugins when they trust the repository folder.
450
+
451
+ ## MCP Integration
452
+
453
+ pair-review exposes a [Model Context Protocol (MCP)](https://modelcontextprotocol.io) interface, allowing AI coding agents to programmatically read review feedback. The MCP server is included automatically when you install the pair-review Claude Code plugin. For standalone MCP setup (without the plugin), see [Standalone MCP Setup](#standalone-mcp-setup-without-plugin) below.
454
+
455
+ ### Transport Modes
456
+
457
+ **stdio (recommended)** — run pair-review as a stdio MCP server. The agent communicates via stdin/stdout JSON-RPC while the web UI launches on a local port for the human reviewer:
458
+
459
+ ```bash
460
+ npx @in-the-loop-labs/pair-review --mcp
461
+ ```
462
+
463
+ **HTTP** — the Streamable HTTP endpoint at `http://localhost:7247/mcp` (stateless mode) is available whenever the pair-review web server is running.
464
+
465
+ ### Available Tools
466
+
467
+ | Tool | Description | Availability |
468
+ |------|-------------|--------------|
469
+ | `get_server_info` | Get pair-review server info including web UI URL and version | stdio only |
470
+ | `get_analysis_prompt` | Get rendered analysis prompts for a review level and tier | stdio + HTTP |
471
+ | `get_user_comments` | Get human-curated review comments (authored or adopted), grouped by file | stdio + HTTP |
472
+ | `get_ai_analysis_runs` | List all AI analysis runs for a review | stdio + HTTP |
473
+ | `get_ai_suggestions` | Get AI-generated suggestions from the latest analysis run, or from a specific run via `runId` | stdio + HTTP |
474
+ | `start_analysis` | Start an AI analysis in the app for local or PR changes | stdio + HTTP |
475
+
476
+ All review tools accept lookup parameters:
477
+ - **Local reviews**: `path` + `headSha`
478
+ - **PR reviews**: `repo` (e.g. `"owner/repo"`) + `prNumber`
479
+
480
+ `get_ai_suggestions` also accepts an optional `runId` to target a specific analysis run (discovered via `get_ai_analysis_runs`), bypassing the need for review lookup parameters.
481
+
482
+ ### Standalone MCP Setup (Without Plugin)
483
+
484
+ If you want just the MCP tools without the full plugin (no skills), you can add the MCP server directly to any coding agent that supports MCP (Claude Code, Cursor, Windsurf, etc.).
485
+
486
+ #### Generic MCP Configuration
487
+
488
+ **stdio transport (recommended)** — run pair-review as a child process. The agent communicates via stdin/stdout JSON-RPC:
489
+
490
+ - **Command:** `npx @in-the-loop-labs/pair-review --mcp`
491
+ - **Environment variables:** Set `GITHUB_TOKEN` if you want PR review support (not needed for local-only reviews). GitHub token will also be read from `~/.pair-review/config.json` if configured.
492
+
493
+ **HTTP transport** — connect to a running pair-review instance:
494
+
495
+ - **URL:** `http://localhost:7247/mcp` (stateless Streamable HTTP)
496
+ - Start the server first with `npx @in-the-loop-labs/pair-review` or by opening a PR review, then point your agent at the HTTP endpoint.
497
+
498
+ You can also copy the `plugin/.mcp.json` file from this package into your project for agents that support `.mcp.json` discovery.
499
+
500
+ #### Claude Code Specific
501
+
502
+ Add the MCP server via the Claude Code CLI:
503
+
504
+ **stdio transport (recommended):**
505
+
506
+ ```bash
507
+ claude mcp add pair-review -- npx @in-the-loop-labs/pair-review --mcp
508
+ ```
509
+
510
+ **HTTP transport:**
511
+
512
+ ```bash
513
+ claude mcp add --transport http pair-review http://localhost:7247/mcp
514
+ ```
515
+
516
+ These commands update your MCP configuration in `~/.claude/settings.json` (user-level) or your project's `.claude/settings.json` (project-level).
517
+
365
518
  ## Development
366
519
 
367
520
  ### Prerequisites
@@ -3,25 +3,40 @@
3
3
 
4
4
  const path = require('path');
5
5
  const { spawn } = require('child_process');
6
- const updateNotifier = require('update-notifier');
7
6
  const pkg = require('../package.json');
8
7
 
9
- // Check for updates and notify user
10
- updateNotifier({ pkg }).notify();
8
+ const args = process.argv.slice(2);
9
+ const isMCP = args.includes('--mcp');
10
+
11
+ // Check for updates and notify user (skip in MCP mode to avoid stdout pollution)
12
+ if (!isMCP) {
13
+ const updateNotifier = require('update-notifier');
14
+ updateNotifier({ pkg }).notify();
15
+ }
11
16
 
12
17
  async function main() {
13
18
  try {
14
- // Get command line arguments (excluding 'node' and script path)
15
- const args = process.argv.slice(2);
16
-
17
19
  // Get the path to the main application file
18
20
  const mainPath = path.join(__dirname, '..', 'src', 'main.js');
19
-
21
+
22
+ // In MCP mode, pipe stdin/stdout for JSON-RPC and inherit stderr for logs.
23
+ // In normal mode, inherit all stdio streams.
24
+ const stdioOption = isMCP
25
+ ? ['pipe', 'pipe', 'inherit']
26
+ : 'inherit';
27
+
20
28
  // Spawn the main process with arguments
21
29
  const app = spawn('node', [mainPath, ...args], {
22
- stdio: 'inherit'
30
+ stdio: stdioOption
23
31
  });
24
32
 
33
+ // In MCP mode, bridge stdin/stdout between parent and child
34
+ if (isMCP) {
35
+ process.stdin.pipe(app.stdin);
36
+ app.stdout.pipe(process.stdout);
37
+ app.stdin.on('error', () => {}); // ignore EPIPE if child exits
38
+ }
39
+
25
40
  app.on('error', (error) => {
26
41
  console.error('Failed to start pair-review:', error.message);
27
42
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@in-the-loop-labs/pair-review",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "description": "Your AI-powered code review partner - Close the feedback loop with AI coding agents",
5
5
  "main": "src/server.js",
6
6
  "bin": {
@@ -11,6 +11,8 @@
11
11
  "bin/",
12
12
  "src/",
13
13
  "public/",
14
+ "plugin/",
15
+ "plugin-code-critic/",
14
16
  "README.md",
15
17
  "LICENSE"
16
18
  ],
@@ -26,8 +28,9 @@
26
28
  "test:e2e": "playwright test",
27
29
  "test:e2e:headed": "playwright test --headed",
28
30
  "test:e2e:debug": "playwright test --debug",
31
+ "generate:skill-prompts": "node scripts/generate-skill-prompts.js",
29
32
  "changeset": "changeset",
30
- "version": "changeset version",
33
+ "version": "changeset version && node scripts/sync-plugin-versions.js && git add .claude-plugin/marketplace.json plugin/.claude-plugin/plugin.json plugin-code-critic/.claude-plugin/plugin.json",
31
34
  "release": "npm whoami > /dev/null || { echo 'Error: Not logged in to npm. Run: npm login'; exit 1; } && npm run version && changeset tag && npm publish && git push && git push --tags"
32
35
  },
33
36
  "keywords": [
@@ -55,6 +58,7 @@
55
58
  },
56
59
  "homepage": "https://github.com/in-the-loop-labs/pair-review#readme",
57
60
  "dependencies": {
61
+ "@modelcontextprotocol/sdk": "^1.25.3",
58
62
  "@octokit/rest": "^19.0.11",
59
63
  "better-sqlite3": "^11.8.1",
60
64
  "express": "^4.18.2",
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "pair-review",
3
+ "version": "1.2.0",
4
+ "description": "pair-review app integration — Open PRs and local changes in the pair-review web UI, run server-side AI analysis, and address review feedback. Requires the pair-review MCP server.",
5
+ "author": {
6
+ "name": "in-the-loop-labs",
7
+ "email": "tjwp@inthelooplabs.com"
8
+ },
9
+ "homepage": "https://github.com/in-the-loop-labs/pair-review",
10
+ "repository": "https://github.com/in-the-loop-labs/pair-review",
11
+ "license": "GPL-3.0-or-later",
12
+ "keywords": [
13
+ "code-review",
14
+ "pull-request",
15
+ "ai",
16
+ "pair-programming",
17
+ "feedback-loop",
18
+ "mcp"
19
+ ]
20
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "mcpServers": {
3
+ "pair-review": {
4
+ "type": "stdio",
5
+ "command": "npx",
6
+ "args": ["@in-the-loop-labs/pair-review", "--mcp"]
7
+ }
8
+ }
9
+ }
@@ -0,0 +1,47 @@
1
+ ---
2
+ name: ai-critic
3
+ description: >
4
+ Fetch AI-generated review suggestions from pair-review and make code changes to address them.
5
+ Use when the user says "address AI feedback", "address AI suggestions", "fix AI review feedback",
6
+ or wants to iterate on code based on AI analysis results from pair-review.
7
+ ---
8
+
9
+ # AI Critic
10
+
11
+ Fetch AI-generated suggestions from pair-review and make code changes to address the valid ones.
12
+
13
+ ## Determine review context
14
+
15
+ Determine whether this is a local review or a PR review:
16
+
17
+ 1. If the user explicitly says "local", use local mode.
18
+ 2. Otherwise, determine the GitHub owner, repo, and PR number for the current branch. If a PR exists, use PR mode with `repo` and `prNumber` params.
19
+ 3. If no PR exists, use local mode with `path` (absolute cwd) and `headSha` (`git rev-parse HEAD`) params.
20
+
21
+ ## Fetch AI suggestions
22
+
23
+ Call `mcp__pair-review__get_ai_suggestions` with the review context params. This returns suggestions from the latest analysis run by default.
24
+
25
+ If the user wants suggestions from a specific analysis run, call `mcp__pair-review__get_ai_analysis_runs` first to list available runs, then pass the appropriate `runId` to `get_ai_suggestions`.
26
+
27
+ Only active and adopted suggestions are included (dismissed ones are excluded).
28
+
29
+ If no suggestions are returned, tell the user there are no AI suggestions to address.
30
+
31
+ ## Triage and address suggestions
32
+
33
+ AI suggestions are not human-curated — apply judgment. For each suggestion:
34
+
35
+ 1. Read the file at the referenced path and lines.
36
+ 2. Evaluate the suggestion: is it a real issue, a false positive, or a stylistic preference?
37
+ 3. If the suggestion is valid and actionable, make the code change.
38
+ 4. If the suggestion is a false positive or not worth addressing, skip it and note why.
39
+
40
+ Use the `ai_confidence` field as a signal but not a hard threshold — low-confidence suggestions can still be valid.
41
+
42
+ ## Report
43
+
44
+ After processing all suggestions, provide a summary:
45
+ - How many suggestions were reviewed
46
+ - Which ones were addressed (and what changed)
47
+ - Which ones were skipped (and why)
@@ -0,0 +1,162 @@
1
+ ---
2
+ name: analyze
3
+ description: >
4
+ Perform AI-powered code review analysis using pair-review's server-side analysis engine via MCP.
5
+ Requires the pair-review MCP server to be connected. For standalone analysis without MCP,
6
+ use the `code-critic:analyze` skill instead.
7
+ Starts analysis via the pair-review MCP start_analysis tool, polls for completion,
8
+ then fetches and presents the curated suggestions. Results are also visible in the
9
+ pair-review web UI alongside the diff.
10
+ Use when the user says "analyze in the app", "analyze in the UI", "run server analysis",
11
+ "analyze with pair-review", or wants analysis results integrated into the pair-review web UI.
12
+ If the user says something ambiguous like "analyze my changes" or "run analysis" without
13
+ specifying a method, and both the `code-critic:analyze` and `pair-review:analyze` skills are available,
14
+ ask whether they want: (1) agent-based analysis (`code-critic:analyze` — results returned
15
+ directly in the conversation, no server required), or (2) in-app analysis
16
+ (`pair-review:analyze` — results appear in the pair-review web UI, requires MCP connection).
17
+ If only one analysis skill is available, use it directly without asking.
18
+ arguments:
19
+ tier:
20
+ description: "Prompt tier: fast (surface/Haiku-class), balanced (standard/Sonnet-class, default), or thorough (deep/Opus-class)"
21
+ required: false
22
+ default: balanced
23
+ skipLevel3:
24
+ description: "Skip Level 3 (codebase context) analysis. Useful for small or isolated changes."
25
+ required: false
26
+ default: false
27
+ customInstructions:
28
+ description: "Optional repo or user-specific review instructions"
29
+ required: false
30
+ ---
31
+
32
+ # Analyze Changes (Server-Side via MCP)
33
+
34
+ Perform a three-level code review analysis using pair-review's built-in analysis engine. Unlike the `code-critic:analyze` skill (which spawns analysis agents directly within the coding agent's context), this skill delegates all analysis work to the pair-review server via MCP tool calls. Use this skill when the pair-review MCP server is connected; use `code-critic:analyze` when it is not.
35
+
36
+ **Prerequisites**: The pair-review MCP server must be connected with the `start_analysis`, `get_ai_analysis_runs`, and `get_ai_suggestions` tools available.
37
+
38
+ ## 1. Gather context
39
+
40
+ Determine what is being reviewed:
41
+
42
+ - **Local changes**: Run `git rev-parse HEAD` to get the HEAD SHA, and use the current working directory as the path.
43
+ - **PR changes**: Determine the repository (`owner/repo`) and PR number. If the user provides a PR URL, extract these from it. If available, run `gh pr view --json number,headRepository` or similar.
44
+ - If the user specifies a particular scope, use that.
45
+
46
+ Collect:
47
+ - Whether this is local or PR mode
48
+ - For local: the absolute path and HEAD SHA
49
+ - For PR: the `owner/repo` string and PR number
50
+
51
+ ## 2. Start analysis
52
+
53
+ Call the `start_analysis` MCP tool with the appropriate parameters:
54
+
55
+ **For local mode:**
56
+ ```json
57
+ {
58
+ "path": "/absolute/path/to/repo",
59
+ "headSha": "abc123...",
60
+ "tier": "balanced",
61
+ "skipLevel3": false,
62
+ "customInstructions": "optional instructions"
63
+ }
64
+ ```
65
+
66
+ **For PR mode:**
67
+ ```json
68
+ {
69
+ "repo": "owner/repo",
70
+ "prNumber": 42,
71
+ "tier": "balanced",
72
+ "skipLevel3": false,
73
+ "customInstructions": "optional instructions"
74
+ }
75
+ ```
76
+
77
+ Pass the `tier`, `skipLevel3`, and `customInstructions` arguments from the skill invocation.
78
+
79
+ The tool returns immediately with `{ analysisId, runId, reviewId, status: "started" }`.
80
+
81
+ ## 3. Poll for completion
82
+
83
+ Analysis typically takes 1-5 minutes depending on the size of the changes and the tier.
84
+
85
+ Poll using `get_ai_analysis_runs` with `limit: 1` and the review coordinates from step 1. Wait approximately 10 seconds between polls.
86
+
87
+ **For local mode:**
88
+ ```json
89
+ {
90
+ "path": "/absolute/path/to/repo",
91
+ "headSha": "abc123...",
92
+ "limit": 1
93
+ }
94
+ ```
95
+
96
+ **For PR mode:**
97
+ ```json
98
+ {
99
+ "repo": "owner/repo",
100
+ "prNumber": 42,
101
+ "limit": 1
102
+ }
103
+ ```
104
+
105
+ Verify that `runs[0].id` matches the `runId` returned from step 2 to ensure you are polling the correct analysis (another tab or user could have triggered a concurrent run).
106
+
107
+ Check the `status` field in `runs[0]`:
108
+ - `"running"`: Analysis is still in progress — keep polling
109
+ - `"completed"`: Analysis finished — proceed to fetch results using the same `runId`
110
+ - `"failed"`: Analysis failed — report the failure to the user
111
+
112
+ Keep polling until `status` is `completed` or `failed`. Report progress to the user between polls.
113
+
114
+ ## Error handling
115
+
116
+ - If `start_analysis` returns an error, report it to the user with the error message. Common causes: the PR has not been loaded in pair-review yet, the worktree is missing, or invalid parameters.
117
+ - If polling shows `status: "failed"`, report the failure to the user. The `error` field in the run object contains the failure reason.
118
+ - If `get_ai_suggestions` returns an empty list after a completed analysis, this means no issues were found -- report a clean result.
119
+
120
+ ## 4. Fetch results
121
+
122
+ Once the analysis is complete, call `get_ai_suggestions` to retrieve the curated suggestions.
123
+
124
+ Pass the `runId` from step 2's `start_analysis` response (same value used for polling):
125
+
126
+ ```json
127
+ {
128
+ "runId": "the-runId-from-step-2"
129
+ }
130
+ ```
131
+
132
+ If `runId` is unavailable, fall back to resolving by review coordinates:
133
+
134
+ **For local mode:**
135
+ ```json
136
+ {
137
+ "path": "/absolute/path/to/repo",
138
+ "headSha": "abc123..."
139
+ }
140
+ ```
141
+
142
+ **For PR mode:**
143
+ ```json
144
+ {
145
+ "repo": "owner/repo",
146
+ "prNumber": 42
147
+ }
148
+ ```
149
+
150
+ This returns the final orchestrated suggestions from the latest analysis run.
151
+
152
+ ## 5. Report
153
+
154
+ Present the curated suggestions to the user, organized by file. For each suggestion show:
155
+ - File and line reference
156
+ - Type (bug, improvement, security, performance, praise, etc.)
157
+ - Title and description
158
+ - Confidence level
159
+
160
+ Group suggestions by file for easy navigation. Highlight critical issues (bugs, security) prominently.
161
+
162
+ If no suggestions were found, report that the analysis completed cleanly.
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: local
3
+ description: >
4
+ Open local uncommitted changes for review in the pair-review web UI.
5
+ This only opens the browser — it does not run AI analysis or generate suggestions.
6
+ Once open, the user can browse the diff, leave comments, and trigger analysis
7
+ from the web UI themselves.
8
+ Use when the user says "review my local changes", "review local", "open local review",
9
+ or wants to open a pair-review session for uncommitted work in the current directory.
10
+ If the user wants automated AI analysis of their local changes rather than just opening
11
+ the browser, use the `code-critic:analyze` skill (standalone, requires code-critic plugin) or `pair-review:analyze` skill (requires MCP server) instead. Note that the user can
12
+ also trigger AI analysis from within the pair-review web UI after opening it.
13
+ ---
14
+
15
+ # Local Review
16
+
17
+ Open the current working directory in the pair-review web UI for local code review.
18
+
19
+ ## Steps
20
+
21
+ 1. Call the `mcp__pair-review__get_server_info` tool to get the server URL.
22
+ 2. Get the absolute path of the current working directory.
23
+ 3. URL-encode the path.
24
+ 4. Open the browser: `open "{url}/local?path={encoded_path}"`
25
+
26
+ If `get_server_info` fails or the MCP server is not connected, tell the user to start pair-review first:
27
+ ```
28
+ npx @in-the-loop-labs/pair-review --mcp
29
+ ```
@@ -0,0 +1,28 @@
1
+ ---
2
+ name: pr
3
+ description: >
4
+ Open the GitHub pull request for the current branch in the pair-review web UI.
5
+ This only opens the browser — it does not run AI analysis or generate suggestions.
6
+ Once open, the user can browse the diff, leave comments, and trigger analysis
7
+ from the web UI themselves.
8
+ Use when the user says "review this PR", "review pull request", "open PR review",
9
+ or wants to open a pair-review session for the current branch's pull request.
10
+ If the user wants automated AI analysis of the PR rather than just opening the browser,
11
+ use the `code-critic:analyze` skill (standalone, requires code-critic plugin) or `pair-review:analyze` skill (requires MCP server) instead. Note that the user can also trigger
12
+ AI analysis from within the pair-review web UI after opening it.
13
+ ---
14
+
15
+ # PR Review
16
+
17
+ Open the current branch's GitHub PR in the pair-review web UI.
18
+
19
+ ## Steps
20
+
21
+ 1. Call the `mcp__pair-review__get_server_info` tool to get the server URL.
22
+ 2. Determine the GitHub owner, repo, and PR number for the current branch.
23
+ 3. Open the browser: `open "{url}/pr/{owner}/{repo}/{number}"`
24
+
25
+ ## Error handling
26
+
27
+ - If `get_server_info` fails, tell the user to start pair-review first: `npx @in-the-loop-labs/pair-review --mcp`
28
+ - If no PR exists for the current branch, tell the user.
@@ -0,0 +1,41 @@
1
+ ---
2
+ name: user-critic
3
+ description: >
4
+ Fetch human review comments from pair-review and make code changes to address them.
5
+ Use when the user says "address review feedback", "fix review comments", "address comments",
6
+ or wants to iterate on code based on feedback left by a human reviewer in pair-review.
7
+ ---
8
+
9
+ # Address Review Feedback
10
+
11
+ Fetch human-curated review comments from pair-review and make code changes to address each one.
12
+
13
+ ## Determine review context
14
+
15
+ Determine whether this is a local review or a PR review:
16
+
17
+ 1. If the user explicitly says "local", use local mode.
18
+ 2. Otherwise, determine the GitHub owner, repo, and PR number for the current branch. If a PR exists, use PR mode with `repo` and `prNumber` params.
19
+ 3. If no PR exists, use local mode with `path` (absolute cwd) and `headSha` (`git rev-parse HEAD`) params.
20
+
21
+ ## Fetch comments
22
+
23
+ Call `mcp__pair-review__get_user_comments` with the review context params.
24
+
25
+ If no comments are returned, tell the user there's nothing to address.
26
+
27
+ ## Address each comment
28
+
29
+ For each comment returned:
30
+
31
+ 1. Read the file at the referenced path and lines.
32
+ 2. Understand what the reviewer is asking for — it may be a bug fix, a refactoring request, a question, or a style change.
33
+ 3. Make the code change that addresses the feedback.
34
+ 4. If the comment is a question or unclear, explain your interpretation and what you changed.
35
+
36
+ ## Report
37
+
38
+ After addressing all comments, provide a summary:
39
+ - Which files were changed
40
+ - What was done for each comment
41
+ - Any comments that were ambiguous or could not be addressed (explain why)
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "code-critic",
3
+ "version": "1.2.0",
4
+ "description": "AI-powered code review analysis — Run three-level AI analysis and implement-review-fix loops directly in your coding agent. Works standalone, no server required.",
5
+ "author": {
6
+ "name": "in-the-loop-labs",
7
+ "email": "tjwp@inthelooplabs.com"
8
+ },
9
+ "homepage": "https://github.com/in-the-loop-labs/pair-review",
10
+ "repository": "https://github.com/in-the-loop-labs/pair-review",
11
+ "license": "GPL-3.0-or-later",
12
+ "keywords": [
13
+ "code-review",
14
+ "ai",
15
+ "analysis",
16
+ "code-critic",
17
+ "critic-loop"
18
+ ]
19
+ }