prr-kit 1.2.3 → 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 (45) hide show
  1. package/README.md +200 -24
  2. package/package.json +1 -1
  3. package/src/core/agents/prr-master.agent.yaml +10 -6
  4. package/src/core/tasks/clear.md +36 -71
  5. package/src/core/tasks/help.md +7 -6
  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 +27 -19
  9. package/src/core/workflows/party-mode/steps/step-02-discussion.md +13 -11
  10. package/src/core/workflows/party-mode/workflow.md +7 -7
  11. package/src/prr/agents/architecture-reviewer.agent.yaml +2 -2
  12. package/src/prr/agents/business-reviewer.agent.yaml +2 -2
  13. package/src/prr/agents/general-reviewer.agent.yaml +2 -2
  14. package/src/prr/agents/performance-reviewer.agent.yaml +2 -2
  15. package/src/prr/agents/security-reviewer.agent.yaml +2 -2
  16. package/src/prr/workflows/1-discover/select-pr/steps/step-05-confirm.md +96 -25
  17. package/src/prr/workflows/1-discover/select-pr/workflow.md +1 -1
  18. package/src/prr/workflows/2-analyze/collect-pr-context/steps/step-02-collect-sources.md +2 -1
  19. package/src/prr/workflows/2-analyze/collect-pr-context/steps/step-03-manual-context-input.md +102 -0
  20. package/src/prr/workflows/2-analyze/collect-pr-context/steps/{step-03-build-knowledge-base.md → step-04-build-knowledge-base.md} +32 -22
  21. package/src/prr/workflows/2-analyze/collect-pr-context/workflow.md +5 -6
  22. package/src/prr/workflows/2-analyze/describe-pr/steps/step-01-load-context.md +3 -3
  23. package/src/prr/workflows/2-analyze/describe-pr/steps/step-04-output.md +6 -7
  24. package/src/prr/workflows/2-analyze/describe-pr/workflow.md +2 -2
  25. package/src/prr/workflows/3-review/architecture-review/checklist.md +1 -2
  26. package/src/prr/workflows/3-review/architecture-review/workflow.yaml +4 -3
  27. package/src/prr/workflows/3-review/business-review/checklist.md +1 -2
  28. package/src/prr/workflows/3-review/business-review/instructions.xml +2 -0
  29. package/src/prr/workflows/3-review/business-review/workflow.yaml +4 -3
  30. package/src/prr/workflows/3-review/general-review/checklist.md +1 -2
  31. package/src/prr/workflows/3-review/general-review/instructions.xml +7 -0
  32. package/src/prr/workflows/3-review/general-review/workflow.yaml +4 -3
  33. package/src/prr/workflows/3-review/performance-review/checklist.md +1 -2
  34. package/src/prr/workflows/3-review/performance-review/workflow.yaml +4 -3
  35. package/src/prr/workflows/3-review/security-review/checklist.md +1 -2
  36. package/src/prr/workflows/3-review/security-review/workflow.yaml +4 -3
  37. package/src/prr/workflows/4-improve/improve-code/checklist.md +1 -2
  38. package/src/prr/workflows/4-improve/improve-code/workflow.yaml +3 -2
  39. package/src/prr/workflows/5-ask/ask-code/steps/step-01-load-context.md +2 -2
  40. package/src/prr/workflows/6-report/generate-report/steps/step-01-collect.md +13 -9
  41. package/src/prr/workflows/6-report/generate-report/steps/step-03-write.md +2 -2
  42. package/src/prr/workflows/6-report/generate-report/workflow.md +2 -1
  43. package/src/prr/workflows/6-report/post-comments/steps/step-01-format.md +4 -5
  44. package/src/prr/workflows/6-report/post-comments/workflow.md +3 -2
  45. package/src/prr/workflows/quick/workflow.md +86 -28
@@ -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,63 +8,71 @@ 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
- - Focus: code logic, naming, readability, DRY, best practices, test coverage, side effects
50
+ - Focus: code logic, naming, readability, DRY, best practices, test coverage, side effects, and stack-specific best practices from knowledge base
43
51
  - Style: pragmatic, balances perfection with practicality
