CodeSentinelAI is an autonomous code-auditing pipeline designed to detect, analyze, correct, and validate Python code using a combination of deterministic static analysis and AI reasoning.
The project explores how AI agents can move beyond simply explaining code errors and instead participate in a controlled detect → analyze → correct → validate loop.
Traditional linters are excellent at detecting known classes of issues, but they generally stop at reporting problems.
Developers still have to:
- Understand the reported error
- Identify the root cause
- Modify the code
- Run the code again
- Verify that the correction actually works
CodeSentinelAI explores an automated workflow that closes this loop.
Python Source Code
│
▼
┌───────────────┐
│ Ruff │
│ Static Check │
└───────┬───────┘
│
Errors / Tracebacks
│
▼
┌───────────────┐
│ AI Agent │
│ Code Analysis │
└───────┬───────┘
│
Corrected Code
│
▼
┌───────────────┐
│ Validation │
│ & Execution │
└───────┬───────┘
│
Validated Result
1. Static Analysis
Ruff performs deterministic analysis of the Python source code and identifies issues.
2. Error Extraction
Relevant errors and execution information are collected and provided to the AI reasoning layer.
3. AI-Powered Analysis
The language model analyzes the reported problem and determines how the code should be corrected.
4. Self-Correction
The agent generates a corrected version of the source code.
5. Validation
The corrected code is checked and executed to determine whether the proposed correction is valid.
The current implementation uses:
- Python 3.10+
- Ruff for deterministic static analysis
- Ollama for local LLM inference
- An agentic feedback loop for code analysis and correction
The current local-LLM architecture allows experimentation without requiring an external model API.
Most developer tools focus on one part of the development workflow:
- Linters detect problems
- IDEs highlight problems
- LLMs explain problems
- Developers manually apply and verify fixes
CodeSentinelAI explores a different approach:
Detect the problem → reason about the problem → generate a correction → validate the correction.
The goal is not to replace deterministic developer tooling, but to combine deterministic checks with AI reasoning in a controlled workflow.
Given Python code containing an error:
def calculate_total(items):
total = 0
for item in items
total += item
return totalThe pipeline can:
- Detect the syntax problem using static analysis.
- Extract the relevant diagnostic information.
- Provide the context to the AI reasoning layer.
- Generate a corrected implementation.
- Validate the corrected code.
python_code_auditor/
│
├── auditor.py # Core auditing pipeline
├── day1.py # Development / experimentation code
└── README.md # Project documentation
- Python 3.10+
- Ruff
- Ollama
pip install ruffDownload and install Ollama from:
Then configure a local model suitable for code analysis.
- Deterministic Python static analysis
- Ruff integration
- Error / traceback extraction
- Local LLM integration
- AI-assisted code correction
- Corrected-code validation workflow
- Web-based interface
- Repository-level auditing
- GitHub integration
- Pull-request code review
- Security-focused analysis
- Multi-file project analysis
- Automated test generation
- Production-grade sandboxed execution
Build a reliable detect → analyze → correct → validate pipeline.
Integrate the auditor into GitHub repositories and pull requests.
Expand analysis beyond syntax and linting into security vulnerabilities, unsafe patterns, and reliability issues.
Provide developers and teams with an automated AI-assisted code auditing workflow.
The current development version uses a local LLM through Ollama.
A planned direction for CodeSentinelAI is to integrate Claude's API for higher-quality code reasoning, remediation, and project-level analysis.
This would allow the system to combine:
- Deterministic static analysis
- Large-context code reasoning
- Automated remediation
- Validation and execution
- Repository-level analysis
Claude integration is currently part of the planned product direction and is not represented as an existing feature of this repository.
CodeSentinelAI aims to make code auditing an active engineering workflow rather than a passive error-reporting step.
Instead of:
Write Code
↓
Find Error
↓
Read Error
↓
Fix Manually
↓
Run Again
the goal is:
Write Code
↓
Detect
↓
Analyze
↓
Correct
↓
Validate
↓
Verified Code
CodeSentinelAI
AI-powered code auditing and automated remediation.
GitHub: https://github.com/kaushikteja26/python_code_auditor
Domain: https://codesentinelai.dev
This project is currently an experimental development project.