Skip to main content

🛡️ CodeSentinel

AI Code Review & Security Assistant — Powered by loopy-agent

Python License


✨ Features

Feature Description
🔒 Security Scanner Pattern-based detection for 12+ vulnerability types
🤖 AI Code Review Maker/checker verification for accurate reviews
📊 Risk Scoring Prioritized findings by severity
📁 Repo Scanning Batch scan entire repositories
🔗 GitHub Integration Auto-review PRs and post comments
🌐 MCP Server Expose as tool for AI assistants
📄 Report Export HTML, JSON, Markdown, SARIF formats
💾 Caching Reduces API costs on repeated reviews

🚀 Quick Start

# Install
pip install codesentin3l

# Or clone and install
git clone https://github.com/Dream-Pixels-Forge/codesentin3l
cd codesentinel
pip install -e .

📖 Usage

CLI Commands

# Security scan (no API key needed)
codesentin3l scan myfile.py

# AI-powered review
export OPENAI_API_KEY="sk-..."
codesentin3l review myfile.py

# Full scan + review
codesentin3l full myfile.py

# Scan entire repository
codesentin3l repo ./my-project

# Review a git diff
codesentin3l pr changes.diff

# Start MCP server
codesentin3l mcp

# Run demo
codesentin3l demo

CLI Options

--provider openai|anthropic    # LLM provider (default: openai)
--model gpt-4|claude-3-opus   # Model (default: gpt-4)
--output <dir>                 # Output directory for reports
--format html|markdown|json    # Report format

🐍 Python API

Quick Review

import asyncio
from src import CodeReviewer

async def main():
    reviewer = CodeReviewer(provider="openai", model="gpt-4")
    result = await reviewer.review_file("my_code.py")
    reviewer.print_report(result)
    await reviewer.close()

asyncio.run(main())

Security Scan

from src import SecurityScanner

scanner = SecurityScanner()
findings = scanner.scan_file("my_code.py")
scanner.print_findings(findings)

risk_score = scanner.get_risk_score(findings)

Repo Scanning

from src import RepoScanner

scanner = RepoScanner()
summary = scanner.scan_repo("./my-project")
scanner.print_summary(summary)

Report Generation

from src import ReportGenerator, ReportConfig, ReportFormat

config = ReportConfig(
    format=ReportFormat.HTML,
    output_dir="./reports",
)
generator = ReportGenerator(config)
content = generator.generate(review=result, security_findings=findings)
path = generator.save(content, "my-review")

🌐 MCP Server

Start the MCP server to expose CodeSentinel as tools:

codesentin3l mcp

Available Tools

Tool Description
codesentinel_scan Scan code for security issues
codesentinel_review AI-powered code review
codesentinel_full Full scan + review combined
codesentinel_scan_file Scan a file from disk

Using with Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "codesentin3l": {
      "command": "python",
      "args": ["-m", "src.mcp_server"],
      "cwd": "/path/to/codesentinel"
    }
  }
}

🔗 GitHub Integration

Review a PR

from src import GitHubIntegration

async def main():
    gh = GitHubIntegration(token="ghp_...")
    review = await gh.review_pr("owner", "repo", pr_number=123)
    print(review.summary)
    print(f"Approved: {review.approved}")

asyncio.run(main())

Post Review Comment

review = await gh.review_pr("owner", "repo", 123, post_comment=True)

🔒 Security Patterns Detected

Pattern Severity Description
SQL Injection 🔴 Critical String formatting in queries
Command Injection 🔴 Critical os.system, eval, exec
Hardcoded Secrets 🔴 Critical API keys, passwords in code
Private Keys 🔴 Critical Embedded private keys
Weak Hashing 🟠 High MD5, SHA1 for passwords
XSS Risk 🟠 High innerHTML, dangerouslySetInnerHTML
Path Traversal 🟠 High Unsanitized file paths
Insecure Random 🟡 Medium random module for security
Debug Enabled 🟡 Medium DEBUG=True in production
CORS Wildcard 🟡 Medium Access-Control-Allow-Origin: *
Weak Crypto 🟠 High ECB mode, DES, RC4

📊 Report Formats

Format Use Case
HTML Visual reports, CI dashboards
JSON Machine parsing, integrations
Markdown GitHub, documentation
SARIF GitHub Code Scanning

🏗️ Architecture

┌─────────────────────────────────────────────────────────┐
│                    CodeSentinel                         │
├─────────────────────────────────────────────────────────┤
│                                                         │
│  ┌─────────────┐    ┌─────────────┐    ┌─────────────┐ │
│  │   Security  │    │     AI      │    │   GitHub    │ │
│  │   Scanner   │    │   Reviewer  │    │ Integration │ │
│  │  (patterns) │    │  (loopy)    │    │   (PRs)     │ │
│  └──────┬──────┘    └──────┬──────┘    └──────┬──────┘ │
│         │                  │                  │         │
│         └──────────────────┼──────────────────┘         │
│                            │                            │
│                    ┌───────▼───────┐                    │
│                    │    Reporter   │                    │
│                    │ HTML/JSON/MD  │                    │
│                    └───────────────┘                    │
│                                                         │
├─────────────────────────────────────────────────────────┤
│                   loopy-agent                           │
│  ┌──────────┬──────────┬──────────┬──────────┐         │
│  │   loop   │ gateway  │ verification│  cache  │         │
│  └──────────┴──────────┴──────────┴──────────┘         │
└─────────────────────────────────────────────────────────┘

🧪 Examples

See the examples/ directory:

  • vulnerable_app.py — Code with intentional security issues
  • clean_app.py — Secure coding best practices

📝 License

MIT


🤝 Contributing

Contributions welcome! See CONTRIBUTING.md.


Built with ❤️ using loopy-agent

Metadata

Release files for codesentin3l 3.2.0

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

Source distribution (sdist)

Source distribution for codesentin3l 3.2.0
File Size Uploaded Provenance
codesentin3l-3.2.0.tar.gz 42.2 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for codesentin3l 3.2.0
File Interpreter ABI Platform
codesentin3l-3.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 88.7 kB

Release files / codesentin3l-3.2.0.tar.gz

Download URL codesentin3l-3.2.0.tar.gz
Size 42.2 kB
Tags Source
SHA-256 checksum
How to use checksums
57d391b66758996cb1ea6258a5c4c7ea58516766928a5f845b25adb394db3f3a
BLAKE2b-256 checksum
How to use checksums
728e231183f627d25d4c92586d5f42955a8e3b752593b33cf7a06af9dc07b3bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 11, 2026.

Transparency log

Release files / codesentin3l-3.2.0-py3-none-any.whl

Download URL codesentin3l-3.2.0-py3-none-any.whl
Size 46.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
11d14cb216dd20ee017ae5385de0a9b4fddd2ff11343ff8399692bd6ac4ef55c
BLAKE2b-256 checksum
How to use checksums
425ca2412cc55f5aed25fd2a60ac6d70b476dab080de283fe971263e9926cb60
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 11, 2026.

Transparency log

Security for codesentin3l 3.2.0

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for codesentin3l-3.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 11, 2026.

Transparency log

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

3.2.0 This release

2 release files Full 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