An autonomous pantry and grocery budget agent that runs on a VPS and is orchestrated by the Hermes Agent.
GroceryMind:
- Tracks your pantry inventory and predicts when items will run out.
- Looks up (or estimates) prices at multiple grocery stores.
- Updates a simple monthly budget file.
- Sends you a Telegram receipt after each run.
- Can be triggered manually or on a schedule via Hermes cron.
📹 Demo video: GroceryMind + Hermes walkthrough
cron_trigger.py– main entrypoint; orchestrates a full GroceryMind run.data/pantry.json– current pantry inventory and consumption data.data/budget.json– monthly grocery budget and transaction history.scripts/consumption.py– computesdays_leftper item and flags low/critical stock.scripts/scraper.py– calls Firecrawl to search store websites and estimate prices.scripts/purchaser.py– "mock" purchases: updates pantry + budget JSON files.scripts/notifier.py– sends a Telegram receipt with what was (auto-)purchased.
flowchart LR
User[You on Telegram / CLI] -->|/grocerymind or cron| Hermes[Hermes Agent]
Hermes -->|terminal tool| VPS[(VPS)]
VPS -->|python3 cron_trigger.py| CronTrigger[cron_trigger.py]
CronTrigger --> Consumption[scripts/consumption.py\npantry check]
CronTrigger --> Scraper[scripts/scraper.py\nFirecrawl price search]
CronTrigger --> Purchaser[scripts/purchaser.py\nupdate pantry + budget]
CronTrigger --> Notifier[scripts/notifier.py\nTelegram receipt]
Consumption --> PantryFile[data/pantry.json]
Purchaser --> PantryFile
Purchaser --> BudgetFile[data/budget.json]
Notifier --> Telegram[Telegram Chat]
-
Pantry check
scripts/consumption.calculate_days_left()loadsdata/pantry.json.- For each item, it computes: [ \text{days_left} = \frac{\text{quantity}}{\text{daily_consumption}} ]
- Items are labeled:
- 🔴 CRITICAL –
days_left <= 1 - 🟡 LOW –
days_left <= threshold_days - 🟢 OK – otherwise
- 🔴 CRITICAL –
- All CRITICAL/LOW items are returned as the "to buy" list.
-
Best price search
- For each low item,
scripts/scraper.search_price():- Builds a search URL for Rewe, Aldi, and Lidl.
- Calls the Firecrawl API with an extraction prompt:
Find the price of {item} in euros. Return only the lowest price as a number.
- Parses the response and picks the cheapest store.
- If scraping fails, it falls back to a random "mock" price so the demo still works.
- For each low item,
-
Mock purchase + budget update
scripts/purchaser.mock_purchase():- Updates the pantry:
- Restocks the item to 14 days of consumption.
- Updates
quantity,days_left, andpreferred_store.
- Updates the budget in
data/budget.json:- Increments
spent_this_month. - Recomputes
remaining. - Appends a transaction with
auto_purchased: true.
- Increments
- Updates the pantry:
-
Telegram receipt
scripts/notifier.notify()formats a Markdown message with:- Each purchased item, price, and store.
- Total spent in this run.
- Remaining monthly budget.
- Sends it to your configured Telegram chat via
python-telegram-bot.
-
Orchestration
cron_trigger.run_grocery_check()ties everything together:- Step 1 – pantry check.
- Step 2 – best prices.
- Step 3 – mock purchases.
- Step 4 – Telegram notification + summary.
On the VPS where you run GroceryMind:
- Python 3.10+ with:
requestspython-dotenvpython-telegram-bot
- Hermes Agent installed and configured.
- API keys and tokens stored in
~/.hermes/.env:OPENROUTER_API_KEY(or other LLM provider key for Hermes)FIRECRAWL_API_KEYTELEGRAM_BOT_TOKENTELEGRAM_ALLOWED_USERS(comma-separated Telegram user IDs)
Important: The project root /root/grocerymind also has a local .env, but it is not committed to git and should never contain secrets for this public repo.
From the VPS shell:
cd /root/grocerymind
python3 cron_trigger.pyThis will:
- Print a step-by-step log in the terminal.
- Update
data/pantry.jsonanddata/budget.json. - Attempt to send a Telegram notification if env vars are configured.
You can also test individual components:
python3 scripts/consumption.py # show pantry status + low items
python3 scripts/scraper.py # test price scraping for "milk"
python3 scripts/purchaser.py # test a single mock purchase
python3 scripts/notifier.py # send a sample Telegram receiptHermes runs on the same VPS and manages:
- Terminal commands (to run
python3 cron_trigger.py). - Secrets in
~/.hermes/.env. - Messaging gateways (Telegram, Discord, Slack, WhatsApp).
- A built-in cron scheduler.
A grocerymind skill can:
- Explain what this project does.
- Run
python3 /root/grocerymind/cron_trigger.pyon demand. - Summarize what was purchased and the remaining budget after each run.
Once installed, you can simply type:
/grocerymind
Run GroceryMind now.
from within Hermes (CLI or Telegram), and the agent will call the terminal tool to execute the script.
Inside a Hermes chat:
/cron add "0 8 * * *" "Run python3 /root/grocerymind/cron_trigger.py and then summarize what was purchased and the remaining budget."
Hermes' gateway + cron scheduler will:
- Run GroceryMind every morning at 08:00.
- Deliver the summary to your chosen "home" channel (e.g. Telegram).
Make sure the gateway is running:
hermes gateway install # once, to install as a service
hermes gateway start # start the service- Pantry items – Edit
data/pantry.jsonto add or adjust items:daily_consumptionshould reflect your real usage.threshold_dayscontrols when an item is considered "low".avg_priceandpreferred_storeact as fallbacks when scraping fails.
- Budget – Edit
data/budget.json:- Change
monthly_budgetto match your real budget. - Reset
spent_this_month,remaining, andtransactionsas needed.
- Change
- Safety rails – A recommended future improvement:
- Add a max spend per run (e.g. don't auto-purchase if the run exceeds a threshold, just notify instead).
- Add a "dry run" flag so you can simulate purchases without mutating the JSON files.
GroceryMind is a demo / experimental project:
- It uses Firecrawl and simple heuristics to guess prices from store websites.
- It performs "mock" purchases by updating JSON files; it does not place real orders.
- Always review Telegram receipts and JSON updates before relying on it for real budgeting.