AI Habit Tracker Telegram Bot Icon
AI Habit Tracker BotOpen Sourceby Asit Purohit • MetaMotion
100% Free & Open-Source • Privacy First • Gemini AI

AI Habit Tracker Telegram Bot

The free, open-source AI Habit Tracker and life log that lives directly inside Telegram. Track study hours with live stopwatch timers, count daily habits, log sleep, write AI reflections, and audit wasted time with Google Gemini AI.

✨ Powered by Next.js 15⚡ Supabase Database🧠 Google Gemini AI🔒 Locked to your Telegram ID
Telegram • @asit108_bot
Live Session
⏱️ Physics Study — Running01h 24m 12s
🕐 Started: 08:30 AM • Pause anytime — paused time is excluded from logs.
⏸ Pause⏹ Stop🔄 Refresh
📊 /today Scorecard:

💧 Drink Water: 3,500 / 5,000 ml (70%)

😴 Sleep: 7 hours 15 min

⏱️ Physics Study: 2 hours 45 min

🕳️ Wasted: 4 hours 18 min of 14 hours elapsed

🤖/ask AI: "How much did I study this week?" → Deterministic SQL aggregation, zero hallucinated math!

Complete Capabilities

What the AI Habit Tracker Bot Does

Engineered for real life. It handles midnight roll-overs, pauses, phone-screen distractions, and mathematical accountability.

⏱️

Live Stopwatch Timer

Start study or work sessions in Telegram with real-time elapsed seconds. Pause when stepping away, resume when back. Paused time is strictly excluded from final logs.

5-min still running nudges + auto midnight split
😴

Dedicated Sleep System Timer

Undeletable system timer. Tap Start at bedtime and Stop on waking. Sessions split automatically at midnight (e.g. 11 PM to 12 AM on Day 1, 12 AM to 7 AM on Day 2).

Silent mode: zero annoying 5-minute nudges
💧

Habit Counters & Daily Ticks

Log water intake (ml), workout reps, or book pages with quick +1, +5, +10 buttons or typed values. Daily yes/no routines (vitamins, morning walk) are ticked in 1 tap.

Daily goal progress bars and target tracking
🕳️

Deterministic Wasted Time Audit

Every minute of the day is accounted for. Unaccounted time = elapsed day minutes − all tracked timers (study + sleep). Zero guessing, zero wishful thinking.

Daily scorecard in /today and weekly reviews
📖

AI Diary & Reflection (/log)

Type how your day went. Google Gemini AI reads your reflection and automatically extracts summary, mood, people mentioned, project tags, and key decisions.

Matches known tasks & appends diary notes
🤖

Deterministic Ask AI (/ask)

Ask in natural language: "How much did I study this month?" or "How much time did I waste yesterday?". Gemini selects tools; all arithmetic is executed by TypeScript.

Guaranteed math accuracy, no LLM math hallucinations
🎯

Focus Tagging & Session Notes

When you stop a work timer, rate your session: Focused, Casual, or Distracted. Add a quick 1-sentence note of what you accomplished.

Track deep work percentage over weeks
❓

Doubts & Questions Organizer

Send /doubt to log questions while studying. Gemini automatically suggests or merges into existing topics. Browse doubts with 5-per-page pagination and mark resolved.

Compact 64-byte Telegram callbacks & AI querying
⏰

To-Dos & Timely Reminders

Schedule one-off tasks with /todo specifying date and time. The bot notifies you right when it's due, with an inline button to mark completed.

Habit reminders + one-time to-do alerts

Cheat Sheet

AI Habit Tracker Telegram Commands

Everything you need is accessible via simple Telegram slash commands or quick-tap buttons.

CommandActionWhat it does
/startMain MenuDisplays today at a glance, quick habit buttons, and active timer controls.
/todayFull ScorecardHabits, routines, diary summary, and unaccounted wasted time.
/tasksView & LogStart timers, increment counters, or check daily routines.
/addtaskCreate TaskGuided wizard to create a timer, counter, or daily tick with reminders.
/editEdit / ArchiveModify reminder time, target goals, schedule, or soft-delete habits.
/todoScheduled RemindersOne-time to-dos with exact calendar date and clock time reminders.
/doubtAcademic DoubtsRecord doubts, auto-clustered by AI topic, with pagination & toggle.
/logAI DiaryReflect on your day. Gemini extracts mood, summary, and links task notes.
/ask <query>AI Data AnalysisAsk anything about your logs, study habits, or wasted hours. Zero hallucinations.
/statusStopwatch StatusBrings running timer controls back to the newest Telegram message.

