Skip to content

Add Bitwarden Code Review plugin with agent-based architecture#9

Merged
SaintPatrck merged 7 commits into
mainfrom
plugin/bitwarden-code-review
Nov 17, 2025
Merged

Add Bitwarden Code Review plugin with agent-based architecture#9
SaintPatrck merged 7 commits into
mainfrom
plugin/bitwarden-code-review

Conversation

@SaintPatrck

Copy link
Copy Markdown
Contributor

🎟️ Tracking

N/A

📔 Objective

Introduces comprehensive code review plugin following Bitwarden engineering standards:

  • Autonomous bitwarden-code-reviewer agent with structured review protocols
  • Support for repository-specific guidelines via .claude/prompts/review-code.md
  • 5-tier finding classification system (CRITICAL, IMPORTANT, DEBT, SUGGESTED, QUESTION)
  • Mandatory comment format with collapsible details sections
  • False positive prevention through pattern recognition

Plugin structure:

  • Comprehensive README with usage examples and GitHub Actions integration
  • CONTRIBUTING.md with update process and quality checks
  • Agent definition with security-first review approach

Configuration updates:

  • Added plugin entry to marketplace.json
  • Added "anthropics" to .cspell.json for GitHub Actions examples

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

Introduces comprehensive code review plugin following Bitwarden engineering standards:
- Autonomous bitwarden-code-reviewer agent with structured review protocols
- Support for repository-specific guidelines via .claude/prompts/review-code.md
- 5-tier finding classification system (CRITICAL, IMPORTANT, DEBT, SUGGESTED, QUESTION)
- Mandatory comment format with collapsible details sections
- False positive prevention through pattern recognition

Plugin structure:
- Comprehensive README with usage examples and GitHub Actions integration
- CONTRIBUTING.md with update process and quality checks
- Agent definition with security-first review approach

Configuration updates:
- Added plugin entry to marketplace.json
- Added "anthropics" to .cspell.json for GitHub Actions examples

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@SaintPatrck
SaintPatrck force-pushed the plugin/bitwarden-code-review branch from ca2da2f to 8688a75 Compare November 14, 2025 18:02
@SaintPatrck
SaintPatrck marked this pull request as ready for review November 14, 2025 18:05
@SaintPatrck
SaintPatrck requested a review from a team as a code owner November 14, 2025 18:05
@github-actions

github-actions Bot commented Nov 14, 2025

Copy link
Copy Markdown

Logo
Checkmarx One – Scan Summary & Details574eb3fc-cb0c-432f-97bf-69b325fdee40

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

@claude

claude Bot commented Nov 14, 2025

Copy link
Copy Markdown
Contributor

Claude finished @SaintPatrck's task —— View job


Code Review Complete ✅

Tasks

  • Launch bitwarden-code-reviewer agent
  • Analyze PR changes and generate findings
  • Post review results

Overall Assessment: APPROVE

Reviewed the addition of the Bitwarden Code Review plugin across 7 files. This is a clean, well-structured PR that follows repository conventions and plugin standards.

Findings: 2 (informational inquiries only)

Finding 1: Inconsistent License Field Across Plugins

File: plugins/bitwarden-code-review/.claude-plugin/plugin.json:11

💭 QUESTION: License field inconsistency across plugins

Details and inquiry

The new plugin uses "license": "Bitwarden" while existing plugins use "license": "MIT":

  • claude-retrospective: MIT
  • claude-config-validator: (missing license field)
  • bitwarden-code-review: Bitwarden

The repository has a LICENSE.txt file containing the Bitwarden License Agreement. Should all plugins in this repository use "license": "Bitwarden" for consistency, or are different licenses intentional based on plugin purpose?

This affects plugin metadata clarity and user expectations about usage rights.


Finding 2: Existing Plugins Have Outdated Repository URLs

Scope: Repository-wide cleanup opportunity (not blocking for this PR)

💭 QUESTION: Repository URL migration not complete for existing plugins

Details and context

This PR correctly uses ai-plugins in all URLs:

  • https://github.com/bitwarden/ai-plugins
  • Plugin homepage: https://github.com/bitwarden/ai-plugins/tree/main/plugins/bitwarden-code-review

