mira

miracodeaiApache-2.0活跃维护

自托管的 AI 代码审查工具,能对 PR 做索引化审查、生成变更讲解、扫描漏洞、绘制依赖图,还支持自定义规则和从反馈中持续学习。

Self-hosted AI code reviewer with indexed PR reviews, walkthroughs, vulnerability scanning, dependency graphs, custom rules, and a learning loop.

v0.11.1发布于 2026-11-09 12:00 UTC398star +5 / 7 天81fork同步于 2026-11-10 23:58 UTC

怎么上手

由 README 提炼,执行前请确认
docker run -p 8000:8000 --env-file .env -v "$(pwd)/mira.yaml:/app/mira.yaml" ghcr.io/miracodeai/mira:latest --config /app/mira.yaml
硬件要求按 README 说明

README 未说明显存或 CPU 要求;支持通过 OpenRouter、vLLM、Ollama、Together、Groq、Fireworks 或 AWS Bedrock 等 OpenAI 兼容端点调用模型,也可用 Codex CLI 本地运行。

有 Docker 镜像
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

自托管 AI 代码审查工具,用你自己的 LLM key 审 PR,代码和数据都留在自己基础设施上

自托管的 AI 代码审查工具,能对 PR 做索引化审查、生成变更讲解、扫描漏洞、绘制依赖图,还支持自定义规则和从反馈中持续学习。

核心能力

  • 用全仓库索引给模型提供跨文件上下文,不只审 diff
  • 按置信度阈值、去重、自我批判和每 PR 评论上限过滤噪音
  • 从已合并 PR 和人工评审模式中合成团队规则,形成学习闭环
  • 每小时轮询 OSV.dev 扫描依赖 CVE,并提供依赖与影响范围图
  • 审查时检查其他开放 PR,标记合并冲突和重复工作风险

容易踩的坑

