mai-buddy
Copilot instructions2 starsChanged 58 days agoMITView on GitHub
- Reads credentials
- Installs packages
We split this copilot-instructions.md into the rules it gives an agent
19 rules. About 1 is common, 11 are distinctive, and 7 are very specific to this project.
≈1
Common · estimate
Many files like this have a rule of this kind.
≈11
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Common: line 36
Error Handling: Use try-catch blocks and provide descriptive error messages
- Distinctive: line 37
Async/Await: Prefer async/await over promises for asynchronous operations
- Distinctive: line 69
Never commit API keys or secrets to source code
- Distinctive: line 70
Use electron-store for secure storage of user credentials
- Distinctive: line 77
Use WebSocket protocol for MCP communication
- Distinctive: line 81
Keep main process lean, delegate heavy work to services
- Distinctive: line 82
Use IPC (Inter-Process Communication) for main/renderer communication
- Distinctive: line 88
Default trigger phrase is "Mai Buddy" (customizable)
- Distinctive: line 92
Use electron-store for persistent storage
- Very specific: line 104
Test command: npm test (Jest configuration)
- Very specific: line 106
Test MCP connections: npm run test-mcp
- Distinctive: line 109
Keep dependencies up to date but test thoroughly before upgrading
- Very specific: line 116
Create class in src/main/services/
- Very specific: line 118
Call initialize() in setupServices()
- Distinctive: line 119
Add IPC handlers if needed
- Very specific: line 122
Add connection definition in mcp-manager.js getAvailableMCPConnections()
- Very specific: line 124
Update MCP server routes in mcp-server.js if needed
- Very specific: line 128
Use PromptManager to construct combined prompts
- Distinctive: line 129
Test with different configurations (tech context, user context)
≈ “Common” is an estimate: at least 1 in 5 of the 3,669 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Copilot Instructions for Mai Buddy
Project Overview
Mai Buddy is a desktop AI agent application built with Electron that integrates GPT-4, ElevenLabs voice synthesis, and the Model Context Protocol (MCP) for extensibility. The application runs in the system tray and provides always-available AI assistance through voice and text interfaces.
Technology Stack
- Runtime: Node.js 18+
- Framework: Electron (desktop application)
- AI Integration: OpenAI GPT-4, GPT-4 Turbo, GPT-3.5 Turbo
- Voice Services: ElevenLabs text-to-speech
- Protocols: MCP (Model Context Protocol), WebSocket
- State Management: electron-store
- Dependencies: axios, ws, socket.io, express
Architecture
- Main Process (
src/main/): Electron main process handling window management, system tray, global shortcuts - Renderer Process (
src/renderer/): UI rendering and user interactions - Services (
src/main/services/):ai-service.js: OpenAI API integration and conversation managementvoice-service.js: ElevenLabs integration and speech recognitionmcp-manager.js: MCP connection management (GitHub and system integrations functional)mcp-server.js: Local MCP server implementationmcp-tools.js: MCP tool definitions and handlershotkey-manager.js: Global keyboard shortcut managementprompts/: System prompt management and templates
Code Style & Conventions
- Indentation: 2 spaces (enforced by ESLint)
- Quotes: Single quotes for strings
- Semicolons: Required at end of statements
- Naming:
- Classes use PascalCase (e.g.,
AIService,MCPManager) - Methods and variables use camelCase
- Constants use UPPER_SNAKE_CASE
- Classes use PascalCase (e.g.,
- Comments: Include file-level JSDoc comments explaining purpose
- Error Handling: Use try-catch blocks and provide descriptive error messages
- Async/Await: Prefer async/await over promises for asynchronous operations
Development Workflow
Installation
npm installRunning
npm start # Run the application
npm run dev # Development mode with hot reload
npm run watch # Watch mode with nodemonBuilding
npm run build # Build for current platform
npm run build-mac # macOS build
npm run build-win # Windows build
npm run build-linux # Linux buildCode Quality
npm run lint # Run ESLintImportant Guidelines
Security
- Never commit API keys or secrets to source code
- Use electron-store for secure storage of user credentials
- Validate all user inputs before processing
- Be cautious with nodeIntegration and contextIsolation settings
MCP Integration
- Currently, only GitHub and system integrations are fully functional
- MCP connections are work in progress - handle gracefully
- Use WebSocket protocol for MCP communication
- Store connection configurations in electron-store
Electron Best Practices
- Keep main process lean, delegate heavy work to services
- Use IPC (Inter-Process Communication) for main/renderer communication
- Implement proper window lifecycle management
- Handle platform differences (macOS, Windows, Linux)
Voice Features
- ElevenLabs integration is optional (gracefully degrade if not configured)
- Default trigger phrase is "Mai Buddy" (customizable)
- Speech recognition requires proper permissions
State Management
- Use electron-store for persistent storage
- Store user settings, API keys, conversation history
- Handle missing or corrupted store data gracefully
File Organization
- Main entry point:
src/main/main.js(MaiBuddyApp class) - Services: Self-contained service classes with clear responsibilities
- Renderer: UI code separate from main process logic
- Assets: Icons and resources in
/assetsdirectory - Config:
.env.examplefor environment variables template
Testing
- Test command:
npm test(Jest configuration) - Manual testing recommended for Electron UI features
- Test MCP connections:
npm run test-mcp
Dependencies
- Keep dependencies up to date but test thoroughly before upgrading
- Electron and OpenAI are core dependencies - handle breaking changes carefully
- Some packages have deprecation warnings but are stable (e.g., eslint@8.x)
Common Tasks
Adding a New Service
- Create class in
src/main/services/ - Initialize in
MaiBuddyAppconstructor - Call
initialize()insetupServices() - Add IPC handlers if needed
Adding MCP Connection
- Add connection definition in
mcp-manager.jsgetAvailableMCPConnections() - Implement tool handlers in
mcp-tools.js - Update MCP server routes in
mcp-server.jsif needed
Modifying System Prompts
- Edit templates in
src/main/services/prompts/config/ - Use
PromptManagerto construct combined prompts - Test with different configurations (tech context, user context)
Known Issues & Notes
- File paths in some services (e.g., ai-service.js) use forward slashes and assume Unix-like conventions; when adding cross-platform features, use
path.join()orpath.resolve()for compatibility - Some MCP connections are placeholders awaiting implementation
- Voice features require system permissions and may need platform-specific handling
- Global shortcuts may conflict with other applications
External Resources
Where files are headingNew Copilot instructions files have more rules about branches and pull requests, and fewer about code style.
Of the Copilot instructions files we read, the 2,297 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

