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.sh
Click to expand manual setup instructions
npm install
cd server
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
cd 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
π Detailed Usage Guide
// 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 Agent
Backend (server/.env
)
FLASK_ENV=development
PORT=5000
MODELS_PATH=./models
USE_DEMO_MODE=true
LOG_LEVEL=INFO
Models 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 ./server
Frontend (Vercel)
# Deploy to Vercel
npm run build
vercel --prod
Backend (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:watch
cd 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-feature
This 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