Skip to main content

MCP server adding an independent second LLM perspective (Judge B) with full project graph context

Project description

Contrarian

MCP server that adds a second LLM perspective (Judge B) directly inside Claude Code.

Claude Code is Judge A — it already has full project context. Contrarian adds Judge B, an independent model from a different lab, via a single tool call. Same rubric, different priors, no context switch.


How it works

  1. Claude Code invokes contrarian_review() — no args for auto-detect, or pass specific files.
  2. Contrarian resolves the input: git diff, last commit, or full audit (in that order).
  3. Judge B (external model) reviews against JUDGE.md in the project root.
  4. Findings are returned inline and appended to REPORT.md for the dialogue log.

Auto-detect order:

  • diff — any staged/unstaged changes or untracked files
  • last-commit — clean tree → reviews the last commit
  • audit — forced with audit=true, or nothing else found

Installation

Requires Python 3.10+. You'll need a free API key from DeepSeek (no credit card required).

pip install contrarian
contrarian setup

contrarian setup prompts for your API key, then writes the MCP server config to ~/.claude/.claude.json automatically. Restart Claude Code after running it.

That's it.


Manual config (alternative)

If you prefer to configure manually, add to ~/.claude/.claude.json:

{
  "mcpServers": {
    "contrarian": {
      "type": "stdio",
      "command": "contrarian",
      "args": [],
      "env": {
        "JUDGE_B_API_KEY": "sk-or-...",
        "JUDGE_B_BASE_URL": "https://openrouter.ai/api/v1"
      }
    }
  }
}

Default provider is DeepSeek (api.deepseek.com, model deepseek-chat). Change JUDGE_B_BASE_URL and JUDGE_B_MODEL to use any OpenAI-compatible provider (Gemini, Groq, Ollama, OpenRouter, etc.).

Anthropic models are blocked at runtime — Judge B must come from a different lab than Judge A.


Usage

Inside any Claude Code session, the tool is available as contrarian_review.

contrarian_review()                                    # auto-detect mode
contrarian_review({ path: "src/auth.py" })             # single file, diff
contrarian_review({ path: "src/auth.py", full: true }) # full file
contrarian_review({ paths: ["src/a.py", "src/b.py"] }) # multi-file, reviewed as a unit
contrarian_review({ audit: true })                     # force full repo walk
contrarian_review({ model: "google/gemini-3.1-pro-preview" }) # one-off model override

Rubric

Place a JUDGE.md at the project root to customize what Judge B looks for. Without it, a built-in fallback rubric applies.

The built-in rubric covers four dimensions:

Dimension What to find
Exactitude Logic errors, wrong assumptions, incorrect implementation
Missing Unhandled cases, absent validation, unconsidered implications
Premises Assumptions that could be wrong
Alternatives Fundamentally different approaches

Output is always JSON:

{
  "exactitude": { "verdict": "ok|warn|fail", "findings": [] },
  "missing": [],
  "premises": [],
  "alternatives": []
}

Report log

Findings are appended to REPORT.md at the project root under [Judge B] blocks. Claude Code annotates findings under [Judge A] blocks. Judge B reads previous exchanges before each review — closed findings (addressed, won't fix, disagree) are not re-raised.


Phase roadmap

  • Phase 2 (current): MCP server + project graph context. Auto-detect mode. Python rewrite.
  • Phase 3: Operational hardening — token budget guard, graph latency, detached HEAD handling.
  • Phase 4: Agent watchdog — autonomous background review on commit.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

contrarian-0.2.1.tar.gz (16.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

contrarian-0.2.1-py3-none-any.whl (17.3 kB view details)

Uploaded Python 3

File details

Details for the file contrarian-0.2.1.tar.gz.

File metadata

  • Download URL: contrarian-0.2.1.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for contrarian-0.2.1.tar.gz
Algorithm Hash digest
SHA256 d083fd0cf6b727f7dcc556f0b1e6c4d5f43c0a794f91fdfb01638a57f752a7c5
MD5 cb12213bea10c574c0172db9d7c05998
BLAKE2b-256 c0253d3451dcd59fb82e12167fd8e05c85775c0bfac0e28941f2a80bd12652b9

See more details on using hashes here.

File details

Details for the file contrarian-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: contrarian-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 17.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for contrarian-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 362dbbe63b9c60d6f587ffeeb99e0fc7a624eea474afa47f9a10265fddb13455
MD5 0faddf832bb63494ecdde7ab19f7f4ba
BLAKE2b-256 e193e8c39e99793cb57a5da2ddf2d11cc630b37fde54bc103831786524e46efe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page