Skip to main content

CodeSpy logo

CodeSpy

An open-source AI reviewer that catches bugs, improves code quality, and integrates directly into your PR workflow, without sacrificing control or security.


Table of Contents


Why CodeSpy?

Most AI code reviewers are:

  • ❌ Black boxes
  • ❌ SaaS-only
  • ❌ Opaque about reasoning
  • ❌ Risky for sensitive codebases

CodeSpy is different:

  • 🔍 Transparent reasoning
  • 🔐 Self-hostable
  • 🔄 Native PR integration
  • 🧩 Extensible architecture
  • 📦 100% open-source

Built for engineering teams that care about correctness, security, and control.


Features

  • 🔒 Security Analysis — Detects common vulnerabilities (injection, auth issues, data exposure) with CWE references
  • 🐛 Bug Detection — Identifies logic errors, null references, resource leaks, edge cases
  • 📝 Documentation Review — Checks for missing docstrings, outdated comments, incomplete docs
  • 🌐 SEO & AI-Visibility Review (opt-in) — Flags website changes that hurt crawling, indexing, ranking, or citation by search engines and AI assistants (client-only content, noindex, missing redirects, robots/bot rules, structured data, hreflang, Core Web Vitals). See SEO Review
  • 🛠️ Implementation Plan (opt-in) — Turns the review's findings into an ordered, per-scope fix plan (files, change, how to verify), posted as a collapsible section in the PR review or full-path report. See Implementation Plan
  • 🔍 Intelligent Scope Detection — Automatically identifies code scopes (frontend, backend, infra, microservice in monorepo, etc.)
  • 🧠 Cross-Review Memory — Agents learn patterns, constants, and domain knowledge from past reviews of the same codebase
  • 💰 Cost Tracking — Track LLM calls, tokens, and costs per review
  • 🤖 Model Agnostic — Works with OpenAI, AWS Bedrock, Anthropic, Gemini, Ollama, and more via LiteLLM
  • 🐳 Docker Ready — Run locally or in the cloud with Docker
  • GitHub GitLab GitHub & GitLab — Works with both platforms, auto-detects from URL
  • 🖥️ Local Reviews — Review local git changes without GitHub/GitLab — diff against any branch, ref, or review uncommitted work
  • 📂 Full-Path Reviews — Review existing code with no PR: codespy review-path sparse-clones a repo path, reviews every scope in it, and opens a PR with the report. See Full-Path Review
  • 🧩 MCP Server — IDE integration via Model Context Protocol — trigger reviews from AI coding assistants without leaving your editor
  • 🔌 GitHub Action — One-line integration for automatic PR reviews

Installation

Using pip

pip install codespy-ai

Using Homebrew (macOS/Linux)

brew tap khezen/codespy
brew install codespy

Using Docker

# Pull the pre-built image from GitHub Container Registry
docker pull ghcr.io/khezen/codespy:latest

# Or build locally
docker build -t codespy .

Using Poetry (for development)

# Clone the repository
git clone https://github.com/khezen/codespy.git
cd codespy

# Install dependencies
poetry install

# Or install only production dependencies
poetry install --only main

Quick Start

Get up and running in 30 seconds:

# 1. Set your Git token (or let codespy auto-discover from gh/glab CLI)
export GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxx  # For GitHub
# OR
export GITLAB_TOKEN=glpat-xxxxxxxxxxxxxxxxxxxx  # For GitLab

# 2. Set your LLM provider (example with Anthropic)
export DEFAULT_MODEL=anthropic/claude-opus-4-6
export ANTHROPIC_API_KEY=sk-ant-xxxxxxxxxxxxxxxxxxxx

# 3. Review a PR or MR!
codespy review https://github.com/owner/repo/pull/123
# OR
codespy review https://gitlab.com/group/project/-/merge_requests/123

# Or review existing code with no PR: codespy opens a PR with the report
codespy review-path https://github.com/owner/repo --path services/api

codespy auto-discovers credentials from standard locations (~/.aws/credentials, gh auth token, glab auth token, etc.) - see Configuration for details.


Documentation

Guide Contents
Usage CLI commands, full-path reviews, Docker, GitHub Action, MCP server, output formats
Configuration Environment variables, YAML config, model strategy, per-signature settings
Architecture Pipeline design, DSPy signatures, supported languages
Memory System Hippocampus (episodic), Cerebral (semantic store), Prefrontal (recall)
Development Setup, build, test, lint

Contributors

  • @khezen
  • @pranavsriram8

License

MIT

Metadata

Release files for codespy-ai 2.4.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for codespy-ai 2.4.3
File Size Uploaded Provenance Actions
codespy_ai-2.4.3.tar.gz 292.5 kB Without provenance Details for codespy_ai-2.4.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for codespy-ai 2.4.3
File Interpreter ABI Platform Actions
codespy_ai-2.4.3-py3-none-any.whl Python 3 none any Details for codespy_ai-2.4.3-py3-none-any.whl

Total release size: 668.5 kB

Release files / codespy_ai-2.4.3.tar.gz

Download URL codespy_ai-2.4.3.tar.gz
Size 292.5 kB
Tags Source
SHA-256 checksum
How to use checksums
77abdfff290752b0252968f9427e7625cd5a3958fe474014e5c65bc9c0c0735a
BLAKE2b-256 checksum
How to use checksums
fd2799da9b35418624f94b726a9d03b550a4953b4f17d63aacb9f37c6e82e048
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / codespy_ai-2.4.3-py3-none-any.whl

Download URL codespy_ai-2.4.3-py3-none-any.whl
Size 376.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4d291ea6919b194d230159e773a9e08514722899e9c9086e15ed42648f9b1d00
BLAKE2b-256 checksum
How to use checksums
276ffce149ca7125bbe7e26da1fb32c5122309a266786213206872cd0a0cf055
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for codespy-ai 2.4.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.4.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page