44
52
  - Output format: 🔴/🟡/🟢/❓ with file:line references + suggested fix
45
53
 
46
54
  **🔒 Sam (Security Reviewer)**
47
- - Focus: OWASP Top 10, secrets, auth, injection, rate limiting, input validation
55
+ - Focus: OWASP Top 10, secrets, auth, injection, rate limiting, input validation, and stack-specific security threats from knowledge base
48
56
  - Style: paranoid-but-practical, every finding is a risk statement
49
57
  - Output format: WHAT / WHERE (file:line) / HOW exploitable / HOW TO FIX
50
58
 
51
59
  **⚡ Petra (Performance Reviewer)**
52
- - Focus: N+1 queries, async patterns, memory leaks, caching, payload size, bundle bloat
60
+ - Focus: N+1 queries, async patterns, memory leaks, caching, payload size, bundle bloat, and stack-specific performance patterns from knowledge base
53
61
  - Style: data-driven, quantifies impact when possible ("adds ~Xms per request")
54
62
  - Output format: impact estimate + root cause + fix
55
63
 
56
64
  **🏗️ Arch (Architecture Reviewer)**
57
- - Focus: SOLID, layering, coupling, consistency with codebase, shared module blast radius
65
+ - Focus: SOLID, layering, coupling, consistency with codebase, shared module blast radius, and stack-specific architectural patterns from knowledge base
58
66
  - Style: big-picture thinker, values consistency over theoretical purity
59
67
  - Output format: pattern analysis + reference to existing pattern + recommendation
60
68
 
61
69
  **💼 Biz (Business Reviewer)**
62
- - Focus: user impact, feature completeness vs acceptance criteria, business risk, data safety, observability
70
+ - Focus: user impact, feature completeness vs acceptance criteria, business risk, data safety, observability, and project-specific business concerns from knowledge base
63
71
  - Style: speaks in business terms — revenue impact, user churn, compliance risk
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}`
@@ -7,15 +7,17 @@ description: "Run the multi-reviewer discussion and compile unified findings"
7
7
 
8
8
  ## Sequence of Instructions
9
9
 
10
+ > **Active reviewers only.** Read the active reviewer list from step 1 (determined by `user_instructions.review_scope`). Skip any reviewer section below whose code is not in the active list. Only active reviewers speak and produce findings.
11
+
10
12
  ### 1. Round 1 — Each Reviewer's Initial Take
11
13
 
12
14
  Go through the diff once per reviewer. Each reviewer applies rules from the PR knowledge base loaded in step 1 in addition to their domain expertise.
13
15
 
14
16
  ---
15
17
 
16
- **👁️ Alex says:**
18
+ **👁️ Alex says:** *(skip if GR not in scope)*
17
19
 
18
- [Alex reviews for: logic correctness, naming, readability, DRY violations, missing error handling, test coverage, side effects, resource cleanup]
20
+ [Alex reviews for: logic correctness, naming, readability, DRY violations, missing error handling, test coverage, side effects, resource cleanup, and stack-specific code quality issues from knowledge base]
19
21
 
20
22
  Format each finding as:
21
23
  ```
@@ -25,9 +27,9 @@ Format each finding as:
25
27
 
26
28
  ---
27
29
 
28
- **🔒 Sam says:**
30
+ **🔒 Sam says:** *(skip if SR not in scope)*
29
31
 
30
- [Sam reviews for: secrets/credentials, SQL injection, XSS, authentication checks, authorization, rate limiting, error message exposure, OWASP Top 10]
32
+ [Sam reviews for: secrets/credentials, SQL injection, XSS, authentication checks, authorization, rate limiting, error message exposure, OWASP Top 10, and stack-specific security threats from knowledge base]
31
33
 
32
34
  Format each finding as:
33
35
  ```
@@ -38,9 +40,9 @@ Format each finding as:
38
40
 
39
41
  ---
40
42
 
41
- **⚡ Petra says:**
43
+ **⚡ Petra says:** *(skip if PR not in scope)*
42
44
 
43
- [Petra reviews for: N+1 queries, missing indexes, sync I/O on hot paths, unbound queries, missing caching, large payloads, memory leaks, inefficient loops]
45
+ [Petra reviews for: N+1 queries, missing indexes, sync I/O on hot paths, unbound queries, missing caching, large payloads, memory leaks, inefficient loops, and stack-specific performance issues from knowledge base]
44
46
 
45
47
  Format each finding as:
46
48
  ```
