Skip to content
alok-devforgePublic

About

AI-powered codebase intelligence platform. Analyzes legacy codebases with real-time AST parsing, interactive dependency graphs, RAG-driven knowledge retrieval, and automated GitOps sandboxing.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

18 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧠 CogniCode — AI-Powered Codebase Intelligence Platform

Understand any codebase in minutes, not months.

Version License Python Next.js PRs Welcome


📖 About

CogniCode is a developer dashboard that helps teams understand, change, and stress-test large codebases with confidence. It combines real-time AST analysis, LLM reasoning, and a vector-based knowledge engine, so you can open an undocumented repo and quickly see how it's built, what's risky, and what a change will break.

✨ Highlights

  • 🏛️ Legacy Archeologist: auto-generates architecture blueprints from undocumented code
  • 💥 Blast Radius Graph: click any module to see what breaks, color-coded by severity
  • 🗺️ Risk Map & Quality Gate: score every file and scan the whole codebase in one click
  • 🔄 Bidirectional Sync: keep code and docs in step, with live drift detection
  • 🔍 RAG Knowledge Engine: ask questions in plain English, get answers with file citations
  • 🧪 Stress Testing & Traffic Simulator: find bottlenecks before production does
  • 🌿 GitOps Sandbox: experiment on ephemeral branches, then merge or auto-abort

The Problem

Engineering teams inherit massive codebases with zero documentation, make "safe" changes that cascade into outages, and lose institutional knowledge when people leave. CogniCode combines real-time AST analysis, LLM-powered reasoning, vector-embedded knowledge (ChromaDB), ephemeral GitOps sandboxing, and real stress testing into a single developer dashboard.


Screenshots

Dashboard Archeologist
Main Dashboard & Code Editor Legacy Archeologist
Blast Radius Sandbox
Blast Radius Dependency Graph Traffic Simulator & GitOps Sandbox
Bidirectional Sync
Bidirectional Code ↔ Docs Sync

Tech Stack


Features

Feature Description
Legacy Archeologist Auto-generates architecture blueprints from undocumented code via AST + LLM inference. Detects design patterns, flags anti-patterns, computes confidence scores.
Blast Radius Graph Interactive React Flow visualization of cross-file dependencies. Click any module to see what breaks — color-coded by severity.
Risk Map Every file scored by coupling, complexity, and size. Identifies high-risk modules before they cause production issues.
Quality Gate One-click codebase-wide quality scan — cyclomatic complexity, cognitive complexity, Big-O estimates, and severity-leveled violations.
Bidirectional Sync Live drift detection between code and documentation. Edit code → docs auto-regenerate. Edit docs → generate starter code.
RAG Knowledge Engine ChromaDB-powered vector search. Ingest repos, ask questions in natural language, get answers with file-level citations.
Stress Testing Fire 1–50 concurrent analysis workers on your codebase. Measures real latency (avg/p50/p95/max), throughput, and per-worker timelines.
GitOps Sandbox One-click ephemeral branch spawning. Experiment in isolation, then merge or auto-abort on conflicts.
Traffic Simulator Predicts cascading bottlenecks by cross-correlating code complexity with traffic patterns on the blast radius graph.
Incremental Analysis Delta-based re-analysis sends only changed files with prior context to the LLM. ~62% token savings.
Knowledge Graph Enriched graph with inheritance edges, composition detection, module clusters, and PageRank-style centrality scoring.

Getting Started

Prerequisites: Python 3.11+, Node.js 18+

# Clone
git clone https://github.com/alok-devforge/CogniCode.git
cd CogniCode

# Backend
cd backend
python -m venv venv
venv\Scripts\activate          # Windows (use source venv/bin/activate on Mac/Linux)
pip install -r requirements.txt
cp .env.example .env           # Add your Groq API key
python -m uvicorn main:app --reload --port 8000

# Frontend (new terminal)
cd cognicode-app
npm install
npm run dev

Open http://localhost:3000 → Open a folder → Analyze.

Get a free Groq API key at console.groq.com. Without a key, the app falls back to regex-based structural analysis.


Architecture

┌──────────────────────────────────────────────────────────┐
│                    FRONTEND (Next.js 16)                  │
│                                                           │
│  CodeEditor · DependencyGraph · BidirectionalSync         │
│  CodebaseMap · CommandStation · RAGPanel · LoadTester      │
│                         ↓                                 │
│                      api.ts                               │
└───────────────────────────┬──────────────────────────────┘
                            │ HTTP :8000
┌───────────────────────────┴──────────────────────────────┐
│                   BACKEND (FastAPI)                       │
│                                                           │
│  main.py ── llm_service · ast_service · code_graph        │
│             knowledge_graph · rag_service · models         │
│                  ↓                        ↓               │
│            Groq API (3-model         ChromaDB             │
│             fallback chain)        (Vector Store)         │
└──────────────────────────────────────────────────────────┘

LLM Fallback Chain

Priority Model Notes
1st llama-3.3-70b-versatile Best quality — tried first
2nd llama-3.1-8b-instant Auto-fallback on 429 rate limit
3rd gemma2-9b-it Last resort before regex fallback

Project Structure

CogniCode/
├── backend/
│   ├── main.py                 # FastAPI server (25+ routes)
│   └── app/
│       ├── llm_service.py      # LLM integration + 3-model fallback
│       ├── ast_service.py      # Python AST parser
│       ├── code_graph.py       # Multi-language dependency graph (13+ langs)
│       ├── knowledge_graph.py  # Enriched graph with centrality scoring
│       ├── rag_service.py      # ChromaDB vectorization & search
│       ├── github_sync.py      # Bidirectional Git synchronization
│       ├── graph_assistant.py  # AI codebase chat assistant
│       ├── stress_engine.py    # Concurrent load testing engine
│       └── models.py           # Pydantic schemas
├── cognicode-app/
│   └── src/
│       ├── app/                # Next.js pages & layouts
│       ├── components/         # React UI components
│       └── lib/                # API client & state management
└── assets/images/              # Screenshots

Languages Used

Python · TypeScript · JavaScript · Go · Rust · Java · C/C++ · C# · Ruby · PHP · Swift · Kotlin · Dart


Team

Name Role
Alok Project Lead & AI/RAG Core
Sabnur Frontend Foundation & Editor
Oheli Visualizations & Blueprints
Kalkita Systems Parsing & Syncing

Built for engineering teams that refuse to let complexity win.

About

AI-powered codebase intelligence platform. Analyzes legacy codebases with real-time AST parsing, interactive dependency graphs, RAG-driven knowledge retrieval, and automated GitOps sandboxing.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages