AI Impact Assessment for Code Changes
Project description
CheckodAI
AI Impact Assessment for code changes - understand what Copilot changed before you commit it.
Overview
CheckodAI is a Python CLI tool that helps developers understand the scope and implications of their code changes by analyzing git diffs and extracting modified symbols (functions, classes, variables). It can optionally use a local LLM (Ollama) to assess the risk of each change.
Privacy
CheckodAI runs entirely locally.
- No code is uploaded
- No cloud calls required
- No telemetry
- Works offline with local LLM (Ollama)
All analysis happens on your machine.
Key Features:
- ๐ Local-first: Runs entirely on your machine - no cloud calls
- ๐ Symbol-level analysis: Detects changed functions, classes, and variables
- ๐ท๏ธ Change type detection: Identifies what type of change (added, removed, modified, signature changed)
- ๐ก Impact summaries: Human-readable recommendations for each changed symbol
- ๐ค AI-powered risk assessment: Uses local Ollama for intelligent impact analysis
- ๐ก๏ธ Commit guard: Advisory warnings for HIGH risk changes (non-blocking)
- ๐ฏ CLI-first interface: Simple
checkod assesscommand - ๐ Summary reports: Clear output of what changed and risk levels
- ๐ง Production-ready: Proper project structure and error handling
- โก Graceful fallback: Works without Ollama using heuristic analysis
Installation
Prerequisites
- Python 3.8+
- Git
- Ollama (optional, for AI risk assessment)
Install Ollama (optional but recommended)
# macOS / Linux
curl -fsSL https://ollama.ai/install.sh | sh
# Or use Homebrew (macOS)
brew install ollama
# Pull the model
ollama pull llama3
# Start the server (runs on localhost:11434)
ollama serve
Quick Start
- Install from PyPI:
pip install checkod-ai
- Run assessment:
checkod assess
Or for development setup:
- Clone the repository:
git clone <repository-url>
cd checkod
- Create and activate a virtual environment:
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install in development mode:
pip install -e .
Usage
Basic Usage
Analyze changes in the current repository:
checkod assess
Analyze changes in a specific repository:
checkod assess --repo /path/to/repo
Skip AI risk assessment (if Ollama not available):
checkod assess --no-risk
Commit Guard
The commit guard provides advisory warnings for HIGH risk changes:
# Assessment with advisory warnings enabled
checkod assess --risk
If HIGH risk is detected:
โ ๏ธ HIGH IMPACT CHANGE DETECTED
This change may affect critical system behavior.
Recommended:
โข run related tests
โข verify downstream services
โข review impact summary
Commit will proceed.
Exit code: 0 (advisory, non-blocking)
See COMMIT_GUARD.md for detailed guard usage and integration patterns.
Example Output
๐ Starting Impact Assessment...
๐ Git Diff (1250 characters):
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
diff --git a/src/utils.py b/src/utils.py
index abc1234..def5678 100644
--- a/src/utils.py
+++ b/src/utils.py
@@ -10,6 +10,10 @@
+def calculateDiscount(price, tier):
+ return price * (1 - tier * 0.1)
...
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ Changed Symbols (3 detected):
โข calculateDiscount
โข OrderStatus
โข userTier
๐ Change Summary:
Functions: 1 function added
Classes: 1 class added
Variables: 1 variable added
================================================================================
๐ Impact Summary
================================================================================
You changed: calculateDiscount()
Change Type: function added
Risk Level: MEDIUM
This may affect:
โข checkout_service (logic flow)
โข /api/orders (user-facing behavior)
โข test_checkout (test coverage)
Recommended Actions:
โข Write unit tests for calculateDiscount
โข Test integration with checkout service
โข Document function parameters and return type
โข Verify checkout_service handles the change
โข Load test affected service endpoints
โ
Assessment complete!
With AI risk assessment enabled (Ollama running), you'll also see:
================================================================================
๐ค AI Risk Assessment (powered by local Ollama)
================================================================================
๐ Analyzing risk for each symbol...
Symbol: calculateDiscount
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Risk Classification: MEDIUM
Reason: Used in multiple modules; requires testing and code review.
Validation Steps:
โข Test discount calculation across pricing tiers
โข Verify integration with checkout service
โข Add regression tests if coverage is low
See Risk Assessment Module for setup and usage details.
Project Structure
checkod/
โโโ __init__.py # Package initialization
โโโ main.py # CLI entry point (Typer)
โโโ agent.py # Core orchestrator
โโโ observe.py # Git diff reading (GitPython)
โโโ understand.py # Symbol extraction (regex patterns)
โโโ change_type.py # Change type detection
โโโ assess.py # Risk assessment (Ollama integration)
โโโ summary.py # Impact summary generation
โโโ guard.py # Commit guard for HIGH risk โญ
Architecture
Components
-
main.py - CLI interface using Typer
- Exposes
assesscommand - Handles user input and options
- Calls the agent orchestrator
- Exposes
-
agent.py - Orchestrator
- Coordinates the workflow
- Calls observe and understand modules
- Formats and displays results
-
observe.py - Git integration
- Uses GitPython to read diffs
- Gets both staged and unstaged changes
- Returns raw diff content
-
understand.py - Symbol extraction
- Parses diff for changed symbols
- Uses regex patterns for symbol detection
- Returns list of modified symbols
-
change_type.py - Change type detection
- Identifies what type of change was made
- Classifies as: added, removed, modified, signature changed
- Provides confidence scoring
- Enriches symbols with metadata
-
assess.py - Risk assessment
- Integrates with Ollama for AI analysis
- Builds structured prompts for LLM
- Provides heuristic fallback when Ollama unavailable
- Classifies changes as LOW/MEDIUM/HIGH risk
Workflow
User Input โ CLI (main.py)
โ
Agent (agent.py) - Orchestrator
โ
Observe (observe.py) - Read git diff
โ
Understand (understand.py) - Extract symbols
โ
Detect (change_type.py) - Identify change types
โ
Assess (assess.py) - Evaluate risk (optional, requires Ollama)
โ
Display Results
Development
Running Tests
pytest
Code Quality
# Format code
black .
# Check code style
flake8 .
# Type checking
mypy checkod
Development Dependencies
The project includes development tools for testing and code quality:
pytest- Testing frameworkpytest-cov- Coverage reportingblack- Code formatterflake8- Lintermypy- Type checker
Install with:
pip install -e ".[dev]"
Current Limitations
Current Version (0.1.0)
- Regex-based parsing: Symbol extraction uses regex patterns, not full AST parsing
- Limited language support: Patterns work best with Python and JavaScript
- Basic LLM integration: Ollama support available but must be local
- No usage tracking: Doesn't analyze actual symbol usage in codebase
Future Enhancements
- Full AST-based parsing for accurate symbol detection
- Multi-language support (Java, Go, Rust, etc.)
- Dependency graph analysis for usage tracking
- Integration with codebase analysis tools
- Pre-commit hook integration
- Historical trend analysis
- Custom risk policies per team
Configuration
Future versions will support configuration via checkod.yaml:
# Planned for future release
symbols:
min_impact_score: 0.5
languages:
- python
- javascript
patterns:
exclude:
- test_*
- __pycache__
Troubleshooting
"Not a valid git repository" error
Ensure you're running checkod assess in a directory that is a git repository:
git init # If needed
No symbols detected
This can happen if:
- Changes are only in configuration files
- Symbols don't match current regex patterns
- Consider checking the raw diff:
git diff
Virtual environment issues
Recreate the environment:
rm -rf venv
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
Documentation
- README.md - Full user guide, architecture, troubleshooting
- SETUP.md - Quick start and common tasks
- CONTRIBUTING.md - How to contribute and develop
- CHANGE_TYPE_DETECTION.md - Change type identification and usage
- RISK_ASSESSMENT.md - AI-powered risk assessment setup and usage
- AI_RISK_ASSESSMENT_SUMMARY.md - Implementation overview
- IMPACT_SUMMARY.md - Developer-facing impact analysis and recommendations
- COMMIT_GUARD.md - Commit blocking on HIGH risk changes
- .github/copilot-instructions.md - Copilot development guidance
Contributing
This is an experimental project. Contributions are welcome!
License
MIT License - See LICENSE file for details
Roadmap
Phase 1 (Current):
- Basic git diff reading
- Regex-based symbol extraction
- CLI interface
Phase 2 (Planned):
- Full AST parsing
- Multi-language support
- Impact scoring
Phase 3 (Future):
- AI-powered analysis
- Integration with CI/CD
- Web-based dashboard
Note: This is an early-stage project. The API and behavior are subject to change.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file checkod_ai-0.1.0.tar.gz.
File metadata
- Download URL: checkod_ai-0.1.0.tar.gz
- Upload date:
- Size: 24.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0f56dd2768f1ca00263a5f2f7274b6575db5809dc20fc2334d75685a068e3e0
|
|
| MD5 |
44a56ece0d42bdcc8f3a4ca20479706b
|
|
| BLAKE2b-256 |
5fa72bb525c41a7960c662b2228f8f156ca38881ad79c8ea43742950847b47ce
|
File details
Details for the file checkod_ai-0.1.0-py3-none-any.whl.
File metadata
- Download URL: checkod_ai-0.1.0-py3-none-any.whl
- Upload date:
- Size: 23.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d594f4365d30abff30e1c6e5a1a4eb45c73ac40c8ca175414c3857525b2699fb
|
|
| MD5 |
9b1cb819acbd33322312e8b7e23200cd
|
|
| BLAKE2b-256 |
5f84c3ff6dece4e5ad1217c8b47c65707a39edf2f218efc789698cb04cd86f67
|