@@ -51,9 +53,9 @@ Format each finding as:
51
53
 
52
54
  ---
53
55
 
54
- **🏗️ Arch says:**
56
+ **🏗️ Arch says:** *(skip if AR not in scope)*
55
57
 
56
- [Arch reviews for: layer violations, circular dependencies, tight coupling, inconsistent patterns, shared module blast radius, backward compatibility breaks]
58
+ [Arch reviews for: layer violations, circular dependencies, tight coupling, inconsistent patterns, shared module blast radius, backward compatibility breaks, and stack-specific architecture concerns from knowledge base]
57
59
 
58
60
  Format each finding as:
59
61
  ```
@@ -66,9 +68,9 @@ Format each finding as:
66
68
 
67
69
  ### 2. Round 2 — Biz Translates + Cross-Review Discussion
68
70
 
69
- **💼 Biz speaks last** — synthesizes findings from Alex/Sam/Petra/Arch into business impact:
71
+ **💼 Biz speaks last** *(skip if BR not in scope)* — synthesizes findings from Alex/Sam/Petra/Arch into business impact:
70
72
 
71
- [Biz reviews for: user-facing regressions, feature completeness, data safety, deployment risk, observability gaps, compliance issues]
73
+ [Biz reviews for: user-facing regressions, feature completeness, data safety, deployment risk, observability gaps, compliance issues, and project-specific business concerns from knowledge base]
72
74
 
73
75
  For each 🔴 finding from prior reviewers, Biz adds business consequence:
74
76
  ```
@@ -103,7 +105,7 @@ After discussion, produce a unified finding list, deduplicated and prioritized:
103
105
  ## 🎉 Party Mode — Unified Findings
104
106
 
105
107
  **PR:** {target_branch} → {base_branch}
106
- **Session participants:** Alex 👁️ + Sam 🔒 + Petra ⚡ + Arch 🏗️ + Biz 💼
108
+ **Session participants:** {active reviewers from step 1}
107
109
 
108
110
  ### 🔴 Blockers ({count})
109
111
  [all blockers from all reviewers, attributed to reviewer]
@@ -2,7 +2,7 @@
2
2
  name: party-mode
3
3
  description: "Multi-reviewer discussion: all specialized agents review and debate the PR together"
4
4
  main_config: "{project-root}/_prr/prr/config.yaml"
5
- nextStep: "./steps/step-01-load-reviewers.md"
5
+ nextStep: "./steps/step-00-user-instructions.md"
6
6
  ---
7
7
 
8
8
  # Party Mode Workflow 🎉
@@ -11,9 +11,10 @@ nextStep: "./steps/step-01-load-reviewers.md"
11
11
 
12
12
  ## WORKFLOW ARCHITECTURE
13
13
 
14
- 2-step process:
15
- 1. Load reviewer personas and assign sections
16
- 2. Run structured discussion with each reviewer contributing findings
14
+ 3-step process:
15
+ 1. Collect user instructions (scope, focus, requirements, context) — always runs, user must respond
16
+ 2. Load reviewer personas filtered by scope
17
+ 3. Run structured discussion with each active reviewer contributing findings
17
18
 
18
19
  ## WHEN TO USE
19
20
 
@@ -26,9 +27,8 @@ Use Party Mode when you want:
26
27
  ## INITIALIZATION
27
28
 
28
29
  Load config from `{main_config}`.
29
- Load PR context from `{review_output}/current-pr-context.yaml`.
30
-
31
- If no PR context exists, prompt user to run [SP] Select PR first.
30
+ Use `session_output`, `target_branch`, `base_branch`, `pr_number` from working context.
31
+ If not set: prompt user to run [SS] Select Session or [SP] Select PR first.
32
32
 
33
33
  ## EXECUTION
34
34
 
