|
| 1 | +summary: "Schema for .deepreview config files that define automated code review rules." |
| 2 | + |
| 3 | +instructions: | |
| 4 | + .deepreview files define review rules that match changed files by glob pattern and |
| 5 | + run AI-powered reviews against them. Each rule has a description, match patterns, |
| 6 | + a review strategy, and instructions for the reviewer. The JSON schema enforces |
| 7 | + structure; these requirements enforce quality that structural validation cannot catch. |
| 8 | +
|
| 9 | + Key concepts: |
| 10 | + - Rules are scoped by directory — a .deepreview file governs files relative to its location |
| 11 | + - Strategies control batching: individual (one task per file), matches_together (one task |
| 12 | + for all matched files), all_changed_files (one task with every changed file in the PR) |
| 13 | + - Instructions can be inline or referenced from a markdown file |
| 14 | + - precomputed_info_for_reviewer_bash_command runs before the reviewer and injects output |
| 15 | + as context, avoiding the need for the reviewer to run tools itself |
| 16 | + - additional_context.unchanged_matching_files pulls in unchanged files that match the |
| 17 | + pattern, useful for cross-file consistency checks |
| 18 | +
|
| 19 | +json_schema_path: "deepreview_schema.json" |
| 20 | + |
| 21 | +matchers: |
| 22 | + - "**/.deepreview" |
| 23 | + |
| 24 | +requirements: |
| 25 | + description-matches-instructions: > |
| 26 | + Each rule's `description` MUST accurately reflect what the rule's instructions |
| 27 | + actually check. A description saying "Review for security" when instructions only |
| 28 | + check formatting is misleading. Descriptions are used for rule discovery and |
| 29 | + triage — inaccurate descriptions waste reviewer time. |
| 30 | +
|
| 31 | + strategy-matches-intent: > |
| 32 | + The `strategy` MUST match the rule's review intent. Use `individual` when each |
| 33 | + file can be reviewed independently. Use `matches_together` when the reviewer needs |
| 34 | + to see all matched files together (e.g., cross-file consistency, DRY checks). Use |
| 35 | + `all_changed_files` when the reviewer needs full PR context regardless of match |
| 36 | + patterns (e.g., requirements traceability). A rule using `matches_together` or |
| 37 | + `all_changed_files` whose instructions only examine each file in isolation SHOULD |
| 38 | + use `individual` instead. |
| 39 | +
|
| 40 | + instructions-actionable: > |
| 41 | + Rule instructions MUST be specific enough for a reviewer to produce a consistent |
| 42 | + PASS/FAIL verdict. "Check if it looks good" is not actionable. Instructions SHOULD |
| 43 | + enumerate concrete checks and specify the output format (PASS with no issues, or |
| 44 | + FAIL with file, line, and description for each issue). |
| 45 | +
|
| 46 | + instructions-not-overly-broad: > |
| 47 | + A single rule MUST NOT contain per-file or per-path conditional logic in its |
| 48 | + instructions (e.g., "For files in src/foo/, check X; for files in src/bar/, |
| 49 | + check Y"). If instructions vary by file path, the rule SHOULD be split into |
| 50 | + multiple narrower rules with appropriate match patterns. |
| 51 | +
|
| 52 | + placement-near-target: > |
| 53 | + Rules SHOULD live in the .deepreview file closest to the files they govern. If |
| 54 | + all of a rule's match patterns target files within a single subdirectory, the |
| 55 | + rule SHOULD be in that subdirectory's .deepreview file, not the project root. |
| 56 | + Exception: rules that intentionally span multiple top-level directories or use |
| 57 | + `all_changed_files` strategy are project-wide by nature. |
| 58 | +
|
| 59 | + no-overlapping-rules: > |
| 60 | + Rules in the same .deepreview file (or at the same directory level) whose match |
| 61 | + patterns overlap substantially SHOULD be combined into a single rule — unless |
| 62 | + merging would make instructions unfocused (over ~2000 words), or the rules use |
| 63 | + different `agent` personas. Duplicate coverage wastes reviewer time and can |
| 64 | + produce contradictory findings. |
| 65 | +
|
| 66 | + precompute-runnable-commands: > |
| 67 | + If a rule's instructions tell the reviewer to run a shell command (e.g., |
| 68 | + `uv run ruff`, `make lint`, `pytest`), that command SHOULD be moved to |
| 69 | + `precomputed_info_for_reviewer_bash_command` instead. The reviewer receives |
| 70 | + precomputed output as context automatically, which is faster and more reliable |
| 71 | + than having the reviewer invoke tools. Instructions SHOULD then reference the |
| 72 | + precomputed output rather than telling the reviewer to run commands. |
| 73 | +
|
| 74 | + file-reference-for-long-instructions: > |
| 75 | + Rules with inline instructions exceeding ~80 lines SHOULD use a file reference |
| 76 | + (`instructions: { file: path/to/instructions.md }`) instead. Long inline YAML |
| 77 | + blocks are hard to read, edit, and diff. The referenced file can use full markdown |
| 78 | + formatting. |
| 79 | +
|
| 80 | + auto-fix-rules-clearly-marked: > |
| 81 | + Rules that instruct the reviewer to edit files (auto-fix rules) MUST clearly |
| 82 | + state "This is an auto-fix rule — you SHOULD edit files to resolve issues" at |
| 83 | + the top of their instructions. This distinguishes them from read-only review |
| 84 | + rules and sets correct expectations for the reviewer agent. |
0 commit comments