CodeMuse - AI Co-Developer
Your personal AI coding assistant that learns and adapts to YOUR unique coding style.
CodeMuse is a VS Code extension that observes your coding patterns, learns from them, and provides personalized AI-powered suggestions that match your style. Built with local-first privacy using SQLite for learning data and powered by Google's free-tier Gemini API.
Features
Right-click any selected code to access:
- Refactor Code - AI-powered refactoring that preserves your coding style
- Explain Code - Plain-English explanations with complexity analysis
- Suggest Improvement - Performance and readability recommendations
- Generate Comments - Add contextual comments following your style
- Debug This - Identify potential issues with actionable fixes
- Search on Google - Quick browser search for selected text
- Ask ChatGPT - Open ChatGPT with your selection
Side Panel Chat (Ctrl+Shift+C)
- Interactive AI assistant within VS Code
- Ask questions about your code with full file context
- Get instant answers without leaving your editor
Adaptive Learning Mode
CodeMuse tracks (locally!) your coding patterns when Learning Mode is ON:
- Variable naming conventions
- Indentation preferences (tabs/spaces, size)
- Comment density and style
- Function length patterns
- Problem-solving sequences
All learning data is stored locally in SQLite - nothing is sent to the cloud.
Learning Analytics Dashboard
View your coding metrics in real-time:
- Total coding sessions and time
- "Stuck moments" tracking (Ctrl+Shift+H when you need help)
- Style profile breakdown
- Most edited files
- Export learning reports to Markdown
Smart "Get Help" Feature (Ctrl+Shift+H)
When you're stuck:
- Press
Ctrl+Shift+H
- CodeMuse analyzes your current context
- Logs the "stuck moment" locally
- Provides AI-powered debugging suggestions
- Track your progress in resolving issues
Installation
Prerequisites
- VS Code version 1.80.0 or higher
- Node.js 18+ installed
- Gemini API Key (free tier available)
Get Your Gemini API Key (Free!)
- Visit https://makersuite.google.com/app/apikey
- Click "Create API Key"
- Copy your key
Install the Extension
Option 1: From Source (Development)
cd C:\Users\Saksham\codemuse-vscode
npm install
npm run build
code --install-extension codemuse-1.0.0.vsix
Option 2: Build and Install
npm install
npm run package
code --install-extension codemuse-1.0.0.vsix
- Open VS Code Settings (
Ctrl+,)
- Search for "CodeMuse"
- Enter your Gemini API key in
codemuse.geminiApiKey
- (Optional) Choose model:
gemini-1.5-flash (recommended for free tier)
Usage
Quick Start
Enable Learning Mode (enabled by default)
- Click the CodeMuse status bar item to toggle
- When ON: "🤖 CodeMuse"
- When OFF: "🤖 CodeMuse (Paused)"
Select Code and Right-Click
- All context menu options appear
- Try "Explain Code" for a quick demo
Open Side Panel
- Press
Ctrl+Shift+C or click CodeMuse icon in Activity Bar
- Chat tab: Ask questions
- Learning Analytics tab: View your stats
When You're Stuck
- Press
Ctrl+Shift+H
- Get contextual debugging help
- CodeMuse logs it and tracks resolution
Keyboard Shortcuts
Ctrl+Shift+C - Open Chat Panel
Ctrl+Shift+H - Get Help (When Stuck)
Settings
| Setting |
Default |
Description |
codemuse.geminiApiKey |
"" |
Your Gemini API key |
codemuse.learningMode |
true |
Enable/disable pattern tracking |
codemuse.offlineMode |
false |
Work without API calls (local analysis only) |
codemuse.modelName |
gemini-1.5-flash |
Gemini model to use |
Offline Mode
Enable "Offline Mode" in settings to:
- Disable all Gemini API calls
- Continue tracking coding patterns locally
- View analytics without AI features
Architecture
Local-First Privacy
- SQLite Database stores all learning data in
~/.vscode/globalStorage/codemuse
- No cloud sync - your data never leaves your machine
- No telemetry - we don't track anything except locally
Tech Stack
- Extension: TypeScript + VS Code API
- AI: Google Gemini API (free tier:
gemini-1.5-flash)
- Storage: SQLite via
better-sqlite3
- Browser Integration: Node.js
open package
Project Structure
codemuse-vscode/
├── src/
│ ├── extension.ts # Main entry point
│ ├── commands/
│ │ └── index.ts # All command handlers
│ ├── panels/
│ │ ├── ChatPanel.ts # Chat WebView
│ │ └── AnalyticsPanel.ts # Analytics WebView
│ └── utils/
│ ├── gemini.ts # Gemini API wrapper
│ └── learning.ts # SQLite learning system
├── media/
│ ├── icon.svg # Extension icon
│ └── css/ # WebView styles
├── package.json # Extension manifest
├── tsconfig.json # TypeScript config
├── esbuild.js # Build script
└── README.md # This file
Development
Build Commands
# Install dependencies
npm install
# Compile TypeScript
npm run compile
# Watch mode (development)
npm run watch
# Build for production
npm run build
# Package extension
npm run package
Testing
- Open project in VS Code
- Press
F5 to launch Extension Development Host
- Test commands and features
- Check Output → CodeMuse for logs
Debugging
- Extension Logs: Output → CodeMuse
- WebView Logs: Right-click panel → Inspect Element → Console
- Database: Located at
%APPDATA%\Code\User\globalStorage\codemuse\codemuse-learning.db
Free-Tier Optimization
CodeMuse is designed to work efficiently within Gemini's free tier:
- Minimal API Calls - Only when you explicitly request AI features
- Prompt Optimization - Concise prompts to reduce token usage
- Local Analysis - Style detection happens locally without AI
- Batch Support - Future versions will batch requests
- Model Choice - Default to
gemini-1.5-flash (faster + cheaper)
Free Tier Limits (as of 2024)
- Gemini 1.5 Flash: 15 requests/minute, 1M tokens/day
- Gemini 1.5 Pro: 2 requests/minute, 50K tokens/day
Future Enhancements
- [ ] OpenAI/Anthropic model support
- [ ] Embedding-based context analysis
- [ ] Cloud sync (optional) for multi-device
- [ ] Team style profiles
- [ ] Inline code suggestions
- [ ] Auto-refactor on save
- [ ] VS Code Copilot integration
Contributing
Contributions welcome! Feel free to:
- Report bugs via GitHub Issues
- Submit pull requests
- Suggest features
- Improve documentation
Troubleshooting
Extension Not Loading
- Check VS Code version (must be 1.80+)
- Reload VS Code:
Ctrl+Shift+P → "Reload Window"
- Check Extension Host logs: Help → Toggle Developer Tools
API Key Issues
- Verify key is correct in settings
- Check key permissions at Gemini API Console
- Try switching to
gemini-pro model
SQLite Errors
- Ensure write permissions to
globalStorage folder
- Delete
codemuse-learning.db to reset (data will be lost)
Commands Not Showing
- Check you've selected code before right-clicking
- Reload VS Code
- Reinstall extension
FAQ
Q: Is my code sent to Google?
A: Only when you explicitly use AI features (refactor, explain, etc.). Learning/tracking happens locally.
Q: Can I use this offline?
A: Yes! Enable "Offline Mode" to disable AI features but keep local tracking.
Q: Will this slow down VS Code?
A: No. Learning analysis runs asynchronously with minimal performance impact.
Q: Can I export my learning data?
A: Yes! Go to Learning Analytics → Export Report.
Q: Is my API key secure?
A: Yes, it's stored in VS Code's secure settings. Never commit it to version control.
License
MIT License - see LICENSE file
Credits
Built with:
Made with ❤️ for developers who value their unique coding style
Support: GitHub Issues