@open-code-review/agents 1.0.1 → 1.0.3

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.
@@ -0,0 +1,158 @@
1
+ # OCR Setup Guard
2
+
3
+ **This is a sub-skill that MUST be called at the start of ALL OCR skills and commands.**
4
+
5
+ ## Purpose
6
+
7
+ Validate that OCR is properly set up before proceeding with any review operations. This prevents confusing errors and provides clear guidance when setup is incomplete.
8
+
9
+ ## Installation Modes
10
+
11
+ OCR supports two installation modes:
12
+
13
+ | Mode | Skills Location | Commands Location | How to Install |
14
+ |------|-----------------|-------------------|----------------|
15
+ | **CLI** | `.ocr/skills/` | `.ocr/commands/` | `npx @open-code-review/cli init` |
16
+ | **Plugin** | Plugin cache | Plugin cache | `/plugin install open-code-review` |
17
+
18
+ **The setup guard adapts based on which mode is detected.**
19
+
20
+ ## Directory Structure
21
+
22
+ ```
23
+ .ocr/
24
+ ├── commands/ # Central command definitions (CLI mode)
25
+ ├── skills/ # Skill files (CLI mode, symlinked or copied)
26
+ └── sessions/ # Review session storage (both modes)
27
+ ```
28
+
29
+ ## When to Use
30
+
31
+ Call this guard at the **very beginning** of:
32
+ - `/ocr-review` or `/open-code-review:review` - Before starting any code review
33
+ - `/ocr-show` or `/open-code-review:show` - Before displaying past sessions
34
+ - `/ocr-history` or `/open-code-review:history` - Before listing sessions
35
+ - `/ocr-post` or `/open-code-review:post` - Before posting to GitHub
36
+ - Any other OCR operation that requires session storage
37
+
38
+ ## Validation Steps
39
+
40
+ Execute these checks in order:
41
+
42
+ ### 1. Detect Installation Mode
43
+
44
+ First, determine how OCR was installed:
45
+
46
+ ```bash
47
+ # Check for CLI mode (skills in project)
48
+ ls -la .ocr/skills/SKILL.md 2>/dev/null && echo "CLI_MODE"
49
+
50
+ # If no local skills, check if running as plugin
51
+ # (Plugin mode = skills accessed from plugin, only sessions dir needed locally)
52
+ ```
53
+
54
+ **CLI Mode**: `.ocr/skills/` exists → validate full CLI setup
55
+ **Plugin Mode**: No `.ocr/skills/` but OCR commands work → only need sessions directory
56
+
57
+ ### 2. CLI Mode Validation
58
+
59
+ If `.ocr/skills/` exists (CLI mode):
60
+
61
+ **Check for .ocr Directory:**
62
+ ```bash
63
+ ls -la .ocr/ 2>/dev/null || echo "NOT_FOUND"
64
+ ```
65
+
66
+ **If NOT_FOUND:**
67
+ ```
68
+ ⛔ OCR is not set up in this project.
69
+
70
+ To set up OCR, run:
71
+
72
+ npx @open-code-review/cli init
73
+
74
+ This will install OCR skills, commands, and create the sessions directory.
75
+ ```
76
+ **Then STOP.**
77
+
78
+ **Check for Skills Directory:**
79
+ ```bash
80
+ ls -la .ocr/skills/SKILL.md 2>/dev/null || echo "NOT_FOUND"
81
+ ```
82
+
83
+ **If NOT_FOUND:**
84
+ ```
85
+ ⛔ OCR skills are missing.
86
+
87
+ The .ocr directory exists but skills are not installed.
88
+
89
+ To fix, run:
90
+
91
+ npx @open-code-review/cli init
92
+ ```
93
+ **Then STOP.**
94
+
95
+ ### 3. Plugin Mode Validation
96
+
97
+ If running as a Claude Code plugin (no `.ocr/skills/` but command is accessible):
98
+
99
+ **Check for sessions directory:**
100
+ ```bash
101
+ ls -la .ocr/sessions/ 2>/dev/null || echo "NOT_FOUND"
102
+ ```
103
+
104
+ **If NOT_FOUND:**
105
+ ```
106
+ 📦 Plugin mode detected - initializing project...
107
+
108
+ Creating .ocr/sessions/ directory for review storage.
109
+ ```
110
+
111
+ Then create the directory:
112
+ ```bash
113
+ mkdir -p .ocr/sessions
114
+ ```
115
+
116
+ Create `.ocr/.gitignore` if it doesn't exist:
117
+ ```bash
118
+ echo "sessions/" > .ocr/.gitignore
119
+ ```
120
+
121
+ ### 4. Bootstrap Sessions Directory (JIT)
122
+
123
+ For both modes, ensure sessions directory exists:
124
+
125
+ ```bash
126
+ mkdir -p .ocr/sessions
127
+ ```
128
+
129
+ This is safe to do automatically since it's just an empty directory for storing review sessions.
130
+
131
+ ## Success Response
132
+
133
+ If all checks pass, respond briefly and proceed:
134
+
135
+ ```
136
+ ✓ OCR setup verified
137
+ ```
138
+
139
+ Then continue with the requested operation.
140
+
141
+ ## Integration Example
142
+
143
+ At the start of any OCR skill execution:
144
+
145
+ ```markdown
146
+ # Before doing anything else:
147
+ 1. Read and execute `references/setup-guard.md`
148
+ 2. If setup guard fails, STOP and show the error message
149
+ 3. If setup guard passes, proceed with the requested operation
150
+ ```
151
+
152
+ ## Why This Matters
153
+
154
+ - **Better DX**: Users get clear, actionable feedback instead of cryptic errors
155
+ - **Fail Fast**: Problems are caught immediately, not mid-operation
156
+ - **Consistent UX**: Every OCR command behaves the same way when setup is missing
157
+ - **Self-Documenting**: The error messages tell users exactly how to fix the issue
158
+ - **Dual Mode**: Works seamlessly whether installed via CLI or Claude Code plugin
@@ -0,0 +1,296 @@
1
+ # Synthesis Phase
2
+
3
+ After discourse (or individual reviews if `--quick`), synthesize all findings into a unified final review.
4
+
5
+ ## Philosophy: Model Real Engineering Teams
6
+
7
+ This synthesis process is designed to mirror how high-performing engineering teams (Google, Stripe, etc.) conduct code review, following principles articulated by Martin Fowler and the continuous delivery community:
8
+
9
+ 1. **Any reviewer can block** — A single engineer identifying a critical issue (security vulnerability, data integrity risk, correctness bug) can block a merge. This is non-negotiable.
10
+
11
+ 2. **No feedback is lost** — Every comment from every reviewer surfaces in the final output, fully attributed. Just like PR comments, individual perspectives are preserved—not averaged away.
12
+
13
+ 3. **Suggestions are suggestions** — Non-blocking feedback (style preferences, refactoring ideas, minor improvements) is presented for consideration but doesn't prevent merge.
14
+
15
+ 4. **Tech Lead synthesizes, doesn't override** — The Tech Lead aggregates and presents all feedback with a recommendation, but doesn't suppress minority opinions or "outvote" blockers.
16
+
17
+ 5. **Trust and autonomy** — Authors are trusted to address feedback appropriately. Reviews are collaborative conversations, not gatekeeping.
18
+
19
+ ## Purpose
20
+
21
+ - **Preserve all feedback** — Every finding from every reviewer appears, attributed
22
+ - **Identify blockers** — Surface anything that should prevent merge
23
+ - **Present suggestions** — Non-blocking improvements for author consideration
24
+ - **Assess requirements** — Evaluate against provided requirements (if any)
25
+ - **Recommend action** — Clear verdict with rationale
26
+
27
+ ## Synthesis Process
28
+
29
+ ### Step 1: Gather All Feedback
30
+
31
+ Collect without filtering:
32
+ - All individual reviews (`reviews/*.md`)
33
+ - Discourse results (`discourse.md`) if available
34
+ - Requirements context (`requirements.md`) if provided
35
+ - Tech Lead's original analysis
36
+
37
+ **Critical**: Do not discard or "deduplicate away" any reviewer feedback at this stage.
38
+
39
+ ### Step 2: Identify Blockers
40
+
41
+ A finding is a **blocker** if ANY of the following are true:
42
+
43
+ | Blocker Criteria | Examples |
44
+ |------------------|----------|
45
+ | **Security vulnerability** | SQL injection, auth bypass, secrets exposure |
46
+ | **Data integrity risk** | Race conditions causing data loss, silent failures |
47
+ | **Correctness bug** | Logic errors that produce wrong results |
48
+ | **Breaking change without migration** | API contract violations, schema changes without rollback |
49
+ | **Compliance violation** | GDPR, HIPAA, PCI-DSS requirements not met |
50
+
51
+ **Any single reviewer can flag a blocker.** This is not subject to consensus—one engineer seeing a security hole is sufficient to block.
52
+
53
+ ### Step 3: Collect Suggestions
54
+
55
+ All non-blocking feedback is preserved and attributed:
56
+
57
+ ```markdown
58
+ ## Suggestions
59
+
60
+ ### Code Quality
61
+ - "Consider extracting this into a separate function for testability" — @principal-1
62
+ - "The variable naming could be more descriptive" — @quality-1
63
+
64
+ ### Performance
65
+ - "This could be optimized with memoization" — @principal-2
66
+
67
+ ### Style
68
+ - "Prefer `const` over `let` here" — @quality-2
69
+
70
+ ### Testing
71
+ - "Edge case for empty input not covered" — @testing-1
72
+ ```
73
+
74
+ **No suggestion is lost.** Even if only one reviewer mentions something, it surfaces.
75
+
76
+ ### Step 4: Note Consensus and Dissent
77
+
78
+ When multiple reviewers comment on the same area:
79
+
80
+ ```markdown
81
+ ### Finding: Error handling in auth flow
82
+
83
+ **Reviewers**: @principal-1, @principal-2, @quality-2
84
+
85
+ @principal-1: "Missing try-catch around the OAuth callback"
86
+ @principal-2: "Agreed — this will crash on token refresh failure"
87
+ @quality-2: "The error handling exists but doesn't propagate to the UI"
88
+
89
+ **Consensus**: All agree error handling needs improvement
90
+ **Dissent**: None
91
+ ```
92
+
93
+ When reviewers disagree:
94
+
95
+ ```markdown
96
+ ### Finding: Caching strategy
97
+
98
+ **Reviewers**: @principal-1, @security-1
99
+
100
+ @principal-1: "Should add Redis caching for performance"
101
+ @security-1: "Caching user data introduces staleness risks for permissions"
102
+
103
+ **Consensus**: None — valid tradeoff
104
+ **Tech Lead note**: Present both perspectives to author for decision
105
+ ```
106
+
107
+ ### Step 5: Assess Requirements (if provided)
108
+
109
+ If requirements were provided, evaluate each against the implementation:
110
+
111
+ ```markdown
112
+ ## Requirements Assessment
113
+
114
+ | Requirement | Status | Notes | Flagged By |
115
+ |-------------|--------|-------|------------|
116
+ | Users can log in via OAuth | ✓ Met | Implementation complete | @principal-1 |
117
+ | Session tokens expire after 24h | ? Unclear | Expiry logic not visible in diff | @security-1 |
118
+ | Failed logins are rate-limited | ✗ Gap | No rate limiting found | @security-1 |
119
+
120
+ **Gaps identified**: 1 requirement not met (rate limiting)
121
+ **Needs clarification**: 1 requirement unclear (token expiry)
122
+ ```
123
+
124
+ A requirements gap MAY be a blocker if it represents a critical feature. The reviewer who identifies the gap makes the blocking determination.
125
+
126
+ ### Step 6: Collect Clarifying Questions
127
+
128
+ Preserve all questions from all reviewers:
129
+
130
+ ```markdown
131
+ ## Clarifying Questions
132
+
133
+ Every question below was raised by a reviewer. Please address each.
134
+
135
+ ### From @principal-1
136
+ - "The spec says 'fast response' — what's the target latency?"
137
+
138
+ ### From @security-1
139
+ - "Should this include rate limiting, or is that a separate PR?"
140
+ - "Was account lockout intentionally left out?"
141
+
142
+ ### From @testing-1
143
+ - "How should concurrent login attempts be handled?"
144
+ ```
145
+
146
+ ### Step 7: Synthesize Verdict
147
+
148
+ The Tech Lead determines the verdict based on simple rules:
149
+
150
+ | Condition | Verdict | Rationale |
151
+ |-----------|---------|-----------|
152
+ | **Any blocker exists** | REQUEST CHANGES | Blockers must be resolved before merge |
153
+ | **Unanswered questions about requirements** | NEEDS DISCUSSION | Author should clarify intent |
154
+ | **Suggestions only, no blockers** | APPROVE | Trust author to consider suggestions |
155
+ | **No findings** | APPROVE | Code is ready to merge |
156
+
157
+ **Important**: The Tech Lead does NOT override blockers. If any reviewer flags a blocker, the verdict is REQUEST CHANGES regardless of other opinions.
158
+
159
+ ---
160
+
161
+ ## Final Review Template
162
+
163
+ ```markdown
164
+ # Code Review: {branch/PR}
165
+
166
+ **Date**: {YYYY-MM-DD}
167
+ **Reviewers**: @principal-1, @principal-2, @quality-1, @security-1
168
+ **Mode**: Full (with discourse) | Quick (no discourse)
169
+
170
+ ---
171
+
172
+ ## Verdict
173
+
174
+ **APPROVE** | **REQUEST CHANGES** | **NEEDS DISCUSSION**
175
+
176
+ {One sentence rationale}
177
+
178
+ ---
179
+
180
+ ## Blockers
181
+
182
+ {If any blockers exist, they appear here. Each blocker must be resolved before merge.}
183
+
184
+ ### 🚫 {Blocker Title}
185
+ **Flagged by**: @security-1
186
+ **Type**: Security vulnerability
187
+ **Location**: `path/to/file.ts:42-50`
188
+
189
+ **Issue**: {Description of the problem}
190
+
191
+ **Why this blocks**: {Impact if merged as-is}
192
+
193
+ **Suggested fix**:
194
+ ```{language}
195
+ {code suggestion if applicable}
196
+ ```
197
+
198
+ ---
199
+
200
+ ## Suggestions
201
+
202
+ {All non-blocking feedback, preserved and attributed}
203
+
204
+ ### Code Quality
205
+ - "Consider extracting the validation logic into a separate function" — @principal-1
206
+ - "The error messages could be more user-friendly" — @quality-1
207
+
208
+ ### Performance
209
+ - "This query could benefit from an index on `user_id`" — @principal-2
210
+
211
+ ### Testing
212
+ - "Edge case for empty array not covered" — @testing-1
213
+
214
+ ### Style
215
+ - "Prefer early returns to reduce nesting" — @quality-1
216
+
217
+ ---
218
+
219
+ ## Consensus & Dissent
220
+
221
+ {When multiple reviewers commented on the same topic}
222
+
223
+ ### Topic: Error handling approach
224
+ **Reviewers**: @principal-1, @principal-2, @quality-1
225
+
226
+ | Reviewer | Position |
227
+ |----------|----------|
228
+ | @principal-1 | "Wrap in try-catch and log to monitoring" |
229
+ | @principal-2 | "Agree with try-catch approach" |
230
+ | @quality-1 | "Consider custom error types for better debugging" |
231
+
232
+ **Consensus**: All agree on try-catch; @quality-1 adds refinement suggestion
233
+
234
+ ---
235
+
236
+ ## What's Working Well
237
+
238
+ - "Clean separation of concerns in the service layer" — @principal-1
239
+ - "Good test coverage for the happy path" — @testing-1
240
+ - "Proper input validation on all endpoints" — @security-1
241
+
242
+ ---
243
+
244
+ ## Requirements Assessment
245
+
246
+ {If requirements were provided}
247
+
248
+ | Requirement | Status | Notes | Reviewer |
249
+ |-------------|--------|-------|----------|
250
+ | Users can log in via OAuth | ✓ Met | Implementation complete | @principal-1 |
251
+ | Rate limiting on login | ✗ Gap | Not implemented | @security-1 |
252
+
253
+ ---
254
+
255
+ ## Clarifying Questions
256
+
257
+ {All questions from all reviewers — author should address each}
258
+
259
+ ### From @principal-1
260
+ - "What's the expected latency target for the auth flow?"
261
+
262
+ ### From @security-1
263
+ - "Is rate limiting planned for a follow-up PR?"
264
+
265
+ ---
266
+
267
+ ## Individual Reviews
268
+
269
+ Full reviews available in session directory:
270
+
271
+ | Reviewer | Blockers | Suggestions | File |
272
+ |----------|----------|-------------|------|
273
+ | @principal-1 | 0 | 3 | `reviews/principal-1.md` |
274
+ | @principal-2 | 0 | 2 | `reviews/principal-2.md` |
275
+ | @quality-1 | 0 | 4 | `reviews/quality-1.md` |
276
+ | @security-1 | 1 | 2 | `reviews/security-1.md` |
277
+
278
+ **Session**: `.ocr/sessions/{session-id}/`
279
+ **Discourse**: `discourse.md`
280
+ ```
281
+
282
+ ---
283
+
284
+ ## Key Principles Recap
285
+
286
+ 1. **Blockers are binary** — Something either blocks merge or it doesn't. No "severity scoring."
287
+
288
+ 2. **One reviewer can block** — Security engineer sees a vulnerability? That's a blocker, period.
289
+
290
+ 3. **Suggestions don't block** — Style preferences, refactoring ideas, and minor improvements are presented but don't prevent merge.
291
+
292
+ 4. **All feedback surfaces** — Every comment from every reviewer appears in the final output. Nothing is "averaged away."
293
+
294
+ 5. **Author has autonomy** — For suggestions, the author decides what to address. Trust the engineer.
295
+
296
+ 6. **Tech Lead facilitates** — The Tech Lead synthesizes and recommends, but doesn't override individual blockers or suppress feedback.