Understand Your Code Better with Local AI - No Cloud Required
As a developer, I've always struggled with understanding complex codebases, especially when jumping into unfamiliar projects or revisiting old code. That's why I built ClarifAI - a free, privacy-focused Visual Studio Code extension that uses local AI models to explain code and suggest improvements, all running on your own machine.
What is ClarifAI?
ClarifAI (yes, the pun is intentional!) is a VS Code extension that brings the power of AI code analysis directly into your IDE. Unlike cloud-based AI coding assistants that send your code to external servers, ClarifAI runs completely locally using Ollama, ensuring your proprietary code never leaves your computer.
Key Features
- Instant Code Explanations: Select any code snippet and get detailed explanations in plain English
- Smart Enhancement Suggestions: Receive AI-powered recommendations to improve code quality, performance, maintainability, and readability
- 100% Local & Private: Your code stays on your machine - no cloud uploads, no privacy concerns
- Real-time Streaming: Get instant feedback as the AI generates responses
- Beautiful Interface: Clean, intuitive sidebar panel with markdown rendering and syntax highlighting
- Universal Language Support: Works with any programming language VS Code supports
- Completely Free: No subscriptions, no API costs, no hidden fees
Why I Built ClarifAI
This is my first VS Code extension, and I created it to solve a real problem I faced daily: understanding what code actually does without spending hours tracing through logic. Whether it's legacy code, unfamiliar frameworks, or even my own code from six months ago, having an AI assistant that can explain and suggest improvements has been a game-changer.
How to Use ClarifAI
Using ClarifAI is incredibly simple. Here's a quick walkthrough:
1. Installation & Setup
First, you need to install two things:
-
Install Ollama from ollama.ai - this is the local AI runtime that powers ClarifAI
-
Download an AI model. I recommend starting with
deepseek-coder- it's only 800MB, fast, and excellent at explaining code:ollama pull deepseek-coderOther great models for code analysis:
codellama- Meta's specialized code modelphind-codellama- Fine-tuned for coding tasksmistral- Great all-around model with solid code capabilities
-
Install ClarifAI from the VS Code Extensions Marketplace (search for "ClarifAI" or "clarif-ai")
2. Analyzing Your Code
Once installed, here's how to use ClarifAI:
-
Open any code file in VS Code (JavaScript, Python, Go, Rust - anything works!)
-
Select the code you want to analyze - it can be a single function, a class, or an entire file
-
Click the ClarifAI icon in the left sidebar to open the panel
-
Choose your AI model from the dropdown (e.g.,
deepseek-coder) -
Select the analysis mode:
- Explain Code: Get a detailed breakdown of what the code does
- Suggest Enhancements: Get recommendations for improvements
-
Click "Analyze Selected Code" and watch as the AI streams its analysis in real-time
Example: Analyzing an HTTP Contact Form
Let me show you a real example. Say you have an HTTP endpoint that handles contact form submissions. You're reviewing it for security and want to understand exactly what it does:
- Select the entire function or route handler
- Choose the "Explain Code" mode
- Click Analyze
ClarifAI will provide:
- A high-level summary of what the code does
- Explanation of each function and its purpose
- Details about data flow and dependencies
- Potential security considerations
Then, switch to "Suggest Enhancements" mode and analyze the same code again. ClarifAI might suggest:
- Input validation improvements
- Better error handling
- Performance optimizations
- Security enhancements like rate limiting or sanitization
- Code readability improvements
Why ClarifAI Stands Out
Privacy First
Unlike GitHub Copilot, Cursor, or other cloud-based AI coding tools, ClarifAI runs entirely on your local machine. Your proprietary code, trade secrets, and sensitive logic never leave your computer.
No Subscription Fees
No monthly costs, no API tokens, no usage limits. Once you have Ollama installed, ClarifAI is completely free forever.
Flexible Model Selection
You're not locked into a single AI model. Choose from dozens of open-source models optimized for different tasks, or use smaller models on less powerful hardware.
Works Offline
No internet connection? No problem. ClarifAI works perfectly offline since everything runs locally.
Beginner Friendly
Whether you're a junior developer trying to understand a senior's code, or an experienced developer exploring a new codebase, ClarifAI makes code comprehension accessible.
Real-World Use Cases
1. Code Reviews
Before reviewing a pull request, use ClarifAI to understand the changes quickly and identify potential issues.
2. Legacy Code Exploration
Working with a 10-year-old codebase with no documentation? ClarifAI can explain what each module does.
3. Learning New Languages
Picking up Rust or Go? Analyze example code to understand language-specific patterns and idioms.
4. Security Audits
Use the enhancement suggestions to identify potential security vulnerabilities in authentication, data handling, or API endpoints.
5. Refactoring Guidance
Get suggestions on how to improve code structure, reduce complexity, and follow best practices.
6. Documentation Assistance
Understand complex algorithms or business logic before documenting them.
What's Coming Next
I'm actively developing ClarifAI and have exciting features planned:
Prompt Generation for AI Coding Assistants
One feature I'm particularly excited about is automatic prompt generation. ClarifAI will analyze your code and generate optimized prompts you can use with your favorite AI coding assistant - whether that's Claude Code, GitHub Copilot, Cursor, or any other tool.
Imagine selecting buggy code, clicking a button, and getting a perfectly formatted prompt that you can paste into your AI assistant:
"This TypeScript function handles user authentication but has a race condition in the token refresh logic. Refactor it to use proper async/await patterns and add error handling for network failures."
Other Planned Features
- Analysis History: Keep track of previous analyses and refer back to them
- Custom Prompts: Create your own analysis modes tailored to your workflow
- Batch Analysis: Analyze multiple files or entire directories at once
- Debugging Mode: Specialized analysis for bug hunting and troubleshooting
- Performance Profiling Suggestions: Get optimization recommendations based on code patterns
- Documentation Generation: Automatically generate code comments and docs
Technical Details
Built With
- TypeScript: Core extension logic
- VS Code Extension API: Native integration with VS Code
- Ollama API: Local AI model inference
- Webview API: Custom sidebar panel with rich UI
How It Works
ClarifAI uses the VS Code Extension API to capture your code selection, then sends it to Ollama running locally on your machine. The AI model processes the code and streams the response back, which is rendered in a beautiful markdown format with syntax highlighting.
Performance
Thanks to streaming responses and efficient local processing, ClarifAI provides near-instant feedback. Smaller models like deepseek-coder can analyze typical functions in under 2 seconds on modern hardware.
Installation Guide
Quick Install
- Open VS Code
- Go to Extensions (
Ctrl+Shift+XorCmd+Shift+X) - Search for "ClarifAI"
- Click Install
Manual Install from VSIX
- Download the
.vsixfile from the GitHub releases - Open VS Code
- Go to Extensions view
- Click the
...menu "Install from VSIX..." - Select the downloaded file
Install Ollama
- Visit ollama.ai
- Download for your OS (Windows, Mac, or Linux)
- Install and ensure the service is running
- Pull a model:
ollama pull deepseek-coder
Community & Support
Get Involved
- P Star the project on GitHub
- Report bugs or request features via GitHub Issues
- Share your experience - leave a review on the VS Code Marketplace
- Contribute - Pull requests are welcome!
Need Help?
- Check the GitHub Issues for common problems
- Visit my website: abdulkadersafi.com
- Email: safi.abdulkader@gmail.com
Tips & Best Practices
Choosing the Right Model
- For speed: Use
deepseek-coder(800MB) - perfect for quick explanations - For detail: Use
codellama:13b- more thorough but slower - For general code: Use
mistral- good all-rounder
Getting Better Results
- Select relevant code: Don't analyze entire files unless necessary
- Be specific: Analyze functions or logical blocks for clearer explanations
- Use both modes: First explain code, then get enhancement suggestions
- Experiment with models: Different models have different strengths
Performance Tips
- Keep Ollama running in the background to avoid startup delays
- Use smaller models on laptops or machines with limited RAM
- Close other heavy applications when running larger models
Comparison with Other AI Coding Tools
| Feature | ClarifAI | GitHub Copilot | Cursor | Claude Code |
|---|---|---|---|---|
| Privacy | 100% Local | Cloud-based | Cloud-based | Cloud-based |
| Cost | Free Forever | $10/month | $20/month | Varies |
| Offline | Yes | No | No | No |
| Code Explanation | Yes | Limited | Yes | Yes |
| Enhancement Suggestions | Yes | Yes | Yes | Yes |
| Model Choice | Dozens | Fixed | Few | Few |
| Open Source | Yes | No | No | No |
Conclusion
ClarifAI represents my vision for what AI coding assistance should be: free, private, and accessible to everyone. Whether you're a student learning to code, a professional developer working with sensitive codebases, or someone who simply values privacy, ClarifAI is built for you.
This is my first VS Code extension, and while I'm proud of what it can do, I know there's room for improvement. I'm committed to actively developing ClarifAI based on community feedback and making it the best local AI code analysis tool available.
Try ClarifAI Today
Download ClarifAI from the VS Code Marketplace and experience the power of local AI code analysis. No account needed, no credit card required, no cloud uploads - just install and start understanding your code better.
Frequently Asked Questions (FAQ)
Q: Is ClarifAI really free?
A: Yes! ClarifAI is completely free and open source. There are no hidden costs, no premium tiers, and no subscriptions.
Q: How does ClarifAI protect my privacy?
A: ClarifAI runs entirely on your local machine using Ollama. Your code never leaves your computer, unlike cloud-based alternatives.
Q: What programming languages does ClarifAI support?
A: ClarifAI works with any language that VS Code supports - JavaScript, TypeScript, Python, Java, C#, Go, Rust, PHP, Ruby, and many more.
Q: Do I need a powerful computer to run ClarifAI?
A: Not necessarily. Smaller models like deepseek-coder (800MB) run smoothly on most modern laptops. For better performance, 8GB RAM is recommended.
Q: Can I use ClarifAI offline?
A: Yes! Once you have Ollama and your models installed, ClarifAI works perfectly without an internet connection.
Q: How does ClarifAI compare to GitHub Copilot?
A: While Copilot focuses on code completion, ClarifAI specializes in code explanation and analysis. ClarifAI is also free, private, and runs locally.
Q: Can I contribute to ClarifAI development?
A: Absolutely! The project is open source on GitHub. Contributions, feature requests, and bug reports are all welcome.
Q: What if I find a bug?
A: Please report it on the GitHub Issues page. I actively monitor and respond to issues.
Q: Will ClarifAI work on Windows/Mac/Linux?
A: Yes! ClarifAI works on all platforms that support VS Code and Ollama (Windows, macOS, and Linux).
Q: How fast is the analysis?
A: With models like deepseek-coder, most functions are analyzed in under 2 seconds. Larger code selections may take longer depending on your hardware.
š¤ Need a Custom RSVP System or Dashboard?
I help businesses build tools that actually work , even on tight deadlines.
Whether you're planning an event, need internal tools, or want a custom dashboard for your team , I can help.
Reach out
š§ Email: safi.abdulkader@gmail.com | š» LinkedIn: @abdulkader-safi | š± Instagram: @abdulkader.safi | š¢ DSRPT
Drop me a line, Iām always happy to collaborate! š