需要先准备 .env 中的 GitHub App 凭据、webhook secret 和 OPENROUTER_API_KEY 等密钥;用 Codex CLI 提供方时需先 codex login 并只读挂载 CODEX_HOME;Bitbucket 评论命令的权限检查需要管理员权限,否则要在 commands.allowed_users 中列账户 id。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v0.11.1
  1. v0.11.1最新正式版2026-11-09 · 2026-11-09 12:00 UTC

    What's Changed

    Full Changelog: https://github.com/miracodeai/mira/compare/v0.11.0...v0.11.1

  2. v0.11.02026-11-07 · 2026-11-07 15:17 UTC
    查看更新说明

    What's Changed

  3. v0.10.12026-10-28 · 2026-10-28 21:02 UTC
    查看更新说明

    What's Changed

    Full Changelog: https://github.com/miracodeai/mira/compare/v0.10.0...v0.10.1

  4. v0.10.02026-10-26 · 2026-10-26 16:52 UTC
    查看更新说明

    What's Changed

  5. v0.9.12026-09-24 · 2026-09-24 14:08 UTC
    查看更新说明

    What's Changed

    New Contributors

    Full Changelog: https://github.com/miracodeai/mira/compare/v0.9.0...v0.9.1

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    Self-host every feature: full review engine, codebase indexing, vulnerability scanning, custom rules, org-wide package search, dashboard, learning loop. No paid tier, no license key, no SaaS upsell.

    Mira reviews your pull requests using your choice of LLM (via OpenRouter, which fronts Anthropic, OpenAI, Google, DeepSeek, and more) and posts concise, actionable feedback. The noise filter, confidence clamping, and learning loop ensure you only see comments that matter. See FEATURES.md for the full surface.

    Why Teams Choose Mira

    • Model agnostic — Run Claude, GPT, Gemini, DeepSeek, Llama, or any OpenAI-compatible endpoint: OpenRouter, vLLM, Ollama, Together, Groq, Fireworks, or AWS Bedrock direct. Per-provider quirks are config, not code, so adding a provider is a one-line entry.
    • Zero markup on LLM costs — Bring your own key. You pay the model provider directly; Mira never proxies your spend or adds a multiplier. The dashboard shows real per-repo, per-model cost — not estimates.
    • Learns from your context — Mira synthesizes rules from your merged PRs: rejected comments and human review patterns become team rules that shape future reviews.
    • You set the rules — Define custom and org-wide review rules in plain language, per-repo via .mira.yaml or from the dashboard.
    • Privacy first — Self-hosted by default. Diffs, indexes, review history, and CVE data live in your SQLite or Postgres, on infra you own. No phone-home, no required telemetry, no "is this used for training?"
    • Low-noise reviews — Confidence thresholds, dedup, a self-critique pass, and per-PR caps mean every comment is one worth reading — Mira has the best precision of any top-tier tool on the public Code Review Bench, on a model that costs cents per review.
    • Catches PRs stepping on each other — While reviewing, Mira checks the repo's other open PRs and flags merge-conflict risk and duplicate effort right in the walkthrough.
    • Indexed, cross-file context — A full-repo code index gives the model real project context, not just the diff — plus org-wide package search and hourly OSV.dev CVE scanning across every repo.
    • GitHub, GitLab, Forgejo, and Bitbucket Cloud — Auto-reviews every PR and merge request and answers @miracodeai questions inline across GitHub, GitLab, Forgejo (incl. Codeberg), and Bitbucket Cloud. The engine, indexer, and dashboard are provider-agnostic, so a new host is a data entry plus one provider class.
    • Self-host on day one — Docker image with Railway / Fly.io / Render configs, SQLite or Postgres. Every feature included.

    Dashboard

    Mira dashboard

    Your data, your dashboard

    Most AI reviewers are SaaS: your diffs (and often the full surrounding code) leave for a third-party server, and the only "view" you get is the comments that come back on a PR. Mira flips both halves of that:

    • Your code never leaves your infra. Diffs, embeddings, indexes, review history, vulnerability data, all stored in your SQLite or Postgres, on infrastructure you own. No phone-home, no required telemetry, no "is this used for training?" question.
    • The dashboard you see above is yours. It's not a marketing screenshot of someone else's view of your code. CodeRabbit, Greptile, and similar SaaS reviewers don't expose anything like it. Mira's dashboard surfaces signals you don't get anywhere else:
      • Org-wide package inventory: answer "which repos use [email protected]?" in one query. Stack it next to your CVE feed for instant blast-radius checks.
      • CVE alerts on every dependency: hourly OSV.dev poll, severity + advisory link + fix version surfaced inline next to the package.
      • Dependency + blast-radius graphs: see exactly which files and repos depend on a symbol before you change it.
      • Per-repo review event stream: every webhook, every chunk, every cost figure, in one place for live troubleshooting.
      • Cost & token telemetry: actual spend per repo and per model, not estimates, because you control the LLM key.
      • Review-health page: stale/waiting PRs, a reviewer-responsiveness leaderboard, throughput trends, and rubber-stamp detection (approvals with no substantive review) — plus per-contributor analytics with a year-long heatmap and Mira's review-quality signal.
      • Coming soon, change-frequency heatmaps: surface the files that bug fixes keep landing on so you can target review attention.

    If your engineering team needs answers like "which of our repos are exposed to this CVE?" or "what's the blast radius of changing this function?", those questions stop being multi-day investigations and start being one-click dashboard pages.

    Benchmark

    On the full 50-PR offline set of the public Martian Code Review Bench, Mira running an inexpensive model (DeepSeek v4.1 flash) ranks first on F1 of 23 published reviewers and posts the fewest unmatched comments of any tool above 50% recall. Run on 6 November 2026.

    ReviewerPrecisionRecallF1TP / FP / FN
    Mira · DeepSeek v4.1 flash75.0%55.1%63.587 / 29 / 71
    Cubic v256.5%60.8%58.596 / 74 / 62
    Qodo Extended v256.2%57.0%56.690 / 70 / 68
    Augment52.4%61.4%56.697 / 88 / 61
    Devin67.3%41.8%51.666 / 32 / 92
    Qodo v247.1%56.3%51.389 / 100 / 69
    Cursor Bugbot54.3%44.3%48.870 / 59 / 88
    GitLab Duo47.5%48.1%47.876 / 84 / 82
    Greptile v4.146.9%48.1%47.576 / 86 / 82
    GitHub Copilot v234.3%62.0%44.198 / 188 / 60
    CodeRabbit33.8%58.2%42.892 / 180 / 66
    Claude Code36.5%41.1%38.765 / 113 / 93

    The full ranking of all 23 reviewers, per-PR results, head commits and settings are in benchmark-results.json.

    Mira sits furthest up on the precision axis at a recall most tools don't reach: the tools that find a few more bugs (Cubic, Augment, Copilot, CodeRabbit) post two to six times as many comments that match nothing in the reference set.

    Median review time was 106 seconds per PR; all 50 reviews completed.

    Methodology: all 50 PRs of the Martian Code Review Bench offline dataset, reviewed once each with Mira's shipping defaults and scored with the benchmark's own matching prompts and Claude Sonnet 4.5 as the judge; competitor rows are the benchmark's published results on the same PRs. Settings, per-PR results and commit pins are in benchmark-results.json.

    Quick Start

    Run Mira self-hosted to auto-review every PR and merge request and answer @miracodeai questions inline. GitHub (as a GitHub App), GitLab (via a group/project access token), Forgejo/Codeberg (via an access token), and Bitbucket Cloud (via an access or API token) are all supported.

    1. Deploy — one-click on Railway, or with Docker:

    Deploy on Railway

    # mira.yaml — deployment-wide defaults. Every key is optional.
    llm:
      model: "anthropic/claude-sonnet-4-6"
      indexing_model: "anthropic/claude-haiku-4-5"
    
    # .env — secrets only.
    MIRA_GITHUB_APP_ID=123456
    MIRA_GITHUB_PRIVATE_KEY="$(cat private-key.pem)"
    MIRA_WEBHOOK_SECRET=your-secret
    OPENROUTER_API_KEY=sk-or-...
    
    docker run -p 8000:8000 --env-file .env \
      -v "$(pwd)/mira.yaml:/app/mira.yaml" \
      ghcr.io/miracodeai/mira:latest --config /app/mira.yaml
    

    2. Install the app on your repos — every PR gets reviewed.

    Bitbucket Cloud — instead of the GitHub App creds, set:

    # A workspace/project/repository access token (Bearer), or an API token as email:token.
    # Scopes: repository read, pull requests read+write, webhooks read+write.
    MIRA_BITBUCKET_TOKEN=ATCTT3x...
    MIRA_BITBUCKET_WEBHOOK_SECRET=your-secret
    MIRA_BITBUCKET_WORKSPACE=your-workspace   # optional: dashboard repo discovery scope
    MIRA_BITBUCKET_BOT_USER=mira              # optional: bot nickname if the token can't read /user
    

    Then add a workspace (or repository) webhook pointing at https://<mira-host>/bitbucket/webhook with the same secret and the triggers Repository: Push, Pull request: Created, Updated, Merged, Comment created. Bitbucket PRs have no labels, so @mira pause state is kept in Mira's database. Comment commands check repository permission through the workspace permissions API, which needs admin rights; otherwise list reviewers' account ids in commands.allowed_users. Bitbucket nicknames are not unique, so authorization and the allowlist match the commenter's account id, never the nickname.

    → Full walkthrough: creating the GitHub App & quickstart · GitLab setup · deploy options · choosing models, custom endpoints & AWS Bedrock

    Codex CLI

    If you already use OpenAI Codex locally, Mira can run reviews through the Codex CLI instead of an HTTP API key. Authentication stays inside Codex via CODEX_HOME/auth.json, created by codex login:

    # mira.yaml
    llm:
      provider: "codex-cli"
      model: "codex-default"      # use the Codex CLI default model
      codex_home: "/run/codex"    # optional; defaults to CODEX_HOME
      codex_sandbox: "read-only"  # the only accepted sandbox policy
      codex_timeout_seconds: 900  # optional
    

    The official Mira image includes a pinned Codex CLI. Mount a Codex login read-only:

    docker run -p 8000:8000 --env-file .env \
      -e CODEX_HOME=/run/codex \
      -v "$HOME/.codex:/run/codex:ro" \
      -v "$(pwd)/mira.yaml:/app/mira.yaml:ro" \
      ghcr.io/miracodeai/mira:latest --config /app/mira.yaml
    

    This provider does not require OPENROUTER_API_KEY. Mira copies only auth.json from the read-only mount into a private, writable temporary Codex home for each invocation. It launches Codex in an empty temporary workspace with a minimal environment, disables inherited shell environment variables and user/project rules, and enforces the read-only sandbox. Provider choice, executable/auth paths, sandbox policy, and timeout are deployment-only settings; repository .mira.yaml files cannot override them. For one-shot mira review runs, --config is treated as untrusted by default. An operator-owned config may opt in with --trust-execution-settings; never use that flag with a repository-controlled file.

    Codex CLI does not expose Mira's temperature or hard output-token controls, so Mira disables ensemble sampling for this provider. The mounted OAuth session is still a sensitive deployment credential: use a dedicated Codex account/session and isolate the Mira container from unrelated host files and services.

    Configuration

    mira.yaml (loaded via --config) holds deployment-wide defaults. Drop a .mira.yaml in any repo — or use the dashboard — to override per-repo; both deep-merge over mira.yaml for that repo only:

    # .mira.yaml — optional per-repo override
    filter:
      confidence_threshold: 0.5  # noisier repo → lower bar
      max_comments: 10
    

    → Full schema and every key: Configuration docs.

    Development

    git clone https://github.com/miracodeai/mira.git
    cd mira
    pip install -e ".[dev,serve]"
    
    # Run tests
    pytest tests/ -v
    
    # Run the regression suite (hits real GitHub + LLM, ~$1, ~3 min).
    # Pinned PRs whose findings have flickered across iterations. Run before
    # merging changes that touch prompts, the noise filter, or the engine.
    OPENROUTER_API_KEY=... GITHUB_TOKEN=... pytest -m eval -v
    
    # Lint
    ruff check src/ tests/
    
    # Type check
    mypy src/mira/ --ignore-missing-imports
    

    License

    Apache 2.0. See LICENSE.