Inspiration

As developers, we’ve all experienced opening a new or massive open-source repository and immediately feeling overwhelmed by thousands of lines of unfamiliar code. Understanding how everything connects, identifying critical entry points, and estimating the “blast radius” of even a small refactor can take days of manual exploration.

We built Haven to be the AI Staff Engineer we always wished we had, a tool that doesn’t just chat with your code, but truly understands its architecture, visualizes relationships, and plans complex engineering changes with the caution and foresight of a senior developer.


What it does

Haven is an elite repository intelligence platform that transforms how developers interact with large codebases:

  • Deep Repository Analysis: Clone any GitHub repository and instantly generate a comprehensive structural and dependency map.
  • Cited Architectural Q&A: Ask complex questions about the codebase and receive answers with file- and line-level citations.
  • Interactive Dependency Graphs: Visualize module and file relationships using interactive Mermaid.js diagrams.
  • Risk-Aware Refactor Planning: Generate multiple refactor strategies, each broken down into incremental, reviewable pull requests.
  • Quantitative Risk Assessment: Every plan includes a safety score based on blast radius, structural complexity, and test coverage gaps.

How we built it

Haven is powered by a high-performance stack optimized for scale and precision:

  • Backend: FastAPI (Python 3.12) orchestrates git ingestion, analysis, and reasoning workflows.
  • Frontend: A sleek React 18 interface inspired by Vercel’s design aesthetic, featuring custom modals for interactive graph exploration.
  • Reasoning Engine: A multi-stage pipeline using OpenAI and Anthropic models, with ChromaDB for vector embeddings.
  • Static & Graph Analysis: A custom engine analyzes Python, TypeScript, and C++ repositories to extract import relationships and compute structural metrics like in-degree and out-degree to identify entry points and “God files.”

The overall risk score is calculated using a weighted formula:

$$ S_{total} = \left\lceil \frac{\sum (S_i \cdot W_i)}{\sum W_i} \right\rceil $$

where weights prioritize blast radius and change complexity.


Challenges we ran into

  • Multi-Language Import Resolution: Supporting Python, TypeScript, and C++ required handling edge cases like barrel imports, __init__.py packages, and global headers.
  • Context Window Management: Large repositories exceed LLM limits. We built a custom Memory Manager to intelligently prune and prioritize code chunks during RAG.
  • Structured LLM Output: Getting consistent, sequential refactor plans required extensive prompt iteration and a robust fallback parsing system.

Accomplishments that we're proud of

  • The Risk Score System: Haven doesn’t just suggest changes, it explains why they’re risky by detecting sensitive areas like authentication flows and entry points.
  • Interactive Visuals: Combining LLM reasoning with live dependency graphs makes complex codebases feel intuitive and “alive.”
  • PR-Sized Planning: Haven understands real-world engineering workflows by breaking large changes into 3–4 safe, reviewable pull requests.

What we learned

  • Graphs > Text: Pure RAG isn’t enough for code. Structural graphs are essential for understanding impact.
  • Citations Build Trust: File- and line-level citations are critical when using AI for mission-critical engineering decisions.
  • Incrementalism is King: Safe engineering happens in small, verifiable steps, and our refactor planner is built around that philosophy.

What's next for Haven

  • Auto-Code Generation: Generate branches and push refactors directly to GitHub.
  • CI/CD Integration: A Haven bot that comments on PRs with risk assessments and blast-radius diagrams.
  • IDE Extension: Bring dependency graphs and cited Q&A directly into VS Code for a seamless developer experience.

Built With

Share this project:

Updates