miracodeai/mira

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

Mira – Self‑hosted AI code reviewer

What it is – Mira is an open‑source service you run on your own infrastructure that automatically reviews pull‑requests (or merge‑requests) with a large language model of your choice. It adds a web dashboard, a code‑index, vulnerability alerts and a learning loop that adapts the reviewer to your team’s style.

Why it matters – Most AI code‑review products are SaaS: they ship your diffs to a third‑party server and you only see the generated comments. Mira keeps all data (diffs, embeddings, CVE feeds, usage logs) in a SQLite or Postgres database you control, so there is no hidden telemetry or data‑selling.


Core capabilities (as described in the README)

Feature What you get
Model‑agnostic reviews Any OpenAI‑compatible endpoint (OpenRouter, Ollama, vLLM, Together, Groq, AWS Bedrock, etc.) or local LLM via the Codex CLI. You supply the API key, Mira never adds a markup on the cost.
Noise reduction Confidence thresholds, deduplication, a self‑critique pass and a per‑PR comment cap so you only see concise, high‑value feedback.
Learning loop Mira watches which of its comments are rejected or edited and turns those patterns into custom review rules that influence future runs.
Custom rules Define organization‑wide or per‑repo policies in plain language (.mira.yaml or through the dashboard).
Full‑repo indexing Before a review the whole repository is embedded, giving the LLM context beyond the diff. The index also powers an org‑wide package inventory and dependency‑graph queries.
Vulnerability scanning Hourly OSV.dev CVE feed is stored and shown next to affected packages, with blast‑radius graphs.
Dashboard A self‑hosted UI showing cost per repo/model, review health metrics, package inventory, CVE alerts, and analytics on reviewer responsiveness.
Git platform support GitHub (as a GitHub App), GitLab (token), Forgejo/Codeberg (token). A Bitbucket adapter is planned.
Speed / quality Benchmarked on the public Code Review Bench: median ~77 s per PR with an F1 score of 44, placing Mira on the speed‑quality Pareto frontier.
Deployment Docker image (ghcr.io/miracodeai/mira:latest) with one‑click Railway templates, Fly.io, Render, or plain docker run. Supports SQLite (default) or Postgres for persistence.

How it works (high‑level flow)

  1. Configuration – A global mira.yaml (mounted into the container) defines defaults such as the LLM model and indexing model. Individual repositories may add a .mira.yaml to tweak thresholds or comment limits.
  2. Webhook listener – Mira runs as a web service that receives PR events from the supported Git hosts.
  3. Indexing – When a repo is first seen, Mira builds an embedding index of the whole codebase (using the indexing_model). This index is stored in the chosen database.
  4. Review generation – On a new PR, Mira retrieves the diff, queries the LLM (via the configured provider), and receives a set of suggested comments.
  5. Noise filter – Comments are filtered by confidence, de‑duplicated, and capped according to the repo’s settings.
  6. Posting – The filtered comments are posted back to the PR (GitHub, GitLab, Forgejo) and also recorded in the dashboard.
  7. Learning – If a reviewer rejects a comment or edits it, Mira records that outcome and updates its rule set, making future reviews more aligned with the team’s preferences.

Getting started quickly

# 1. Create a .env with your secrets
cat > .env <<EOF
MIRA_GITHUB_APP_ID=123456
MIRA_GITHUB_PRIVATE_KEY="$(cat private-key.pem)"
MIRA_WEBHOOK_SECRET=your-secret
OPENROUTER_API_KEY=sk-or-...
EOF

# 2. Optional global config (mira.yaml)
cat > mira.yaml <<EOF
llm:
  model: "anthropic/claude-sonnet-4-6"
  indexing_model: "anthropic/claude-haiku-4-5"
EOF

# 3. Run the container
docker run -p 8000:8000 \
  --env-file .env \
  -v "$(pwd)/mira.yaml:/app/mira.yaml" \
  ghcr.io/miracodeai/mira:latest --config /app/mira.yaml

After the service is up, install the generated GitHub App (or the GitLab token) on your repositories. Every new PR will be reviewed automatically.


Development & contribution

  • Install in editable mode: pip install -e ".[dev,serve]"
  • Run the test suite with pytest tests/
  • A special -m eval marker runs integration tests that hit real GitHub and LLM endpoints (requires API keys).
  • Code is type‑checked with mypy and linted with ruff.

License

Apache 2.0 – free for commercial or private use, with the usual attribution requirements.


Bottom line – Mira gives teams full control over AI‑assisted code review: they pick the model, keep all data on‑prem, and gain extra observability (cost, security, reviewer analytics) that typical SaaS reviewers hide. The project is actively maintained, provides Docker images and a one‑click Railway template, and positions itself as the fastest open‑source reviewer on the public benchmark.

Related

  • Project
  • Project
  • Project
  • Project