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
  • 🔍 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
  • 🧩 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

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, 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 memory for cross-review knowledge
Development Setup, build, test, lint

Contributors

  • @khezen
  • @pranavsriram8

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

codespy_ai-1.0.5.tar.gz (158.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

codespy_ai-1.0.5-py3-none-any.whl (216.5 kB view details)

Uploaded Python 3

File details

Details for the file codespy_ai-1.0.5.tar.gz.

File metadata

  • Download URL: codespy_ai-1.0.5.tar.gz
  • Upload date:
  • Size: 158.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for codespy_ai-1.0.5.tar.gz
Algorithm Hash digest
SHA256 248e4750a554d4274edfc8c6283d2c14b619b6cb3913b01c5ac8d373b5e2640e
MD5 e94af932dbcd515ec0f43f115ca345a1
BLAKE2b-256 d7c9a8c3a41b8eae80056686413df00492401b3dfc5bd9dff2e77857c7e755e9

See more details on using hashes here.

File details

Details for the file codespy_ai-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: codespy_ai-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 216.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for codespy_ai-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 b15208d28722f081e760dadff1f68c4495c8a86fc4c747c46c36cb0a859a4311
MD5 0997e53cfba9bb8c0c3bb8c903c53c32
BLAKE2b-256 1890aac1c30333588a9b160fdc44c0e7239cf967abb7ec7fdad89ef2041dfb8e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page