The Autonomous System Architect for your Terminal and IDE.
Codetrace AI is a privacy-first AI agent that builds a "Hybrid Brain" of your codebase β combining semantic vector search with structural call-graph analysis β so it understands what calls what, who owns what, and what breaks if you change something.
The biggest addition yet. A completely new, interactive HTML architecture map generated directly from your code graph.
- Folder-level dependency map β groups all symbols by directory and renders cross-folder function call edges
- Hover on any folder β instantly highlights all its connections and shows a detailed breakdown panel
- Hover on any edge β reveals the exact function-to-function calls driving that dependency
- Click a folder β opens a detail sidebar showing all files, symbols, and dependency counts
- Collapsible tree with smooth animations β
[+]/[-]indicators keep large graphs navigable - Search bar β find any symbol and highlight its containing folder instantly
- Drag, zoom, and pan β full interactive layout control
Codetrace now parses C#, Swift, Kotlin, Bash, HTML, JSON, CSS, YAML, SQL, TOML, and Dockerfiles in addition to the original Python, JS, TS, Java, C++, Go, Rust, and PHP.
Local Ollama models connected with Codetrace-AI works 2x faster than before due to the optimization made in the code and Call Graph it initally takes time to load the model but after that it works 2x faster than before as now it use single model for the whole session.
Codetrace AI is open-source. Contributions, bug reports, and feature requests are welcome. If you build something with or inspired by Codetrace, we'd love to hear about it β please credit the original project.
Codetrace acts as a highly knowledgeable senior engineer on your project:
| Feature | Description |
|---|---|
| π Autonomous Code Research | Ask a question, and the agent proactively searches, reads files, and traverses the graph to find the exact answer |
| πΊοΈ Interactive Architecture Map | codetrace visualize generates a beautiful, self-contained interactive HTML graph of your code architecture |
| π Structural Call Graph Mapping | Navigates class and function definitions across 11+ languages to see exactly how your application is wired |
| π₯ Blast Radius Analysis | Analyzes the downstream impact of a code change before you make it, preventing unintended breakages |
| βοΈ Human-in-the-Loop Code Edits | Proposes code changes with a rich diff preview β you approve or decline before anything is written to disk |
| β‘ Smart SHA-256 Delta Sync | Re-indexes only the files that actually changed. Lightning fast on every subsequent run |
| π IDE Context Injection (MCP) | Connects the Hybrid Brain directly into Cursor, Windsurf, or Claude Code for in-editor AI assistance |
| π Persistent Chat Sessions | All conversations are saved. Resume any past session by ID, or export it to Markdown |
| π 100% Local & Air-Gapped | All parsing, embedding, and graph mapping happens on your machine. Zero data leaves without your consent |
Codetrace is built with a Privacy-First design. It can operate 100% offline:
- Local LLM: Configure any local provider via Ollama (e.g.,
llama3.2,deepseek-coder). - Local Embeddings: Uses HuggingFace
bge-small+e5-smallmodels, downloaded once and cached. - True Air-Gap: Transfer the HuggingFace cache (
~/.cache/huggingface/hub) via USB. Runcodetrace init --offlineto block all external calls permanently.
Warning
Ollama Users β Context Window & RAM Dependency When using Ollama, the effective context window of your local model is directly limited by your available system RAM. If the model's context window is larger than what your RAM can load, Ollama may hang, respond extremely slowly, or crash silently.
Recommendations:
- 8 GB RAM:
qwen2.5-coder:7bΒ·deepseek-r1:7bΒ·phi4-mini(best balance of coding + reasoning at this size) - 16 GB RAM:
qwen2.5-coder:14bΒ·deepseek-r1:14bΒ·gemma3:12bΒ·gemma4:12b (quantized)(recommended sweet spot for most developers) - 32 GB+ RAM:
qwen2.5-coder:32bΒ·deepseek-r1:32bΒ·devstral:24b(near frontier-level code reasoning locally)
If Codetrace hangs during a chat session while using Ollama, the most likely cause is the model running out of RAM to process the context. Switch to a smaller model with codetrace config.
Requires Python 3.10+
pip install codetrace-aiuv pip install codetrace-aiNote: Python version 3.14 might have problem with installation of dependencies. Use python version 3.10-3.12 for better experience. For GPU users, make sure you have CUDA installed.
cd /path/to/your/project
codetrace init
codetrace chat
codetrace initconfigures your LLM provider, downloads embedding models, indexes your codebase, and registers the MCP server β all in one command.
| Command | Description |
|---|---|
codetrace init [PATH] |
One-command setup: config β download models β index β register MCP |
codetrace chat |
Launch the interactive AI Architect chat loop |
codetrace chat --resume <ID> |
Resume a specific past chat session |
codetrace index <PATH or URL> |
Re-index a local directory or clone + index a GitHub URL |
codetrace config |
View or update your LLM provider and API key |
codetrace visualize |
Generate and open an interactive HTML architecture graph |
codetrace history |
List all past chat sessions for the current project |
codetrace export <ID> |
Export a chat session to terminal or save as a Markdown file |
Flags:
--offlineβ Strict air-gapped mode (blocks all telemetry and external requests)--fastβ Use smaller embedding models for lower RAM usage--llm <provider>β Pre-select provider:groq,openai,anthropic,gemini,ollama
In-chat commands:
/clearβ Start a fresh session without exitingexit/quitβ Close the chat
The AI has access to 7 specialized tools it invokes autonomously:
| Tool | What it does |
|---|---|
search_codebase |
Hybrid semantic search (BGE + E5 + RRF + FlashRank reranker) |
get_symbol_relations |
Graph traversal β see callers and dependencies of any symbol |
analyze_impact |
Blast radius β find every downstream symbol affected by a change |
read_file |
Read full file content from the indexed DB snapshot |
write_file |
Propose a code change with a diff preview for your approval |
inspect_index |
List all indexed files and DB coverage metadata |
git_diff |
Run a safe, injection-protected git diff |
codetrace init automatically registers the MCP server in Cursor and Claude Code. No manual configuration needed.
Your IDE instantly gains access to all 7 tools above for in-editor assistance.
Using Windsurf? Add it manually to your mcp.json:
"codetrace": {
"command": "python",
"args": [
"/absolute/path/to/your/project/codetrace_mcp/server.py",
"--project",
"/absolute/path/to/your/project"
]
}After codetrace init, your project will have:
your-project/
βββ .codetrace/
β βββ chroma/ β vector embeddings (ChromaDB)
β βββ graph_metadata.db β code call graph (SQLite + NetworkX)
β βββ sync_metadata.db β SHA-256 delta sync state
β βββ chat_history.db β persistent chat sessions
β βββ graph_visualization.html β generated by `codetrace visualize`
βββ src/
βββ your code files
Global config is stored at ~/.codetrace/config.json
- β
NEW: Interactive Architecture Visualizer (
codetrace visualize) with collapsible tree, hover panels, search, and cross-folder call edges - β NEW: Expanded language support β C#, Swift, Kotlin, Bash, HTML, JSON, CSS, YAML, SQL, TOML, Dockerfile
- β NEW: Token Budget Manager β 3-tier context window management with auto-history compression
- β
NEW: Multi-provider Agent Loop via pure
httpx(zero LangChain dependency) - β
NEW: Live model listing during
codetrace configβ fetches available models from your provider's API - β
IMPROVED: Parallel file parsing with
ThreadPoolExecutorfor significantly faster indexing - β
IMPROVED: Path traversal protection on
read_fileandwrite_filetools
- Initial public release with Hybrid Brain engine (BGE + E5 + ChromaDB + NetworkX)
- Core agentic tool suite (
search_codebase,analyze_impact,write_file,git_diff) - MCP auto-registration for Cursor and Claude Code
- SHA-256 Smart Delta Sync
- GitHub URL cloning + indexing support
- Persistent chat sessions with
historyandexport
We welcome contributions! See CONTRIBUTING.md for guidelines.
π¬ Help shape Codetrace: Join the discussion β
MIT License β Copyright (c) 2026 Viraaj Sawant. See LICENSE for details.

