CodeSense 2.0 is a state-of-the-art developer assistant and codebase intelligence platform built upon modern Retrieval-Augmented Generation (RAG) paradigms. Ingest any public GitHub repository URL, inspect its AST symbol hierarchy and technology ecosystem, and query the codebase with hybrid search, neural cross-encoder re-ranking, and grounded source citations.
+-------------------------------------------------------------+
| Streamlit 2.0 Glassmorphic UI |
| (Multi-Repo Selector, Code Inspector, Symbol Catalog, Chat) |
+------------------------------+------------------------------+
|
REST API / SSE|Streaming
v
+-------------------------------------------------------------------------------------------------------------------------------+
| FastAPI 2.0 Backend Layer |
| (Ingest, Repos, File Inspector, Symbols, Chat Stream) |
+--------------------------------+--------------------------------------------------------------+-------------------------------+
| |
v v
+---------------------------------------------------------------+ +---------------------------------------------------------+
| Contextual Ingestion Pipeline | | Modern RAG Orchestration Agent |
| | | |
| 1. Git Repository Cloner (Multi-Repo Isolated Storage) | | 1. Query Analyzer & AST Symbol Resolver |
| 2. Syntax-Aware Hierarchical Chunker (Anthropic Contextual) | | 2. Reciprocal Rank Fusion (Dense FAISS + Sparse BM25) |
| 3. AST Symbol Table Extractor (Classes, Methods, Interfaces) | | 3. FlashRank Neural Cross-Encoder Re-ranker |
| 4. Dense Embedder (FastEmbed BGE-small / MiniLM ONNX) | | 4. Line Context Verifier & Hallucination Guard |
| 5. Sparse Code BM25 Engine (Subtokenized Identifiers) | | 5. Multi-Provider LLM Gateway (Groq, OpenAI, Anthropic, |
| 6. Repo Ecosystem & Intelligence Report Generator | | HuggingFace, Ollama, & Local Synthesizer) |
+---------------------------------------------------------------+ +---------------------------------------------------------+
| ^
v |
+-----------------------------------------------------------------------------------------------+-------------------------------+
| Isolated Storage & Index Layer |
| |
| storage/repos/{repo_id}/ storage/indices/{repo_id}/ |
| ├── Full Source Code Cache ├── index.faiss (Normalized Dense Vectors) |
| └── Git Metadata ├── bm25.pkl (Code Subtokenized BM25 Index) |
| ├── symbols.json (AST Symbol Table) |
| storage/registry.json ├── chunks.json (Contextual Chunks & Coordinates) |
| └── Multi-Repo Catalog & Active Repo └── report.json (Ecosystem, Complexity, Entry Points) |
+---------------------------------------------------------------------------------------------------------------+
| Capability | Legacy RAG | CodeSense 2.0 (Modern RAG) |
|---|---|---|
| Chunking Strategy | Naive character/line splits (chunk_size=500) |
Syntax-Aware Contextual Chunking: Preserves functions, classes, and scopes, prepending file location, scope, and import dependencies (Anthropic-style Contextual Retrieval). |
| Search Engine | Pure dense vector similarity | Hybrid Search: Dense Vector Search (FastEmbed + FAISS) + Sparse Keyword Search (BM25 with camelCase/snake_case tokenization) fused via Reciprocal Rank Fusion (RRF). |
| Re-ranking | None (noisy top-k) | FlashRank Neural Cross-Encoder: Re-evaluates top candidate chunks to eliminate false positives and score precision-at-k. |
| Code Symbols | None | AST Symbol Catalog: Extracts classes, functions, and interfaces for deterministic O(1) symbol lookups without semantic approximations. |
| Repository Management | Hardcoded single cloned_repo |
Multi-Repo Management: Isolated storage and indices per repository with instant repo switching and persistent caching. |
| LLM Gateway | Single hardcoded provider | Multi-Provider Engine: Supports Groq, OpenAI, Anthropic, HuggingFace, Ollama, plus a Zero-Cost Offline Synthesizer. |
| User Interface | Basic chat | Interactive Glassmorphic Studio: Code Inspector with line numbers, AST Symbol Navigator, RAG hyperparameter tuning (Alpha, Top-K, Reranker toggle), and live agent traces. |
- Python 3.10+
- Git installed on system path
Copy .env.example to .env in codesense/backend/:
cp codesense/backend/.env.example codesense/backend/.envEdit .env to configure your preferred LLM provider (or leave blank to use the built-in Offline Synthesizer):
# Recommended for ultra-fast, free inference:
GROQ_API_KEY=gsk_your_groq_api_key_here
# Or OpenAI:
# OPENAI_API_KEY=sk-your-openai-key
# Server settings
PORT=8000
HOST=127.0.0.1pip install -r codesense/backend/requirements.txtFrom codesense/backend:
uvicorn main:app --reload --port 8000API Documentation and Interactive Swagger UI will be available at http://127.0.0.1:8000/docs.
In a new terminal:
streamlit run codesense/frontend/app.pyOpen your browser at http://localhost:8501.
POST /ingest: Clone and index a public GitHub repository.GET /repos: List all indexed repositories and current active selection.POST /repos/active: Switch active repository without re-indexing.POST /chat: Query the codebase with hybrid retrieval, reranking, and citation grounding.POST /chat/stream: Server-Sent Events (SSE) streaming endpoint for live tokens and agent traces.GET /symbols: Query the AST code symbol table (classes, functions, interfaces).GET /file: Inspect specific lines of code in the codebase with line numbers.