Skip to content

Commit b12e66c

Browse files
nhortonclaude
andcommitted
feat: add deepschema for .deepreview files, remove redundant review rule
Create a standard deepschema for .deepreview config files with semantic quality requirements (description accuracy, strategy intent, actionable instructions, placement, consolidation, precomputed commands, auto-fix marking). Remove the now-redundant deepreview_config_quality rule from the root .deepreview since the deepschema covers the same ground. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 6944af4 commit b12e66c

3 files changed

Lines changed: 85 additions & 84 deletions

File tree

.deepreview

Lines changed: 0 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -369,90 +369,6 @@ shell_code_review:
369369
section markers) still accurate after the changes? Flag any comments
370370
that describe behavior that no longer matches the code.
371371

372-
deepreview_config_quality:
373-
description: "Review .deepreview configs for rule consolidation, overly broad rules, description accuracy, and correct directory placement."
374-
match:
375-
include:
376-
- "**/.deepreview"
377-
review:
378-
strategy: matches_together
379-
additional_context:
380-
unchanged_matching_files: true
381-
instructions: |
382-
Review the .deepreview config files for structural quality. Check all
383-
four of the following, across ALL .deepreview files (changed and unchanged):
384-
385-
## 1. Rule Consolidation
386-
387-
Rules that match the same (or nearly the same) set of files SHOULD be
388-
combined into a single rule — unless merging their instructions would
389-
make the reviewer's context too large or unfocused. Specifically:
390-
391-
- Flag rules in the same .deepreview file (or across files at the same
392-
directory level) whose `match.include` patterns overlap substantially.
393-
- "Too large" means the combined instructions would exceed ~2000 words
394-
or cover unrelated concerns that would confuse a single reviewer.
395-
- If two rules match identical files but one uses a specialized `agent`
396-
persona, that is a valid reason to keep them separate.
397-
398-
## 2. Description Accuracy
399-
400-
Each rule's `description` field must accurately reflect what the rule
401-
actually checks. Compare the description to the `instructions` (inline
402-
or referenced file) and flag any mismatches. For example:
403-
404-
- A description saying "Review Python files for security" when the
405-
instructions only check formatting — flag it.
406-
- A description that is vague or generic when the instructions are
407-
specific — flag it and suggest a more accurate description.
408-
409-
## 3. Overly Broad Rules (Needless Combining)
410-
411-
The inverse of consolidation: a single rule that matches a broad set of
412-
files but whose instructions are actually file-specific or path-specific.
413-
This is a sign the rule should be split into multiple narrower rules.
414-
415-
Indicators to flag:
416-
- A rule with a wide `match.include` pattern (e.g., `**/*.py`, `src/**`)
417-
but instructions that say things like "For files in src/foo/, check X;
418-
for files in src/bar/, check Y" — these should be separate rules with
419-
narrower match patterns.
420-
- Instructions that enumerate specific filenames or paths and assign
421-
different checks to each — the match pattern should be doing this
422-
filtering, not the instructions.
423-
- A rule whose instructions are mostly conditional on which file is being
424-
reviewed, rather than applying uniformly to all matched files.
425-
426-
Exceptions (do NOT flag these):
427-
- Rules where ~70%+ of the instructions apply to all matched files, with
428-
only minor per-file notes (e.g., "For test files, also check fixtures").
429-
- Rules using `matches_together` strategy where cross-file analysis is
430-
the point (e.g., doc-sync rules that compare source and documentation).
431-
432-
## 4. Directory Placement
433-
434-
.deepreview files should live as close as possible to the files they
435-
govern. If ALL of a rule's `match.include` patterns target files within
436-
a single subdirectory (e.g., `learning_agents/**`), then the rule
437-
should likely live in that subdirectory's `.deepreview` file instead
438-
of the project root. Flag rules that could be moved closer to their
439-
target files.
440-
441-
Exceptions (do NOT flag these):
442-
- Rules that intentionally match files across multiple top-level
443-
directories (e.g., `src/**` AND `tests/**`).
444-
- Rules using `all_changed_files` strategy, which are project-wide
445-
by nature.
446-
- Rules that reference `additional_context.unchanged_matching_files`
447-
with patterns spanning multiple directories.
448-
449-
## Output Format
450-
451-
- PASS: No issues found.
452-
- FAIL: Issues found. List each with the .deepreview file path,
453-
rule name, which check failed (consolidation / description / overly-broad / placement),
454-
and a specific recommendation.
455-
456372
job_schema_instruction_compatibility:
457373
description: "Verify all standard and library job.yml definitions and templates are compatible with the job schema."
458374
match:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../schemas/deepreview_schema.json
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
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

Comments
 (0)