{"id":28376922,"url":"https://github.com/levonium/ai-email-assistant","last_synced_at":"2025-06-26T14:30:34.303Z","repository":{"id":283591833,"uuid":"952269415","full_name":"levonium/ai-email-assistant","owner":"levonium","description":"AI Email Assistant for checking your email and generating resnses.","archived":false,"fork":false,"pushed_at":"2025-03-21T02:46:38.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-25T03:54:51.860Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/levonium.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-21T02:21:23.000Z","updated_at":"2025-03-21T02:46:41.000Z","dependencies_parsed_at":"2025-03-21T03:28:34.950Z","dependency_job_id":"5e810f5c-dc94-456e-9c77-9e70b1fbe71e","html_url":"https://github.com/levonium/ai-email-assistant","commit_stats":null,"previous_names":["levonium/ai-email-assistant"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/levonium/ai-email-assistant","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levonium%2Fai-email-assistant","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levonium%2Fai-email-assistant/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levonium%2Fai-email-assistant/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levonium%2Fai-email-assistant/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/levonium","download_url":"https://codeload.github.com/levonium/ai-email-assistant/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levonium%2Fai-email-assistant/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262084464,"owners_count":23256241,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-30T00:38:39.370Z","updated_at":"2025-06-26T14:30:34.291Z","avatar_url":"https://github.com/levonium.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Email Assistant\n\nAn intelligent email assistant that processes incoming emails and generates responses using AI (OpenAI GPT, Anthropic Claude or Google Gemini). The service reads emails through IMAP, generates appropriate responses, and saves them as drafts if necessary. It features a learning system that improves responses based on your instructions and examples.\n\nCloned from [dmrrlc/ai-email-responder](https://github.com/dmrrlc/ai-email-responder)\n\n## Features\n\n- **Email Processing**:\n\n  - Monitors inbox for new unread emails\n  - Filters emails using customizable rules\n  - Marks processed emails as read\n  - Saves generated responses as drafts\n\n- **AI Integration**:\n\n  - Supports OpenAI GPT, Anthropic Claude and Google Gemini\n  - Customizable system prompts\n  - Temperature and token limit controls\n  - Conversation history tracking\n  - Context-aware responses using previous interactions\n\n- **Learning Capabilities**:\n\n  - Persistent training context\n  - Add new instructions while running\n  - Learn from your final edited responses\n  - Maintains conversation history per sender\n  - Uses recent examples to improve responses\n\n- **Service Management**:\n  - Systemd service integration\n  - Automatic restart on failure\n  - Rotating log files\n  - Health monitoring\n  - Graceful shutdown handling\n\n## Requirements\n\n- Python 3.7+\n- Email account with IMAP access\n- API key from OpenAI, Anthropic or Google\n\n## Installation\n\n1. Clone the repository:\n\n```bash\ngit clone [repository-url]\ncd email-assistant\n```\n\n2. Install required packages:\n\n```bash\nsource ./venv/bin/activate\npip install -r requirements.txt\n```\n\n3. Create a configuration file `config.yaml`:\n\nCopy and modify the `config.example.yaml` file.\n\nKeep either OpenAI, Anthropic or Google key and model values in the config file, that's what determines which service will be used.\n\n## Usage\n\nStart the assistant manually:\n\n```bash\nsource ./venv/bin/activate\npython3 email_assistant_service.py\n```\n\nRun the service in the background by setting up a cron job or use systemd. Use the `run_service.sh` file.\n\n## File Structure\n\n- `base_email_assistant.py`: Base class with shared functionality\n- `email_assistant_anthropic.py`: Anthropic Claude version of the assistant\n- `email_assistant_google.py`: Google Gemini version of the assistant\n- `email_assistant_openai.py`: OpenAI GPT version of the assistant\n- `email_assistant_service.py`: Service management\n- `config.yaml`: Configuration file\n- `training_context.json`: Stores learning context (created automatically)\n- `conversation_history.json`: Stores conversation history (created automatically)\n\n## Error Handling\n\nThe assistant includes comprehensive error handling:\n\n- Graceful handling of API failures\n- Automatic retry on network issues\n- Detailed error logging\n- Service health monitoring\n- Draft saving fallback mechanisms\n- Conversation history backup\n\n## Logging Configuration\n\nThe assistant supports two logging configurations:\n\n1. Development Mode (when running directly):\n\n   - Logs are stored in the `logs` directory in the project root\n   - Used when running with `run_service.sh`\n   - Stores process ID in `logs/email_assistant.pid`\n   - Redirects stdout/stderr to `logs/email_assistant.log`\n\n2. Production Mode (when running as systemd service):\n   - Logs are stored in `/var/log/email-assistant`\n   - Used when running as a systemd service\n   - Implements log rotation (10MB max size, 5 backup files)\n   - Proper system logging integration\n   - Better for production environments\n\n## Security Notes\n\n- Store your API keys and email credentials securely\n- Never commit config.yaml with real credentials\n- Consider using environment variables for sensitive data\n- Review generated responses before sending\n- Use App Passwords for Gmail and other accounts with 2FA\n- Run service as non-root user\n- Keep dependencies updated\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flevonium%2Fai-email-assistant","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flevonium%2Fai-email-assistant","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flevonium%2Fai-email-assistant/lists"}