🔗 The /healthdb link: the live dashboard
The coach lives in Telegram, but sometimes you want to see everything at once — weekly sleep, falling weight, blood pressure, intake. That’s what the command /healthdb: it sends you a deep-link that opens the live dashboard, reading directly from your Supabase. It's the same source of truth as the bot, but in a visual dashboard.
🟣 New here?
- Dashboard — a web page (in
agent/dashboard/) that reads your Supabase and draws cards and charts. Same database as the coach, another window. - Deep-link — a link that opens directly in the right place and authenticated. Here it loads your token all at once, without you entering a password.
- HttpOnly cookie — a cookie the browser stores but the page’s JavaScript no can read. It helps hide the token from malicious scripts.
🎛️ Illustrative recreation of the dashboard — isn’t a real screenshot. Made-up numbers, just to show the layout.
📊 How to read: the window has a title bar (3 dots) and independent cards. Each card is a data source: sleep, weight, intake, blood pressure, HRV. The mini bars show the trend, not just today’s number — that’s what the panel adds to the chat.
Goal: open the authenticated live dashboard. In Telegram, you just send /healthdb and the coach returns this button; the link itself looks like this:
https://<seu-host>/healthdb?token=<DASHBOARD_TOKEN>
How to verify: when you open it, the dashboard loads; reload the page and notice that the ?token=... disappears from the URL — it migrated to an HttpOnly cookie on the 1st load. If the dashboard stays open without the token in the address bar, it worked.
💡 Why a link, not a password
The token goes once in the URL and disappears afterward — it stays only in the HttpOnly cookie. You don’t type anything, and the secret isn’t left in your browser history after the 1st load. It’s convenient without leaving the door unlocked.
Key concepts
The command that generates the dashboard button.
Opens directly and you’re already authenticated.
Disappears from the URL on the 1st load.
Reads from the same Supabase as the coach.
😴 The Sleep & Recovery card
The most important card on the dashboard is the Sleep & Recovery: the last 7 days of sleep and recovery, side by side. One number can lie; seven days show the pattern — whether you’re building up sleep debt or have recovered. It’s the same data that goes into the coach’s snapshot, now shown visually.
📊 How to read: the purple bar shows how much you slept; the cyan line is how you recovered. Notice Wednesday (red bar, 5h30 → recovery 48%): a short night pulls recovery down. On Friday, you slept longer and recovered to 80%. The dashboard shows the relationship, not isolated numbers.
🔎 What to look for on this card
- •A trend of the week, not the day: 7 days tell you whether you're repaying or accumulating sleep debt.
- •The you’re worth (red days) and what came before: late dinner, alcohol, a hard workout at night.
- •If recovery goes up later of a good night's sleep—confirms that sleep is your biggest lever.
Key concepts
The window that reveals the pattern.
The bar and line tell the same story.
The bad day points to the cause from the previous day.
It’s what the coach uses in the snapshot.
📉 Trends: weight, intake, and vitals
Weight, intake (what you ate), and vitals (blood pressure, HRV, resting heart rate) only make sense over time. Today’s weight could be water; the line of two weeks is the truth. The dashboard plots these trends so you can see the direction, not the daily noise.
📊 How to read: ignore it if a point rises a little (water, salt). What matters is the slope: the line drops from 78.5 to 75.0 kg and enters the target range (cyan). A gentle downward trend > obsession with the daily number.
Goal: see the same points the dashboard plots, straight from Supabase, without opening the browser.
python3 agent/scripts/db.py query \
"select date, weight_kg from vitals \
where weight_kg is not null \
order by date desc limit 14"
How to verify: a 14-row table comes out with the date and weight. Check that the values match the weight card row in the /healthdb — the dashboard and database tell the same story.
✓ Read the trend
- ✓Look at the 7–14-day trend.
- ✓Cross-reference weight ↓ with this week's intake and sleep.
- ✓Wait for the line before changing strategy.
✗ Reacting to noise
- ✗Panic because you gained 0.4 kg in a day.
- ✗Cutting food based on a single spike.
- ✗Weigh yourself at different times and compare.
Key concepts
The direction of the line > today’s point.
Water and salt affect the day, not the week.
What went in: calories and macros.
Blood pressure, HRV, RHR over time.
📖 Read it as a story, not an isolated number
A number by itself—"recovery 48%"—doesn’t teach you anything. The history teaches: why fell, what changed, what do. The dashboard shows the numbers; you (and the coach) turn them into a narrative. Reading the dashboard means asking “what’s the story this week?”
✗ Standalone number
- ✗"Recovery 48%." So what? It doesn’t tell you the cause or the next step.
- ✗"Weight 75.4." Up or down? Compared to what?
- ✗Look at one data point, feel guilty, close the dashboard.
✓ As a story
- ✓"Dropped to 48%" because I ate dinner late + wine; tomorrow I eat dinner early."
- ✓"Weight has been dropping for 10 days; the change was stopping eating at 7 p.m."
- ✓Review the week, understand the cause, adjust one thing.
See the valley
Recovery plummeted on Wednesday. The number alone is just alarming.
Finds the cause
Look at the previous day on the intake card: dinner at 9:30 PM + two glasses of wine.
Take away the lesson
"Late dinner + alcohol = low recovery for me." It becomes a familiar pattern.
Adjust and confirm
Eat dinner early on Thursday; by Friday, recovery is back to 80%. The story is complete — and it taught you one of your buttons.
Key concepts
The cause behind the number.
The variable that moved the line.
Number → cause → next step.
Data is information, not judgment.
🔐 Dashboard security
The dashboard displays health data—sensitive information. The DASHBOARD_TOKEN: a secret key in your ~/.env that unlocks the dashboard. Without the right token, the page won’t open. And the token is never exposed: after the 1st load, it lives only in HttpOnly cookie.
🟣 New here?
- DASHBOARD_TOKEN — one of the keys to
~/.env(the README table says: "Gates the web dashboard"). It’s the secret that unlocks the dashboard. - ~/.env — file in your home directory where secrets are stored. Kept out of git, never versioned.
- HttpOnly — the cookie exists for the server, but the page’s JavaScript can’t read it. This reduces the risk if a malicious script runs in the tab.
📊 How to read: from left to right is the token's path: it starts in the ~/.env, visit the URL once, it’s stored in the HttpOnly cookie (purple box), and the URL is cleaned up (green box). After that, the secret is no longer visible in the address bar.
Goal: create a long, random token and save it in your ~/.env (never an easy-to-guess value).
python3 -c "import secrets; print('DASHBOARD_TOKEN=' + secrets.token_urlsafe(32))" \
>> ~/.env
How to verify: run grep DASHBOARD_TOKEN ~/.env and see a line with ~43 random characters. Restart the dashboard server and the /healthdb only starts opening with that token.
⚠️ Never do this with the token
- •Paste the link
?token=...in a group, screenshot, or social network — it’s the key to your dashboard. - •Commit the
~/.envor the token in git. - •Using a short/obvious value (e.g.,
123456). If it leaks, generate another one and replace it in the~/.env.
Key concepts
The key that unlocks the dashboard.
A cookie that JavaScript can't read.
Secret kept out of git.
Generate another token and update it.
🗓️ Review every week
The coach reviews the morning (daily). The dashboard is for reviewing the week: once a week, open the /healthdb calmly and read the four trends as a report. Five minutes turn accumulated data into a decision.
✅ Weekly review checklist
Goal: make sure the entire week’s recovery and sleep data is already in the database before you open the dashboard.
python3 agent/scripts/whoop-sync.py
How to verify: the script writes recovery_pct, hrv_ms, resting_hr e sleep_hours in the table vitals. Running it again is idempotent (it doesn’t create duplicates). Afterward, the Sleep & Recovery card in the /healthdb shows the full week.
💡 One adjustment at a time
The weekly review isn’t about changing everything. Choose a button (eat dinner earlier, cut out coffee in the afternoon, go to bed 30 min earlier) and test it for seven days. At the next review, the trend confirms it — or doesn’t. That’s how you learn the your buttons without turning it into a guilt spreadsheet.
Key concepts
Morning = coach; week = dashboard.
Sleep, weight, intake, vitals.
One testable change per week.
Running the sync again doesn’t create duplicates.
🔁 Data → adjustment → result
Everything in the course converges into a single cycle: you see the data in the dashboard, run an adjustment, and next week shows the result — which becomes the new data point. That was the loop that led the author to −3.5 kg in the sprint, without going hungry: sleeping soundly and stopping eating around 7 p.m.
📊 How to read: three boxes, one cycle. Data (dashboard) → Adjustment (a small change) → Result (green, the goal) → and the bottom arrow returns to Data. Each cycle is a week. The secret to −3.5 kg wasn’t willpower: it was the cycle turning.
🏁 The whole course in one sentence
You built a coach that log (Track 2), which talks with you every day (Track 3) and that shows you the story in the numbers (this module). The rest is keeping the cycle going: observe, adjust, confirm. You’ll learn the buttons by doing.
✅ Self-check (optional): what helped the author lose −3,5 kg without going hungry?
Key concepts
The dashboard shows where you are.
A small, testable change.
−3.5 kg without hunger: the loop working as intended.
The result becomes the next data point.
📋 Module summary
🎉 You completed the course!
You’ve completed the course! Go back to the beginning to review any track or pick up where you left off. Now put the cycle into practice in your own routine — observe, adjust, confirm.