PRISM — Pre-Commit Code Review System
Multi-agent code review pipeline that runs before every commit. 10 agents (4 deterministic regex + 6 AI-powered) scan your code for security flaws, quality issues, policy violations, test gaps, architecture problems, and performance bottlenecks. It reviews 12 languages — Python, JavaScript/TypeScript, Go, Rust, Java, C#, C, C++, Ruby, PHP, Kotlin and Swift. Each finding includes the file, line number, problem description, suggestion text, and suggested code fix.
Your code never leaves your machine. No server, no cloud, no database — just local JSON reports and a browser dashboard.
Table of Contents
- Features
- How It Works
- Languages
- Installation
- Quick Start
- Command Reference
- API Key Management
- Configuration
- Agents
- Severity Levels & Blocking
- Effort Levels
- Report System & Dashboard
- Codebase Cache
- Pre-Commit Hook
- CI/CD Integration
- IDE Integration (LSP)
- Auto-Fix
- Deviation Management
- Project Structure
- Running Tests
Features
| Feature |
Description |
| 10 agents |
4 deterministic regex + 6 AI agents, each specialized for a concern |
| 12 languages |
Python, JS/TS, Go, Rust, Java, C#, C, C++, Ruby, PHP, Kotlin, Swift — not Python with the rest ignored |
| Rich findings |
Every finding shows file, line, problem, suggestion text, and suggested code fix |
| Visual dashboard |
Self-contained HTML with severity charts, agent charts, filters, and per-finding detail |
| Multi-provider |
8 providers: Gemini, Claude, OpenAI, OpenRouter, Groq, Together, DeepSeek, Mistral |
| Command-only setup |
prism key set writes the .env for you — no file editing ever |
| Install once, run anywhere |
Ship one wheel; prism key set --global configures every project on the machine |
| Self-explaining failures |
A missing SDK says pip install 'prism-code-review[gemini]', not "no API key" |
| Whole-project audit |
prism scan <path> reviews every file, not just the diff |
| Environment diagnostics |
prism doctor checks keys, SDKs and config before you wonder why AI is silent |
| Pre-commit hook |
Blocks commits with critical/high findings automatically |
| Auto-fix |
Language-aware fixes for secrets, eval(), debugger, banned patterns |
| One finding per issue |
The same problem reported by several agents is collapsed, with the other agents listed as corroboration |
| Codebase cache |
Only re-scans changed files on subsequent runs |
| IDE integration |
LSP server shows findings inline in VS Code, Vim, Emacs, Zed, Helix |
| CI/CD ready |
GitHub Actions tests the full suite on Ubuntu and Windows, Python 3.11–3.13 |
| Test execution |
--test flag runs pytest on changed files before review |
| Finding verification |
Regex agents cross-check AI claims (halves confidence if unverified) |
| Zero cost |
Self-hosted, free tier of any provider |
How It Works
git commit
├─→ pre-commit-hook → prism check-staged [--test]
│ ├─→ Run pytest on changed Python files (optional, --test)
│ ├─→ Deterministic regex agents (no API calls, instant):
│ │ ├─→ security (SECU-XXX) — secrets, injection, dangerous patterns
│ │ ├─→ quality (QUAL-XXX) — complexity, length, naming, TODOs, imports
│ │ ├─→ policy (POL-XXX) — license headers, branch naming, banned patterns
│ │ └─→ test (TST-XXX) — weak assertions, test naming
│ └─→ AI agents (when API key is configured, --effort balanced/max):
│ ├─→ ai_security (SECU-AI-XXX) — secrets, injection, auth flaws
│ ├─→ ai_quality (QUAL-AI-XXX) — complexity, duplication, maintainability
│ ├─→ ai_policy (POL-AI-XXX) — docs, compliance, standards
│ ├─→ ai_test (TST-AI-XXX) — coverage, edge cases, test quality
│ ├─→ ai_architecture (ARC-AI-XXX) — modularity, scalability, abstraction
│ └─→ ai_performance (PERF-AI-XXX) — bottlenecks, memory, complexity
│
└─→ GitHub Actions (CI/CD) → runs tests + automated review on every push
Languages
Every review path reads the file's language first (prism/langs.py), so the agents
measure structure and generate fixes in the language of the file instead of assuming
Python.
| Language |
Extensions |
| Python |
.py, .pyi |
| JavaScript / TypeScript |
.js, .jsx, .mjs, .cjs, .ts, .tsx |
| Go |
.go |
| Rust |
.rs |
| Java |
.java |
| C# |
.cs |
| C |
.c, .h |
| C++ |
.cpp, .cc, .cxx, .hpp, .hh, .hxx |
| Ruby |
.rb, .rake |
| PHP |
.php |
| Kotlin |
.kt, .kts |
| Swift |
.swift |
A file with no declared language (Markdown, YAML, JSON, images) has no language-specific
structure rules — the generic checks still run, and those files score lower on risk.
Binary files are skipped outright rather than scanned as text.
What this changes in practice:
- Function length and complexity are measured as structure. Comments and string
literals are blanked across the whole file first, so a
{ inside a block comment,
or an if quoted in a docstring, is not counted as a branch. In the brace
languages that is the only way to get the count right.
- Auto-fixes stay in the file's language. A hardcoded secret becomes
os.getenv("NAME") in Python, process.env.NAME in JavaScript,
System.getenv("NAME") in Java, os.Getenv("NAME") in Go, and so on — the
declaration is kept and only the literal is swapped. See Auto-Fix.
Installation
Requirements
- Python 3.9+
- An API key for any one of the 8 supported providers. The regex agents need no key at all.
Install
# Clone the repo
git clone <repo-url>
# Install PRISM (no AI SDK — regex agents still work)
pip install -e .
# Gemini (default provider):
pip install -e .[gemini]
# Claude:
pip install -e .[claude]
# OpenAI — this one extra also covers OpenRouter, Groq, Together,
# DeepSeek and Mistral, which are OpenAI-compatible endpoints:
pip install -e .[openai]
# All SDKs at once:
pip install -e .[all]
# Test and lint dependencies:
pip install -e ".[dev]"
There are only three SDKs to install. The five OpenAI-compatible providers
(openai, openrouter, groq, together, deepseek, mistral) reuse the
openai client against a different base_url, so no extra package is needed for them.
Hand the tool to a teammate (no cd, no venv on their side)
One command from any folder — no virtualenv, no source checkout, no build tools:
# On the teammate's machine, once. The [all] extra installs every provider SDK
# plus python-dotenv; without an extra the regex agents run but AI agents skip:
pip install "prism-code-review[all]"
# Set the API key once for every project (tool-wide):
prism key set --global --provider gemini --key YOUR_GEMINI_API_KEY
# Then in any project folder: git init, prism init, prism check ...
No PyPI access (air-gapped machine, internal mirror)? Install straight from the
GitHub Release wheel instead. Note the name[extras] @ url form — pip does not
parse extras that are appended directly onto a wheel URL, so ...whl[all]
returns a 404:
pip install "prism-code-review[all] @ https://github.com/Bibekbwn/prism-code-review/releases/download/v2.0.2/prism_code_review-2.0.2-py3-none-any.whl"
Both routes give the same package. To cut a new release, see
Releasing.
Use [all] when you do not control which provider each developer will use. For
a team standardised on one provider, install only that extra — [gemini],
[claude], or [openai] (the last also covers openrouter, groq, together,
deepseek and mistral).
When the SDK for the active provider is missing, PRISM names it and prints the
fix instead of claiming the key is wrong:
gemini SDK not installed. Install it with: pip install 'prism-code-review[gemini]'
prism key set --global writes the key to the install folder's .env (next to
site-packages), which load_env reads as a fallback after the project-local
.env — so a project-level prism key set still overrides it. Without
--global the key goes to the current project's .env as before.
Three entry points, one dispatcher: the prism console script after a pip
install, py -m prism from anywhere, and py -m prism.cli from a source
checkout with nothing installed.
Live Demo
A dashboard generated from the deliberately vulnerable files in demo/
is published at https://bibekbwn.github.io/prism-code-review/.
Reproduce it locally — the demo files are in the repo, so no setup beyond the
install is needed:
pip install "prism-code-review[all]"
prism check demo/vulnerable.py
prism check demo/app.js
prism check demo/service.go
prism check demo/config.env
prism dashboard
Each check exits non-zero on purpose: every demo file is meant to be blocked.
Quick Start
1. Set your API key (command only — no file editing)
# Gemini (default provider)
prism key set --provider gemini --key YOUR_GEMINI_API_KEY
# Or switch to Claude
prism key set --provider claude --key YOUR_ANTHROPIC_API_KEY
# Or switch to OpenAI
prism key set --provider openai --key YOUR_OPENAI_API_KEY
# Any of the other five also work: openrouter, groq, together, deepseek, mistral
prism key set --provider groq --key YOUR_GROQ_API_KEY
The prism key set command writes .env for you and sets MODEL_PROVIDER.
Switching provider removes the previous provider's key automatically, so
exactly one key is active at a time. You never need to open .env or any file.
Add --global to write the key to the install folder instead of the current
project (set once, use from every project). See API Key Management
for the full provider table.
2. Check the setup
prism doctor # key present? SDK installed? config valid?
doctor explains why AI agents are silent when something is misconfigured, and it
never fails the run.
3. Review a file
prism check path/to/file.py
4. Review staged changes (before commit)
git add .
prism check-staged --effort balanced
5. Install the pre-commit hook (blocks commits with critical/high findings)
prism install-hook
6. View the visual dashboard
prism dashboard
The dashboard opens in your browser automatically after every
prism check-staged / prism check-diff review. It is a single self-contained
HTML file (.prism-reports/dashboard.html) with all report data embedded, so it
works offline and can be shared as-is.
Suppress the automatic open with --no-dashboard, the PRISM_NO_DASHBOARD
environment variable, or by running in CI (auto-detected via CI /
GITHUB_ACTIONS).
Command Reference
Every command available in PRISM, with all flags and options.
All commands work three ways — prism <cmd>, py -m prism <cmd>, and
py -m prism.cli <cmd> from a source checkout. The examples below use prism.
Review Commands
prism check <file> — Review a single file
prism check path/to/file.py # Review with all configured agents
prism check path/to/file.py --json # Output results as JSON
prism check path/to/file.py --fix # Apply auto-fixable changes
prism check path/to/file.py --fix --yes # Apply without the confirmation prompt
prism check path/to/file.py --prompt # Interactively ask about medium/low findings
prism check path/to/file.py --effort lite # Only regex agents (fast, no API)
prism check path/to/file.py --effort balanced # Regex + AI agents (default)
prism check path/to/file.py --effort max # All agents, maximum thoroughness
prism check path/to/file.py --fast # Two-pass summarization for large files
| Flag |
Description |
--json |
Output results as machine-readable JSON |
--fix |
Apply auto-fixable changes to the file |
--yes |
Apply --fix changes without the confirmation prompt |
--prompt |
Ask developer: apply / skip / cancel for medium/low findings |
--effort {lite,balanced,max} |
AI review effort level (default: balanced) |
--fast |
Use two-pass summarization for large files (10K+ lines) |
Output: Every finding shows the file, line number, problem, suggestion, and suggested code fix. A report is saved automatically to .prism-reports/.
Exit code: 0 if commit allowed, 1 if blocking findings or failed quality gates exist, 2 if the file does not exist.
prism check-diff — Review a PR diff against a base branch
prism diff is an alias for the same command.
prism check-diff # Diff against origin/main
prism check-diff --base origin/develop # Diff against another branch
prism check-diff --base origin/main --effort lite # Regex agents only (no API)
prism check-diff --base origin/main --json # Machine-readable JSON
prism check-diff --base origin/main --fast # Two-pass summarization
prism check-diff --no-dashboard # Do not open the dashboard
prism diff --base origin/main # Alias for check-diff