prr-kit 1.3.0 → 1.4.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 (38) hide show
  1. package/README.md +137 -11
  2. package/package.json +1 -1
  3. package/src/core/agents/prr-master.agent.yaml +5 -1
  4. package/src/core/tasks/clear.md +36 -71
  5. package/src/core/tasks/help.md +2 -1
  6. package/src/core/tasks/select-session.md +94 -0
  7. package/src/core/workflows/party-mode/steps/step-00-user-instructions.md +125 -0
  8. package/src/core/workflows/party-mode/steps/step-01-load-reviewers.md +22 -14
  9. package/src/core/workflows/party-mode/steps/step-02-discussion.md +8 -6
  10. package/src/core/workflows/party-mode/workflow.md +7 -7
  11. package/src/prr/config-template.yaml +0 -3
  12. package/src/prr/workflows/1-discover/select-pr/steps/step-05-confirm.md +96 -25
  13. package/src/prr/workflows/1-discover/select-pr/workflow.md +1 -1
  14. package/src/prr/workflows/2-analyze/collect-pr-context/steps/step-03-manual-context-input.md +64 -50
  15. package/src/prr/workflows/2-analyze/collect-pr-context/steps/step-04-build-knowledge-base.md +24 -30
  16. package/src/prr/workflows/2-analyze/collect-pr-context/workflow.md +3 -5
  17. package/src/prr/workflows/2-analyze/describe-pr/steps/step-01-load-context.md +3 -3
  18. package/src/prr/workflows/2-analyze/describe-pr/steps/step-04-output.md +6 -7
  19. package/src/prr/workflows/2-analyze/describe-pr/workflow.md +2 -2
  20. package/src/prr/workflows/3-review/architecture-review/checklist.md +1 -2
  21. package/src/prr/workflows/3-review/architecture-review/workflow.yaml +3 -2
  22. package/src/prr/workflows/3-review/business-review/checklist.md +1 -2
  23. package/src/prr/workflows/3-review/business-review/workflow.yaml +3 -2
  24. package/src/prr/workflows/3-review/general-review/checklist.md +1 -2
  25. package/src/prr/workflows/3-review/general-review/workflow.yaml +3 -2
  26. package/src/prr/workflows/3-review/performance-review/checklist.md +1 -2
  27. package/src/prr/workflows/3-review/performance-review/workflow.yaml +3 -2
  28. package/src/prr/workflows/3-review/security-review/checklist.md +1 -2
  29. package/src/prr/workflows/3-review/security-review/workflow.yaml +3 -2
  30. package/src/prr/workflows/4-improve/improve-code/checklist.md +1 -2
  31. package/src/prr/workflows/4-improve/improve-code/workflow.yaml +3 -2
  32. package/src/prr/workflows/5-ask/ask-code/steps/step-01-load-context.md +2 -2
  33. package/src/prr/workflows/6-report/generate-report/steps/step-01-collect.md +13 -9
  34. package/src/prr/workflows/6-report/generate-report/steps/step-03-write.md +2 -2
  35. package/src/prr/workflows/6-report/generate-report/workflow.md +2 -1
  36. package/src/prr/workflows/6-report/post-comments/steps/step-01-format.md +4 -5
  37. package/src/prr/workflows/6-report/post-comments/workflow.md +3 -2
  38. package/src/prr/workflows/quick/workflow.md +86 -28
package/README.md CHANGED
@@ -38,9 +38,137 @@ Then open your IDE in the installed project and use one of these commands to sta
38
38
 
39
39
  ## How It Works
40
40
 
