$npx -y skills add alibaba/open-code-review --skill open-code-review-delegateDelegation mode for open-code-review (OCR). Instead of OCR calling an LLM endpoint, this skill instructs the host agent to perform the code review itself, using OCR only for deterministic engineering: file selection and rule resolution. Use when the host agent should drive the re
| 1 | # Open Code Review — Delegation Mode |
| 2 | |
| 3 | This Codex plugin skill intentionally mirrors the canonical skill at |
| 4 | `skills/open-code-review-delegate/SKILL.md`. Keep both files synchronized when |
| 5 | updating OCR delegation instructions; a symlink is avoided because plugin |
| 6 | installs may only materialize the plugin subtree. |
| 7 | |
| 8 | A skill for performing AI code review where OCR provides deterministic engineering (file filtering, rule resolution) and the host agent performs the actual review using its own intelligence and tools. |
| 9 | |
| 10 | ## Prerequisites |
| 11 | |
| 12 | ```bash |
| 13 | which ocr || echo "NOT INSTALLED" |
| 14 | ``` |
| 15 | |
| 16 | If `ocr` is not installed: |
| 17 | |
| 18 | ```bash |
| 19 | npm install -g @alibaba-group/open-code-review |
| 20 | ``` |
| 21 | |
| 22 | No LLM configuration is needed for delegation mode. |
| 23 | |
| 24 | ## Workflow |
| 25 | |
| 26 | ### Step 1: Preview — Determine What to Review |
| 27 | |
| 28 | ```bash |
| 29 | ocr delegate preview [--from <ref> --to <ref>] [--commit <hash>] [--exclude <patterns>] |
| 30 | ``` |
| 31 | |
| 32 | This outputs: |
| 33 | - **mode** (workspace / range / commit) |
| 34 | - **from / to / commit / merge_base** — ref metadata for constructing git commands |
| 35 | - **Reviewable file list** — paths, status, insertions/deletions |
| 36 | - **Excluded files** — with exclusion reason |
| 37 | |
| 38 | **Common invocations:** |
| 39 | |
| 40 | | Scenario | Command | |
| 41 | |----------|---------| |
| 42 | | Workspace changes | `ocr delegate preview` | |
| 43 | | Branch comparison | `ocr delegate preview --from main --to feature` | |
| 44 | | Single commit | `ocr delegate preview -c abc123` | |
| 45 | |
| 46 | ### Step 2: Get Rules for Files |
| 47 | |
| 48 | ```bash |
| 49 | ocr delegate rule <path1> <path2> ... |
| 50 | ``` |
| 51 | |
| 52 | Pass the reviewable file paths from Step 1. Output is grouped by rule content — files sharing the same rule appear under one group, avoiding repetition. |
| 53 | |
| 54 | ### Step 3: Get Diffs |
| 55 | |
| 56 | Use git directly based on the mode/ref info from Step 1: |
| 57 | |
| 58 | **Range mode** (merge_base provided in preview output): |
| 59 | ```bash |
| 60 | git diff <merge_base>..<to> -- <path> |
| 61 | ``` |
| 62 | |
| 63 | **Commit mode**: |
| 64 | ```bash |
| 65 | git show <commit> -- <path> |
| 66 | ``` |
| 67 | |
| 68 | **Workspace mode**: |
| 69 | ```bash |
| 70 | # Tracked files |
| 71 | git diff HEAD -- <path> |
| 72 | # New untracked files — read directly (entire file is new code) |
| 73 | cat <path> |
| 74 | ``` |
| 75 | |
| 76 | ### Step 4: Review Each File |
| 77 | |
| 78 | For each reviewable file: |
| 79 | |
| 80 | 1. Get its diff (Step 3) |
| 81 | 2. Consult its Rule Group (from Step 2) for the review checklist |
| 82 | 3. Conduct a thorough review, using appropriate context tools as needed |
| 83 | |
| 84 | ### Step 5: Format Output |
| 85 | |
| 86 | Each comment must follow this structure: |
| 87 | |
| 88 | | Field | Type | Required | Description | |
| 89 | |-------|------|----------|-------------| |
| 90 | | path | string | yes | Relative file path | |
| 91 | | content | string | yes | Review comment describing the issue | |
| 92 | | start_line | integer | no | Start line in the new file | |
| 93 | | end_line | integer | no | End line in the new file | |
| 94 | | category | enum | no | bug, security, performance, maintainability, test, style, documentation, other | |
| 95 | | severity | enum | no | critical, high, medium, low | |
| 96 | |
| 97 | ### Step 6: Classify and Report |
| 98 | |
| 99 | Group findings by severity: |
| 100 | |
| 101 | - **Critical/High**: Bugs, security issues, data loss risks — always report |
| 102 | - **Medium**: Performance concerns, error handling gaps, maintainability issues — report with context |
| 103 | - **Low**: Style nits, minor suggestions — report only if clearly valuable |
| 104 | |
| 105 | Discard likely false positives silently. |
| 106 | |
| 107 | ### Step 7: Fix (Optional) |
| 108 | |
| 109 | If the user requested "review and fix": |
| 110 | - Apply High/Critical fixes directly |
| 111 | - Describe Medium fixes that require manual intervention |
| 112 | - Skip Low-priority items unless trivial |
| 113 | |
| 114 | ## Sub-commands Reference |
| 115 | |
| 116 | | Command | Purpose | |
| 117 | |---------|---------| |
| 118 | | `ocr delegate preview` | Which files to review + mode/ref metadata | |
| 119 | | `ocr delegate rule <path...>` | Review rules grouped by content | |
| 120 | |
| 121 | ## Shared Flags |
| 122 | |
| 123 | | Flag | Description | |
| 124 | |------|-------------| |
| 125 | | `--from <ref>` | Source ref for range mode | |
| 126 | | `--to <ref>` | Target ref for range mode | |
| 127 | | `-c, --commit <hash>` | Single commit mode | |
| 128 | | `--repo <path>` | Repository root (default: cwd) | |
| 129 | | `--rule <path>` | Custom rule.json path | |
| 130 | | `--exclude <patterns>` | Comma-separated exclude patterns | |
| 131 | | `-b, --background <text>` | Business context | |
| 132 | | `-B, --background-file <path>` | Business context from Markdown file | |
| 133 | |
| 134 | ## Gotchas |
| 135 | |
| 136 | - **No LLM needed on OCR side** — delegation mode never calls an LLM. All intelligence comes from the host agent. |
| 137 | - **Rules are grouped** — Files sharing the same rule are grouped together in the output. You can pass any number of pa |