p4-code-review
P4 Code Review (Swarm), using multiple specialized agents with confidence-based scoring.
It drives the p4mcp-server tools and Swarm reviews.
What it does
Given a Swarm review ID, the /p4-code-review command runs a multi-agent pipeline:
- Resolve — look up the review and take its most recent associated changelist as the one to review.
- Precheck (haiku) — skip if the changelist is empty, the review is already finished-reviewing, the change is trivial/automated, or Claude has already commented on the review.
- Gather CLAUDE.md (haiku) — collect depot paths of CLAUDE.md files that govern the changed files.
- Summarize (sonnet) — describe what the changelist does.
- Review (4 parallel agents) — 2 sonnet agents for CLAUDE.md compliance + 2 opus agents for bugs/logic/security, tuned for high-signal-only findings.
- Validate (parallel subagents) — each candidate issue is independently re-checked against the full file content, not just the diff.
- Filter — drop anything that didn't survive validation.
- Report — print findings to the terminal.
8–9. Comment (opt-in) — with
--comment, post inline + summary comments to the associated Swarm review.
Usage
/p4-code-review:run <review-id> # review and print findings only
/p4-code-review:run <review-id> --comment # also post comments to the Swarm review
Examples:
/p4-code-review:run 2095
/p4-code-review:run 2095 --comment
Requirements
- A Perforce MCP server connected to Claude Code, exposing the
query_changelists,query_files,query_reviews, andmodify_reviewstools. - The server name is not hardcoded. The command resolves your Perforce MCP server at
runtime by finding whichever connected server exposes those tools, so it works regardless
of the name you registered it under (
p4mcp,p4mcp,p4,helix, …). No edit required. Theallowed-toolsfrontmatter is keyed to the defaultp4mcpname for auto-approval only — under a different name the tools still work, they just prompt for permission. To silence those prompts, edit themcp__p4mcp__prefixes incommands/run.mdto match your server. --commentmode requires write permission on the review.
Installation
This repo is its own plugin marketplace. Add it, then install the plugin:
/plugin marketplace add Himanshu-jn52/p4-code-review
/plugin install p4-code-review@p4-code-review
To test it locally without a marketplace, point Claude Code straight at the directory:
claude --plugin-dir /path/to/p4-code-review
Repository layout:
p4-code-review/
├── .claude-plugin/
│ ├── plugin.json # plugin manifest
│ └── marketplace.json # marketplace catalog (lists this plugin)
├── commands/run.md
├── LICENSE
└── README.md
License
MIT.