41
- <p align="center">
42
- <img src="docs/assets/how-it-works.svg" alt="How It Works" width="100%"/>
43
- </p>
41
+ ```
42
+ ┌─────────────────────────────────────────────────────────┐
43
+ │ /prr-quick │
44
+ │ Load config.yaml │
45
+ └───────────────────────┬─────────────────────────────────┘
46
+
47
+ ╔═══════════════▼════════════════╗
48
+ ║ PHASE 1 — SELECT PR ║
49
+ ╚═══════════════╤════════════════╝
50
+
51
+ ┌──────────▼──────────┐
52
+ │ 1a. git fetch origin │
53
+ └──────────┬──────────┘
54
+
55
+ ┌──────────▼───────────────┐
56
+ │ 1b. List open PRs/MRs │
57
+ │ + recent branches │
58
+ └──────────┬───────────────┘
59
+
60
+ ┌──────────▼───────────────┐
61
+ │ 1c. ⌨️ Select PR/branch │ ← USER INPUT
62
+ │ Enter PR# or name │
63
+ └──────────┬───────────────┘
64
+
65
+ ┌──────────▼──────────┐
66
+ │ 1d. Load diff │
67
+ │ count files/lines│
68
+ └──────────┬──────────┘
69
+
70
+ ┌──────────▼──────────────────────────┐
71
+ │ 1e. Create session folder │
72
+ │ {output}/{date}-{slug}/ │
73
+ └──────────┬──────────────────────────┘
74
+
75
+ ┌──────────▼──────────────────────────┐
76
+ │ 1f. Generate diffs/ folder │
77
+ │ one .md per changed file │
78
+ └──────────┬──────────────────────────┘
79
+
80
+ ╔═══════════════▼════════════════╗
81
+ ║ PHASE 2 — DESCRIBE PR ║
82
+ ╚═══════════════╤════════════════╝
83
+
84
+ ┌──────────▼──────────────┐
85
+ │ 2a. Classify PR type │
86
+ │ bugfix/feature/... │
87
+ └──────────┬──────────────┘
88
+
89
+ ┌──────────▼──────────────┐
90
+ │ 2b. File-by-file │
91
+ │ walkthrough │
92
+ └──────────┬──────────────┘
93
+
94
+ ┌──────────▼──────────────┐
95
+ │ 2c. Print PR description │
96
+ └──────────┬──────────────┘
97
+
98
+ ╔═══════════════▼═══════════════════════╗
99
+ ║ PHASE 2.5 — COLLECT PR CONTEXT ║
100
+ ╚═══════════════╤═══════════════════════╝
101
+
102
+ ┌──────────▼──────────────────────────┐
103
+ │ Step 1. Analyze changed files │
104
+ │ detect stacks, domains, file types │
105
+ └──────────┬──────────────────────────┘
106
+
107
+ ┌──────────▼──────────────────────────┐
108
+ │ Step 2. Collect context from: │
109
+ │ CLAUDE.md · CONTRIBUTING.md │
110
+ │ .eslintrc · tsconfig · pyproject │
111
+ │ ARCHITECTURE.md · docs/** │
112
+ │ @context/@security annotations │
113
+ │ stack rules (vue3/react/django/...) │
114
+ │ MCP tools · RAG · URL sources │
115
+ └──────────┬──────────────────────────┘
116
+
117
+ ┌──────────▼──────────────────────────┐
118
+ │ Step 3. ⌨️ User instructions │ ← USER INPUT
119
+ │ scope / focus / requirements / │
120
+ │ context — or Enter for full review │
121
+ └──────────┬──────────────────────────┘
122
+
123
+ ┌────────┴────────┐
124
+ ▼ ▼
125
+ [provided] [empty]
126
+ parse scope & scope = "all"
127
+ focus/req/ctx full standard
128
+ │ │
129
+ └────────┬────────┘
130
+
131
+ ┌──────────▼──────────────────────────┐
132
+ │ Step 4. Build pr-context.yaml │
133
+ │ all collected context + user_instr │
134
+ │ → {session_output}/pr-context.yaml │
135
+ └──────────┬──────────────────────────┘
136
+
137
+ ╔═══════════════▼════════════════╗
138
+ ║ PHASE 3 — REVIEW ║
139
+ ╚═══════════════╤════════════════╝
140
+
141
+ ┌──────────▼──────────────────────────┐
142
+ │ Scope gate │
143
+ │ read user_instructions.review_scope │
144
+ └──────┬───────────────────────────────┘
145
+
146
+ ┌──────────┴──────────┐
147
+ [in scope] [not in scope]
148
+ │ │
149
+ ▼ ▼
150
+ ┌─────────────┐ ⏭️ skipped
151
+ │ GR · SR │ (no output file)
152
+ │ PR · AR │
153
+ │ BR │
154
+ └──────┬──────┘
155
+
156
+ ╔▼════════════════════════╗
157
+ ║ PHASE 4 — REPORT ║
158
+ ╚╤════════════════════════╝
159
+
160
+ │ Compile findings → sort by severity
161
+ │ 🔴 Blockers → 🟡 Warnings
162
+ │ 🟢 Suggestions → ❓ Questions
163
+ │ Write → final-review.md
164
+
165
+ ╔▼════════════════════════╗
166
+ ║ PHASE 5 — DONE ║
167
+ ╚╤════════════════════════╝
168
+
169
+ ├── auto_post_comment: true → post inline comments automatically
170
+ └── auto_post_comment: false → ⌨️ type PC to post, Enter to finish
171
+ ```
44
172
 