5-Minute Setup Walkthrough

How to Deploy Your AI Habit Tracker Bot

You need three 100% free accounts: Telegram, Supabase, and Google AI Studio. Follow these 5 steps to launch your private bot.

1

Get the Source Code

Download the production-ready code zip directly from this page, or clone the repository to your machine:

📥 Download simple-habit-tracker-bot.ziporgit clone https://github.com/metamotion7/telegram-life-log.git
2

Get Your Free API Keys

  • •
    Telegram Bot Token: Open Telegram, message @BotFather, send /newbot, follow the prompts, and copy the HTTP API Token.
  • •
    Supabase Database: Go to supabase.com (free tier), create a new project, and go to Project Settings → API to copy your Project URL and service_role secret key.
  • •
    Google Gemini API Key: Visit aistudio.google.com, click Create API Key. It provides free generous quotas.
  • •
    Your Telegram ID: Message @userinfobot to get your numeric ID. This locks the bot exclusively to you.
3

Run the Database SQL Schema

Open your Supabase Dashboard → SQL Editor. Copy and paste the contents of supabase/schema.sql (from the downloaded zip or repo), and click Run.

✅ Creates tasks, logs, active_timers, todos, doubts, and starter habits.
4

Deploy to Vercel & Set Environment Variables

Import your repository into vercel.com (Next.js preset) and add these environment variables in project settings:

TELEGRAM_BOT_TOKEN=your_bot_token_from_botfather
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
SUPABASE_SERVICE_ROLE_KEY=your_service_role_secret
GEMINI_API_KEY=your_gemini_api_key
APP_TIMEZONE=Asia/Kolkata # or your IANA timezone
ALLOWED_TELEGRAM_USER_ID=your_numeric_telegram_id
CRON_SECRET=a_random_password_for_cron
5

Activate Webhook & Minute Cron

Point Telegram to your live Vercel URL by running this one command in your browser or terminal:

https://api.telegram.org/bot<YOUR_TOKEN>/setWebhook?url=https://<YOUR_VERCEL_APP>.vercel.app/api/webhook

To keep timers ticking and reminders triggering every minute:

Create a free 1-minute cron job on cron-job.org pointing to: https://<YOUR_APP>.vercel.app/api/tick?key=<CRON_SECRET>

💡 Prefer running locally without Vercel? Just run npm run poll on your Mac or PC! It automatically clears any webhooks, long-polls Telegram directly, refreshes timers every 5 seconds, and delivers reminders locally.

Common Questions

AI Habit Tracker FAQ

Everything you need to know about using this free AI Habit Tracker Telegram Bot.

What is an AI Habit Tracker Telegram Bot?+

An AI Habit Tracker Telegram Bot is a free, personal productivity assistant that lives directly inside Telegram. It tracks daily habits, study stopwatch sessions, sleep hours, and calculates wasted time — powered by Google Gemini AI — with no subscription fees.

Is this AI Habit Tracker free and open-source?+

Yes — 100% free and open-source under the MIT license. It deploys on the free tiers of Vercel, Supabase, and Google AI Studio, so you pay nothing ongoing. Download the source code directly from this page.

How does the AI analyse my habits and study time?+

When you send /ask, Google Gemini AI converts your natural-language question into an exact SQL query executed against your private Supabase database. All arithmetic is done deterministically in TypeScript — zero hallucinated numbers.

Does the AI Habit Tracker work without a premium Telegram subscription?+

Yes. It works with any free Telegram account. You self-host the bot on Vercel's free hobby plan; there are no Telegram Premium requirements.

How is this different from other AI habit tracker apps?+

Unlike app-based trackers, this AI Habit Tracker lives inside Telegram — no extra app installs. It's single-user and privacy-first: your data stays in your own Supabase database. It also computes wasted time deterministically rather than estimating it.

Can I track study time with this AI Habit Tracker?+

Yes. The live stopwatch lets you start a named study session (e.g., Physics Study), pause and resume it, and the bot nudges you every 5 minutes while running. Sessions automatically split at midnight for accurate daily logs.