AFKmate 🤖
Your AFK coding companion — AI-powered code analysis while you're away.
AFKmate is a Visual Studio Code extension that automatically analyzes your code after 3 minutes of inactivity, identifying structural issues, syntax errors, and potential bugs without requiring manual intervention.

✨ Features
💤 AFK-Powered Analysis
- Idle Detection: Automatically triggers analysis after 3 minutes of AFK time
- Smart File Tracking: Only analyzes files marked as "modified" in VS Code
- Zero Manual Debugging: Work on your code, go AFK, come back to insights
🎯 Comprehensive Error Detection
- Syntax Errors: Catches typos, missing semicolons, and language-specific syntax issues
- Structural Problems: Identifies architectural issues and code smell
- Logic Errors: Detects potential bugs that require debugging
- Style Issues: Suggests improvements for code readability and best practices
💡 Intelligent UI
- Side Panel Interface: Clean panel in your activity bar
- One-Click Analysis: "Analyze Now" button for instant feedback
- Clickable Issues: Jump directly to error locations with one click
- Categorized Results: Errors, warnings, and suggestions clearly organized
- Real-time Updates: See analysis progress and results instantly
🔌 LLM-Powered Backend
- Integrated with Vercel-deployed backend API
- Supports multiple LLM providers (OpenAI, Claude, Gemini)
- Configurable API endpoint and authentication
- Real-time analysis with 30-second timeout handling
📦 Installation
From Source (Development)
Clone the repository:
git clone https://github.com/tu-tu-op/afkmate.git
Install dependencies:
npm install
Compile the extension:
npm run compile
Press F5 to run in Extension Development Host
From VSIX (Coming Soon)
Download the .vsix file and install via:
code --install-extension afkmate-0.0.1.vsix
🚀 Usage
Automatic Analysis
- Open any project in VS Code
- Start editing files
- Go AFK for 3 minutes (grab coffee ☕)
- Come back to automatic analysis results in the AFKmate panel
Manual Analysis
- "Analyze Now" Button: Click the button in the AFKmate sidebar panel
- Command Palette (
Ctrl+Shift+P / Cmd+Shift+P):
AFKmate: Analyze Now - Trigger immediate analysis
Keyboard Shortcuts
You can customize keyboard shortcuts in VS Code settings:
- Open Command Palette → Preferences: Open Keyboard Shortcuts
- Search for "AFKmate"
⚙️ Configuration
Access settings via File → Preferences → Settings and search for "AFKmate":
| Setting |
Type |
Default |
Description |
afkmate.idleTimeMinutes |
number |
3 |
Minutes of inactivity before analysis starts |
afkmate.autoStart |
boolean |
true |
Automatically start analyzing when idle |
afkmate.apiUrl |
string |
https://ecospace-backend.vercel.app/api/analyze |
Backend API URL for code analysis |
afkmate.apiKey |
string |
"" |
API Key for backend authentication (optional) |
Example Settings
{
"afkmate.idleTimeMinutes": 5,
"afkmate.autoStart": true,
"afkmate.apiUrl": "https://your-backend.vercel.app/api/analyze",
"afkmate.apiKey": "your-api-key-here"
}
🏗️ Architecture
Project Structure
afkmate/
├── src/
│ ├── extension.ts # Main extension entry point
│ ├── idleDetector.ts # Idle time detection logic
│ ├── fileTracker.ts # Modified files tracker
│ ├── analyzer.ts # Code analysis engine with LLM integration
│ └── webview/
│ └── webviewViewProvider.ts # Panel UI provider
├── package.json # Extension manifest
└── tsconfig.json # TypeScript configuration
Key Components
1. Idle Detector
Monitors editor activity and triggers analysis after configured idle time:
- Tracks text changes, editor switches, and cursor movements
- Configurable idle threshold (default: 3 minutes)
- Automatic reset on any user activity
2. File Tracker
Maintains a list of modified files using VS Code's workspace API:
- Listens to
onDidChangeTextDocument events
- Tracks saved and unsaved changes
- Integrates with source control status
3. Code Analyzer
Core analysis engine with LLM integration:
- Collects VS Code's built-in diagnostics
- Connects to Vercel-deployed backend API
- Handles JSON parsing with markdown code block removal
- Returns structured error, warning, and suggestion data
4. Webview Panel
Custom UI displaying analysis results:
- Activity bar integration with AFKmate icon
- Interactive "Analyze Now" button
- Issue list with file navigation
- Real-time status updates
🔌 Backend Integration
AFKmate uses a Vercel-deployed backend for LLM-powered analysis.
Current Backend
- URL:
https://ecospace-backend.vercel.app/api/analyze
- Method: POST
- Timeout: 30 seconds
API Contract
Request Format:
{
"input": "file content here",
"fileName": "App.tsx",
"language": "typescript",
"analysisTypes": ["syntax", "structure", "logic", "style"]
}
Response Format:
{
"result": {
"errors": [
{
"line": 10,
"column": 5,
"severity": "error",
"message": "Missing semicolon",
"type": "syntax"
}
],
"warnings": [...],
"suggestions": [...]
}
}
Custom Backend Setup
To use your own backend:
- Deploy your LLM analysis API
- Update
afkmate.apiUrl in VS Code settings
- Optionally set
afkmate.apiKey for authentication
🛠️ Development
Prerequisites
- Node.js (v16 or higher)
- Visual Studio Code (v1.74.0 or higher)
- TypeScript knowledge
Build Commands
Install dependencies
npm install
Compile TypeScript
npm run compile
Watch mode (auto-compile on changes)
npm run watch
Run linter
npm run lint
Debugging
- Open project in VS Code
- Press
F5 to launch Extension Development Host
- Set breakpoints in TypeScript files
- View Debug Console for logs
Testing
npm test
🤝 Contributing
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature)
- Commit your changes (
git commit -m 'Add amazing feature')
- Push to the branch (
git push origin feature/amazing-feature)
- Open a Pull Request
Code Style
- Use TypeScript with strict mode enabled
- Follow VS Code extension best practices
- Add comments for complex logic
- Maintain consistent formatting with ESLint
📝 Roadmap
- [x] LLM integration with Vercel backend
- [x] One-click "Analyze Now" button
- [ ] Multiple LLM provider support (OpenAI, Claude, Gemini)
- [ ] Customizable analysis rules
- [ ] Multi-language support enhancements
- [ ] Performance optimizations for large files
- [ ] Diff-based analysis (analyze only changed lines)
- [ ] Team sharing of analysis configurations
- [ ] Integration with CI/CD pipelines
- [ ] Custom rule creation UI
🐛 Known Issues
- Backend responses with improperly escaped JSON may show as text suggestions
- Large files (>10MB) may cause performance delays
- Line-by-line extraction fallback for complex JSON responses
Report issues on GitHub Issues
📜 License
This project is licensed under the MIT License - see the LICENSE file for details.
👤 Author
Sushant Singh
🙏 Acknowledgments
- Inspired by automated code analysis tools
- Built with VS Code Extension API
- Backend deployed on Vercel
- LLM-powered analysis
📚 Resources
Made with ❤️ for developers who code better when they're AFK
If you find this extension helpful, please ⭐ star the repository!