---
description: "Run a standalone defensive, static security review of a diff, a branch or a repo: build a run-scoped threat model, emit reviewer-shaped findings joined to OWASP + CWE with CVSS scoring, evidence and before/after fixes, and inventory dependencies offline. No live target, no payloads. Use when reviewing code for security outside a full pipeline run, auditing a dependency set, or preparing a branch for a security sign-off."
description-tr: "Bir diff, branch veya repo üzerinde bağımsız, savunma amaçlı statik güvenlik incelemesi koşar: çalışmaya özel tehdit modeli kurar, OWASP + CWE'ye bağlı, CVSS puanlı, kanıtlı ve önce/sonra düzeltmeli reviewer biçiminde bulgular üretir, bağımlılıkları çevrimdışı envanterler. Canlı hedef yok, payload yok."
argument-hint: "[#N | repo#N | PR-URL | branch | path]  -  optional: a PR, a local branch, or a path to scope the review. If omitted (interactive), reviews the current branch diff against its base."
parameters: [{"name":"target","kind":"text"}]
gui: form
destructive: false
confirm: none
---

# multi-agent security-review  -  standalone defensive static review

**Input**: $ARGUMENTS

The same security audit Phase 3 runs at Step 2.7, invoked on its own. Defensive and static: it reads code, configuration and dependency manifests and reports vulnerabilities. It never runs the target, fires a payload, or reaches a live host.

## Scope resolution

Resolve what to review from `$ARGUMENTS`, same input shapes as `/multi-agent:review`:

- `#N` / `repo#N` / a PR URL (GitHub or Bitbucket Server) → that PR's diff.
- a local branch name → its diff against the base branch.
- a path → the files under it.
- omitted (interactive) → the current branch diff against its base; autopilot uses the current branch.

Compute the diff once and cap it the way Phase 3 Step 1.9 does; write the capped diff to `.pipeline/security-diff.txt` when it exceeds the budget.

## Steps

### 1. Threat model

Produce `.pipeline/threat-model.md` if absent (four sections: attacker, trust boundaries, attack surface, severity calibration), or read the existing one. Contract: `$HOME/.claude/multi-agent-refs/threat-model.md`. Mirror to `state.threatModel`.

### 2. Method (the plugin skill)

Load the always-on `ai-common-toolkit:security-review` skill for the method: walk the OWASP checklist (Web/API Top 10 2021 for services and sites, Mobile Top 10 2024 for apps) against the changed surface, join each finding to a CWE, and score it. This command orchestrates; it does not re-derive the method.

### 3. Findings (the security-auditor)

Dispatch `Agent(subagent_type: "security-auditor")` on the capped diff plus the threat model. It returns one `reviewer-output.schema.json` object whose `findings[]` each carry the `security` envelope of `security-finding.schema.json`. Compute every `security.cvss.baseScore` + `band` with the toolkit `security_cvss_score` tool, so a score cannot drift from its vector. Validate the object with `$HOME/.claude/scripts/validate-reviewer.mjs`; on failure, one self-correction rework then halt.

### 4. Dependencies (offline)

Run the toolkit `security_dep_inventory` tool on the lockfiles in scope to get a normalized `{ecosystem, name, version}` inventory. When the analyst toolkit is registered, hand that inventory to `ai-analyst-toolkit:evidence-registry` for a known-CVE lookup; a vulnerable dependency becomes an `A06:2021` finding with the advisory's CWE and CVE. This command contacts nothing itself.

### 5. Report

Write the findings to `.pipeline/security-findings.json` (the reviewer-output object) and render a human summary: count by severity, each blocking and important finding with its OWASP id, CWE, CVSS band, evidence, and before/after fix. An empty findings list with `approved: true` is the correct result for a clean review; do not invent findings.

## Relationship to the pipeline

- Inside a run, the same audit is Phase 3 Step 2.7 (`$HOME/.claude/multi-agent-refs/features/security-audit.md`), triggered by the `security_path` diff-risk signal. This command is the standalone entry point; both share the persona, the schemas and the toolkit tools.
- This is not the `store-ready` device pass under `/multi-agent:test`, and it is not a secret scanner: the pipeline's `pre-commit-check.sh` already covers secrets.
- No writes to Jira, GitHub or Confluence: routing findings to a ticket is a separate, approval-gated step.

**Autopilot**: reviews the current branch, writes the report, and never opens a PR or comments.
