Architecture#
MergeMonkey runs every pull request through a layered, isolated pipeline. Your source code is never written to a shared disk, never visible outside an ephemeral sandbox, and never persisted after the review is posted. This page walks through the full system.

The request lifecycle#
Webhook arrives
GitHub or GitLab delivers a
pull_request/merge_requestevent to Ingress atapp.mergemonkey.dev. Ingress verifies the signature against your per-install webhook secret and rejects anything that doesn't match.Job enqueued
Valid events are serialized and pushed onto a Redis / BullMQ queue. No code is fetched yet — only the event metadata.
Worker dequeues and spawns a sandbox
The Worker supervisor pops the job and spawns a new Sandbox — an ephemeral process with its own PID namespace and private
/tmpfilesystem. Circuit breakers throttle spawn rate if upstream APIs misbehave.Container clones and analyzes
Inside the sandbox, a short-lived container runs Clone & AST (27 languages, 44 framework support layers, 500+ detection patterns) followed by Lite + Agent — the AI review pass. The container can reach only the LLM provider; no other network access is permitted.
Results flow back
Findings travel out of the isolated network into the API, which posts inline review comments back to GitHub / GitLab and persists review metadata (not source) to Postgres (encrypted at rest).
Sandbox destroyed
The moment results are written, the sandbox process exits and its filesystem is destroyed. No data from your repo survives outside the sandbox's lifetime.
Trust boundaries#
Two nested isolation zones protect your source code.
Private Network
Isolated Network
Crossing either boundary requires going through a policy-enforcing component (Ingress inbound, API outbound). There is no shared filesystem between your repo's clone and any persistent storage.
Isolation guarantees#
Three invariants hold for every review:
- No secrets in runtime — provider OAuth tokens, webhook secrets, and LLM API keys never appear in the sandbox's environment. The sandbox calls the API for what it needs, never reads secrets directly.
- Network isolation — the sandbox can reach the LLM provider only. Outbound traffic to any other host is dropped at the network layer.
- Zero persistence — your repo is cloned into the sandbox's private
/tmp, analyzed, and destroyed. The only thing that survives is the review comment posted back to GitHub / GitLab and the review metadata (PR ID, timestamps, finding counts) stored in Postgres.
Data handling#
Source code
LLM context
Review metadata
Webhooks
What runs where#
| Component | Purpose | Network zone |
|---|---|---|
| Ingress | Webhook validation, token issuance | Private |
| Redis / BullMQ | Job queue | Private |
| Worker | Supervisor, spawns sandboxes, enforces circuit breakers | Private |
| Sandbox | Ephemeral process wrapping each review job | Isolated |
| Container | Clone, AST analysis, AI review passes | Isolated |
| LLM Provider | External reasoning model (per-user API keys) | External (sandbox egress only) |
| API | Posts results to VCS, manages database | Private |
| Postgres | Review metadata, encrypted at rest | Private |
Self-hosted deployments#
If you run MergeMonkey on your own infrastructure, the same architecture ships intact — every component is deployed inside your network, and the isolated sandbox zone can be restricted further (e.g. to a self-hosted LLM). See the GitHub Enterprise and GitLab Self-Managed setup guides.