InboxSentinel is a state-of-the-art AI Agent designed for high-stakes productivity. It doesn't just "filter" emailsβit remembers your professional history, triages incoming messages by importance, and lets you respond to critical business leads from Telegram with a single click.
Why we use JSON?": We chose a JSON-based persistent memory to keep the agent lightweight and privacy-focused, ensuring all user data stays local and easily auditable without third-party cloud database overhead.
In 2026, we are drowning in "Smart" newsletters and junk. Critical emails from clients or partners often get lost in the noise. Managing these on a mobile device is clunky, and standard "Auto-Reply" bots sound like robots.
InboxSentinel bridges the gap between Automation and Authenticity:
- π― Priority Triage: Uses LLM intent analysis to ignore junk and only notify you of high-value interactions.
- π§ Deep Memory (RAG): It scans your
clean_memory.json(past interactions) to ensure drafts match your specific tone and previous context. - π± Zero-Friction UI: Receive a notification on Telegram while on the move, review the AI draft, and click "Send"βall without opening a laptop.
- βοΈ Dynamic Refinement: Not happy with a draft? Use the
alteroreditcommands to tweak the AI's response in real-time.
- Model:
arcee-ai/trinity-large-preview(via OpenRouter) for high-reasoning drafting. - Backend: Python 3.x
- Communication: IMAP (Gmail) for ingestion, SMTP for secure transmission.
- Interface: Telebot (Telegram API) for the mobile "Command Center."
- Database: JSON-based persistent memory (Cleaned & Pre-processed).
- Ingest: Monitor Gmail via IMAP for new unread messages.
- Filter: AI classifies the email as
ImportantorJunk. - Recall: If important, the agent pulls the last 5-10 interactions with that sender.
- Draft: AI generates a concise, professional reply using that history.
- Human Approval: You receive a Telegram alert with buttons to Send, Alter, or Ignore.
- Update: Once sent, the conversation is saved back to
clean_memory.jsonto improve future drafts.
| Feature | Normal AI Email Writer | My Project |
|---|---|---|
| User must paste email | β | β |
| Works automatically | β | β |
| Remembers past interactions | β | β |
| Learns communication style | β | β |
| Filters importance | β | β |
| Has workflow loop | β | β |
| Acts like assistant | β | β |
To get InboxSentinel AI running on your local machine, follow these steps.
Ensure you have Python 3.9+ installed. You will also need a Telegram Bot Token (from BotFather) and a Google App Password if you are using Gmail.
Run the following command to install all necessary dependencies for the AI engine, mail handling, and Telegram interface:
pip install imap-tools pyTelegramBotAPI openai beautifulsoup4 python-dotenvSince InboxSentinel AI interacts directly with your inbox, you must use a Google App Password. Standard passwords will not work due to Google's security protocols.
Google only allows App Passwords if your account is secured with 2FA.
- Go to your Google Account Settings.
- On the left navigation panel, select Security.
- Under "How you sign in to Google," ensure 2-Step Verification is turned ON.
- Follow the on-screen prompts to link your phone or backup codes.
- Once 2-Step Verification is active, go to the App Passwords Page.
- App Name: Enter
InboxSentinel(or any name you prefer). - Click Create.
- Copy the 16-character code in the yellow bar.
β οΈ Important: This is the only time you will see this code. Paste it directly into your.envfile under thePASSWORDfield.
Ensure your Gmail is ready to talk to the AI Agent:
- Open Gmail in your browser and go to Settings (gear icon) > See all settings.
- Click the Forwarding and POP/IMAP tab.
- In the "IMAP access" section, select Enable IMAP.
- Click Save Changes at the bottom.
While InboxSentinel AI can be hosted on any cloud provider (AWS, Heroku, Railway), we have optimized this version for Google Colab to leverage high-speed processing and easy storage integration via Google Drive.
To ensure your clean_memory.json persists even after your Colab session ends, run the following snippet in your notebook:
from google.colab import drive
drive.mount('/content/drive')
# Change directory to your project folder
import os
os.chdir('/content/drive/My Drive/Next-Byte/')For InboxSentinel AI to provide contextually accurate responses, it needs to understand your communication style and past interactions. This is achieved through an initial data extraction phase.
Unlike standard bots, InboxSentinel uses a Local Memory Engine. By extracting your past emails:
- Relationship Context: The AI knows if a sender is a long-term client or a new contact.
- Tone Matching: The agent learns how you typically greet, sign off, and structure your professional replies.
- Contextual RAG: When a new mail arrives, the system retrieves relevant historical snippets to ensure the draft is grounded in fact, not hallucinations.
Before running the main agent, you need to populate your local clean_memory.json.
- Navigate to the
Extract-mail.pyfile in this repository. - Ensure your
.envcredentials are set. - Run the extraction script: Extract-mail.py in my repo
- Run the Cleaning scrip to clean your Extracted json from: clean-json.py in my repo
InboxSentinel AI is model-agnostic, but it is optimized for high-reasoning tasks. We use OpenRouter as our gateway to access the worldβs most powerful Large Language Models (LLMs).
- Visit OpenRouter.ai.
- Sign up using your Google account or email.
- Go to any model you like in the dashboard and click "Quickstart" where you get "Create API key".
- Copy your key and paste it into your
.envfile underOPENROUTER_API_KEY.
While you can use any model available on OpenRouter (GPT-4, Claude 3, etc.), we recommend and use:
- Model:
arcee-ai/trinity-large-preview:free - Why? It offers exceptional Reasoning Capabilities, allowing the agent to understand complex email threads and nuances.
- Cost: This specific model is currently free to use, making this project highly accessible and cost-effective.
To receive notifications and control the AI agent from your phone, you need to create your own Telegram Bot.
- Open Telegram and search for @BotFather.
- Send the command
/newbot. - Give your bot a Name (e.g.,
MySentinel) and a Username (ending in_bot). - Copy the API Token provided and paste it into your
.envfile underTELEGRAM_TOKEN.
The bot needs to know who to send the emails to.
- Start a chat with your new bot and send any message (e.g., "Hello").
- Search for @userinfobot in Telegram.
- Send a message to it, and it will reply with your ID (a string of numbers).
- Paste this ID into your
.envfile underCHAT_ID.
Once you have configured the .env file, you are ready to launch InboxSentinel.
The "brain" of this project is located in main-code.py. This script handles the real-time monitoring of your inbox, AI reasoning, and Telegram interaction.
- For Permanent Use: Since the agent needs to run 24/7 to monitor your mail, we recommend a VPS or a paid hosting plan (like Railway, Heroku, or a Raspberry Pi).
- For Testing (Free): If you are just testing or presenting, Google Colab works perfectly.
- Upload the repo files to your Google Drive.
- Run the script in a Colab cell using
!python main.py. - Note: Ensure your Colab session doesn't time out during the monitoring phase.
You are now ready to go. Run the script, sit back, and let InboxSentinel AI turn your cluttered inbox into a high-performance executive feed.