@@ -5,7 +5,7 @@ agent:
5
5
  title: "Architecture Code Reviewer"
6
6
  icon: "🏗️"
7
7
  module: prr
8
- capabilities: "SOLID principles, design patterns, layered architecture, coupling and cohesion, API design, consistency with existing codebase patterns"
8
+ capabilities: "SOLID principles, design patterns, layered architecture, coupling and cohesion, API design, consistency with existing codebase patterns, and stack-specific architectural patterns"
9
9
  hasSidecar: false
10
10
  no_launcher: true
11
11
 
@@ -38,7 +38,7 @@ agent:
38
38
 
39
39
  - trigger: "AR or fuzzy match on architecture-review"
40
40
  workflow: "{project-root}/_prr/prr/workflows/3-review/architecture-review/workflow.yaml"
41
- description: "[AR] Architecture Review: SOLID, layering, coupling, codebase consistency"
41
+ description: "[AR] Architecture Review: Architecture analysis adapted to your codebase"
42
42
 
43
43
  - trigger: "IC or fuzzy match on improve-code"
44
44
  workflow: "{project-root}/_prr/prr/workflows/4-improve/improve-code/workflow.yaml"
@@ -5,7 +5,7 @@ agent:
5
5
  title: "Business Impact Reviewer"
6
6
  icon: "💼"
7
7
  module: prr
8
- capabilities: "user impact, feature completeness, business risk, data safety, observability, deployment risk, acceptance criteria validation"
8
+ capabilities: "user impact, feature completeness, business risk, data safety, observability, deployment risk, acceptance criteria validation, and project-specific business concerns"
9
9
  hasSidecar: false
10
10
  no_launcher: true
11
11
 
@@ -39,7 +39,7 @@ agent:
39
39
 
40
40
  - trigger: "BR or fuzzy match on business-review"
41
41
  workflow: "{project-root}/_prr/prr/workflows/3-review/business-review/workflow.yaml"
42
- description: "[BR] Business Review: User impact, business risk, feature completeness, data safety"
42
+ description: "[BR] Business Review: Business impact analysis adapted to your project"
43
43
 
44
44
  - trigger: "IC or fuzzy match on improve-code"
45
45
  workflow: "{project-root}/_prr/prr/workflows/4-improve/improve-code/workflow.yaml"
@@ -5,7 +5,7 @@ agent:
5
5
  title: "General Code Reviewer"
6
6
  icon: "👁️"
7
7
  module: prr
8
- capabilities: "code logic, naming conventions, readability, DRY principles, error handling, test coverage, code smells"
8
+ capabilities: "code logic, naming conventions, readability, DRY principles, error handling, test coverage, code smells, and stack-specific best practices"
9
9
  hasSidecar: false
10
10
  no_launcher: true
11
11
 
@@ -37,7 +37,7 @@ agent:
37
37
 
38
38
  - trigger: "GR or fuzzy match on general-review"
39
39
  workflow: "{project-root}/_prr/prr/workflows/3-review/general-review/workflow.yaml"
40
- description: "[GR] General Review: Comprehensive code quality analysis"
40
+ description: "[GR] General Review: Code quality analysis — adapted to your stack"
41
41
 
42
42
  - trigger: "IC or fuzzy match on improve-code"
43
43
  workflow: "{project-root}/_prr/prr/workflows/4-improve/improve-code/workflow.yaml"
@@ -5,7 +5,7 @@ agent:
5
5
  title: "Performance Code Reviewer"
6
6
  icon: "⚡"
7
7
  module: prr
8
- capabilities: "N+1 query detection, memory leak analysis, async/await patterns, bundle size, caching strategies, database query optimization"
8
+ capabilities: "N+1 query detection, memory leak analysis, async/await patterns, bundle size, caching strategies, database query optimization, and stack-specific performance patterns"
9
9
  hasSidecar: false
10
10
  no_launcher: true
11
11
 
@@ -38,7 +38,7 @@ agent:
38
38
 
39
39
  - trigger: "PR or fuzzy match on performance-review"
40
40
  workflow: "{project-root}/_prr/prr/workflows/3-review/performance-review/workflow.yaml"
