PTENES
MODULE 3.3

🧲 Memory, patterns, and supplements

What helps the coach improve over time: the semantic recall, o /advice reconciled with your data, the /supplements connected to the risk flags, and when to ignore the coach.

7
Topics
~35
Minutes
Practical
Level
Use
Type
Your progress in this module 0% · 0 of 7
1

🧲 Semantic recall in action

The sentence that shows the coach “remembering” is always similar: "the last time you ate dinner late, your recovery dropped to 52% the next day". It isn’t guessing — every message from you became a line with memory semantics, and when you ask something similar to a past question, it surfs this history and retrieves the relevant passage from weeks ago.

🟢 New here? Three words before you continue

  • Embedding (vector) — is your sentence turned into a list of numbers that captures the meaning, not the exact words. “Can I eat something sweet today?” and “Can I have dessert?” land close together in the space, even when phrased differently. In HealthOS, OpenAI generates it (the key OPENAI_API_KEY).
  • pgvector — a Postgres extension (in your Supabase) that stores these vectors and finds the closest ones by similarity. It’s what the migration 0001_init.sql turns on.
  • Semantic recall — “search by meaning.” Instead of looking for the exact word, the coach searches past messages for ones with a meaning similar to what you just said.
💬 Your message"can I eat dinner late?" 🔢 Embeddingbecomes a vector (meaning) 🗄️ pgvectorsimilarity search 🧠 Retrieved pattern"dinner at 9 p.m. → recovery 52%" the coach opens the response with “last time you…” — the excerpt came from weeks ago

📊 How to read: from left to right is the search: today's phrase (cyan) becomes a vector, pgvector finds the most similar past entry, and the coach brings up the pattern (purple). It's not the latest message—it's the most relevant, even if it’s from weeks ago.

In practice, this changes the tone: instead of "avoid eating dinner late" (generic), you get "you already seen this bring your number down three times.” The coach is surfing your own patterns — and that's why it gets more useful the more weeks you build up.

Key concepts

By meaning

Finds similar past entries, not the exact word.

Vector + pgvector

Phrase becomes numbers; the database finds the closest match.

"Last time…"

The sentence that shows the memory at work.

Improves over time

More weeks = more patterns to ride.

2

📚 /advice — reconciled expert tip

You saw an influencer say "fasting for 16 hours every day speeds up fat loss." The /advice take this tip, look up the source in an expert tips database (RAG, with citations) and — here’s the clever part — reconciles with your numbers before returning it. The generic tip becomes "for you, today, does this make sense or not?"

🟢 New here?

RAG (Retrieval-Augmented Generation) — “retrieval-augmented generation.” Instead of answering from memory, the coach first search real excerpts (the expert tip + your data line) and only then writes, citing where it came from. That's what prevents guesswork and makes the answer traceable.

▶️ Copy and run — ask for /advice about a tip

Goal: see the coach reconcile an influencer tip with your data, with the source cited.

# No Telegram, mande para o bot:
/advice <cole-aqui-a-dica-que-voce-ouviu>

# Ex.: /advice jejum de 16h todo dia acelera a perda de gordura

# Prefere terminal? advice.py é o único script que precisa de requests:
pip install requests
python3 agent/scripts/advice.py "jejum 16/8 acelera a perda de gordura"
How to verify: the response cite the source and closes by reconciling with you—something like "the tip exists, but your AM cortisol is already high and you sleep ~6h: aggressive fasting could make your cortisol worse; discuss it with your doctor first". In the build checklist, this is item "Influencer advice RAG returns cited tips reconciled to your data".

💡 The difference in one sentence

A chatbot repeats the influencer’s tip. The /advice a compare against your lab results and genetics — and tells you when popular advice doesn’t work for your body.

Key concepts

Cited RAG

Finds the source and cites where it came from.

Reconciles

Checks the tip against your numbers.

requests

The only dependency outside the standard library.

Always verify

The output is a question for your doctor, not an order.

3

💊 /supplements — stack linked to your flags

O /supplements doesn’t return the trendy list. It returns the your schedule, where each item is tied to a risk flag coming from your DNA and lab results. In the design, each marker or SNP maps to a flag → a supplement → a target in the schema. That’s how the advice is mechanism-aware, not a guess.

🟢 New here?

