CodeSense Mini: AI-Powered Development Assistant
Inspiration
Every developer has experienced the frustration of encountering a cryptic error message and spending hours searching through Stack Overflow, GitHub issues, and documentation for scattered, incomplete solutions. Despite AI revolutionizing many aspects of development, the debugging process still relies heavily on manual searching and pattern recognition.
The TiDB AgentX Hackathon presented the perfect opportunity to explore how modern vector search capabilities could be combined with AI reasoning to create a truly intelligent debugging assistant. I was inspired by the concept of "agentic" AI - systems that autonomously orchestrate multiple services to solve problems, mimicking how experienced developers actually approach debugging through semantic understanding and pattern recognition rather than just exact keyword matching.
What it does
CodeSense Mini is an AI-powered development assistant that instantly analyzes code errors and provides intelligent, contextual solutions through a sophisticated multi-step agentic workflow:
Core Functionality
- Accepts error messages and problematic code from developers
- Generates vector embeddings of the error context using Gemini AI
- Performs hybrid search combining TiDB's vector similarity with text pattern matching
- Uses AI reasoning to synthesize personalized solutions from similar cases
- Generates corrected code with best practices and detailed explanations
- Provides confidence scoring and step-by-step explanations
Multi-Step Agentic Process
- Embedding Generation: Converts error context to (768)-dimensional vectors
- Intelligent Search: Autonomously selects between vector, text, or hybrid search strategies
- AI Synthesis: Analyzes similar cases and generates contextual solutions
- Code Enhancement: Produces improved code with error handling and best practices
The system supports multiple programming languages (JavaScript, Python, TypeScript, Java, C#) and provides real-time visualization of the agentic workflow in action.
How we built it
Architecture Design
Built around a four-step agentic workflow that demonstrates genuine autonomous decision-making rather than sequential API calls. The system intelligently chooses search strategies and validates results.
Database Implementation
Used TiDB Serverless with carefully designed schema supporting both vector operations and traditional queries:
CREATE TABLE error_patterns ( error_embedding VECTOR(768), solution_embedding VECTOR(768), VECTOR INDEX idx_error_embedding ((VEC_COSINE_DISTANCE(error_embedding))) );
AI Integration
Integrated Google Gemini API for both embeddings (text-embedding-004) and solution generation (gemini-1.5-flash), with structured JSON responses for consistent results.
Frontend Development
Built with Next.js and TypeScript, featuring real-time processing step visualization that shows the agentic workflow in action, transforming a "black box" operation into an educational experience.
Hybrid Search Strategy
Implemented intelligent combination of vector similarity and text matching with deduplication and relevance ranking:
async hybridSearch(embedding: number[], textQuery: string) { const vectorResults = await this.vectorSearch(embedding, limit); const textResults = await this.fullTextSearch(textQuery, limit); // Intelligent deduplication and ranking logic }
Challenges we ran into
Database Compatibility Issues
TiDB's MySQL compatibility had edge cases - FULLTEXT indexes required separate indexes per column, and MATCH() AGAINST() wasn't supported, necessitating custom LIKE-based relevance scoring.
Vector Dimension Mismatch
Initially planned for OpenAI ((1536) dimensions) but switched to Gemini ((768) dimensions) for cost efficiency, requiring database schema migration and careful testing.
API Integration Complexity
Building resilient error handling across multiple external services (TiDB, Gemini API) while maintaining smooth user experience required comprehensive fallback strategies.
Agentic vs Sequential Processing
The real challenge was making the system genuinely "agentic" with autonomous decision-making rather than just a sequence of API calls. This required implementing intelligent search strategy selection and result validation logic.
Real-time Feedback
Implementing processing step visualization required careful state management to show progress without blocking the UI thread.
Production Deployment
Environment consistency between development and production, particularly with database connections and API configurations, required extensive testing and configuration management.
Accomplishments that we're proud of
- Genuine Agentic Behavior: Successfully implemented autonomous decision-making for search strategies, demonstrating true agentic AI rather than simple API orchestration
- Advanced Vector Search Integration: Seamlessly combined TiDB's vector search capabilities with traditional text matching, creating a hybrid approach that outperforms either method alone
- Production-Ready System: Built a fully functional application deployed on Vercel with real-time processing visualization, comprehensive error handling, and responsive design
- Educational Value: Created a system that not only solves problems but teaches users about AI reasoning through transparent processing step visualization
- Technical Innovation: Developed confidence scoring, intelligent result ranking, and multi-step workflow visualization that transforms debugging from guesswork into systematic problem-solving
- Resilient Architecture: Built robust error handling and fallback mechanisms that gracefully handle API failures and database connectivity issues
What we learned
Vector Search & Embeddings
Gained deep understanding of how vector similarity search captures semantic relationships that traditional keyword matching misses. The practical differences between embedding dimensions became clear when switching between AI providers.
Database Compatibility Reality
Learned that "MySQL-compatible" doesn't guarantee perfect compatibility - edge cases exist that require alternative approaches and thorough testing.
Agentic AI Architecture
Building truly autonomous systems requires careful design of decision trees and validation logic, not just API orchestration.
API Integration Resilience
Switching AI providers mid-development highlighted the importance of abstraction layers and the complexity of maintaining consistency across different service capabilities.
User Experience in AI Applications
Visualizing AI processes builds user trust and understanding, transforming potentially opaque operations into educational experiences.
Production Deployment Challenges
Real-world deployment involves numerous configuration details and environment-specific issues that don't appear in development.
What's next for CodeSense Mini
Short-term Enhancements
Next 3 months
- IDE Integration: VS Code and JetBrains plugin development for seamless workflow integration
- Expanded Language Support: Additional programming languages and framework-specific error patterns
- Community Features: User-contributed error patterns and solution rating system
- Enhanced Analytics: Usage tracking and solution effectiveness metrics
Medium-term Vision
6-12 months
- Advanced Multi-step Reasoning: More sophisticated agentic workflows with external tool integration (GitHub API, package managers, documentation services)
- Code Execution Sandbox: Live testing of proposed solutions with safety constraints
- Team Collaboration: Shared knowledge base, team-specific error patterns, and collaborative debugging
- Learning System: Continuous improvement from user feedback and solution effectiveness tracking
Long-term Goals
1+ years
- Autonomous Bug Fixing: Direct code modification capabilities with approval workflows and version control integration
- Predictive Error Detection: Analyzing code patterns to prevent errors before they occur
- Enterprise Integration: SSO, audit logging, compliance features, and enterprise-grade security
- Advanced AI Models: Fine-tuned models for specific programming domains and error categories
Technical Roadmap
- External Tool Orchestration: Integration with more external services (Slack, JIRA, documentation APIs)
- Multi-modal Input: Support for screenshot-based error reporting and visual debugging
- Performance Optimization: Caching layers, request batching, and advanced database indexing
- Mobile Support: Native mobile applications for debugging on-the-go
CodeSense Mini represents just the beginning of how agentic AI can transform developer tooling, with enormous potential for expansion into comprehensive development assistance platforms.
Built With
- googlegeminiai
- mysql2
- nextjs14
- nodejs18
- tailwindcss
- tidbserverless
- vercel
Log in or sign up for Devpost to join the conversation.