41
- description: "[PR] Performance Review: N+1, memory, async, bundle size analysis"
41
+ description: "[PR] Performance Review: Performance analysis adapted to your stack"
42
42
 
43
43
  - trigger: "IC or fuzzy match on improve-code"
44
44
  workflow: "{project-root}/_prr/prr/workflows/4-improve/improve-code/workflow.yaml"
@@ -5,7 +5,7 @@ agent:
5
5
  title: "Security Code Reviewer"
6
6
  icon: "🔒"
7
7
  module: prr
8
- capabilities: "OWASP top 10, SQL injection, XSS, auth vulnerabilities, API key exposure, dependency vulnerabilities, cryptography misuse"
8
+ capabilities: "OWASP top 10, SQL injection, XSS, auth vulnerabilities, API key exposure, dependency vulnerabilities, cryptography misuse, and stack-specific security threats"
9
9
  hasSidecar: false
10
10
  no_launcher: true
11
11
 
@@ -40,7 +40,7 @@ agent:
40
40
 
41
41
  - trigger: "SR or fuzzy match on security-review"
42
42
  workflow: "{project-root}/_prr/prr/workflows/3-review/security-review/workflow.yaml"
43
- description: "[SR] Security Review: Full OWASP-based security analysis"
43
+ description: "[SR] Security Review: Security analysis adapted to your project"
44
44
 
45
45
  - trigger: "IC or fuzzy match on improve-code"
46
46
  workflow: "{project-root}/_prr/prr/workflows/4-improve/improve-code/workflow.yaml"
@@ -1,7 +1,6 @@
1
1
  ---
2
2
  name: "step-05-confirm"
3
3
  description: "Show PR scope summary and confirm before proceeding to review"
4
- contextOutputFile: "{review_output}/current-pr-context.yaml"
5
4
  ---
6
5
 
7
6
  # Step 5: Confirm Scope
@@ -10,10 +9,104 @@ contextOutputFile: "{review_output}/current-pr-context.yaml"
10
9
 
11
10
  ## STEP GOAL
12
11
 
13
- Show a clear summary of what will be reviewed, write PR context to file, and confirm the user wants to proceed.
12
+ Show a clear summary of what will be reviewed, create the session output folder, store PR metadata in working context, and confirm the user wants to proceed.
14
13
 
15
14
  ## Sequence of Instructions
16
15
 
