Backend Code Review Workflow
Run the mandatory reviewers against one immutable scope, then reconcile their evidence. Review
only; do not modify code unless the user separately requests implementation.
Exact dependencies
- Skills:
kotlin-spring-review, refactoring-catalog, design-pattern-apply,
oop-design-review
- Agent:
security-auditor
Treat every dependency as mandatory. Do not substitute a similarly named skill or agent.
Cost-aware native routing
Resolve portable profiles from the current runtime capability catalog at dispatch. Use
kotlin-spring-review=standard/medium, security-auditor=standard/medium, and
refactoring-catalog|oop-design-review|design-pattern-apply=frugal/low. Apply a frontier/high
floor only to the affected security pass for a confirmed authn/authz boundary, irreversible data,
or public-contract risk.
The workflow owner and reconciliation default to standard/medium; the number of installed rules
or skills is not a reason to require a frontier primary. A smaller route remains safe only when its
scope and evidence packet are bounded as described below. Use frontier/high for the affected
judgment, not for every pass or for orchestration as a whole.
Every native handoff uses model_selection: explicit-native-override; spawn with fork_turns: none,
the exact resolved model, and exact reasoning_effort. Never inherit the primary model or reasoning
setting. Record requested/observed route fields in the run ledger and make any mismatch INCOMPLETE.
Do not escalate for timeout, quota, authentication, or missing tools.
Input contract
Require or derive:
target: repository root plus explicit files, module, diff, commit range, or pull-request range
baseline: comparison revision when reviewing a diff; otherwise none
constraints: applicable repository instructions and user-stated compatibility requirements
evidence_budget: commands that may be run and services that may be contacted
Freeze the resolved file list and revisions before dispatch. Give every reviewer the same target,
baseline, constraints, and source snapshot. Record assumptions; never silently widen the scope.
Rule applicability and context budget
Before dispatch, produce an applicability manifest for every mandatory dependency. Each entry
records changed symbols, activated rule families, excluded rule families with a source-backed
reason, and the evidence files or commands available to that pass. A mandatory pass may return
NOT_APPLICABLE only after checking its activation conditions; an evidence-backed
NOT_APPLICABLE counts as completed coverage, while a silent skip or guessed exclusion does not.
Build each handoff from two bounded parts:
- a shared evidence capsule containing the frozen revision, resolved files, concise diff facts,
repository constraints, build metadata, and verification budget
- a lane-specific evidence capsule containing only that reviewer's activated rule families,
directly relevant source slices, callers/contracts, and focused tests
Do not copy unrelated skill bodies, entire knowledge-base directories, full repository prose, or
another reviewer's raw transcript into a handoff. Reviewers may retrieve a named reference when a
finding needs it. Context overflow, malformed output, timeout, or a long rule inventory is a scope
or packet failure, not evidence that a more expensive model is required.
Workflow
1. Preflight
- Resolve the target and repository instructions.
- Verify that all four skills and
security-auditor are available by exact ID.
- Capture the file list, changed symbols, build system, and existing tests.
- Build and record the applicability manifest plus shared and lane-specific evidence capsules.
- Stop as
INCOMPLETE with cause MISSING_DEPENDENCY or UNSTABLE_SOURCE before review if a
dependency is missing or the source snapshot cannot be read consistently.
2. Specialist review
Dispatch independent reviews with bounded parallelism of at most four concurrent runs. Run the
remaining dependency as soon as a slot opens. Each run must return:
severity, confidence, path:line, affected symbol, root cause, concrete evidence, impact,
recommendation, verification, and governing principle.
Ask each dependency to stay in its specialty. Preserve its original output unchanged for audit.
The security run must come from the exact security-auditor agent, not an orchestrator-authored
security summary.
3. Normalize and reconcile
- Reject unsupported findings or mark them
NEEDS_EVIDENCE; do not invent missing locations.
- Deduplicate only when findings identify the same path or symbol and the same root cause.
Similar wording, shared symptoms, or the same file alone are insufficient.
- Merge a duplicate into one finding with all contributing reviewers and evidence. Use the
highest supported severity. A downgrade requires explicit contrary evidence.
- Separate security, correctness, architecture/design, and maintainability impacts when one
proposed change would address several distinct root causes.
- Preserve disagreements under
Dissent: identify the reviewer, its original severity or
recommendation, the competing evidence, and whether the disagreement is resolved. Never force
artificial consensus.
- Detect recommendation conflicts, especially pattern introduction versus YAGNI, domain
encapsulation versus persistence behavior, and refactoring versus transaction semantics.
Prefer the smallest behavior-preserving action supported by evidence; retain unresolved choices.
4. Apply the severity gate
Use these terminal verdicts in priority order:
INCOMPLETE: any mandatory run failed, timed out, or returned unusable output
BLOCK: at least one supported CRITICAL finding
CHANGES_REQUIRED: no CRITICAL finding and at least one supported HIGH finding
WARNING: only supported MEDIUM or LOW findings remain
APPROVE: every mandatory run completed and no supported finding remains
Never emit APPROVE for a partial run. Mark inferred CRITICAL claims as conditional and request
their named verification; they do not become unconditional blockers without evidence.
Output contract
Return one report with:
- Scope and evidence — target, baseline, constraints, commands run, assumptions
- Applicability manifest — activated/excluded rule families and evidence-backed
NOT_APPLICABLE decisions
- Run ledger — exact dependency ID, status, duration if known, and artifact reference
- Verdict — gate result and one-sentence rationale
- Unified findings — stable ID, severity, confidence, location, root cause, impact, evidence,
recommendation, verification, contributors, and dissent
- Conflict decisions — accepted, rejected, and unresolved recommendations with rationale
- Security auditor artifact — immutable artifact reference and digest plus its structured
findings; reproduce the complete redacted output only when the user requests it or no artifact
store is available
- Coverage gaps and next actions
Keep credentials and secrets redacted in both the artifact and any inline fallback; preserve the
auditor's redaction marker rather than reconstructing the value.
Failure and partial-result semantics
- A specialist failure does not erase successful artifacts. Return them with
INCOMPLETE and name
the missing coverage.
- A source change during execution invalidates reconciliation. Return
STALE artifacts under an
INCOMPLETE verdict and request a run against one revision.
- A verification command failure is evidence, not permission to drop a finding. Record the command
and output, then lower confidence only when appropriate.
- A malformed result may be retried once with the output contract restated. Do not silently replace
the specialist's judgment with the orchestrator's.
1---2name: backend-code-review-workflow3description: Orchestrate a consolidated backend review across Kotlin/Spring correctness, refactoring, design patterns, object-oriented design, and security. Use for pull requests, diffs, or backend modules that need one severity-gated report without losing specialist dissent.4---56# Backend Code Review Workflow78Run the mandatory reviewers against one immutable scope, then reconcile their evidence. Review9only; do not modify code unless the user separately requests implementation.1011## Exact dependencies1213- Skills: `kotlin-spring-review`, `refactoring-catalog`, `design-pattern-apply`,14 `oop-design-review`15- Agent: `security-auditor`1617Treat every dependency as mandatory. Do not substitute a similarly named skill or agent.1819## Cost-aware native routing2021Resolve portable profiles from the current runtime capability catalog at dispatch. Use22`kotlin-spring-review=standard/medium`, `security-auditor=standard/medium`, and23`refactoring-catalog|oop-design-review|design-pattern-apply=frugal/low`. Apply a `frontier/high`24floor only to the affected security pass for a confirmed authn/authz boundary, irreversible data,25or public-contract risk.2627The workflow owner and reconciliation default to `standard/medium`; the number of installed rules28or skills is not a reason to require a frontier primary. A smaller route remains safe only when its29scope and evidence packet are bounded as described below. Use `frontier/high` for the affected30judgment, not for every pass or for orchestration as a whole.3132Every native handoff uses `model_selection: explicit-native-override`; spawn with `fork_turns: none`,33the exact resolved `model`, and exact `reasoning_effort`. Never inherit the primary model or reasoning34setting. Record requested/observed route fields in the run ledger and make any mismatch `INCOMPLETE`.35Do not escalate for timeout, quota, authentication, or missing tools.3637## Input contract3839Require or derive:4041- `target`: repository root plus explicit files, module, diff, commit range, or pull-request range42- `baseline`: comparison revision when reviewing a diff; otherwise `none`43- `constraints`: applicable repository instructions and user-stated compatibility requirements44- `evidence_budget`: commands that may be run and services that may be contacted4546Freeze the resolved file list and revisions before dispatch. Give every reviewer the same target,47baseline, constraints, and source snapshot. Record assumptions; never silently widen the scope.4849## Rule applicability and context budget5051Before dispatch, produce an `applicability manifest` for every mandatory dependency. Each entry52records changed symbols, activated rule families, excluded rule families with a source-backed53reason, and the evidence files or commands available to that pass. A mandatory pass may return54`NOT_APPLICABLE` only after checking its activation conditions; an evidence-backed55`NOT_APPLICABLE` counts as completed coverage, while a silent skip or guessed exclusion does not.5657Build each handoff from two bounded parts:5859- a **shared evidence capsule** containing the frozen revision, resolved files, concise diff facts,60 repository constraints, build metadata, and verification budget61- a **lane-specific evidence capsule** containing only that reviewer's activated rule families,62 directly relevant source slices, callers/contracts, and focused tests6364Do not copy unrelated skill bodies, entire knowledge-base directories, full repository prose, or65another reviewer's raw transcript into a handoff. Reviewers may retrieve a named reference when a66finding needs it. Context overflow, malformed output, timeout, or a long rule inventory is a scope67or packet failure, not evidence that a more expensive model is required.6869## Workflow7071### 1. Preflight72731. Resolve the target and repository instructions.742. Verify that all four skills and `security-auditor` are available by exact ID.753. Capture the file list, changed symbols, build system, and existing tests.764. Build and record the applicability manifest plus shared and lane-specific evidence capsules.775. Stop as `INCOMPLETE` with cause `MISSING_DEPENDENCY` or `UNSTABLE_SOURCE` before review if a78 dependency is missing or the source snapshot cannot be read consistently.7980### 2. Specialist review8182Dispatch independent reviews with bounded parallelism of at most four concurrent runs. Run the83remaining dependency as soon as a slot opens. Each run must return:8485`severity`, `confidence`, `path:line`, affected symbol, root cause, concrete evidence, impact,86recommendation, verification, and governing principle.8788Ask each dependency to stay in its specialty. Preserve its original output unchanged for audit.89The security run must come from the exact `security-auditor` agent, not an orchestrator-authored90security summary.9192### 3. Normalize and reconcile93941. Reject unsupported findings or mark them `NEEDS_EVIDENCE`; do not invent missing locations.952. Deduplicate only when findings identify the same path or symbol **and** the same root cause.96 Similar wording, shared symptoms, or the same file alone are insufficient.973. Merge a duplicate into one finding with all contributing reviewers and evidence. Use the98 highest supported severity. A downgrade requires explicit contrary evidence.994. Separate security, correctness, architecture/design, and maintainability impacts when one100 proposed change would address several distinct root causes.1015. Preserve disagreements under `Dissent`: identify the reviewer, its original severity or102 recommendation, the competing evidence, and whether the disagreement is resolved. Never force103 artificial consensus.1046. Detect recommendation conflicts, especially pattern introduction versus YAGNI, domain105 encapsulation versus persistence behavior, and refactoring versus transaction semantics.106 Prefer the smallest behavior-preserving action supported by evidence; retain unresolved choices.107108### 4. Apply the severity gate109110Use these terminal verdicts in priority order:111112- `INCOMPLETE`: any mandatory run failed, timed out, or returned unusable output113- `BLOCK`: at least one supported `CRITICAL` finding114- `CHANGES_REQUIRED`: no CRITICAL finding and at least one supported `HIGH` finding115- `WARNING`: only supported `MEDIUM` or `LOW` findings remain116- `APPROVE`: every mandatory run completed and no supported finding remains117118Never emit `APPROVE` for a partial run. Mark inferred CRITICAL claims as conditional and request119their named verification; they do not become unconditional blockers without evidence.120121## Output contract122123Return one report with:1241251. **Scope and evidence** — target, baseline, constraints, commands run, assumptions1262. **Applicability manifest** — activated/excluded rule families and evidence-backed127 `NOT_APPLICABLE` decisions1283. **Run ledger** — exact dependency ID, status, duration if known, and artifact reference1294. **Verdict** — gate result and one-sentence rationale1305. **Unified findings** — stable ID, severity, confidence, location, root cause, impact, evidence,131 recommendation, verification, contributors, and dissent1326. **Conflict decisions** — accepted, rejected, and unresolved recommendations with rationale1337. **Security auditor artifact** — immutable artifact reference and digest plus its structured134 findings; reproduce the complete redacted output only when the user requests it or no artifact135 store is available1368. **Coverage gaps and next actions**137138Keep credentials and secrets redacted in both the artifact and any inline fallback; preserve the139auditor's redaction marker rather than reconstructing the value.140141## Failure and partial-result semantics142143- A specialist failure does not erase successful artifacts. Return them with `INCOMPLETE` and name144 the missing coverage.145- A source change during execution invalidates reconciliation. Return `STALE` artifacts under an146 `INCOMPLETE` verdict and request a run against one revision.147- A verification command failure is evidence, not permission to drop a finding. Record the command148 and output, then lower confidence only when appropriate.149- A malformed result may be retried once with the output contract restated. Do not silently replace150 the specialist's judgment with the orchestrator's.