Risk flag — a “risk flag” the system raises when one of your test results or genes calls for attention (e.g., sensitive to saturated fat, sensitive to salt, low vitamin D, poor toxin clearance). Each flag points to a supplement or a target in the database—it’s the link between your raw data and the action.

sources risk flags stack + target 🧬 DNA (SNPs) 🩸 Blood tests 🧂 salt-sensitive 🥓 saturated fat ☀️ low vitamin D 💊 /supplementsschedule + target in the schema each marker/SNP → a flag → a supplement or target in the schema

📊 How to read: your data (cyan, on the left) triggers flags in the middle; each flag (purple arrows) pulls an item from the stack on the right. Change your DNA/test results and the stack changes — that's why it's your, not generic.

▶️ Copy and run — ask for today's stack

Goal: see the supplement schedule tied to your goals + risk flags, with the reason for each item.

# No Telegram, mande para o bot:
/supplements

# Quer conferir os dados crus que alimentam o stack?
python3 agent/scripts/db.py select goals
python3 agent/scripts/db.py select lab_results   # <suas-flags-vêm-daqui>
How to verify: a schedule comes out (morning / workout / evening), and each item carries the reason tied to a flag — e.g.: "Vitamin D 4000 IU: your VDR SNP + low test result" or "Omega-3: saturated fat flag". If an item doesn't trace back to a flag or target, it shouldn't be there.

Key concepts

Flag → item

Each supplement has a traceable reason.

DNA + tests

The flags come from your actual dashboard.

Schedule

Morning / workout / evening, not a loose list.

Mechanism-aware

Explains why it matters for your body, not just "take it."

4

📈 Patterns over time

Because everything becomes structured line in the database, the coach doesn’t just react to the latest message — it sees patterns over weeks. The insight that made the biggest impression on the author: the body is interconnected. Poor sleep raises cortisol, and cortisol amplifies everything — blood pressure, hunger, recovery. The coach told him to rest — and he took his first voluntary rest day in months.

😴 Poor sleeprepeated during the week 📈 Cortisol risesthe “amplifier” 🌀 Amplifies everythingBP ↑ · hunger ↑ · recovery ↓ 🛌 Coach: rest1st voluntary rest day rest breaks the cascade — and the following week starts with better recovery

📊 How to read: from left to right is the cascade (sleep → cortisol → everything gets worse); the purple dashed line is the coach interrupting the cycle with a rest day. The insight only appears because the memory is structured and sees the whole week.

1

Week 1 — loose ends

Each day is just a number. Recovery goes up and down without an apparent explanation.

2

Week 2 — the coach connects the dots

"On nights with < 6 hours of sleep, your recovery drops the next day." Structured memory became a correlation.

3

Insight — the body is interconnected

Poor sleep → high cortisol → everything gets worse. The coach started telling you when to push and when to rest. Result: the first voluntary rest day in months.

💡 Why this only works with structured memory

A pattern is a correlation over time. Without structured rows (sleep, recovery, BP, food) recorded day after day, there’s nothing to correlate — you’d only have the latest message. Memory é the product.

Key concepts

Interconnected

Sleep affects cortisol, which affects everything.

Cortisol amplifies

Pulls pressure, hunger, and recovery decline.

Pattern > reaction

Weeks, not just the latest message.

Rest day

Rest became a data-guided decision.

5

📝 Edit CLAUDE.md

O CLAUDE.md é o coach brain — profile, goals, style, and the patterns you’ve already learned about yourself. As use reveals new things (like the sleep cascade in topic 4), you go back and edit it. That’s how the author made the coach “savage” on purpose: polite reminders don’t work for him, so he asked the coach to push him for energy and check-ins.

▶️ Copy and run — teach the coach a new pattern

Goal: log a pattern you discovered and the style you want in the coach’s brain.

# Abra o cérebro do coach e cole no fim:
#   agent/CLAUDE.md

## Estilo do coach
- Seja direto e "savage": me cobre energia e check-ins.
  Não respondo a lembrete educado.

## Padrões que eu já aprendi
- Jantar depois das 20h derruba meu recovery no dia seguinte.
- Café só 90 min após acordar; nada de cafeína após as 14h.
- <cole-aqui-o-seu-próximo-padrão>
How to verify: save, restart the agent, and send a regular message. The tone changes (more accountability), and the new rules show up in the responses. Attention: your CLAUDE.md filled in has a real profile — never commit it to git.