16
+ ### 0. Compute Session Output Folder
17
+
18
+ Generate a unique, human-readable folder for this PR review session:
19
+
20
+ ```
21
+ sanitized_branch = selected_branch
22
+ .toLowerCase()
23
+ .replace(/[^a-z0-9]+/g, '-')
24
+ .replace(/^-+|-+$/g, '')
25
+ .substring(0, 40)
26
+
27
+ if pr_number is set:
28
+ session_slug = "pr{pr_number}-{sanitized_branch}"
29
+ else:
30
+ session_slug = "{sanitized_branch}"
31
+
32
+ datetime_prefix = current datetime as "YYYY-MM-DD-HHmm" (e.g. 2026-03-02-1430)
33
+
34
+ session_output = "{review_output}/{datetime_prefix}-{session_slug}"
35
+ ```
36
+
37
+ Examples:
38
+ - `_prr-output/reviews/2026-03-02-1430-pr44-feature-auth-login`
39
+ - `_prr-output/reviews/2026-03-02-1430-feature-auth-login`
40
+
41
+ Create the folder:
42
+ ```bash
43
+ mkdir -p "{session_output}"
44
+ ```
45
+
46
+ **Store `session_output` in working context** — all subsequent workflows in this session will use it.
47
+
48
+ ### 0b. Generate Diffs Folder
49
+
50
+ Parse the diff already loaded in memory and write per-file markdown files under `{session_output}/diffs/`, mirroring the repo folder tree.
51
+
52
+ **For each changed file in the diff:**
53
+
54
+ 1. Determine file path, status, and line counts from the diff header.
55
+ 2. Construct output path: `{session_output}/diffs/{file_path}.md`
56
+ 3. Create parent directories:
57
+ ```bash
58
+ mkdir -p "{session_output}/diffs/{file_dir}"
59
+ ```
60
+ 4. Write the markdown file:
61
+
62
+ ```markdown
63
+ # {file_path}
64
+ **Status:** {modified|added|deleted|renamed} | **+{lines_added} / -{lines_removed} lines**
65
+ ---
66
+
67
+ **Line {start_line}** *(or **Lines {start}–{end}** for multi-line hunks)*
68
+ ```diff
69
+ - old line content
70
+ + new line content
71
+ ```
72
+
73
+ *(repeat for each hunk in this file)*
74
+ ```
75
+
76
+ **Rules:**
77
+ - **New file:** show all lines as `+` additions under a single hunk block.
78
+ - **Deleted file:** show all lines as `-` deletions under a single hunk block.
79
+ - **Renamed file with no content change:** write status line only, no diff blocks.
80
+ - **Renamed file with changes:** write status `renamed` and include change hunks as normal.
81
+ - One `.md` file per changed file. Folder structure mirrors the repo exactly.
82
+
83
+ **Example output for a modified file:**
84
+
85
+ ```markdown
86
+ # src/auth/login.ts
87
+ **Status:** modified | **+45 / -12 lines**
88
+ ---
89
+
90
+ **Line 23**
91
+ ```diff
92
+ - const token = localStorage.getItem('token')
93
+ + const token = cookieStorage.get('auth_token')
94
+ ```
95
+
96
+ **Lines 67–70**
97
+ ```diff
98
+ - async function login(user, pass) {
99
+ - const result = await db.users.findOne(user)
100
+ + async function login(user: string, pass: string): Promise<User> {
101
+ + const result = await db.users.findOne({ email: user })
102
+ ```
103
+ ```
104
+
105
+ After writing all files, print:
106
+ ```
107
+ ✓ Diffs saved: {file_count} files → {session_output}/diffs/
108
+ ```
109
+
17
110
  ### 1. Display Scope Summary
18
111
 
19
112
  Present a clear summary:
@@ -45,29 +138,7 @@ Recommended reviews for this PR:
45
138
  [BR] Business Review — for feature PRs, data migrations, or any high-risk change
46
139
  ```
47
140
 
48
- ### 2. Write PR Context File
49
-
50
- Write `{contextOutputFile}` with:
51
-
52
- ```yaml
53
- pr:
54
- target_branch: "{selected_branch}"
55
- base_branch: "{base_branch}"
56
- pr_number: "{pr_number}"
57
- pr_title: "{pr_title}"
58
- diff_stats: |
59
- {diff_stats}
60
- commit_count: {commit_count}
61
- files_changed:
62
- {files_changed_list}
63
- diff_strategy: "{diff_strategy}"
64
- date: "{date}"
65
- review:
66
- completed: []
67
- findings: []
68
- ```
69
-
70
- ### 3. Ask for Confirmation
141
+ ### 2. Ask for Confirmation
71
142
 
72
143
  ```
73
144
  ✅ Ready to review. Which review would you like to run first?
@@ -23,7 +23,7 @@ This uses **step-file architecture** with sequential orchestration:
23
23
  - 🛑 NEVER start reviewing without completing this workflow first
24
24
  - 📖 Read entire step file before executing
25
25
  - ⏸️ ALWAYS halt at user selection points — never auto-select
26
- - 💾 Write PR context to `{review_output}/current-pr-context.yaml` after confirmation
26
+ - 💾 Create session folder `{session_output}` and store PR metadata in working context after confirmation (step 5)
27
27
 
28
28
  ## INITIALIZATION
29
29
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: "step-02-collect-sources"
3
3
  description: "Collect context from all identified sources"
4
- nextStepFile: "./step-03-build-knowledge-base.md"
4
+ nextStepFile: "./step-03-manual-context-input.md"
5
5
  ---
6
6
 
7
7
  # Step 2: Collect Context from Sources
@@ -449,3 +449,4 @@ collected_data:
449
449
  ### 9. Load Next Step
450
450
 
451
451
  Add `step-02-collect-sources` to `stepsCompleted`. Load: `{nextStepFile}`
452
+