đ§ Cortex
AI code reviewer that learns from your preferences through reinforcement learning.
Cortex is a privacy-first code reviewer that runs entirely on your machine. Unlike cloud-based tools, it learns YOUR coding style through reinforcement learning and gets smarter with every commit.
⨠Features
- đ Privacy-First: All analysis happens locally, code never leaves your machine
- đ§ Adaptive Learning: Uses RL to learn from your accept/reject decisions
- ⥠Fast: Sub-2-second reviews with quantized local models
- đ¯ Context-Aware: Understands your project structure and patterns
- đ ī¸ Git Integration: Seamlessly works with your existing workflow
- đ Multi-Language: Supports Go, Python, JavaScript, TypeScript, and more
đ Quick Start
Installation
# Clone repository
git clone https://github.com/AdeshDeshmukh/cortex.git
cd cortex
# Build
make build
# Install system-wide (optional)
make install
Usage
# Navigate to your project
cd ~/projects/myapp
# Install git hook
cortex install
# Make code changes
echo "func test() {}" >> main.go
git add main.go
# Commit (Cortex reviews automatically)
git commit -m "Add test function"
Output:
đ§ Cortex Review
đ Summary:
Files changed: 1
Lines added: +1
Lines removed: -0
Languages: go (1)
đ Files:
1. main.go (go)
+1 -0 lines
âŗ Analysis pipeline:
â
Diff parsing complete
âšī¸ Static analysis (coming soon)
âšī¸ LLM suggestions (coming soon)
đ Commands
| Command | Description |
|---|---|
cortex install |
Install pre-commit hook in current repo |
cortex install --force |
Overwrite existing hook |
cortex install --uninstall |
Remove hook |
cortex review |
Manually review staged changes |
cortex review --hook |
Run in hook mode (internal) |
cortex --help |
Show all commands |
đī¸ Architecture
âââââââââââââââââââââââââââââââââââââââââââââââ
â USER COMMITS CODE â
ââââââââââââââââŦâââââââââââââââââââââââââââââââ
â
âŧ
ââââââââââââââââââââââââââââââââââââââââââââââââ
â GIT PRE-COMMIT HOOK â
â Triggers: cortex review --hook â
ââââââââââââââââŦââââââââââââââââââââââââââââââââ
â
âŧ
ââââââââââââââââââââââââââââââââââââââââââââââââ
â DIFF PARSER (Go) â
â Converts git diff â structured data â
ââââââââââââââââŦââââââââââââââââââââââââââââââââ
â
âŧ
ââââââââââââââââââââââââââââââââââââââââââââââââ
â ANALYZER PIPELINE â
â 1. Static analysis (regex, AST) â
â 2. LLM inference (local model) â
â 3. Ranking (RL policy) â
ââââââââââââââââŦââââââââââââââââââââââââââââââââ
â
âŧ
ââââââââââââââââââââââââââââââââââââââââââââââââ
â INTERACTIVE UI â
â User accepts/rejects suggestions â
ââââââââââââââââŦââââââââââââââââââââââââââââââââ
â
âŧ
ââââââââââââââââââââââââââââââââââââââââââââââââ
â FEEDBACK LOOP (Python) â
â Trains model on user preferences â
ââââââââââââââââââââââââââââââââââââââââââââââââ
đ ī¸ Development
Prerequisites
- Go 1.21+
- Git
- Python 3.10+ (for ML features)
Setup
# Clone repo
git clone https://github.com/AdeshDeshmukh/cortex.git
cd cortex
# Install dependencies
go mod download
# Run tests
make test
# Build
make build
# Run locally
./cortex --help
Testing
# Run all tests
make test
# Run with coverage
make coverage
# Run specific package
go test ./internal/git/
đ Project Structure
cortex/
âââ cmd/cortex/ # CLI entry point
â âââ main.go
â âââ commands/ # Cobra commands
â âââ root.go
â âââ install.go
â âââ review.go
âââ internal/ # Private application code
â âââ git/ # Git integration
â âââ hooks.go # Hook management
â âââ diff.go # Diff parsing
â âââ *_test.go # Tests
âââ pkg/ # Public libraries
â âââ types/ # Type definitions
â âââ types.go
âââ go.mod # Go dependencies
âââ Makefile # Build automation
âââ README.md # This file
đ¯ Roadmap
â Phase 1: Foundation (Current)
- Git hook installation
- Diff parsing
- CLI framework
- Test infrastructure
đ§ Phase 2: Intelligence (In Progress)
- Static code analysis
- LLM integration (local inference)
- Prompt engineering
- Suggestion generation
đ Phase 3: Learning (Planned)
- Feedback collection system
- SQLite storage
- RL training pipeline (DPO)
- Model personalization
đŽ Phase 4: Advanced (Future)
- Multi-language support expansion
- IDE integration (VS Code, IntelliJ)
- Team-wide model sharing
- Custom rule definitions
đ¤ Contributing
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'feat: add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Commit Convention
We follow Conventional Commits:
feat: New feature
fix: Bug fix
docs: Documentation changes
test: Test additions/changes
refactor: Code refactoring
chore: Maintenance tasks
đ License
This project is licensed under the MIT License - see the LICENSE file for details.
đ Acknowledgments
- Built with Cobra for CLI
- Inspired by first-principles thinking
- Part of ongoing learning journey in AI/ML systems
đŦ Contact
Adesh Deshmukh
- GitHub: @AdeshDeshmukh
- Project: github.com/AdeshDeshmukh/cortex
â If you find this project useful, please consider giving it a star! // test hook

Log in or sign up for Devpost to join the conversation.