{
  "markdown": "# BYOM Code Review — Bring Your Own Model\n\nCode review with **any AI model** via [OpenRouter](https://openrouter.ai), as a [Claude Code](https://claude.ai/code) plugin.\n\nForked from [openai/codex-plugin-cc](https://github.com/openai/codex-plugin-cc) and adapted to use OpenRouter instead of the Codex app-server, so you can review code with Claude, GPT, Gemini, Llama, or any other model available on OpenRouter.\n\n## What You Get\n\n- `/byom-review:review` — standard code review against your local git state\n- `/byom-review:adversarial-review` — steerable challenge review that questions design choices\n- `/byom-review:setup` — check configuration status\n\n## Requirements\n\n- **OpenRouter API key** — get one at [openrouter.ai/keys](https://openrouter.ai/keys)\n- **Node.js 18.18 or later**\n\n## Install\n\nAdd the plugin in Claude Code:\n\n```bash\n/plugin install byom-review\n```\n\n> **Note:** While the plugin is pending marketplace review, you can install directly from the repo:\n> ```bash\n> /plugin marketplace add jkrish/byom-code-review\n> /plugin install byom-review\n> ```\n\nThen set your API key:\n\n```bash\nexport OPENROUTER_API_KEY=sk-or-v1-your-key-here\n```\n\nRun setup to verify:\n\n```bash\n/byom-review:setup\n```\n\n## Configuration\n\n| Variable | Required | Description |\n|---|---|---|\n| `OPENROUTER_API_KEY` | Yes | Your OpenRouter API key |\n| `BYOM_DEFAULT_MODEL` | No | Default model ID (default: `minimax/minimax-m2.7`) |\n\nYou can also pass `--model <id>` on any review command to override the default.\n\n## Usage\n\n### `/byom-review:review`\n\nRuns a code review on your current work using any model via OpenRouter.\n\n```bash\n/byom-review:review\n/byom-review:review --base main\n/byom-review:review --model openai/gpt-4o\n/byom-review:review --model google/gemini-2.0-flash --scope branch\n/byom-review:review --models anthropic/claude-sonnet-4,openai/gpt-4o,google/gemini-2.0-flash\n/byom-review:review --pr 42\n```\n\nSupports:\n- `--model <id>` — any OpenRouter model\n- `--models <id,id,...>` — run 2-5 models simultaneously for a multi-model comparison review\n- `--base <ref>` — branch review against a base ref\n- `--pr <number>` — review a specific GitHub PR diff (requires `gh` CLI)\n- `--scope <auto|working-tree|branch>` — review scope\n- `--wait` — run in foreground\n\n### `/byom-review:adversarial-review`\n\nRuns a **steerable** review that challenges the implementation and design.\n\n```bash\n/byom-review:adversarial-review\n/byom-review:adversarial-review --base main challenge whether this was the right caching design\n/byom-review:adversarial-review --model anthropic/claude-sonnet-4 look for race conditions\n/byom-review:adversarial-review --pr 42 challenge the error handling strategy\n```\n\nUses the same target selection as `/byom-review:review`. Unlike the standard review, it accepts extra focus text after the flags.\n\n> **Note:** `--pr` cannot be combined with `--base` or `--scope`.\n\n### `/byom-review:setup`\n\nChecks whether the plugin is configured with an OpenRouter API key.\n\n```bash\n/byom-review:setup\n```\n\n## Supported Models\n\nAny model available on OpenRouter works. Popular choices:\n\n| Model | ID |\n|---|---|\n| Claude Sonnet 4 | `anthropic/claude-sonnet-4` |\n| GPT-4o | `openai/gpt-4o` |\n| Gemini 2.0 Flash | `google/gemini-2.0-flash` |\n| Llama 3.1 405B | `meta-llama/llama-3.1-405b-instruct` |\n| DeepSeek R1 | `deepseek/deepseek-r1` |\n\nSee the full list at [openrouter.ai/models](https://openrouter.ai/models).\n\n## Multi-Model Reviews\n\nPass `--models` with a comma-separated list of 2-5 model IDs to run them simultaneously:\n\n```bash\n/byom-review:review --models anthropic/claude-sonnet-4,openai/gpt-4o,google/gemini-2.0-flash\n```\n\nModels run in parallel with straggler timeout detection — if most models finish, slow ones are cancelled rather than blocking the result. After individual reviews, a comparative synthesis covers:\n\n- **Verdict consensus** — did models agree on approve vs needs-attention?\n- **Finding overlap** — issues flagged by multiple models (higher confidence) vs unique to one\n- **Severity alignment** — did models rate the same issues at the same level?\n- **Notable disagreements** — where models contradicted each other\n- **Combined recommendation** — ship or don't ship, based on the weight of evidence\n\n`--models` is not supported for adversarial reviews.\n\n| Variable | Default | Description |\n|---|---|---|\n| `BYOM_STRAGGLER_TIMEOUT_MS` | `300000` | Time to wait for slow models after the first completes |\n| `BYOM_GLOBAL_TIMEOUT_MS` | `300000` | Maximum total time for all models |\n\n## Review Output\n\nReviews produce structured JSON output with:\n\n- **verdict**: `approve` or `needs-attention`\n- **summary**: concise assessment\n- **findings**: array of issues with severity, file, line numbers, confidence, and recommendation\n- **next_steps**: suggested follow-up actions\n\n## How It Works\n\n1. Collects git context (diffs, commit logs, untracked files) from your working tree or branch\n2. Sends context + review prompt to the selected model via OpenRouter's API\n3. Parses structured JSON output matching the review schema\n4. Returns the review result\n\nThe plugin uses OpenRouter's OpenAI-compatible API with structured output support. For models that don't support `json_schema` response format, it falls back to embedding the schema in the system prompt.\n\n## Local Development\n\n### Setup\n\nClone the repo and start Claude Code with the `--plugin-dir` flag pointing to the plugins directory:\n\n```bash\ngit clone https://github.com/jkrish/byom-code-review.git\ncd byom-code-review\nclaude --plugin-dir ./plugins\n```\n\nThis loads all plugins under `plugins/` (including `byom-review`) without needing to install them from a registry. Changes to plugin files take effect on the next Claude Code restart.\n\n### Project Structure\n\n```\nplugins/byom-review/\n├── commands/          # Slash command definitions (Markdown)\n│   ├── review.md\n│   ├── adversarial-review.md\n│   └── setup.md\n├── hooks/\n│   └── hooks.json     # Lifecycle hooks configuration\n├── prompts/           # Prompt templates used by review commands\n├── schemas/           # JSON schemas for structured review output\n├── scripts/\n│   ├── byom-companion.mjs        # Main companion script (setup, review logic)\n│   ├── session-lifecycle-hook.mjs # Session hook entry point\n│   └── lib/                       # Shared utilities\n├── CHANGELOG.md\n├── LICENSE\n└── NOTICE\n```\n\n### Debugging\n\n**Check plugin registration:**\n\n```bash\n/plugin\n```\n\nVerify `byom-review` appears in the list.\n\n**Run setup diagnostics:**\n\n```bash\n/byom-review:setup\n```\n\nThis checks API key configuration and reports any issues as JSON.\n\n**Run the companion script directly:**\n\nYou can invoke the companion script outside of Claude Code for faster iteration:\n\n```bash\n# Check setup status\nnode plugins/byom-review/scripts/byom-companion.mjs setup --json\n\n# Run a review (requires OPENROUTER_API_KEY in env)\nnode plugins/byom-review/scripts/byom-companion.mjs review --json\n\n# Run with a specific model\nnode plugins/byom-review/scripts/byom-companion.mjs review --model openai/gpt-4o --json\n```\n\n**Enable verbose output:**\n\nSet `DEBUG=byom` to see request/response details:\n\n```bash\nDEBUG=byom node plugins/byom-review/scripts/byom-companion.mjs review --json\n```\n\n**Common issues:**\n\n| Problem | Fix |\n|---|---|\n| `OPENROUTER_API_KEY not set` | Export the key: `export OPENROUTER_API_KEY=sk-or-v1-...` |\n| Plugin not found after launch | Ensure `--plugin-dir` points to the `plugins/` directory |\n| Changes not reflected | Restart Claude Code with `--plugin-dir` — plugin files are loaded at startup |\n| Model returns malformed JSON | Try a different model — not all models handle `json_schema` response format reliably |\n| Node version errors | Requires Node.js 18.18+. Check with `node --version` |\n\n## License\n\nApache-2.0 — see [LICENSE](LICENSE).\n",
  "bytes": 7810,
  "sha": "f52c9c373f5c973f12d7cc7f5302de73c9e422ce445fef356ec8b00127471514",
  "repo_slug": "jkrish/byom-code-review",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/plg_jkrish_byom_code_review_byom_review_a7670729/readme"
}