Open Code Review (OCR) — Config, rules & allowlist

docs / modules / config_rules

← all docs

Open Code Review (OCR) — Config, rules & allowlist

flowchart LR IN["Input\nrule.json (custom + project + global layers), config.json, embedded default rule/prompt/allowlist JSON"] --> ACT["Config, rules & allowlist\nDecides which files are even eligible for review, and which review-rule text each eligible file sees."] ACT --> OUT["Output\na rules.Resolver + rules.FileFilter (which files are reviewed and which rule text applies to each), plus loaded prompt template.Template"]

Decides which files are even eligible for review, and which review-rule text each eligible file sees. Package: internal/config/{rules,allowlist,template,toolsconfig}.

What flows through it

flowchart LR IN["rule.json (custom + project + global layers), config.json, embedded default rule/prompt/allowlist JSON"] --> MOD["Config, rules & allowlist"] MOD --> OUT["a rules.Resolver + rules.FileFilter (which files are reviewed and which rule text applies to each), plus loaded prompt template.Template"]

Technical details

Package: internal/config/{rules,allowlist,template,toolsconfig} Depends on: (none — leaf package) Depended on by: CLI, Delegate, Review agent, Scan agent

What actually happens here

allowlist/ holds the supported-file-type and default-exclude-pattern JSON compiled into the binary. rules/system_rules.go resolves path-pattern rules (custom > project > global > system, first match wins per the resolver's own precedence) into the text injected as {{system_rule}} in the main prompt. template/ loads task_template.json / scan_template.json — the actual prompt text, tool-request budgets, and token limits — and can be overridden by a project's own template file.

How the LLM / model version is chosen

No model calls — this package supplies the inputs a model call will use (prompt text, rule text), it never calls one itself.

Deterministic (non-LLM) work in this module

Path-glob rule matching, file-extension allowlisting, and template-engine variable substitution are all deterministic — README calls this out explicitly as 'fine-grained rule matching...more stable and predictable' than doing the same selection purely via prompt instructions.


Part of the module docs index. Full interactive version, with every module side by side: architecture.html §7. Cross-cutting mechanisms this module participates in (retry, compression, manifest, resume, hashing): LLD.