🔁 It’s a loop, not a one-time config

The coach spots a pattern → you confirm → you save it to the CLAUDE.md → it starts using it from then on. The more you teach it, the more it sounds like you getting to know your body.

Key concepts

The brain

CLAUDE.md stores your profile, goals, and style.

You edit

Learned something? Save it there and the coach will use it.

"Savage" optional

Set the tone: from gentle to ruthless.

Outside Git

A completed real profile is never versioned.

6

⚖️ Influencer × your numbers

The golden rule of design: the data owner always wins. Any outside advice — no matter how famous the person who gave it is — is reconciled against your numbers. When generic advice conflicts with your lab results, your lab results win.

✗ Generic influencer advice

  • ✗"Everyone should take 5g of creatine and cut salt." — the same advice for 10 million people.
  • ✗Doesn’t know who you are sensitive to salt (raises blood pressure by 10–15% after a salty lunch).
  • ✗"Coffee all day keeps you productive." — without checking your caffeine gene or your hydration.

✓ Reconciled with your data

  • ✓"The tip is there, but your dashboard calls for attention to salt — let’s go by your number."
  • ✓"You metabolize caffeine quickly: 1 coffee early, cut it off in the afternoon — the rest was thirst."
  • ✓Cites the tip’s source AND shows your data side by side, so you can decide with your doctor.

🧬 Genes are dials, not destiny

The author’s DNA flagged sensitivity to saturated fat and salt, poor toxin clearance, and lactose intolerance. The coach builds on top of these flags — instead of repeating generic advice. It’s the opposite of following this week’s influencer.

Key concepts

Your data wins

Your number takes precedence over the external guidance.

Genes = dials

Adjust the dose; they’re not a verdict.

Side by side

A cited tip + your test, so you can decide.

Anti-hype

Specific beats generic, always.

7

🩺 When to ignore the coach

The coach is a tool for logging and reasoning, not a doctor. All this memory and personalization no turn the coach into a clinical authority. Sometimes the right response is to close Telegram and call a professional.

⚠️ Red alert — stop and see a clinician

  • •Any acute symptom (chest pain, shortness of breath, very high blood pressure). The coach doesn’t diagnose and is instructed to forward it.
  • •Change a supplement or—never—medication. It doesn’t touch medication; interactions are something to discuss with a doctor/nutritionist.
  • •AI can hallucinate: confidently state something wrong or make up a number. Treat every suggestion as a question to take to your doctor.
  • •DNA samples mailed in degrade — the clinic’s panel and Ancestry’s may not match. Don’t make any decisions based on a single report.

✓ Healthy use of the coach

  • ✓Log, see the trend, and formulate better questions for your doctor.
  • ✓Take the plan to a clinician before to follow—as the author did at every step.
  • ✓Treat the output as a hypothesis to verify, not an order to follow.

✗ Following blindly

  • ✗Taking a new dose just because the coach suggested it, without a clinician in the loop.
  • ✗Ignore a symptom because "recovery was green".
  • ✗Confusing personalization with diagnosis — they’re different things.

✅ Self-check (optional): the coach suggested a new supplement dose. What’s the right approach?

Key concepts

Doctor in the loop

Have a clinician verify everything.

Can hallucinate

Being confident and wrong is possible.

Doesn’t diagnose

Refers you elsewhere; it doesn’t change medication.

Hypothesis, not an order

Question for the doctor, not a prescription.

📋 Module summary

✓
Semantic recall — the sentence becomes a vector, pgvector finds similar past entries, and the coach opens with "last time you…".
✓
/advice reconciled — cited RAG that compares the expert’s advice with your numbers.
✓
/supplements by flag — each item in the stack tied to a risk flag from your DNA + lab tests.
✓
Patterns over time — structured memory becomes insight: sleep → cortisol → the first voluntary rest day.
✓
You’re in control — edit the CLAUDE.md, let your data outweigh the influencer, and ignore the coach when it’s time to involve your doctor.

Next module:

3.4 — Dashboard and tracking: the trends dashboard, the Sleep & Recovery card, and how to read multiple weeks at once.