AI-Powered Security Vulnerability Detection and Fixing
Patchsmith combines the power of CodeQL static analysis with Claude AI to automatically detect, triage, and fix security vulnerabilities in your codebase.
Patchsmith's CLI interface with real-time progress tracking, intelligent triage, and comprehensive security reports
- ๐ Static Analysis - Powered by GitHub's CodeQL engine
- ๐ค AI Triage - Intelligent prioritization and grouping of security findings
- ๐ Smart Grouping - Automatically groups similar findings to avoid redundant analysis
- ๐ฌ Detailed Assessment - Comprehensive security analysis with attack scenarios
- ๐ฏ Custom Queries - AI-generated CodeQL queries tailored to your project
- ๐ ๏ธ Automated Fixing - AI-generated patches for vulnerabilities
- ๐ Rich Reports - Detailed reports in Markdown and HTML
- ๐จ Beautiful CLI - Intuitive interface with progress tracking
- ๐ Git Integration - Automatic branching and commits for fixes
-
Python 3.10+
python --version # Should be 3.10 or higher -
CodeQL CLI (required for analysis)
# Download from GitHub releases # https://github.com/github/codeql-cli-binaries/releases # On macOS with Homebrew: brew install codeql # Verify installation: codeql version
pipx install "git+https://github.com/eschnou/patchsmith.git"# Clone the repository
git clone https://github.com/yourusername/patchsmith.git
cd patchsmith
# Install with Poetry
poetry install
# Run Patchsmith
poetry run patchsmith --helpUsing Poetry Shell for Other Repositories
To analyze other projects without prefixing every command with poetry run, activate the Poetry virtual environment:
# From the patchsmith directory, activate the virtual environment
poetry shell
# Now you can use patchsmith directly on any repository
cd /path/to/your/project
patchsmith init
patchsmith analyze --investigate
# Exit the virtual environment when done
exitThis approach is especially useful when working with multiple projects, as you can navigate anywhere and run patchsmith commands directly without the poetry run prefix.
cd /path/to/your/project
patchsmith init# Quick triage (fast, groups findings, assigns priorities)
patchsmith analyze
# Full analysis with deep investigation of top 10 groups
patchsmith analyze --investigate
# Analyze specific project
patchsmith analyze /path/to/project --investigate
# Save results to file
patchsmith analyze -o results.json# Generate project-specific CodeQL queries
patchsmith finetune
# Focus on specific security concerns
patchsmith finetune --focus "SQL injection and authentication bypass"
# Use custom queries in analysis
patchsmith analyze --investigate# List all findings with grouping info
patchsmith list
# Show only critical findings
patchsmith list --severity critical# Deep investigation of a specific finding
patchsmith investigate F-20# Generate markdown report
patchsmith report
# Generate HTML report
patchsmith report --format html# Interactive mode (recommended)
patchsmith fix --interactive
# Fix specific finding
patchsmith fix <finding-id>
# Auto-apply fix (use with caution!)
patchsmith fix <finding-id> --apply# Clean cached results (keeps database)
patchsmith clean
# Remove everything including database
patchsmith clean --allPatchsmith uses a two-tier analysis system:
-
Triage (Always Runs) - Fast analysis that:
- Groups similar findings (e.g., 6 instances of same pattern โ 1 group)
- Assigns priority scores to all groups
- Marks top 10 groups for deep investigation
- Takes ~5-20 minutes
-
Investigation (Optional with
--investigate) - Deep AI analysis that:- Analyzes top 10 priority groups in detail
- Generates attack scenarios and impact assessments
- Provides exploitability scores and remediation guidance
- Takes additional ~10-30 minutes
Grouping Example:
50 raw findings โ 15 distinct groups โ top 10 investigated
Grouping Indicators:
F-20- Single findingF-20 ๐ร6- Group of 6 similar findings
This approach saves time and API costs while ensuring thorough analysis of critical issues.
- CLI Guide - Complete command reference and examples
- Architecture - Technical design and architecture
- Requirements - Full requirements specification
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Layer 4: Presentation โ
โ โข CLI (Rich UI) โ
โ โข HTTP API (coming soon) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Layer 3: Orchestration โ
โ โข Workflow management โ
โ โข Exception and error handling โ
โ โข Progress tracking โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Layer 2: Custom Agents โ
โ โข Analysis agents (triage, investigation) โ
โ โข Brainstorming agents (vulnerability suggestions) โ
โ โข Review agents (fix validation) โ
โ โข Code generation agents (query, patch) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Layer 1: Tools Wrapper โ
โ โข CodeQL CLI โ
โ โข Git โ
โ โข GitHub API โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
# Run all tests
poetry run pytest
# Run with coverage
poetry run pytest --cov
# Run manual end-to-end test
poetry run python tests/manual_test_service_layer.py /path/to/projectPatchsmith is free and open-source software licensed under the GNU General Public License v3.0 (GPL-3.0).
This means you can:
- โ Use Patchsmith for any purpose (commercial or personal)
- โ Study and modify the source code
- โ Distribute copies of Patchsmith
- โ Distribute modified versions
Requirements:
- ๐ Any distributed modifications must also be open-source under GPL-3.0
- ๐ You must include the original license and copyright notices
- ๐ You must state significant changes made to the software
See the LICENSE file for the full license text.
Why GPL-3.0? We believe security tools should be transparent and open. The GPL ensures that improvements to Patchsmith remain available to the entire security community.
- CodeQL - Semantic code analysis by GitHub
- Claude AI - AI assistant by Anthropic
- Rich - Beautiful terminal formatting
Made with โค๏ธ by Transcode for secure software development
