CodeMate: I Built a Coding Mentor for My Friend Who Keeps Getting Stuck
CodeMate: A Local AI Coding Mentor
Problem Statement
My friend is learning C++ and DSA, but faced a recurring issue: whenever he got stuck on a problem, the easiest solution was to ask an AI for the answer. While this solved individual problems, it didn't teach him how to solve subsequent ones. To address this, I built CodeMate, a local AI coding mentor designed around one simple rule: Don't give me the answer. Help me figure it out.
Core Capabilities
CodeMate provides several key features to facilitate independent learning:
- Progressive hints - Instead of immediately revealing solutions, the model gives one conceptual hint and waits for the learner to try again
- Explain mode - Breaks code into its purpose, variables, logic, example execution, and complexity
- Debug mode - Identifies errors, explains causes, and suggests the smallest useful correction
- Practice mode - Generates progressively harder problems based on concepts the learner has struggled with
Architecture
CodeMate is built around a locally running open-weight AI model rather than a proprietary AI API. The architecture flows as follows:
React Frontend ↓ FastAPI Backend ↓ CodeMate Learning Engine ↓ Ollama ↓ Open-weight LLM ↓ Personalized response
The system includes distinct operational modes tailored to different learning situations:
Hint Mode
The model is instructed not to immediately reveal the complete solution. It provides one conceptual hint and waits for the learner to attempt again.
Debug Mode
Instead of rewriting entire programs, this mode identifies errors, explains their causes, and suggests minimal corrections.
Explain Mode
Breaks code down into its purpose, variables, logic, example execution, and computational complexity.
Practice Mode
Generates increasingly difficult problems based on concepts the learner has previously struggled with.
Why Open Innovation Matters
Using an open-weight model locally was intentional and offers several advantages over proprietary APIs:
- Privacy - Code and learning data can remain on the user's device
- Offline capability - The core AI works without an internet connection after installation
- Model freedom - The underlying model can be replaced without rebuilding the entire product
- Behavioral control - Tutoring behavior can be adjusted through custom prompts and application logic
- No per-request API cost - Local inference eliminates pay-per-query fees from proprietary providers
Open innovation also allowed the author to inspect, adapt, and build around the AI itself rather than merely consuming it through an API.
User Experience
After releasing the first version, I shared CodeMate with my friend and had them use it without explanation. Their feedback was:
"Honestly, CodeMate was helpful because it didn't immediately give me the solution. The hints made me think about the problem myself, which helped me understand the logic better. I especially liked the Debug Mode because it explained what was wrong with my code instead of just giving me the corrected code. One thing I would improve is the hint system. Sometimes the first hint was a little too vague, so having a 'Give me a stronger hint' option would make it easier when I'm completely stuck."
This feedback shifted my perspective: overall, I would actually use it while practicing DSA because it feels more like having someone guide me rather than simply providing answers.
Key Learnings
The most significant lesson was that building for a specific person matters far more than creating a generic coding assistant. A generic assistant tries to help everyone, but CodeMate started with one person, one problem, and one question: What would actually help my friend learn instead of simply finishing the problem?
Future Development
If I continue developing CodeMate, here are planned enhancements:
- Better long-term learning profiles
- More accurate misconception detection
- Voice-based tutoring
- More efficient models for low-end laptops
- Personalized revision plans
- Support for additional programming languages
Demo & Repository
The project remains active and open-source, embodying the principle of being a learning layer between "I'm stuck" and "I understand it now."
Comments
No comments yet. Start the discussion.