Skip to content

PM-33385 - Craft a multi-agent code review#96

Merged
theMickster merged 23 commits into
mainfrom
multi-agent-review
May 14, 2026
Merged

PM-33385 - Craft a multi-agent code review#96
theMickster merged 23 commits into
mainfrom
multi-agent-review

Conversation

@theMickster
Copy link
Copy Markdown
Contributor

@theMickster theMickster commented Apr 24, 2026

🎟️ Tracking

PM-33385 - Create multi-agent code review skill

📔 Objective

Adds a new performing-multi-agent-code-review skill. Intentionally a different lens from the existing bitwarden-code-reviewer agent — that agent reviews code the way a human reviewer would; this skill has Claude evaluate code as Claude, with output constraints a human can read. The pipeline runs 6 subagents per review each with a specific purpose and well-defined prompt.

Nitty-gritty skill details

Expand
  • Four invocation modes: PR, local changes, branch comparison, and commit-range (e.g. "last week of commits", "last 20 commits", "since 2026-04-23").
  • Configurable model — opus by default; tunable via --model to dial cost vs. depth.
  • Pipeline: architecture compliance pass → 3 parallel diff reviewers (quality, bug, security) → per-finding validation → severity audit.
  • Confidence threshold ≥ 80; everything below is dropped silently.
  • The architecture agent is the only codebase-aware lens — the 2 diff-only reviewers (quality, bug) are deliberately constrained to the diff to avoid context contamination. The security agent is context-allowed and receives full PR context to sharpen adversarial reasoning. The architecture agent counterweights by loading full files, sibling code, and project docs, catching pattern violations, boundary violations, and doc/code drift the diff-only reviewers cannot.
  • Severity-bucketed local markdown report written to a local directory — plugin data dir by default (organized across projects, never git-tracked), or the repo root if preferred.
  • Findings render in 🛑 Blocker / ⚠️ Important / ♻️ Refactor with a collapsed "dismissed findings" block showing what was caught and rejected, with rejection reasons.
  • Each finding includes a Caught by sub-agent attribution (Architecture, Code quality, Bug analysis, Security & logic, Validation).

Use cases

