feat(code-review): add graph-aware Design Critic reviewer - #170
Merged
Merged
Conversation
Add the Design Critic — an always-on, deep-tier conditional core reviewer that evaluates software-design craftsmanship (module depth, information hiding, SOLID, dependency direction, project structure), drawing on A Philosophy of Software Design, SOLID, and Clean Architecture. It is source:"core" (exempt from DOMAIN_CRITIC_CAP), runs on Sonnet, and emits category:"Code Quality" findings scoped to flaws this change introduces. - Cap domain critics uniformly at 3 (was 5) on both standard and deep; deep's extra breadth now comes from the Design Critic + Impact Analyzer. - Make the Design Critic graph-aware: spawn it on code-review-worker-graph and add get_architecture + query_graph to that worker so it can read the real module layout and dependency edges (falls back to grep when the graph is unavailable or review_root is set). - Remove the unused callsite_snippet_hash / snippet_hash_matched fields (LLMs cannot compute sha256; the field had no working consumer) — the verifier now content-matches the verbatim callsite snippet. - Render both conditional core reviewers (Impact Analyzer + Design Critic) on the fleet "Reviewers:" line by deriving the set from _SPAWN_CORE_ROLES instead of a hand-maintained tuple. - Comment/docstring accuracy fixes surfaced by a self-review. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add the v3.1.0 CHANGELOG entry (Design Critic reviewer, uniform domain-critic cap of 3, graph-aware Design Critic, callsite_snippet_hash removal) and refresh the README: depth-tier table (cap 5→3, Design Critic row, Impact Analyzer now shipping), /deep description, the graph worker's consumers/tools, and the design_critic_suffix.txt prompt listing. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the Design Critic — an always-on, deep-tier conditional core reviewer that evaluates software-design craftsmanship (module depth & information hiding, SOLID, dependency direction & layer boundaries, project structure), drawing on A Philosophy of Software Design (Ousterhout), SOLID, and Clean Architecture (Martin). It's
source: "core"(exempt from the domain-critic cap), runs on Sonnet, and emitscategory: "Code Quality"findings scoped to design flaws a change introduces or worsens.Bumps
code-reviewto v3.1.0 (MINOR).What's in it
New reviewer
tools/prompts/design_critic_suffix.txt— the Design Critic fleet role (7-step evaluation procedure: complexity framing → project structure → dependency graph → module depth → SOLID → code-level → testability/consistency), wired intoCOVERAGE_CORE_CONDITIONALwith an{"type": "always"}trigger so it runs on every--depth deepreview.Domain-critic cap collapsed 5 → 3
DOMAIN_CRITIC_CAP = 3across standard and deep (removed the depth-awareSTANDARD_DOMAIN_CRITIC_CAP/branch). Deep's extra breadth now comes from the Design Critic + Impact Analyzer rather than a wider critic allowance.Design Critic is graph-aware
code-review-worker-graphand uses thecodebase-memory-mcpknowledge graph (get_architecturefor module/layer layout,query_graphfor dependency direction & import cycles) when the repo is indexed, falling back to grep otherwise. The graph worker's tool set gainedget_architecture+query_graph. Same safety envelope as the other graph roles (blanked when the server is absent, the project is ambiguous, orreview_rootis set).Removed the dead
callsite_snippet_hashfieldexternal_impact[].callsite_snippet_hashand the coupledEvidenceCheck.snippet_hash_matched(LLMs can't compute sha256; the field had no working consumer). Impact callsites are now validated by reading the cited file and content-matching the verbatimcallsite_snippet.Fleet-summary fix + accuracy cleanup (surfaced by a deep self-review of this branch)
_render_fleet_breakdownnow derives the non-partitioned core display set from_SPAWN_CORE_ROLES, so both conditional core reviewers (Impact Analyzer + Design Critic) render on the "Reviewers:" line — previously the Impact Analyzer was silently omitted. Added a regression test.COVERAGE_CORE_CONDITIONALheader,resolve_coveragedocstring,_SPAWN_CORE_ROLEScomment, and a stale/hashprompt reference._diff/_empty_critic_gatestest helpers into a shared mixin.Validation
pytest plugins/code-review/tools/python/— 1217 passed, 3 skipped (+2 new regression tests)uv run ruff check .— cleanuv run pyright— 0 errors/update-documentation🤖 Generated with Claude Code