Project Story: XvectR
About the project
Inspiration
The inspiration for XvectR stemmed from a growing frustration with existing AI coding assistants that felt disconnected from the developer's local environment and lacked deep contextual understanding of the codebase. While cloud-based AI tools are powerful, they often compromise on privacy, latency, and the ability to seamlessly execute complex, multi-step operations directly within the IDE. We envisioned an assistant that doesn't just generate code snippets, but acts as an autonomous, context-aware pair programmer right inside Visual Studio Code. We wanted a tool that leverages the power of local LLMs to ensure total data privacy while providing agentic capabilities—like analyzing impact radius, refactoring ASTs, and managing git workflows—without ever leaving the editor.
What it does
XvectR is an advanced, fully agentic AI coding assistant built as a VS Code extension. It transforms your editor into a highly intelligent workspace powered by dynamic, local AI models. Unlike traditional chat interfaces, XvectR acts as a proactive agent capable of executing complex engineering tasks autonomously.
Its core features include:
- Impact Radius Analysis: Before you make a change, XvectR predicts affected files, modules, APIs, tests, and dependencies, providing a comprehensive risk assessment and change impact visualization.
- AST-Powered Refactoring Engine: It goes beyond simple string replacement, performing syntax-aware code transformations such as symbol renaming, import updates, and structural refactors safely across the entire codebase using Abstract Syntax Trees.
- Git Workflow Agent: XvectR seamlessly integrates with your version control. It can create branches, implement features, validate changes, generate semantic commits, and even prepare professional pull request summaries autonomously.
- Security Shield: Privacy and security are paramount. Our Security Shield detects and redacts API keys, credentials, secrets, and sensitive information locally before any data is processed by the AI.
- Multi-Chat Project Memory: It maintains persistent, workspace-specific conversations. It retains architectural decisions, ongoing tasks, and development context across sessions, allowing you to pick up exactly where you left off.
- Dynamic Model Routing: It intelligently routes tasks to the optimal local model (via Ollama) based on the requirement—whether it's coding, reasoning, repository analysis, or vision tasks—maximizing performance and accuracy while keeping data on your machine.
How we built it
XvectR was built primarily using JavaScript/Node.js, specifically tailored for the VS Code Extension API.
- Core Architecture: The extension registers a Webview Panel that acts as the primary user interface. We established a robust two-way communication bridge between the React/HTML frontend and the Node.js backend.
- Agentic Tooling: We designed a modular tool execution framework (
tools/directory) where each capability (AST parsing, Git operations, file system access) is an independent module. The central orchestrator interprets model intentions and dynamically invokes these tools. - Local AI Integration: We integrated deeply with Ollama, allowing XvectR to stream responses (
stream: true) directly into the UI for near-instantaneous feedback. Theollama1.jsorchestrator handles tool calling (tool_calls) synchronously as chunks stream in, ensuring a smooth user experience. - AST and Impact Analysis: We utilized JavaScript parsers to build the AST-powered refactoring engine, allowing the AI to understand the structural syntax of the code rather than just text.
- Session Management: We implemented a local file-based persistent memory system (
.xvectrdirectory) to store and retrieve multi-chat sessions securely.
Challenges we ran into
Building a responsive, local-first agentic IDE brought several significant challenges:
- Streaming Latency with Tool Calls: Initially, waiting for the LLM to finish thinking before executing tools and rendering text caused a massive 10+ second delay in the UI. We had to completely refactor our Ollama integration to support native streaming (
stream: true), accumulating tool calls on the fly while simultaneously rendering text chunks to the webview. - Cross-Platform Command Execution: Executing terminal commands autonomously (especially Git operations) varied wildly between environments (e.g., PowerShell on Windows vs. Bash on Linux). We had to sanitize and format our spawned shell commands (using
;instead of&&for sequential execution) to ensure compatibility across different operating systems. - Context Window Management: Passing entire project contexts to local models without blowing up the context window was difficult. We had to build an intelligent retriever and indexer to ensure only the most relevant snippets and AST structures were fed to the prompt.
- UI State Synchronization: Keeping the Webview UI synchronized with the backend state, especially when switching between multiple historical chat sessions, required careful state management and precise message passing to prevent race conditions.
Accomplishments that we're proud of
- Zero-Latency Feel: Successfully implementing the streaming architecture makes XvectR feel incredibly fast and responsive, comparable to cloud-based alternatives but running entirely locally.
- True Agentic Capability: Watching XvectR autonomously analyze an impact radius, refactor a file, and commit the changes via Git—all triggered from a single prompt—is a massive milestone. It truly acts as a developer.
- Security by Design: We are incredibly proud of the Security Shield. Ensuring that developers can use AI on proprietary codebases without the fear of leaking secrets is a game-changer for enterprise adoption.
What we learned
- The Power of Local LLMs: We learned that local models are more than capable of handling complex reasoning and tool execution if provided with the right context and a robust orchestration layer.
- ASTs are the Future of AI Coding: Treating code as text is insufficient for reliable AI refactoring. Leveraging Abstract Syntax Trees (ASTs) is absolutely critical for making safe, syntax-aware transformations.
- UX is Everything: Even the most powerful AI is useless if the developer experience is clunky. Optimizing the latency between prompt and visual feedback was the most crucial lesson in building a developer tool.
What's next for XvectR
- Multi-Agent Swarms: We plan to introduce specialized sub-agents (e.g., a dedicated "Tester Agent" or "Reviewer Agent") that can collaborate simultaneously on a single complex task.
- Visual Debugging: Enhancing the vision capabilities to allow developers to paste screenshots of UI bugs or error traces, and having XvectR automatically navigate to the faulty code and propose a fix.
- Language Server Protocol (LSP) Integration: Deeply integrating with the LSP to provide real-time, inline code generation and predictive autocomplete, moving beyond just the chat panel.
- Custom Tool Creation: Allowing users to define their own custom tools using simple JavaScript scripts that XvectR can dynamically discover and execute.
Built With
- javascript
- lance-db
- ollama
- tree-sitter
- vscode-extension-api
Log in or sign up for Devpost to join the conversation.