45
173
  The framework installs into your project as a `_prr/` folder. Agents and workflows are Markdown/YAML files that your AI IDE reads and executes — no server, no background process, no API keys required beyond your IDE's AI.
46
174
 
@@ -71,9 +199,6 @@ auto_post_comment: false # true → auto-post findings after every
71
199
  # ─── Context Collection ────────────────────────────────────────────────────
72
200
  context_collection:
73
201
  enabled: true # false → disable context collection entirely
74
- skip_manual_input_context: false # true → skip the manual context input prompt
75
- # false (default) → agent asks user for additional context
76
- # before building the knowledge base; input is marked ⚠️ IMPORTANT
77
202
  mode: pr-specific # only value: pr-specific (always fresh, never cached)
78
203
 
79
204
  # Sources below are auto-detected — override only if needed:
@@ -139,11 +264,11 @@ external_sources:
139
264
  ### Quick mode — one command, full pipeline
140
265
 
141
266
  ```
142
- /prr-quick or /prr-master → QR
267
+ /prr-quick
143
268
  ```
144
269
 
145
- Runs automatically: **select PR → describe → collect context → 5 reviews generate report**
146
- Only pauses once to ask which PR/branch to review.
270
+ Runs automatically: **select PR → describe → collect context → review → report**
271
+ Pauses **twice** for user input: once to select the PR/branch, once for review instructions (scope, focus, requirements — or Enter for a full standard review).
147
272
 
148
273
  ### Manual mode — step by step
149
274
 
@@ -218,13 +343,14 @@ All findings use a standard format:
218
343
 
219
344
  ## Context Collection
220
345
 
221
- After [DP] Describe PR, context is collected **automatically** — no manual step needed:
346
+ After [DP] Describe PR, context is collected **automatically** — then the agent pauses once for your instructions:
222
347
 
223
348
  1. Analyzes changed files to detect domains (`authentication`, `state-management`, etc.)
224
349
  2. Reads relevant config files (`.eslintrc`, `.prettierrc`, `tsconfig.json`) and standards docs (`CONTRIBUTING.md`, `ARCHITECTURE.md`)
225
350
  3. Extracts inline `@context:` / `@security:` / `@pattern:` annotations from the diff
226
351
  4. Optionally queries **MCP tools** (Confluence, Jira, Figma) and **RAG systems** if configured
227
- 5. Writes `pr-{branch}-context.yaml` loaded by all reviewers
352
+ 5. Asks for **review instructions** — scope (`only security`), focus, requirements, or context. Press Enter for a full standard review
353
+ 6. Writes `pr-context.yaml` inside the session folder — loaded by all reviewers
228
354
 
229
355
  > See [CONFIGURATION.md](CONFIGURATION.md) for MCP intents, RAG setup, and URL sources.
230
356
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prr-kit",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "AI-driven Pull Request Review Kit — structured agent workflows for thorough, consistent code review",
5
5
  "main": "tools/cli/prr-cli.js",
