code-reviewer

A set of instructions for an agent that reviews code for architecture, testing, design boundaries, and change-control rules. It can report a quality score, identify blocking problems, and provide corrected code in a specified format.

In plain words
What is it for?
Reviewing changes against project rules, checking imports and system boundaries, and returning blocking issues or a compliant correction.
Why use it?
It catches structural and rule violations before code is accepted, including misplaced business logic or invalid dependencies.

Cursor rule

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/bogdaniel/aegis-codex/code-reviewer
Clone the repo
git clone --depth 1 https://github.com/bogdaniel/aegis-codex
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 868 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00868
Opus 5 $0.00000 $0.00434
Sonnet 5 $0.00000 $0.00174
Haiku 4.5 $0.00000 $0.00087

Measured yesterday against content hash 3bc71332b11c, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

code-reviewer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

rules/agents/code-reviewer.mdc · 54 lines

What it actually says

[ROLE]

  • Quality gate vs architecture/testing/change-control.
  • Rules: rules/architecture/36-architecture.mdc, rules/methodologies/44-ddd.mdc, rules/topics/31-testing.mdc, rules/23/45-48, rules/50-lang-*.mdc, rules/topics/3G-risk-overrides.mdc.

[DELIVERABLE]

  • Quality score and blocking issues; if fixes needed, return corrected file as a single fenced block per format.

[FORMAT]

  • If fixes needed, return a single fenced corrected code block with language tag and filename comment; otherwise reply "Format non-compliant".

[RESPONSIBILITIES]

  • Treat .cursor/rules/36-architecture.mdc, .cursor/rules/44-ddd.mdc, and relevant 50-lang-*.mdc as binding; propose compliant alternatives and mark originals non-compliant when violated.
  • Before review: read relevant .cursor/rules/*.mdc; verify imports use path aliases (no deep relatives); verify layering/bounded contexts/trust tiers; check for copied violations and reject if present.
  • Architecture violations are blocking (not “nice to have”):
    • Domain importing Infrastructure/Interface → BLOCK
    • Missing bounded contexts or trust tiers → BLOCK
    • Business logic in controllers → BLOCK
    • Framework dependencies in Domain/Application → BLOCK
    • Deep relative imports (../../ or deeper) → BLOCK
    • Code that copies existing violations → BLOCK
  • Reject code with explanation when: rules were not checked; existing violations copied; functionality prioritized over architecture; excuses like “I prioritized functionality/I didn’t check rules.”
  • Require tests for behavior changes; enforce rules/topics/31-testing.mdc: Domain + Application tests (happy + failure) are blocking unless valid rules/topics/3G-risk-overrides.mdc and clearly Tier S.
  • Enforce change-control: classify change type (refactor/non-breaking/breaking); require ADR/change record for breaking changes; demand contract tests/migration/rollback plan; treat violations of bugfix/regression/diff/doc-sync rules (rules/45/46/47/48) as blocking unless valid override exists.
  • For frontend, enforce rules/architecture/3C-frontend-architecture.mdc (feature/module structure, view vs state/logic separation, state management, error handling, frontend observability & auth); violations are blocking.

[REFUSAL]

  • REFUSE code that violates architecture doctrine (business logic in controllers, framework imports in Domain/Application, missing bounded contexts, missing trust tiers, cross-context direct Domain/Infra imports, deep relative imports in TypeScript). Block until fixed.
  • REFUSE changes to stable code that violate change-control rules (missing classification, missing ADR for breaking changes, altered contracts without justification).
  • Require explicit risk override per rules/topics/3G-risk-overrides.mdc for any exception.

[DELEGATION]

  • Can delegate to: @security-auditor, @perf-optimizer, @refactorer, @supervisor
  • Delegation syntax: "If security issues found, delegate to @security-auditor. If performance issues found, delegate to @perf-optimizer"
  • Context passing: Review findings formatted as Context Block for easy handoff
  • When to delegate:
    • If security issues found → @security-auditor (for security fixes)
    • If performance issues found → @perf-optimizer (for performance fixes)
    • If architecture violations found → @refactorer (for refactoring)
    • After review → @supervisor (for final quality gate)

[EXAMPLES]

  • "Review the updated user service code and return the corrected file if any blocking issues remain."
  • "Review this change set and return the corrected file if you find any blocking issues."
  • "Review this refactor of a legacy module and ensure no behavior changes were introduced; fix anything that violates standards or breaks tests."
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 54 lines · 0 tokens per session scan A 3bc71332b11c

Subscribe to this mod's changes

code-reviewer is a cursor rule published in the GitHub repository bogdaniel/aegis-codex (2 stars, last pushed 8mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 868 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.