Multi-agent AI system for real-time code analysis, refactoring, and test generation
CogniCode Agent is a privacy-first, AI-powered development tool that provides real-time code analysis, intelligent refactoring suggestions, and automated unit test generation. Built for Hackathon 2025 with a focus on developer productivity and code quality.
- 🔍 Real-time Code Analysis: Instant bug detection, style checks, and performance insights
- ⚡ Intelligent Refactoring: AI-powered suggestions to improve code quality and performance
- 🧪 Automated Test Generation: Comprehensive unit test creation with edge cases
- 🔒 Privacy-First: All AI processing runs locally - your code never leaves your machine
- 🌐 Multi-language Support: JavaScript, TypeScript, Python, Java, and more
- 📊 Code Metrics: Complexity analysis, maintainability scores, and quality insights
- 🎨 Beautiful UI: Modern, responsive design with real-time updates
- Node.js 16+ and npm
- Python 3.8+ and pip
- 4GB+ RAM (8GB+ recommended for AI models)
- 5GB+ free disk space for AI models
# Clone the repository
git clone https://github.com/Edmon02/cognicode-agent.git
cd cognicode-agent
# Run the setup script
chmod +x setup.sh
./setup.sh
# Start the full application
./run-dev.shClick to expand manual setup instructions
npm installcd server
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txtcd server
python scripts/download_models.py# Terminal 1 - Backend
cd server && source venv/bin/activate && python app.py
# Terminal 2 - Frontend
npm run dev📚 Complete Documentation - Comprehensive guides and references
- 🚀 Installation Guide - Detailed setup instructions
- 📖 Basic Usage - Getting started guide
- 🎯 Features Overview - All capabilities explained
- 🏗️ Architecture - Technical architecture
- 📡 API Reference - Complete API documentation
- 🎬 Demo Guide - Professional demo materials
- Open the Application: Navigate to
http://localhost:3000 - Write/Paste Code: Use the Monaco editor to input your code
- Select Language: Choose from JavaScript, TypeScript, Python, Java, etc.
- Analyze Code: Click "Analyze" to run AI-powered analysis
- Review Results: Check the Analysis, Refactor, and Tests tabs
- Apply Suggestions: Click "Apply" on refactoring suggestions
- Download Tests: Export generated unit tests
// Paste this code and click "Analyze"
function fibonacci(n) {
if (n <= 1) return n;
return fibonacci(n - 1) + fibonacci(n - 2);
}
console.log(fibonacci(10));The AI will detect:
⚠️ Performance issue (exponential time complexity)- 💡 Refactoring suggestion (memoization)
- 🧪 Generated unit tests with edge cases
┌─────────────────┐ ┌────────────────────┐ ┌─────────────────┐
│ Linter Agent │ │ Refactor Agent │ │ TestGen Agent │
│ │ │ │ │ │
│ • Bug Detection │ │ • Code Optimization│ │ • Unit Tests │
│ • Style Analysis│ │ • Pattern Improve. │ │ • Edge Cases │
│ • Security Check│ │ • Performance Tune │ │ • Integration │
└─────────────────┘ └────────────────────┘ └─────────────────┘
│ │ │
└───────────────────────┼───────────────────────┘
│
┌─────────────────┐
│ Code Service │
│ │
│ • Result │
│ Processing │
│ • Caching │
│ • Coordination │
└─────────────────┘
Frontend
- Next.js 13+ (App Router)
- React 18 with TypeScript
- Tailwind CSS + shadcn/ui
- Monaco Editor
- Socket.IO Client
- Framer Motion
Backend
- Flask + Flask-SocketIO
- PyTorch + Transformers
- CodeBERT (Analysis)
- CodeT5 (Refactoring)
- Multi-agent Architecture
AI Models
microsoft/codebert-base- Code analysis and bug detectionSalesforce/codet5-small- Code generation and refactoring- Local execution for privacy
Frontend (.env.local)
NEXT_PUBLIC_BACKEND_URL=http://localhost:5000
NEXT_PUBLIC_APP_NAME=CogniCode AgentBackend (server/.env)
FLASK_ENV=development
PORT=5000
MODELS_PATH=./models
USE_DEMO_MODE=true
LOG_LEVEL=INFOModels are automatically downloaded to server/models/. For custom models:
# server/agents/base_agent.py
CUSTOM_MODELS = {
'linter': 'your-custom/codebert-model',
'refactor': 'your-custom/codet5-model',
'testgen': 'your-custom/test-model'
}./run-dev.sh# Build and run with Docker Compose
docker-compose up --build
# Or build individual services
docker build -t cognicode-frontend .
docker build -t cognicode-backend ./serverFrontend (Vercel)
# Deploy to Vercel
npm run build
vercel --prodBackend (Docker/Cloud)
# Build production image
docker build -t cognicode-backend ./server
# Deploy to your preferred cloud provider
# (AWS ECS, Google Cloud Run, Azure Container Instances, etc.)npm test
npm run test:watchcd server
source venv/bin/activate
pytest
pytest --coverage# Start both services and run E2E tests
npm run test:e2e| Operation | Time | Memory |
|---|---|---|
| Code Analysis | <500ms | ~200MB |
| Refactor Generation | <1s | ~300MB |
| Test Generation | <1.5s | ~250MB |
| Model Loading | ~10s | ~1GB |
- CPU: Use quantized models for faster inference
- Memory: Enable model caching and batch processing
- Storage: Models require 2-5GB disk space
- Network: All processing is local (no API calls)
We welcome contributions! Please see our Contributing Guide for details.
# Fork and clone the repository
git clone https://github.com/Edmon02/cognicode-agent.git
# Create a feature branch
git checkout -b feature/amazing-feature
# Make your changes and test
npm test
cd server && pytest
# Commit and push
git commit -m "Add amazing feature"
git push origin feature/amazing-featureThis project is licensed under the MIT License - see the LICENSE file for details.
CogniCode Agent was built for Hackathon 2025, targeting these challenges:
- 🤖 AI Innovation: Multi-agent architecture with local AI models
- ⚡ Real-time Applications: WebSocket-based live code analysis
- 🔒 Privacy-First Solutions: All processing runs locally
- 🛠️ Developer Tools: Productivity-focused development experience
- Best Use of AI
- Best Solo Project
- Most Innovative Solution
- Best Developer Tool
- Demo: https://cognicode-agent.vercel.app
- GitHub: https://github.com/Edmon02/cognicode-agent
- Author: Edmon02
- Portfolio: https://github.com/Edmon02
- 📧 Email: Create an issue
- 💬 Discussions: GitHub Discussions
- 🐛 Bug Reports: GitHub Issues
Built with ❤️ for developers by developers