agentleFS
djleamendjleamen/mai-buddy/.github/copilot-instructions.md

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
  1. Common:

    Error Handling: Use try-catch blocks and provide descriptive error messages

    line 36
  2. Distinctive:

    Async/Await: Prefer async/await over promises for asynchronous operations

    line 37
  3. Distinctive:

    Never commit API keys or secrets to source code

    line 69
  4. Distinctive:

    Use electron-store for secure storage of user credentials

    line 70
  5. Distinctive:

    Use WebSocket protocol for MCP communication

    line 77
  6. Distinctive:

    Keep main process lean, delegate heavy work to services

    line 81
  7. Distinctive:

    Use IPC (Inter-Process Communication) for main/renderer communication

    line 82
  8. Distinctive:

    Default trigger phrase is "Mai Buddy" (customizable)

    line 88
  9. Distinctive:

    Use electron-store for persistent storage

    line 92
  10. Very specific:

    Test command: npm test (Jest configuration)

    line 104
  11. Very specific:

    Test MCP connections: npm run test-mcp

    line 106
  12. Distinctive:

    Keep dependencies up to date but test thoroughly before upgrading

    line 109
  13. Very specific:

    Create class in src/main/services/

    line 116
  14. Very specific:

    Call initialize() in setupServices()

    line 118
  15. Distinctive:

    Add IPC handlers if needed

    line 119
  16. Very specific:

    Add connection definition in mcp-manager.js getAvailableMCPConnections()

    line 122
  17. Very specific:

    Update MCP server routes in mcp-server.js if needed

    line 124
  18. Very specific:

    Use PromptManager to construct combined prompts

    line 128
  19. Distinctive:

    Test with different configurations (tech context, user context)

    line 129

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
copilot-instructions.md

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 management
    • voice-service.js: ElevenLabs integration and speech recognition
    • mcp-manager.js: MCP connection management (GitHub and system integrations functional)
    • mcp-server.js: Local MCP server implementation
    • mcp-tools.js: MCP tool definitions and handlers
    • hotkey-manager.js: Global keyboard shortcut management
    • prompts/: 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
  • 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 install

Running

npm start       # Run the application
npm run dev     # Development mode with hot reload
npm run watch   # Watch mode with nodemon

Building

npm run build       # Build for current platform
npm run build-mac   # macOS build
npm run build-win   # Windows build
npm run build-linux # Linux build

Code Quality

npm run lint    # Run ESLint

Important 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 /assets directory
  • Config: .env.example for 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

  1. Create class in src/main/services/
  2. Initialize in MaiBuddyApp constructor
  3. Call initialize() in setupServices()
  4. Add IPC handlers if needed

Adding MCP Connection

  1. Add connection definition in mcp-manager.js getAvailableMCPConnections()
  2. Implement tool handlers in mcp-tools.js
  3. Update MCP server routes in mcp-server.js if needed

Modifying System Prompts

  • Edit templates in src/main/services/prompts/config/
  • Use PromptManager to 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() or path.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

Download now (ZIP)

  • 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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.