However, existing plugins still reference the old repository name ai-marketplace:

  • plugins/claude-retrospective/.claude-plugin/plugin.json: https://github.com/bitwarden/ai-marketplace
  • plugins/claude-config-validator/.claude-plugin/plugin.json: https://github.com/bitwarden/ai-marketplace
  • plugins/claude-config-validator/README.md: Multiple ai-marketplace references

While this doesn't block the current PR (which uses correct URLs), should the existing plugins be updated in a follow-up PR to maintain consistency across the marketplace?


Summary

The PR demonstrates excellent documentation quality, proper plugin structure, and adherence to repository patterns. The plugin introduces a comprehensive code review agent with thorough documentation, clear usage examples, and proper marketplace integration.

Key Observations:

  • Plugin structure follows repository conventions
  • Marketplace integration properly configured
  • Documentation is comprehensive with clear usage examples
  • Repository URLs correctly use ai-plugins throughout
  • Plugin version (0.1.0) intentionally differs from marketplace version (1.0.0) per maintainer feedback
  • .cspell.json correctly adds "anthropics" for GitHub Actions examples

The two questions raised are informational inquiries about repository-wide consistency rather than issues with this specific PR.


Fixes issue where agent posted all findings in a single PR comment instead of
distributing them as inline review comments on specific lines.

Changes to AGENT.md:
- Add "GitHub Comment Posting Protocol" section (111 lines)
- Document distinction between review comments vs issue comments
- Provide exact gh CLI syntax for posting inline comments with --file and --line
- Add workflow sequence: analyze → post inline comments → post summary
- Include concrete examples of proper gh pr review and gh pr comment usage
- Mandate use of review comments for code-specific findings

Changes to CONTRIBUTING.md:
- Remove specific token budget threshold (<20,000)
- Keep general requirement for token usage measurement

The agent now has explicit instructions for using:
- `gh pr review --comment` for inline comments on specific lines
- `gh pr comment` for final summary comment only

This ensures findings appear in the Files Changed view attached to relevant code,
not consolidated in the PR timeline.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

If deficient, create a finding (💭) with rewrite suggestions in a collapsible `<details>` section.

### Step 4: Load Repository-Specific Guidelines

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.

Added this step to ensure repo-specific rules are considered.

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.

do we need to be more direct here? "If deficient, you must create a finding..."

You don't have to make that change now, but i find that stronger language like that reduces the chance that Claude will just 'forget' or ignore a directive.

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.

Agreed. If that starts happening we certainly be more direct in our phrasing, or leverage other tooling to make sure local context is properly injected.

Corrects repository references to match actual GitHub repository name.

Changes:
- plugin.json: Update homepage and repository URLs to ai-plugins
- README.md: Update marketplace URL in GitHub Actions example to ai-plugins