Expand - At the end of a [Claude Code Agent Teams](https://code.claude.com/docs/en/agent-teams) coding session — slots into an agent feedback loop where teammates work, address findings, and refactor. - When an engineer is approaching the end of local development work and needs depth of review. - When an engineer has completed work on a draft PR and needs depth of review prior to publish. - When an engineer is peer-reviewing a high-density, cross-team, or very complex pull request.

Field test results on live PRs

Expand
  1. PM-26250 Explore options to enable direct importer for mac app store build clients#17479 (comment)
  2. [PM-32016] - make at-risk banner dismissable clients#20505 (comment)
  3. [PM-34165] Introduce InviteKeyBundle for supporting future AC auto-confirm workflow sdk-internal#1021 (comment)
  4. Add missing functions to Send API calls sdk-internal#961 (comment)
  5. [PM-32211] fix private key before key rotation sdk-internal#994 (comment)
  6. [PM-33982] feat: Add device management screen android#6754 (comment)
  7. [BRE-1838] tune DevOps Actions Audit Skill #89 (comment)

Cost estimates

Expand

Cost comparison sdk-internal/pull/1020

multi-agent review

image

single-agent /bitwarden-code-review:code-review-local

image

Cost comparison misc/pull/348

multi-agent review

image

single-agent review

image

🧪 Testing

Expand for reviewer steps to try the four modes locally

Step 1: Install the required sibling plugins

The skill aborts without bitwarden-tech-lead and bitwarden-security-engineer available in the same marketplace. Confirm both are installed before invoking.

Step 2: Trigger each mode and confirm the report shape

In a Bitwarden repo checkout, invoke each form below and confirm a code-review-*.md lands in the directory you selected at invocation time (plugin data dir by default), with severity-bucketed findings and a Caught by: line on every finding:

  • PR mode — /performing-multi-agent-code-review 12345 (substitute a real PR number)
  • Local mode — make an uncommitted change, then /perform-multi-agent-code-review
  • Branch comparison — on a clean feature branch, /perform-multi-agent-code-review
  • Commit-range — /performing-multi-agent-code-review on the last 5 commits

Step 3: Confirm the dismissed-findings block

Each report should include a collapsed "dismissed findings" section listing findings that didn't survive Step 4 validation or Step 5 severity audit, with the rejection reason.

@github-actions
Copy link
Copy Markdown

Logo
Checkmarx One – Scan Summary & Details2438330f-9677-47c0-b21d-888091cf8e04

Great job! No new security vulnerabilities introduced in this pull request

Co-authored-by: Copilot <copilot@github.com>
"metadata": {
"description": "Official Bitwarden Claude Plugin Marketplace",
"version": "1.0.1",
"pluginRoot": "./plugins"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have been experimenting with cross agent configuration (namely Github Copilot) and I found that this configuration is incorrect. It should only be used it all plugins below did not have the ./plugins/ prefix in the source property. However, since all of them do, this should be removed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As noted in the pull request description, these standards are intentionally different because of the depth of work being done by the subagents. The intention is that we don't surface noise to engineers, but real signals of problems. I feel strongly that humans should be relied upon for suggestions and nit-picks. Claude should stay in this lane IMO.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to chat in a thread about my perspective and why I cut out all suggestions in this suggested skill.

- Speculative issues that depend on specific inputs or runtime state without evidence those inputs occur in practice.
- Pre-existing issues not introduced or worsened by this change.

## Confidence Scoring
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have found good success with providing Claude with a scale that has concrete descriptions of what is and is not considered a confident finding.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arguably the best suggestion from the /skill-creator was this markdown. Given the subagents a concrete messaging format has drastically improved consistency of findings and being able to track what agent came up with what finding is also very helpful.

@theMickster theMickster marked this pull request as ready for review May 4, 2026 08:35
@theMickster theMickster requested a review from a team as a code owner May 4, 2026 08:35
@theMickster theMickster added the ai-review Request a Claude code review label May 4, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 4, 2026

🤖 Bitwarden Claude Code Review

Overall Assessment: REQUEST CHANGES

Reviewed the new performing-multi-agent-code-review skill: SKILL.md plus five reference files (modes.md, discovery-standards.md, evaluation-standards.md, finding-shape.md, report-template.md), the version bump to 1.11.0 across marketplace.json / plugin.json / README tables, and the changelog entry. The orchestration spec is internally consistent, reference splits keep SKILL.md lean, and pluginRoot was correctly removed from marketplace.json per the pre-existing reviewer note. One issue flagged inline on the chunked validation path.

Code Review Details
  • ⚠️ : Collateral val-N IDs collide across parallel chunked validation subagents and silently overwrite each other in the master map
    • plugins/bitwarden-code-review/skills/performing-multi-agent-code-review/SKILL.md:160

Comment thread plugins/bitwarden-code-review/README.md Outdated
@theMickster theMickster added the ai-review-vnext Request a Claude code review using the vNext workflow label May 4, 2026
Comment thread plugins/bitwarden-code-review/skills/performing-multi-agent-code-review/SKILL.md Outdated
@theMickster theMickster removed ai-review Request a Claude code review ai-review-vnext Request a Claude code review using the vNext workflow labels May 4, 2026
@theMickster theMickster added ai-review Request a Claude code review and removed ai-review Request a Claude code review labels May 4, 2026
Copy link
Copy Markdown
Contributor

@withinfocus withinfocus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This brought up a lot of composition questions from me, and letting other plugins own their space better with deferred review coming from here.

This feels a lot like the security review skill the security engineer has, but different in approach, and that concerns me about consistency. I think we need one to depend on the other, at least for approach definition, otherwise we will get rather different results.

This does seem to work fine as-is, but before it's available I think we have to solve the composition problem.


- Model: Default to the opus model unless `--model` is specified.
- Announce which model is being used before starting the review.
- Don't write to GitHub. All findings go to a local markdown file.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ Can this lean into the available commands and distinguish between online and local?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For v1, I did not envision the multi-agent review as being leveraged by the reusable workflow. My plan is that the skill is used and refined locally prior to making the necessary refactoring changes so that it works both for local reviews and for use in the GitHub reusable workflow.

Comment on lines +49 to +53
**Required — zero-knowledge and threat-model preamble.** Include this block verbatim in the subagent prompt:

> **Zero-knowledge invariant.** Bitwarden servers only store and synchronize encrypted vault data. The server, Bitwarden employees, and third parties must never be able to access unencrypted vault data. Encryption and decryption happen client-side only. The Master Key and Stretched Master Key are never stored on or transmitted to Bitwarden servers.
>
> **Threat-model directive.** Evaluate every change against P01–P06 and the requirements under VD/EK/AT/SC/TC (loaded via the `bitwarden-security-context` skill per the preceding block). For each finding that touches vault data, keys, auth tokens, or user authenticity, name the principle or category it implicates.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💭 I don't understand why this is here -- can you explain? I feel that this would be picked up from the skill and this will be more difficult to maintain; updates over there would miss this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing. I worked closely with the /skill-creator:skill-creator and Claude Docs sub-agents to craft the preamble. I think that line 53 could be slightly less specific on the P01-P06 principals; but there's strong evidence from the docs why these agents perform better with a strong preamble from the skill versus from the Claude orchestration agent just making something up.

The hardcoded preamble is following the our CLAUDE.md's explicit instruction: "When spawning subagents, include the Core Vocabulary definitions and zero-knowledge invariant in the agent prompt — subagents do not inherit CLAUDE.md context."

The docs back up why: for custom subagents like bitwarden-tech-lead, the docs say they "receive only this system prompt (plus basic environment details like working directory), not the full Claude Code system prompt" — so CLAUDE.md doesn't flow through.
Even for general-purpose (built-in) subagents that do load CLAUDE.md, the memory docs note "there's no guarantee of strict compliance" for user-message-delivered context.

The bitwarden-security-context skill handles the detailed vocabulary load. The preamble is the upfront framing that has to be present before the skill call — the two serve different roles.

Subagents receive only this system prompt (plus basic environment details like working directory), not the full Claude Code system prompt.
Claude Docs sub-agents

"CLAUDE.md content is delivered as a user message after the system prompt, not as part of the system prompt itself. Claude reads it and tries to follow it, but there's no guarantee of strict compliance."
How Claude remembers your project


> **Tool discipline.**
>
> - Use Bash for all `gh`/`git` commands. Never use WebFetch or WebSearch.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ Why?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The prompt passes the diff, file paths, and PR metadata directly — subagents don't need to discover anything. The "no probe" rule kills token waste. Step 1 also already verified the environment before subagents launch, so they're operating in a validated context.

Comment thread plugins/bitwarden-code-review/skills/performing-multi-agent-code-review/SKILL.md Outdated

3. Launch 3 agents using the `general-purpose` subagent type to independently review the changes. Each receives the diff and the Review Rules; each emits findings as a JSON array per the Finding Shape schema. In PR mode, pass the PR title and description only to Agent 3 per Context Partitioning — Agents 1 and 2 receive diff + Review Rules only. Send all 3 Agent tool calls in a single message (do NOT use run_in_background).

**Agent 1: Code quality agent**
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💭 Similar to some of my other comments I wondering if this is better served as a call to a review skill within the software engineer plugin.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was an interested finding from the skill-creator to not attempt to leverage a custom subagent, but, instead, just use the general-purpose agent with a strongly grounded prompt.

I would prefer to leave this as-is for v1 unless we can prove that use a custom subagent is superior.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't dig super deep into comparing the general purpose agent with the project preamble grounding versus the security agent. Swapping the bitwarden-security-engineer should be a rather easy change that I can try this week.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SaintPatrck I made refactoring changes in a5689a5 to implement our custom security subagent. I also worked with the /skill-creator to refactor the wall of text that was the additional LLM security context wording.

Copy link
Copy Markdown
Contributor

@SaintPatrck SaintPatrck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Started a first pass. There's a lot to unpack here.

Overall it's looking good. Nothing major stands out so far. Did leave a few suggestions. I'll pick back up Monday.

I'd like to start a thread regarding this comment in Slack. This could get philosophical. 😆

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@theMickster
Copy link
Copy Markdown
Contributor Author

This brought up a lot of composition questions from me, and letting other plugins own their space better with deferred review coming from here.

This feels a lot like the security review skill the security engineer has, but different in approach, and that concerns me about consistency. I think we need one to depend on the other, at least for approach definition, otherwise we will get rather different results.

This does seem to work fine as-is, but before it's available I think we have to solve the composition problem.

I agree that thinking through composition given the changes we have made in the last couple weeks are good to think though together and experiment.

I'm also good to unpack r3180238995 some more. My wording was likely a little harsh; but I think where I was coming from is that I wanted this multi-agent review to primarily spotlight things of strong significance (blockers, bugs, and known bad patterns/practices) and less on minor things. 🤷🏼

Comment thread plugins/bitwarden-code-review/skills/performing-multi-agent-code-review/SKILL.md Outdated
Comment thread plugins/bitwarden-code-review/skills/performing-multi-agent-code-review/SKILL.md Outdated
@bitwarden bitwarden deleted a comment from claude Bot May 12, 2026
@bitwarden bitwarden deleted a comment from claude Bot May 12, 2026
@bitwarden bitwarden deleted a comment from SaintPatrck May 12, 2026
Comment thread plugins/bitwarden-code-review/skills/performing-multi-agent-code-review/SKILL.md Outdated
Comment thread plugins/bitwarden-code-review/skills/performing-multi-agent-code-review/SKILL.md Outdated
theMickster and others added 2 commits May 12, 2026 16:50
…de-review/SKILL.md

Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
…de-review/SKILL.md

Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
@bitwarden bitwarden deleted a comment from SaintPatrck May 12, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 14, 2026

Validation Summary — PR #96

Plugin: bitwarden-code-review (version bump 1.10.1 → 1.11.0)
Scope: new performing-multi-agent-code-review skill plus README/CHANGELOG updates.

Three validations ran:

  1. plugin-validator (plugin-dev) — manifest + plugin structure
  2. skill-reviewer (plugin-dev) — new SKILL.md quality
  3. claude-config-validator — security / secrets / permission scoping

Overall verdict: APPROVE with minor changes recommended. No critical or major security issues. All referenced files exist, version bump is correct, marketplace.json/plugin.json/CHANGELOG.md are consistent, and there are no committed secrets or dangerous permission grants.


Critical

None.

Major (should fix)

1. allowed-tools in skill frontmatter

File: plugins/bitwarden-code-review/skills/performing-multi-agent-code-review/SKILL.md:4

allowed-tools is a slash-command frontmatter field — it is not part of the documented Claude Code SKILL.md spec (which accepts name, description, and a small set of optional metadata fields). The harness will not enforce these tool restrictions for a skill, so the list is effectively documentation, not policy. The actual Tool Discipline section in the body is what governs behavior.

Remediation: Remove the allowed-tools line from frontmatter, or move its intent into the Tool Discipline section of the body so readers don't assume harness-level enforcement.

2. argument-hint in skill frontmatter

File: plugins/bitwarden-code-review/skills/performing-multi-agent-code-review/SKILL.md:5

argument-hint is also a slash-command frontmatter field. Skills are invoked by the model, not via /command [args], so the field has no effect.

Remediation: Remove argument-hint from frontmatter. The accepted invocation shapes (PR number, commit range, --model, --output-dir) are already covered in the "Mode" and "Output Location" sections of the body; if explicit syntax matters, add a short "Invocation" subsection there.

Minor (should review)

3. Description length

File: plugins/bitwarden-code-review/skills/performing-multi-agent-code-review/SKILL.md:3

The description is roughly 870 characters — well above the typical 200–500 char target. Trigger phrases are excellent (specific, third-person, includes commit-range routing), but the "Prefer this over a single-agent review…" rationale belongs in the body.

Remediation: Trim to ~300–400 chars, keeping the trigger phrases and the commit-range cue. Move the preference rationale into the Overview section.

4. Non-standard environment variables

File: plugins/bitwarden-code-review/skills/performing-multi-agent-code-review/SKILL.md:35, :116

  • ${CLAUDE_PLUGIN_DATA} (line 35) is used as the default output directory.
  • ${CLAUDE_SKILL_DIR} (line 116) is used to anchor references/... lookups.

Neither is the documented ${CLAUDE_PLUGIN_ROOT}. If the runtime does not provide these, paths will resolve to empty strings.

Remediation: Verify both variables resolve in the target environment. If not, substitute ${CLAUDE_PLUGIN_ROOT}-relative paths, or document why these alternate variables are required.

5. Prerequisite plugins not declared in plugin.json

File: plugins/bitwarden-code-review/skills/performing-multi-agent-code-review/SKILL.md:14–23

The skill enumerates bitwarden-tech-lead and bitwarden-security-engineer as hard prerequisites and aborts the review if either is missing. Surfacing these only at first invocation is later than necessary.

Remediation: If the Bitwarden marketplace supports declaring inter-plugin dependencies, add them to the plugin manifest so install-time tooling can warn. Otherwise, document the dependency more prominently in the README's "Skills" table.

6. No examples/ directory

File: plugins/bitwarden-code-review/skills/performing-multi-agent-code-review/

For a 9-step orchestration skill with JSON schemas and subagent prompt assembly, a worked example on a small synthetic diff would aid the orchestrator. Not blocking.

Remediation: Consider adding examples/sample-review.md showing a small end-to-end run.


Verified Clean

  • Secrets / credentials: none committed across the nine changed files.
  • Permission scoping: allowed-tools (even if it has no enforcement effect on skills) is narrowly scoped to read-only gh/git operations. No mutating commands (gh pr merge, git push, git commit, git reset), no wildcards, no Bash(rm:*).
  • Settings safety: plugin .claude/settings.json denies a comprehensive list of destructive gh operations — strong defensive posture.
  • Untrusted-input boundary: SKILL.md:79–81 explicitly treats diff content as untrusted, cites CWE-1427 for prompt-injection findings.
  • Zero-knowledge / threat-model preamble: propagated verbatim to subagents (SKILL.md:54–64).
  • WebFetch / WebSearch ban: explicit with rationale (SKILL.md:44, :72).
  • Version consistency: 1.11.0 matches across plugin.json:3, marketplace.json entry, and CHANGELOG.md:8.
  • Changelog format: Keep a Changelog format preserved; ### Added entry for 1.11.0 documents the new skill.
  • Referenced files exist: references/modes.md, discovery-standards.md, evaluation-standards.md, finding-shape.md, report-template.md are all present and non-empty.
  • README: the new skill is listed in the Skills table with specific trigger phrases (README.md:24).
  • Word count: SKILL.md is ~2,650 words, within the 1,000–3,000 target. Progressive disclosure is well executed — heavy schemas live in references/, SKILL.md keeps the orchestration spine.
  • JSON files: parse cleanly.

Priority Remediation Checklist

  1. Remove allowed-tools from SKILL.md frontmatter (line 4).
  2. Remove argument-hint from SKILL.md frontmatter (line 5).
  3. Shorten the description field (line 3) to ~300–400 chars.
  4. Verify ${CLAUDE_PLUGIN_DATA} (line 35) and ${CLAUDE_SKILL_DIR} (line 116) resolve at runtime; substitute ${CLAUDE_PLUGIN_ROOT}-relative paths if not.
  5. (Optional) Declare prerequisite plugins in plugin.json and add an examples/ directory.


4. Launch a single `general-purpose` validation subagent for all findings from Steps 2 and 3. The subagent receives the diff fetched with the mode's diff command from Step 1, the full array of finding objects, the Review Rules, and — in PR mode only — the PR title and description. The subagent returns an array of Step 4 objects (one per input finding) per the Finding Shape schema.

**Chunking escape hatch.** If raw findings from Steps 2 and 3 number more than 25, partition them into chunks of ≤ 15 (preserving collateral context within each chunk; do not split a `source_agent` group across chunks if it would put related findings on opposite sides) and launch one validation subagent per chunk in a single message (do NOT use run_in_background).
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ IMPORTANT: Collateral-finding val-N IDs will collide across parallel chunked validation subagents and silently overwrite each other in the master map.

Details and fix

When more than 25 raw findings trigger the chunking path, multiple validation subagents run in parallel. Each subagent receives no shared counter and — per references/finding-shape.md:34 — emits its own collateral Finding objects with id: "val-N" starting at val-1. The Step 6 merge is keyed by id (per references/finding-shape.md:49-51), so if two parallel subagents each emit a val-1 (or both reach val-2, etc.), the later merge silently overwrites the earlier collateral finding. Collateral findings are by definition new issues that surfaced during validation, so silently losing them defeats the purpose of the collateral-change check on exactly the large-PR path where chunking is most likely.

Suggested fix: namespace the collateral ID by chunk index — e.g. val-{chunk}-N — and propagate the chunk index into each validation subagent's prompt. Update references/finding-shape.md to match.

Copy link
Copy Markdown
Contributor

@SaintPatrck SaintPatrck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm on board with moving this forward and iterating.

@theMickster theMickster merged commit cf0e5ec into main May 14, 2026
17 checks passed
@theMickster theMickster deleted the multi-agent-review branch May 14, 2026 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review Request a Claude code review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants