docs(review-rules): document merge_system_rule in the review rules guide
Description
merge_system_rule is an existing boolean field on a rule.json entry. When set, the matched user rule is combined with the system rule for that file's language instead of replacing it:
{
"rules": [
{
"path": "**/*",
"rule": "Security review: flag hardcoded secrets, unvalidated redirects, and missing authz checks.",
"merge_system_rule": true
}
]
}
$ ocr rules check src/main/java/com/example/UserService.java
Source: Project (.opencodereview/rule.json)
Pattern: **/*
Rule:
────────────────────────────────────────
## System-Specific Rules (Mandatory)
…contents of java.md…
---
## User-Specific Rules (Mandatory)
Security review: flag hardcoded secrets, unvalidated redirects, and missing authz checks.
────────────────────────────────────────
The field has been implemented for a while (ProjectRuleEntry.MergeSystemRule → mergeWithSystemRule, internal/config/rules/system_rules.go), but the review rules guide never mentions it — not in any of the five locales. The only place it appears in the whole repo is skills/open-code-review/SKILL.md, which most users never read.
The cost of this gap is real: #1132 was filed asking for exactly this capability as a new feature, because the docs give every indication that a catch-all user rule unavoidably discards the per-language system rules.
Scope
- File(s):
pages/src/content/docs/en/review-rules.mdpages/src/content/docs/zh/review-rules.mdpages/src/content/docs/ja/review-rules.mdpages/src/content/docs/ru/review-rules.mdpages/src/content/docs/ko/review-rules.md
- Reference implementation:
internal/config/rules/system_rules.go—ProjectRuleEntry(field declaration) andmergeWithSystemRule(merge format and empty-string edge cases) - Existing wording to borrow from:
skills/open-code-review/SKILL.md - Docs-only change; no Go code should need to be touched.
Acceptance Criteria
- [ ] The "Rule file format (layers 1–3)" section lists
merge_system_rulealongsidepathandrule, stating that it is optional and defaults tofalse(replace). - [ ] A worked example shows the JSON plus the resulting
ocr rules checkoutput, so the## System-Specific Rules (Mandatory)/## User-Specific Rules (Mandatory)structure is visible. - [ ] The docs state that the system half is resolved per file, so one catch-all entry yields
java.mdfor.java,python.mdfor.py, anddefault.mdfor unrecognized extensions. - [ ] The docs state that it works in all three user layers:
--rule,<repo>/.opencodereview/rule.json, and~/.opencodereview/rule.json. - [ ] The docs state the limitation: it merges the system layer only. Multiple user entries matching the same file still resolve first-match-wins (see discussion #633), and a matching layer still shadows lower user layers.
- [ ] A recipe is added under "Recipes" for the common case — global security rules on top of the built-in per-language rules — since that is what people search for.
- [ ] All five locales updated with equivalent content.
- [ ]
make testpasses. - [ ]
make checkpasses.
Context
Discovered while triaging #1132 ("Support adding global review rules"), whose entire request is already satisfied by this flag.
Behaviour verified on v1.11.0 with ocr rules check: a.java, a.py, a.go, and an unrecognized extension each produced a different system half, confirming per-file language resolution rather than a fixed default.md; and dropping merge_system_rule reduced the output to the user rule alone.
Good first issue: no Go changes required, the behaviour is easy to observe locally with ocr rules check, and the surrounding doc already has the right structure — a field list to extend and a "Recipes" section to append to. Note that pages/src/content/docs/** is translated prose and is exempt from the English-only scan (see AGENTS.md), so the non-English locales should be written in their own language.
I'd like to take this docs issue: document merge_system_rule in the review-rules guide across all five locales, with a worked example and the Recipes entry for global security rules on top of per-language system rules.
AI disclosure: I'll use Cursor Cloud Agent (model: grok-4.7) to help draft; I'll review every line myself before opening the PR.
This looks completed: PR #1555 (merged 2026-09-24) documents merge_system_rule in the review-rules guide for all five locales (en/ja/ko/ru/zh) with the worked example. I verified the field now appears in each locale's review-rules.md — suggest closing as done.
AI disclosure: drafted with DeepSeek Harness (deepseek-v4.1-flash); I checked the merged PR and the five docs files myself.