Addresses finding from code review about repository URL inconsistency.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@@ -0,0 +1,23 @@
{
"name": "bitwarden-code-review",
"version": "0.1.0",

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.

CRITICAL: Version mismatch between marketplace and plugin manifest

Details and fix

The marketplace.json declares version "1.0.0":

{
  "name": "bitwarden-code-review",
  "source": "./plugins/bitwarden-code-review",
  "version": "1.0.0",
  "description": "Comprehensive code review system with organization-wide standards and repository-specific patterns."
}

But the plugin manifest declares version "0.1.0":

{
  "name": "bitwarden-code-review",
  "version": "0.1.0",
  "description": "Comprehensive code review system..."
}

Fix: Align versions. Since this is the initial release, use either "1.0.0" in both places or "0.1.0" in both places. Based on the other plugins in the marketplace using "1.0.0", recommend changing line 3 of plugin.json from "0.1.0" to "1.0.0".

Version mismatches can cause confusion during plugin installation and updates, and may lead to the wrong version being installed.

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 marketplace and plugins are intentionally different as they represent different things.

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.

At least t was an inline comment 🤭

Comment thread plugins/bitwarden-code-review/README.md Outdated
- uses: actions/checkout@v4

- name: Run Code Review
uses: anthropics/claude-code-action@v1

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.

💭 QUESTION: Is claude-code-action@v1 publicly available?

Context and clarification needed

The GitHub Actions example references:

- name: Run Code Review
  uses: anthropics/claude-code-action@v1

This action doesn't appear to be publicly available in the Anthropic GitHub organization.

Questions:

  1. Is this a planned release that will be available before this plugin ships?
  2. Should this be marked as a future example with a note that the action is coming soon?
  3. Is there an alternative action that should be referenced instead?

If this action isn't yet available, users attempting to follow the documentation will encounter errors when trying to set up GitHub Actions integration.

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.

https://github.com/anthropics/claude-code-action does exist. v1 is used as an example placeholder for the correct version.

**Attempt to read repository-specific guidelines:**

First, check if the file exists:

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.

🎨 SUGGESTED: Improve bash command example readability

Enhancement details

The bash code block has formatting that doesn't render correctly:

First, check if the file exists:

```bash
test -f .claude/prompts/review-code.md && echo "EXISTS" || echo "NOT_FOUND"

This creates ambiguous formatting where the triple backticks appear inside what looks like a markdown code block.

**Suggested improvement** - Use clearer formatting:
```markdown
First, check if the file exists:

    test -f .claude/prompts/review-code.md && echo "EXISTS" || echo "NOT_FOUND"

Or remove the explicit bash fence since it's already described as a bash command in the context.

This improves documentation clarity and ensures proper rendering across different markdown processors.

**If EXISTS**: Read the file using the Read tool:

```
.claude/prompts/review-code.md

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.

🎨 SUGGESTED: Clarify Read tool syntax in instructions

Enhancement details

The instruction says:

**If EXISTS**: Read the file using the Read tool:

.claude/prompts/review-code.md

This formatting is unclear - it appears to show a file path in a code block, but doesn't explicitly indicate this is meant to be used with the Read tool.

Suggested improvement:

**If EXISTS**: Read the file using the Read tool with the path:
    .claude/prompts/review-code.md

Or more explicitly:

**If EXISTS**: Use the Read tool to read `.claude/prompts/review-code.md`

This makes it clearer that this is an instruction for tool usage, not example output or a code snippet to execute.

theMickster
theMickster previously approved these changes Nov 14, 2025

@theMickster theMickster left a comment

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.

Minor 💭 LGTM otherwise!


- name: Run Code Review
uses: anthropics/claude-code-action@v1
with:

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.

💭Are all of these inputs valid? Or did Claude stretch on what is possible? Asking because I checked the inputs from the repo...

export function collectActionInputsPresence(): void {
const inputDefaults: Record<string, string> = {
trigger_phrase: "@claude",
assignee_trigger: "",
label_trigger: "claude",
base_branch: "",
branch_prefix: "claude/",
allowed_bots: "",
mode: "tag",
model: "",
anthropic_model: "",
fallback_model: "",
allowed_tools: "",
disallowed_tools: "",
custom_instructions: "",
direct_prompt: "",
override_prompt: "",
additional_permissions: "",
claude_env: "",
settings: "",
anthropic_api_key: "",
claude_code_oauth_token: "",
github_token: "",
max_turns: "",
use_sticky_comment: "false",
use_commit_signing: "false",
experimental_allowed_domains: "",
};

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.

Interesting. That sorta makes sense because I had to tell Claude about them. I got them from the usage docs.

I'll open a PR in gh-actions to test it.

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 think you're correct but maybe they are being added somewhere's else... They appear to be noted in the YML, too. So what the heck, let's give them a try!

https://github.com/anthropics/claude-code-action/blob/08f88abe2b007cc11b8e87577863e9bdc3e88c32/action.yml#L108

@withinfocus withinfocus left a comment

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.

Let's just roll with it at this point and see how it does.

@SaintPatrck
SaintPatrck merged commit 767aec5 into main Nov 17, 2025
8 of 12 checks passed
@SaintPatrck
SaintPatrck deleted the plugin/bitwarden-code-review branch November 17, 2025 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants