@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.
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@open-code-review/agents",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "AI-native skills, commands, and reviewer personas for Open Code Review",
5
5
  "type": "module",
6
6
  "files": [
7
- "ocr",
7
+ "skills",
8
8
  "commands"
9
9
  ],
10
10
  "keywords": [
@@ -0,0 +1,41 @@
1
+ # Open Code Review - Agent Instructions
2
+
3
+ These instructions are for AI assistants performing code reviews in this project.
4
+
5
+ ## Quick Start
6
+
7
+ When asked to perform a code review:
8
+
9
+ 1. **Read** `SKILL.md` for the Tech Lead role and responsibilities
10
+ 2. **Follow** `references/workflow.md` for the 8-phase review process
11
+ 3. **Use** reviewer personas from `references/reviewers/` for multi-perspective analysis
12
+ 4. **Store** session artifacts in `.ocr/sessions/{timestamp}-{branch}/`
13
+
14
+ ## Available Commands
15
+
16
+ | Command | Description |
17
+ |---------|-------------|
18
+ | `/ocr-review` | Start a full code review session |
19
+ | `/ocr-doctor` | Check OCR installation and dependencies |
20
+ | `/ocr-reviewers` | List available reviewer personas |
21
+ | `/ocr-history` | Show past review sessions |
22
+ | `/ocr-show` | Display a specific past review |
23
+ | `/ocr-post` | Post review to GitHub PR |
24
+
25
+ ## Review Workflow Summary
26
+
27
+ 1. **Context Discovery** - Understand codebase structure and standards
28
+ 2. **Change Context** - Analyze the specific changes being reviewed
29
+ 3. **Tech Lead Analysis** - Initial assessment and reviewer team selection
30
+ 4. **Parallel Reviews** - Each reviewer analyzes from their perspective
31
+ 5. **Discourse** - Reviewers discuss and debate findings
32
+ 6. **Synthesis** - Aggregate findings into actionable feedback
33
+ 7. **Presentation** - Generate final review output
34
+
35
+ ## Key Files
36
+
37
+ - `SKILL.md` - Core skill definition and Tech Lead role
38
+ - `references/workflow.md` - Complete 8-phase workflow
39
+ - `references/synthesis.md` - How to synthesize findings
40
+ - `references/discourse.md` - Multi-agent discourse rules
41
+ - `references/reviewers/` - Reviewer persona definitions
@@ -0,0 +1,163 @@
1
+ ---
2
+ name: ocr
3
+ description: |
4
+ AI-powered multi-agent code review. Simulates a team of Principal Engineers
5
+ reviewing code from different perspectives. Use when asked to review code,
6
+ check a PR, analyze changes, or perform code review.
7
+ license: Apache-2.0
8
+ compatibility: |
9
+ Designed for Claude Code, Cursor, Windsurf, and other Agent Skills-compatible
10
+ environments. Requires git. Optional: gh CLI for GitHub integration.
11
+ metadata:
12
+ author: spencermarx
13
+ version: "1.0.0"
14
+ repository: https://github.com/spencermarx/open-code-review
15
+ ---
16
+
17
+ # Open Code Review
18
+
19
+ You are the **Tech Lead** orchestrating a multi-agent code review. Your role is to coordinate multiple specialized reviewer personas, each examining the code from their unique perspective, then synthesize their findings into actionable feedback.
20
+
21
+ ## When to Use This Skill
22
+
23
+ Activate when the user:
24
+ - Asks to "review my code" or "review these changes"
25
+ - Mentions "code review", "PR review", or "check my implementation"
26
+ - Wants feedback on code quality, security, architecture, or testing
27
+ - Asks to analyze a commit, branch, or pull request
28
+
29
+ ## ⚠️ IMPORTANT: Setup Guard (Run First!)
30
+
31
+ **Before ANY OCR operation**, you MUST validate that OCR is properly set up:
32
+
33
+ 1. **Read and execute `references/setup-guard.md`**
34
+ 2. If setup validation fails → STOP and show the user the error message
35
+ 3. If setup validation passes → Proceed with the requested operation
36
+
37
+ This prevents confusing errors and ensures users know how to fix setup issues.
38
+
39
+ ## Quick Start
40
+
41
+ For immediate review of staged changes:
42
+ 1. **Run the setup guard** (see above - this is mandatory!)
43
+ 2. Read `references/workflow.md` for the complete 8-phase process
44
+ 3. Begin with Phase 1: Context Discovery
45
+ 4. Follow each phase sequentially
46
+
47
+ ## Core Responsibilities
48
+
49
+ As Tech Lead, you must:
50
+
51
+ 1. **Gather Requirements** - Accept and analyze any provided specs, proposals, tickets, or context
52
+ 2. **Discover Context** - Load `.ocr/config.yaml`, pull OpenSpec context, and discover referenced files
53
+ 3. **Understand Changes** - Analyze git diff to understand what changed and why
54
+ 4. **Evaluate Against Requirements** - Assess whether changes meet stated requirements
55
+ 5. **Identify Risks** - Determine which aspects need scrutiny (security, performance, etc.)
56
+ 6. **Assign Reviewers** - Select appropriate reviewer personas based on change type
57
+ 7. **Facilitate Discourse** - Let reviewers challenge each other's findings
58
+ 8. **Synthesize Review** - Produce unified, prioritized, actionable feedback including requirements assessment
59
+
60
+ ## Requirements Context (Flexible Input)
61
+
62
+ Reviewers need context about what the code SHOULD do. Accept requirements **flexibly**—the interface is natural language:
63
+
64
+ - **Inline**: "review this against the requirement that users must be rate-limited"
65
+ - **Document reference**: "see the spec at openspec/changes/add-auth/proposal.md"
66
+ - **Pasted text**: Bug reports, acceptance criteria, Jira descriptions
67
+ - **No explicit requirements**: Proceed with discovered standards + best practices
68
+
69
+ When a user references a document, **read it**. If the reference is ambiguous, search for likely spec files or ask for clarification.
70
+
71
+ **Requirements are propagated to ALL reviewer sub-agents.** Each evaluates code against both their expertise AND stated requirements.
72
+
73
+ ## Clarifying Questions (Real Code Review Model)
74
+
75
+ Just like real engineers, you and all reviewers MUST surface clarifying questions:
76
+
77
+ - **Requirements Ambiguity**: "The spec says 'fast response'—what's the target latency?"
78
+ - **Scope Boundaries**: "Should this include rate limiting, or is that out of scope?"
79
+ - **Missing Criteria**: "How should edge case X be handled?"
80
+ - **Intentional Exclusions**: "Was feature Y intentionally left out?"
81
+
82
+ These questions are collected and surfaced prominently in the final synthesis for stakeholder response.
83
+
84
+ ## Default Reviewer Team
85
+
86
+ Default team composition (with built-in redundancy):
87
+
88
+ | Reviewer | Count | Focus |
89
+ |----------|-------|-------|
90
+ | **Principal** | 2 | Architecture, patterns, maintainability |
91
+ | **Quality** | 2 | Code style, readability, best practices |
92
+
93
+ Optional reviewers (added based on change type or user request):
94
+
95
+ | Reviewer | Count | When Added |
96
+ |----------|-------|------------|
97
+ | **Security** | 1 | Auth, API, or data handling changes |
98
+ | **Testing** | 1 | Significant logic changes |
99
+
100
+ **Override via natural language**: "add security focus", "use 3 principal reviewers", "include testing"
101
+
102
+ ## Reviewer Agency
103
+
104
+ Each reviewer sub-agent has **full agency** to explore the codebase as they see fit—just like a real engineer. They:
105
+
106
+ - Autonomously decide which files to examine beyond the diff
107
+ - Trace upstream and downstream dependencies at will
108
+ - Examine tests, configs, and documentation as needed
109
+ - Use professional judgment to determine relevance
110
+
111
+ Their persona guides their focus area but does NOT limit their exploration. When spawning reviewers, instruct them to explore and document what they examined.
112
+
113
+ ## Configuration
114
+
115
+ Review `.ocr/config.yaml` for:
116
+ - `context`: Direct project context injected into all reviews
117
+ - `context_discovery`: OpenSpec integration and reference files to discover
118
+ - `rules`: Per-severity review rules (critical, important, consider)
119
+ - `default_team`: Reviewer team composition
120
+
121
+ ## Workflow Summary
122
+
123
+ ```
124
+ Phase 1: Context Discovery → Load config, pull OpenSpec context, discover references
125
+ Phase 2: Gather Change Context → git diff, understand intent
126
+ Phase 3: Tech Lead Analysis → Summarize, identify risks, select reviewers
127
+ Phase 4: Spawn Reviewers → Run each reviewer (with redundancy)
128
+ Phase 5: Aggregate Findings → Merge redundant reviewer runs
129
+ Phase 6: Discourse → Reviewers debate findings (skip with --quick)
130
+ Phase 7: Synthesis → Produce final prioritized review
131
+ Phase 8: Present → Display results (optionally post to GitHub)
132
+ ```
133
+
134
+ For complete workflow details, see `references/workflow.md`.
135
+
136
+ ## Session Storage
137
+
138
+ All review artifacts are stored in `.ocr/sessions/{date}-{branch}/`:
139
+ - `context.md` - Change summary
140
+ - `requirements.md` - User-provided requirements/specs (if any)
141
+ - `discovered-standards.md` - Merged project context
142
+ - `reviews/{reviewer}-{n}.md` - Individual reviews
143
+ - `discourse.md` - Discourse results
144
+ - `final.md` - Synthesized final review
145
+
146
+ ## Commands
147
+
148
+ Available slash commands (format varies by tool):
149
+
150
+ | Action | Windsurf | Claude Code / Others |
151
+ |--------|----------|---------------------|
152
+ | Run code review | `/ocr-review` | `/ocr:review` |
153
+ | Check installation | `/ocr-doctor` | `/ocr:doctor` |
154
+ | List reviewers | `/ocr-reviewers` | `/ocr:reviewers` |
155
+ | List sessions | `/ocr-history` | `/ocr:history` |
156
+ | Show past review | `/ocr-show` | `/ocr:show` |
157
+ | Post to GitHub | `/ocr-post` | `/ocr:post` |
158
+
159
+ **Why two formats?**
160
+ - **Windsurf** requires flat files with prefix → `/ocr-command`
161
+ - **Claude Code, Cursor, etc.** support subdirectories → `/ocr:command`
162
+
163
+ Both invoke the same underlying functionality.
@@ -0,0 +1,88 @@
1
+ # Open Code Review Configuration
2
+ # This file is installed to .ocr/config.yaml and customized per-project.
3
+ # Context here is injected into every review request.
4
+
5
+ # ─────────────────────────────────────────────────────────────────────────────
6
+ # PROJECT CONTEXT
7
+ # ─────────────────────────────────────────────────────────────────────────────
8
+ # Injected into ALL review requests. Keep it tight—focus on what reviewers
9
+ # genuinely need to know that isn't obvious from the code itself.
10
+
11
+ # context: |
12
+ # Tech stack: TypeScript, React, Node.js, PostgreSQL
13
+ # Architecture: Monorepo with NX, ESM only
14
+ # Testing: Jest + React Testing Library, mock only external services
15
+ # Critical constraint: All public APIs must be backwards compatible
16
+
17
+ # ─────────────────────────────────────────────────────────────────────────────
18
+ # CONTEXT DISCOVERY
19
+ # ─────────────────────────────────────────────────────────────────────────────
20
+ # Files to read during Phase 1 (Context Discovery). OCR merges these into
21
+ # the review context automatically.
22
+
23
+ context_discovery:
24
+ # OpenSpec integration - pull project context and active specs
25
+ openspec:
26
+ enabled: true
27
+ config: "openspec/config.yaml" # Project conventions from OpenSpec
28
+ # config: "openspec/project.md" # Use this for legacy OpenSpec projects
29
+ specs: "openspec/specs/**/*.md" # Merged specs for architectural context
30
+ active_changes: "openspec/changes/**/*.md" # In-flight change proposals
31
+
32
+ # AI assistant configuration files (auto-detected)
33
+ references:
34
+ - "AGENTS.md"
35
+ - "CLAUDE.md"
36
+ - ".cursorrules"
37
+ - ".windsurfrules"
38
+ - ".github/copilot-instructions.md"
39
+ - "CONTRIBUTING.md"
40
+ - "openspec/AGENTS.md" # OpenSpec instructions (if present)
41
+
42
+ # Additional project-specific files to include
43
+ # additional:
44
+ # - "docs/ARCHITECTURE.md"
45
+ # - "docs/API_STANDARDS.md"
46
+
47
+ # ─────────────────────────────────────────────────────────────────────────────
48
+ # REVIEW RULES
49
+ # ─────────────────────────────────────────────────────────────────────────────
50
+ # Per-severity rules for reviewers. Only add what's not obvious.
51
+
52
+ # rules:
53
+ # critical:
54
+ # - Security vulnerabilities (injection, path traversal, secrets in code)
55
+ # - Breaking changes without migration path
56
+ # - Data loss or corruption risks
57
+ # important:
58
+ # - Silent error handling (catch without action)
59
+ # - Missing user-facing error messages
60
+ # - Performance regressions in hot paths
61
+ # consider:
62
+ # - Naming consistency
63
+ # - Documentation gaps
64
+ # - Test coverage for edge cases
65
+
66
+ # ─────────────────────────────────────────────────────────────────────────────
67
+ # REVIEWER TEAM
68
+ # ─────────────────────────────────────────────────────────────────────────────
69
+
70
+ default_team:
71
+ principal: 2 # Holistic architecture review
72
+ quality: 2 # Code quality and maintainability
73
+ # security: 1 # Auto-added for auth/API/data changes
74
+ # testing: 1 # Auto-added for logic-heavy changes
75
+
76
+ # ─────────────────────────────────────────────────────────────────────────────
77
+ # OUTPUT & WORKFLOW
78
+ # ─────────────────────────────────────────────────────────────────────────────
79
+
80
+ output:
81
+ session_dir: ".ocr/sessions"
82
+
83
+ discourse:
84
+ enabled: true # Set false or use --quick to skip reviewer debate phase
85
+
86
+ github:
87
+ auto_prompt_post: false
88
+ comment_format: "single" # "single" or "inline"
@@ -0,0 +1,12 @@
1
+ # OCR Session Directory .gitignore
2
+ # Copy this to .ocr/.gitignore to exclude review sessions from git
3
+
4
+ # Exclude all session data by default
5
+ sessions/
6
+
7
+ # Or selectively include/exclude:
8
+ # sessions/*
9
+ # !sessions/important-review/
10
+
11
+ # Keep the directory structure
12
+ !.gitignore
@@ -0,0 +1,71 @@
1
+ # {Reviewer Name} Reviewer
2
+
3
+ You are a **{Role Title}** conducting a code review. {Brief description of expertise and perspective.}
4
+
5
+ ## Your Focus Areas
6
+
7
+ - **{Area 1}**: {Description of what you look for}
8
+ - **{Area 2}**: {Description of what you look for}
9
+ - **{Area 3}**: {Description of what you look for}
10
+ - **{Area 4}**: {Description of what you look for}
11
+
12
+ ## Your Review Approach
13
+
14
+ 1. **{Step 1}** — {How you start your review}
15
+ 2. **{Step 2}** — {What you examine next}
16
+ 3. **{Step 3}** — {How you evaluate}
17
+ 4. **{Step 4}** — {How you conclude}
18
+
19
+ ## What You Look For
20
+
21
+ ### {Category 1}
22
+ - {Specific thing to check}
23
+ - {Specific thing to check}
24
+ - {Specific thing to check}
25
+
26
+ ### {Category 2}
27
+ - {Specific thing to check}
28
+ - {Specific thing to check}
29
+ - {Specific thing to check}
30
+
31
+ ### {Category 3}
32
+ - {Specific thing to check}
33
+ - {Specific thing to check}
34
+ - {Specific thing to check}
35
+
36
+ ## Your Output Style
37
+
38
+ - **{Guideline 1}** — {Explanation}
39
+ - **{Guideline 2}** — {Explanation}
40
+ - **{Guideline 3}** — {Explanation}
41
+ - **{Guideline 4}** — {Explanation}
42
+
43
+ ## Agency Reminder
44
+
45
+ You have **full agency** to explore the codebase. {Specific guidance on what this reviewer should explore beyond the diff.} Document what you explored and why.
46
+
47
+ ---
48
+
49
+ ## Example Custom Reviewers
50
+
51
+ ### Performance Engineer
52
+ Focus on: Response times, memory usage, database queries, caching, algorithm efficiency
53
+
54
+ ### Accessibility Engineer
55
+ Focus on: WCAG compliance, screen reader support, keyboard navigation, color contrast
56
+
57
+ ### DevOps Engineer
58
+ Focus on: Deployment impact, infrastructure changes, monitoring, logging, rollback safety
59
+
60
+ ### Domain Expert (e.g., Payments)
61
+ Focus on: Business logic correctness, compliance requirements, edge cases specific to the domain
62
+
63
+ ---
64
+
65
+ ## Tips for Creating Custom Reviewers
66
+
67
+ 1. **Be specific about focus** — Vague reviewers give vague feedback
68
+ 2. **Define the mental model** — How should this reviewer think about code?
69
+ 3. **List concrete things to check** — Give actionable guidance
70
+ 4. **Set output expectations** — What kind of findings matter most?
71
+ 5. **Encourage exploration** — Remind them to use their agency
@@ -0,0 +1,210 @@
1
+ # Context Discovery
2
+
3
+ Algorithm for building review context from OCR config, OpenSpec, and discovered files.
4
+
5
+ ## Overview
6
+
7
+ Context discovery builds a comprehensive review context by:
8
+ 1. Reading `.ocr/config.yaml` for project-specific context and rules
9
+ 2. Pulling OpenSpec context and specs (if enabled)
10
+ 3. Discovering referenced files (AGENTS.md, CLAUDE.md, etc.)
11
+ 4. Merging everything with attribution
12
+
13
+ ## Discovery Sources (Priority Order)
14
+
15
+ ### Priority 1: OCR Config (Highest)
16
+
17
+ Direct context from `.ocr/config.yaml`:
18
+
19
+ ```yaml
20
+ context: |
21
+ Tech stack: TypeScript, React, Node.js
22
+ Critical constraint: All public APIs must be backwards compatible
23
+
24
+ rules:
25
+ critical:
26
+ - Security vulnerabilities
27
+ - Breaking changes without migration
28
+ ```
29
+
30
+ ### Priority 2: OpenSpec Integration
31
+
32
+ If `context_discovery.openspec.enabled: true`:
33
+
34
+ ```
35
+ {openspec.config} # Project conventions (configurable path)
36
+ openspec/specs/**/*.md # Architectural specs
37
+ openspec/changes/**/*.md # Active change proposals
38
+ ```
39
+
40
+ **Note**: The `config` path supports both `.yaml` (extracts `context` field) and `.md` files (uses entire content). Legacy projects can set `config: "openspec/project.md"`.
41
+
42
+ ### Priority 3: Reference Files
43
+
44
+ Files listed in `context_discovery.references`:
45
+
46
+ ```
47
+ AGENTS.md
48
+ CLAUDE.md
49
+ .cursorrules
50
+ .windsurfrules
51
+ .github/copilot-instructions.md
52
+ CONTRIBUTING.md
53
+ openspec/AGENTS.md
54
+ ```
55
+
56
+ ### Priority 4: Additional Files
57
+
58
+ User-configured files in `context_discovery.additional`:
59
+
60
+ ```
61
+ docs/ARCHITECTURE.md
62
+ docs/API_STANDARDS.md
63
+ ```
64
+
65
+ ## Discovery Algorithm
66
+
67
+ ```python
68
+ def discover_context():
69
+ config = read_yaml('.ocr/config.yaml')
70
+ discovered = []
71
+
72
+ # Priority 1: OCR config context
73
+ if config.get('context'):
74
+ discovered.append({
75
+ 'source': '.ocr/config.yaml (context)',
76
+ 'priority': 1,
77
+ 'content': config['context']
78
+ })
79
+
80
+ if config.get('rules'):
81
+ discovered.append({
82
+ 'source': '.ocr/config.yaml (rules)',
83
+ 'priority': 1,
84
+ 'content': format_rules(config['rules'])
85
+ })
86
+
87
+ # Priority 2: OpenSpec
88
+ openspec = config.get('context_discovery', {}).get('openspec', {})
89
+ if openspec.get('enabled', True):
90
+ config_path = openspec.get('config', 'openspec/config.yaml')
91
+
92
+ if exists(config_path):
93
+ # Handle both .yaml and .md config files
94
+ if config_path.endswith('.yaml'):
95
+ os_config = read_yaml(config_path)
96
+ os_context = os_config.get('context')
97
+ else:
98
+ os_context = read(config_path) # .md uses entire content
99
+
100
+ if os_context:
101
+ discovered.append({
102
+ 'source': config_path,
103
+ 'priority': 2,
104
+ 'content': os_context
105
+ })
106
+
107
+ # Read specs for architectural context
108
+ for spec in glob('openspec/specs/**/*.md'):
109
+ discovered.append({
110
+ 'source': spec,
111
+ 'priority': 2,
112
+ 'content': read(spec)
113
+ })
114
+
115
+ # Priority 3: Reference files
116
+ refs = config.get('context_discovery', {}).get('references', [])
117
+ for file in refs:
118
+ if exists(file):
119
+ discovered.append({
120
+ 'source': file,
121
+ 'priority': 3,
122
+ 'content': read(file)
123
+ })
124
+
125
+ return merge_with_attribution(discovered)
126
+ ```
127
+
128
+ ## Shell Commands for Discovery
129
+
130
+ ```bash
131
+ # Read OCR config
132
+ cat .ocr/config.yaml
133
+
134
+ # Check OpenSpec (read config path from .ocr/config.yaml)
135
+ # Supports both .yaml (extracts context field) and .md (uses full content)
136
+ OPENSPEC_CONFIG=$(grep -A1 'openspec:' .ocr/config.yaml | grep 'config:' | awk '{print $2}' | tr -d '"')
137
+ cat "${OPENSPEC_CONFIG:-openspec/config.yaml}" 2>/dev/null
138
+ find openspec/specs -name "*.md" -type f 2>/dev/null
139
+
140
+ # Check reference files
141
+ for f in AGENTS.md CLAUDE.md .cursorrules .windsurfrules CONTRIBUTING.md; do
142
+ [ -f "$f" ] && cat "$f"
143
+ done
144
+ ```
145
+
146
+ ## Output Format
147
+
148
+ Save discovered context to session directory:
149
+
150
+ ```
151
+ .ocr/sessions/{id}/discovered-standards.md
152
+ ```
153
+
154
+ ### Example Output
155
+
156
+ ```markdown
157
+ # Discovered Project Standards
158
+
159
+ **Discovery Date**: 2024-01-15
160
+ **Sources Found**: 4
161
+
162
+ ## From: .ocr/config.yaml (context)
163
+
164
+ Tech stack: TypeScript, React, Node.js
165
+ Critical constraint: All public APIs must be backwards compatible
166
+
167
+ ---
168
+
169
+ ## From: openspec/config.yaml
170
+
171
+ context: |
172
+ Monorepo using NX 22
173
+ ESM only, no CommonJS
174
+ Testing: Jest with React Testing Library
175
+
176
+ ---
177
+
178
+ ## From: AGENTS.md
179
+
180
+ # Agent Instructions
181
+ ...
182
+
183
+ ---
184
+
185
+ ## Review Rules (from .ocr/config.yaml)
186
+
187
+ ### Critical
188
+ - Security vulnerabilities (injection, path traversal, secrets in code)
189
+ - Breaking changes without migration path
190
+
191
+ ### Important
192
+ - Silent error handling (catch without action)
193
+ - Missing user-facing error messages
194
+ ```
195
+
196
+ ## No Context Found
197
+
198
+ If no config exists:
199
+
200
+ 1. Use sensible defaults
201
+ 2. Suggest configuration:
202
+ ```
203
+ 💡 Tip: Run `ocr init` to create .ocr/config.yaml for project-specific review context.
204
+ ```
205
+
206
+ ## Performance
207
+
208
+ - Cache discovered context in session directory
209
+ - Reuse for all reviewers in same session
210
+ - Only re-discover on new session