6
6
  "bin": {
@@ -82,10 +82,14 @@ agent:
82
82
  exec: "{project-root}/_prr/prr/workflows/6-report/post-comments/workflow.md"
83
83
  description: "[PC] Post Comments: Post inline review comments to GitHub/GitLab/Azure/Bitbucket PR"
84
84
 
85
+ - trigger: "SS or fuzzy match on select-session or resume-session"
86
+ exec: "{project-root}/_prr/core/tasks/select-session.md"
87
+ description: "[SS] Select Session: List past review sessions and resume one"
88
+
85
89
  - trigger: "HH or fuzzy match on help"
86
90
  exec: "{project-root}/_prr/core/tasks/help.md"
87
91
  description: "[HH] Help: Show review workflow guide and available commands"
88
92
 
89
93
  - trigger: "CL or fuzzy match on clear or clean or reset"
90
94
  exec: "{project-root}/_prr/core/tasks/clear.md"
91
- description: "[CL] Clear: Remove context files and/or review reports from output folder"
95
+ description: "[CL] Clear: Delete one or more past review sessions"
@@ -8,58 +8,41 @@
8
8
 
9
9
  Read `{project-root}/_prr/prr/config.yaml` to get `review_output` path.
10
10
 
11
- ### 2. Scan Output Folder
11
+ ### 2. Scan Session Folders
12
12
 
13
- List all files currently in `{review_output}`:
13
+ List all session folders in `{review_output}` (datetime-slug subdirectories):
14
14
 
15
15
  ```bash
16
- ls "{review_output}/"
16
+ ls -d "{review_output}"/*/
17
17
  ```
18
18
 
19
- Group into three categories:
19
+ Each session folder is named `{YYYY-MM-DD-HHmm}-{slug}` (e.g. `2026-03-02-1430-pr44-feature-auth`).
20
+ Inside each folder are: `pr-context.yaml` (knowledge base) and review `.md` files.
20
21
 
21
- **Context files** (session state + knowledge bases):
22
- - `current-pr-context.yaml` — active session state (which PR is selected)
23
- - `pr-*-context.yaml` — per-PR knowledge bases built during context collection
24
-
25
- **Intermediate review files** (individual review output, used by [RR] and [PC]):
26
- - `general-review-*.md`
27
- - `security-review-*.md`
28
- - `performance-review-*.md`
29
- - `architecture-review-*.md`
30
- - `business-review-*.md`
31
- - `improve-code-*.md`
32
- - `pr-description-*.md`
33
-
34
- **Review reports** (final compiled reports):
35
- - `review-*.md` — final review reports generated by [RR]
22
+ Also detect any legacy flat files still directly in `{review_output}/` (pre-session-folder format).
36
23
 
37
24
  ### 3. Display What Exists
38
25
 
39
- Show the user exactly what will be affected:
26
+ Show the user a summary of each session:
40
27
 
41
28
  ```
42
29
  🗂️ PRR Output — {review_output}
43
30
 
44
- Context files ({n}):
45
- • current-pr-context.yaml
46
- pr-feature-auth-...-context.yaml
47
- pr-feature-search-...-context.yaml
48
- ... (list all pr-*.yaml)
49
-
50
- Intermediate review files ({k}):
51
- general-review-2026-02-21.md
52
- security-review-2026-02-21.md
53
- pr-description-2026-02-21.md
54
- ... (list all intermediate review files)
55
-
56
- Review reports ({m}):
57
- • review-feature-auth-indexeddb-migration-2026-02-21.md
58
- • review-feature-add-search-functionality-2026-02-21.md
59
- ... (list all review-*.md)
31
+ Session folders ({n}):
32
+
33
+ 📁 2026-03-02-1430-pr44-feature-auth/
34
+ Branch: feature/auth | PR #44 | 2026-03-02
35
+ Files: pr-context.yaml, pr-description.md,
36
+ general-review.md, security-review.md, final-review.md
37
+
38
+ 📁 2026-03-01-0915-fix-null-pointer/
39
+ Branch: fix/null-pointer | no PR | 2026-03-01
40
+ Files: general-review.md
41
+
42
+ ... (list all session folders)
60
43
  ```
61
44
 
62
- If output folder is already empty or doesn't exist:
45
+ If no session folders exist:
63
46
  ```
64
47
  ✅ Nothing to clear — output folder is already empty.
65
48
  ```
@@ -72,49 +55,32 @@ Ask the user what to clear:
72
55
  ```
73
56
  What would you like to clear?
74
57
 
75
- [1] All context files + intermediate review files + review reports
76
- [2] Context only clear session state and knowledge bases (keep reports)
77
- [3] Reports only clear intermediate review files + final review reports (keep context)
78
- [4] Cancel — do nothing
58
+ [1] All sessions delete all session folders
59
+ [2] Select sessions choose specific session(s) to delete
60
+ [3] Cancel do nothing
79
61
  ```
80
62
 
81
63
  Wait for user input.
82
64
 
83
- ### 5. Execute Deletion
84
-
85
- **If [1] All:**
86
- ```bash
87
- rm -f "{review_output}/current-pr-context.yaml"
88
- rm -f "{review_output}"/pr-*-context.yaml
89
- rm -f "{review_output}"/general-review-*.md
90
- rm -f "{review_output}"/security-review-*.md
91
- rm -f "{review_output}"/performance-review-*.md
92
- rm -f "{review_output}"/architecture-review-*.md
93
- rm -f "{review_output}"/business-review-*.md
94
- rm -f "{review_output}"/improve-code-*.md
95
- rm -f "{review_output}"/pr-description-*.md
96
- rm -f "{review_output}"/review-*.md
65
+ **If [2] Select sessions:** List sessions numbered and ask:
66
+ ```
67
+ Which session(s) to delete? (e.g. 1, 3 or 1-3)
97
68
  ```
69
+ Wait for response.
70
+
71
+ ### 5. Execute Deletion
98
72
 
99
- **If [2] Context only:**
73
+ **If [1] All sessions:**
100
74
  ```bash
101
- rm -f "{review_output}/current-pr-context.yaml"
102
- rm -f "{review_output}"/pr-*-context.yaml
75
+ rm -rf "{review_output}"/*/
103
76
  ```
104
77
 
105
- **If [3] Reports only:**
78
+ **If [2] Selected sessions:** For each chosen session folder:
106
79
  ```bash
107
- rm -f "{review_output}"/general-review-*.md
108
- rm -f "{review_output}"/security-review-*.md
109
- rm -f "{review_output}"/performance-review-*.md
110
- rm -f "{review_output}"/architecture-review-*.md
111
- rm -f "{review_output}"/business-review-*.md
112
- rm -f "{review_output}"/improve-code-*.md
113
- rm -f "{review_output}"/pr-description-*.md
114
- rm -f "{review_output}"/review-*.md
80
+ rm -rf "{review_output}/{selected_session_folder}/"
115
81
  ```
116
82
 
117
- **If [4] Cancel:**
83
+ **If [3] Cancel:**
118
84
  ```
119
85
  ❌ Cancelled — nothing was deleted.
120
86
  ```
@@ -122,15 +88,14 @@ Stop.
122
88
 
123
89
  ### 6. Confirm Deletion
124
90
 
125
- Verify files are gone and report:
91
+ Verify folders are gone and report:
126
92
 
127
93
  ```
128
94
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
129
95
  ✅ Clear complete
130
96
 
131
97
  Deleted:
132
- 🗑️ Context files: {n_ctx} file(s) removed
133
- 🗑️ Review reports: {n_rpt} file(s) removed
98
+ 🗑️ Sessions removed: {n} folder(s)
134
99
 
135
100
  Output folder: {review_output}
136
101
  Status: clean
@@ -36,4 +36,5 @@ Use `/prr-help` anytime for guidance on what to do.
36
36
 
37
37
  ### Utilities
38
38
 
39
- - **[CL] Clear** — Remove context files and/or review reports from output folder. Useful when starting fresh or cleaning up after a session. Choose: All / Context only / Reports only.
39
+ - **[SS] Select Session** — List past review sessions and resume one. Use this at the start of a new conversation to pick up where you left off.
40
+ - **[CL] Clear** — Delete one or more past review session folders. Choose specific sessions or clear all.
@@ -0,0 +1,94 @@
1
+ # Select Session
2
+
3
+ **Goal:** List all past PR review sessions and let the user resume one by restoring `session_output` into working context.
4
+
5
+ ## EXECUTION
6
+
7
+ ### 1. Load Config
8
+
9
+ Read `{project-root}/_prr/prr/config.yaml` to get `review_output` path.
10
+
11
+ ### 2. Scan Session Folders
12
+
13
+ List all session folders in `{review_output}`:
14
+
15
+ ```bash
16
+ ls -d "{review_output}"/*/
17
+ ```
18
+
19
+ For each session folder, read its contents to build a summary:
20
+
21
+ ```bash
22
+ ls "{review_output}/{session_folder}/"
23
+ ```
24
+
25
+ From the files present, determine:
26
+ - **Branch / PR** — from folder name (e.g. `2026-03-02-1430-pr44-feature-auth` → PR #44, branch `feature/auth`)
27
+ - **Date / Time** — from folder name prefix (`2026-03-02-1430`)
28
+ - **Reviews done** — which `*-review.md` files exist
29
+ - **Has final report** — `final-review.md` exists
30
+ - **Has description** — `pr-description.md` exists
31
+
32
+ ### 3. Display Sessions
33
+
34
+ ```
35
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
36
+ 📂 Review Sessions — {review_output}
37
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
38
+
39
+ [1] 2026-03-02 14:30 — PR #44 feature/auth-login
40
+ Reviews: DP ✓ GR ✓ SR ✓ RR ✓
41
+ Report: final-review.md ✓
42
+
43
+ [2] 2026-03-01 09:15 — fix/null-pointer-checkout
44
+ Reviews: DP ✓ GR ✓
45
+ Report: —
46
+
47
+ [3] 2026-02-28 17:00 — PR #41 chore/upgrade-deps
48
+ Reviews: DP ✓ GR ✓ AR ✓ RR ✓
49
+ Report: final-review.md ✓
50
+
51
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
52
+ ```
53
+
54
+ If no sessions exist:
55
+ ```
56
+ ✅ No sessions found in {review_output}.
57
+ Run [SP] Select PR or [QR] Quick Review to start a new session.
58
+ ```
59
+ Then stop.
60
+
61
+ ### 4. Ask User to Select
62
+
63
+ ```
64
+ Select a session to resume (enter number):
65
+ ```
66
+
67
+ **HALT — wait for user response.**
68
+
69
+ ### 5. Restore Session
70
+
71
+ Set `session_output` = full path of the selected session folder.
72
+
73
+ Load PR metadata from working context sources available in the session folder:
74
+ - Parse `session_output` folder name to extract: `datetime_prefix`, `pr_number` (if `prN-` prefix), `branch_slug`
75
+ - Read `pr-context.yaml` if it exists — extract `pr_metadata.pr_number`, `pr_metadata.branch`, `pr_metadata.base_branch`
76
+ - Derive `target_branch` and `base_branch` from knowledge base or folder name
77
+
78
+ **Store in working context:**
79
+ - `session_output` = selected folder path
80
+ - `target_branch`, `base_branch`, `pr_number` = from above
81
+
82
+ Display:
83
+ ```
84
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
85
+ ✅ Session restored
86
+
87
+ 📁 {session_output}
88
+ Branch: {target_branch} → {base_branch}
89
+ PR #: {pr_number} (if applicable)
90
+
91
+ Reviews completed: {list or "none"}
92
+ Ready to continue — run any command from the menu.
93
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
94
+ ```
@@ -0,0 +1,125 @@
1
+ ---
2
+ name: "step-00-user-instructions"
3
+ description: "Collect user instructions before the party review begins"
4
+ nextStepFile: "./step-01-load-reviewers.md"
5
+ ---
6
+
7
+ # Step 0: User Instructions
8
+
9
+ ## Goal
10
+ Always ask the user for scope, focus, requirements, or context before reviewers are loaded.
11
+ This step runs even if a `pr-context.yaml` already exists — fresh instructions override any prior `user_instructions` in the file.
12
+
13
+ ## Sequence of Instructions
14
+
15
+ ### 1. Show PR Summary
16
+
17
+ Display:
18
+ ```
19
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
20
+ 🎉 Party Mode — Review Setup
21
+
22
+ Branch: {target_branch} → {base_branch}
23
+ Files: {file_count} changed
24
+ PR: {pr_number if set, else "local branch"}
25
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
26
+ ```
27
+
28
+ ### 2. Prompt User
29
+
30
+ Display EXACTLY:
31
+
32
+ ```
33
+ 💬 Any instructions for this review?
34
+ Press Enter to run a full standard review, or type your instructions below.
35
+
36
+ You can specify:
37
+ • Scope "only security" / "security and architecture" / "skip performance"
38
+ • Focus "focus on SQL injection and rate limiting"
39
+ • Requirements "all API endpoints must have auth middleware"
40
+ • Context "hotfix — ignore refactoring suggestions"
41
+ • Mix freely "security only, focus on JWT handling, context: auth rewrite in progress"
42
+ ```
43
+
44
+ **HALT — wait for user response before continuing.**
45
+
46
+ ### 3. Parse Response
47
+
48
+ **If user pressed Enter / left empty:**
49
+ - Set `user_instructions.provided` = `false`
50
+ - Set `user_instructions.review_scope` = `"all"`
51
+ - Set all other fields to `null`
52
+
53
+ **If user typed something**, parse the free-form text and extract:
54
+
55
+ **`review_scope`** — which reviews to run:
56
+ - Parse for scope signals: "only X", "just X", "X only", "skip X", "no X review", "X and Y"
57
+ - Map to codes: `GR` (general), `SR` (security), `PR` (performance), `AR` (architecture), `BR` (business)
58
+ - Examples:
59
+ - "only security" → `[SR]`
60
+ - "security and architecture" → `[SR, AR]`
61
+ - "skip performance" → `[GR, SR, AR, BR]`
62
+ - "focus on SQL injection" (no scope signal) → `"all"` (focus only, all reviewers still active)
63
+ - If no scope restriction found → `"all"`
64
+
65
+ **`focus_areas`** — specific things reviewers must prioritize (list of strings), or `null` if none.
66
+
67
+ **`custom_requirements`** — mandatory checks user specified (list of strings), or `null`.
68
+
69
+ **`context_notes`** — background info, trade-offs, constraints (list of strings), or `null`.
70
+
71
+ **`raw`** — full original text from user.
72
+
73
+ Set `user_instructions.provided` = `true`.
74
+
75
+ ### 4. Acknowledge
76
+
77
+ **If user provided instructions:**
78
+
79
+ ```
80
+ ✅ Instructions captured.
81
+
82
+ 📋 Scope: {scope_list joined with ", " OR "all reviewers"}
83
+ 🎯 Focus: {focus_areas joined with ", " OR "standard coverage"}
84
+ ✅ Requirements: {custom_requirements joined with ", " OR "none"}
85
+ 📝 Context: {context_notes joined with "; " OR "none"}
86
+ ```
87
+
88
+ **If user left empty:**
89
+
90
+ ```
91
+ ▶️ Full standard review — all reviewers, standard focus.
92
+ ```
93
+
94
+ ### 5. Write to pr-context.yaml
95
+
96
+ Write `user_instructions` to `{session_output}/pr-context.yaml`:
97
+
98
+ - **If `pr-context.yaml` exists**: update only the `user_instructions:` section, leave all other sections intact.
99
+ - **If `pr-context.yaml` does not exist** (Party Mode was run without prior DP/context collection):
100
+ Create a minimal file with just `pr_metadata` and `user_instructions`:
101
+
102
+ ```yaml
103
+ # PR-Specific Context (minimal — created by Party Mode)
104
+ # Generated: {timestamp}
105
+
106
+ pr_metadata:
107
+ pr_number: {pr_number or null}
108
+ branch: {target_branch}
109
+ base_branch: {base_branch}
110
+ collected_at: {ISO timestamp}
111
+
112
+ user_instructions:
113
+ provided: {true|false}
114
+ review_scope: {value}
115
+ focus_areas: {value}
116
+ custom_requirements: {value}
117
+ context_notes: {value}
118
+ raw: {value}
119
+ ```
120
+
121
+ Store `pr_knowledge_base` = `{session_output}/pr-context.yaml` in working context.
122
+
123
+ ### 6. Load Next Step
124
+
125
+ Add `step-00-user-instructions` to `stepsCompleted`. Load: `{nextStepFile}`
@@ -8,35 +8,43 @@ nextStepFile: "./step-02-discussion.md"
8
8
 
9
9
  ## Sequence of Instructions
10
10
 
11
- ### 1. Introduce Party Mode
11
+ ### 1. Load PR Knowledge Base
12
12
 
13
- Display:
13
+ Load the PR knowledge base from working context (`pr_knowledge_base`), or read directly at `{session_output}/pr-context.yaml`.
14
+ It contains stack-specific rules, ESLint/linting rules, project guidelines (CLAUDE.md, CONTRIBUTING.md, ARCHITECTURE.md sections), inline code annotations, and external context.
15
+
16
+ If no knowledge base exists (DP was not run), proceed with local context only — do not block.
17
+
18
+ **Read `user_instructions.review_scope`** from the knowledge base:
19
+ - If `"all"` (or knowledge base missing) → all 5 reviewers are active.
20
+ - If a list (e.g. `[SR, AR]`) → only activate reviewers matching those codes:
21
+ `GR` = Alex · `SR` = Sam · `PR` = Petra · `AR` = Arch · `BR` = Biz
22
+
23
+ ### 2. Introduce Party Mode
24
+
25
+ Display, listing only the **active** reviewers:
14
26
  ```
15
27
  🎉 Party Mode activated!
16
28
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
17
29
  Reviewers joining this session:
18
30
 
19
- 👁️ Alex — General Code Quality
31
+ {active reviewers only, e.g.:}
20
32
  🔒 Sam — Security
21
- ⚡ Petra — Performance
22
33
  🏗️ Arch — Architecture
23
- 💼 Biz — Business Impact
24
34
 
25
35
  PR: {target_branch} → {base_branch}
26
36
  Files changed: {file_count} | Lines: +{additions} -{deletions}
27
37
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
28
38
  ```
29
39
 
30
- ### 2. Load PR Knowledge Base
31
-
32
- Read `{review_output}/current-pr-context.yaml` to get `pr_knowledge_base` path.
33
- Load the knowledge base file — it contains stack-specific rules, ESLint/linting rules, project guidelines (CLAUDE.md, CONTRIBUTING.md, ARCHITECTURE.md sections), inline code annotations, and external context.
34
-
35
- If no knowledge base exists (DP was not run), proceed with local context only — do not block.
40
+ If reviewers were filtered, also print:
41
+ ```
42
+ ⏭️ Skipped: {inactive reviewer names} (not in review scope)
43
+ ```
36
44
 
37
45
  ### 3. Load Reviewer Personas
38
46
 
39
- Internally adopt all reviewer personas simultaneously. All reviewers apply rules from the PR knowledge base in their respective areas.
47
+ Internally adopt only the **active** reviewer personas (determined by scope in step 1). All active reviewers apply rules from the PR knowledge base in their respective areas.
40
48
 
41
49
  **👁️ Alex (General Reviewer)**
42
50
  - Focus: code logic, naming, readability, DRY, best practices, test coverage, side effects, and stack-specific best practices from knowledge base
@@ -64,7 +72,7 @@ Internally adopt all reviewer personas simultaneously. All reviewers apply rules
64
72
  - Runs last, references findings from Alex/Sam/Petra/Arch and translates them to business consequences
65
73
  - Output format: risk level (CRITICAL/HIGH/MEDIUM/LOW) + user impact + deployment recommendation
66
74
 
67
- ### 4. Scan the Diff and Assign Focus Areas
75
+ ### 4. Scan the Diff and Assign Focus Areas (active reviewers only)
68
76
 
69
77
  Read the diff and file list from the knowledge base. Assign focus areas:
70
78
  - SQL/DB files → Petra leads (N+1, missing index), Sam checks (injection)
@@ -74,6 +82,6 @@ Read the diff and file list from the knowledge base. Assign focus areas:
74
82
  - Any file touching auth, payments, PII → Sam mandatory
75
83
  - Schema/migration files → Biz flags (data safety, rollback plan)
76
84
 
77
- ### 4. Load Next Step
85
+ ### 5. Load Next Step
78
86
 
79
87
  Add `step-01-load-reviewers` to `stepsCompleted`. Load: `{nextStepFile}`