name: track-feed description: Log a feed, sleep, nappy, symptom, or weigh-in for Leo. Surfaces 24h patterns, growth trends, and flags anomalies vs NHS/WHO ranges for his age. Use when user says "/track-feed", "/feed", "fed Leo", "Leo had a bottle", "Leo's nappy", "Leo slept", "Leo has a fever", "Leo threw up", "Leo's got a rash", "Leo weighs X", "weighed Leo", or is clearly logging a newborn care or health event. argument-hint: [type] [volume/duration/measure] [notes] | summary | 24h | growth
Symptoms (fever, vomiting, rash, gassiness, post-vaccine reactions) were previously re-explained in prose every time they recurred — three separate post-vaccine sessions in 48h, each starting from scratch. Logging them gives a timeline: "this is day 2 of the post-jab fever, peak was 37.8°C" instead of "tell me again what's happening".
The log lives at baby/logs/feeds.jsonl.
- If
baby/logs/doesn't exist: create the directory - If
feeds.jsonldoesn't exist: create it empty - Never overwrite — always append
2. Parse the Entry
Extract from the user's message:
| Field | Type | Notes |
|---|---|---|
ts |
ISO 8601 timestamp | Default: now. User may say "an hour ago", "at 3am" — parse to absolute time |
type |
breast | bottle | solid | sleep | nappy | symptom |
Required |
volume_ml |
integer | Only for bottle (and later solid) |
duration_min |
integer | For breast, sleep |
side |
L | R | both |
Only for breast |
nappy_type |
wet | dirty | both |
Only for nappy |
symptom |
fever | vomit | rash | gassy | congestion | nosebleed | other |
Only for symptom |
temp_c |
number | Only for symptom of type fever (e.g. 37.8) |
notes |
string | Free text — spit-up, fussy, what preceded it, how long it lasted, etc. |
If the message is vague ("fed Leo"), ask one minimal clarifying question — don't interrogate:
- "Bottle or breast? How much/how long?"
- Accept the answer and log immediately; don't chain more questions
If the message is clear, log silently without confirmation prompts.
3. Append to Log
Write exactly one JSON object per line. Example entries:
{"ts": "2026-04-16T03:14:00Z", "type": "bottle", "volume_ml": 90, "notes": "took it quickly"}
{"ts": "2026-04-16T04:02:00Z", "type": "nappy", "nappy_type": "both"}
{"ts": "2026-04-16T04:30:00Z", "type": "sleep", "duration_min": 135}
{"ts": "2026-04-16T07:15:00Z", "type": "breast", "side": "L", "duration_min": 18}
{"ts": "2026-06-03T19:30:00Z", "type": "symptom", "symptom": "fever", "temp_c": 37.5, "notes": "evening of 8-week jabs, expected MenB reaction, on Calpol protocol"}
{"ts": "2026-06-04T16:00:00Z", "type": "symptom", "symptom": "vomit", "notes": "small posset after 4pm feed, milky not bile, otherwise content"}
Use UTC timestamps with Z suffix. Omit fields that aren't relevant to the event type rather than including nulls.
4. Show 24h Summary
After every log (and when asked for summary), read the last 24 hours of entries and produce:
## Last 24h — Leo ({age})
| | |
|--|--|
| Feeds | {N} ({bottle count} bottle / {breast count} breast) |
| Total volume | ~{X}ml bottle + {Y}min breast |
| Sleep | {total hours}h across {N} blocks (longest: {Xh Ym}) |
| Nappies | {wet count} wet / {dirty count} dirty |
| Symptoms | {only if any in window: e.g. "fever ×2 (peak 37.8°C), 1 vomit"} |
{Anomaly notes if any}
Omit the Symptoms row entirely when none were logged in the window.
5. Anomaly Flags
Compare against NHS/expected ranges for Leo's age (calculate from April 2, 2026).
Newborn (0–4 weeks) expected ranges
- Feeds: 8–12 per 24h (every 2–3h); bottle volumes ~60–120ml per feed by week 2+
- Total intake: ~150–200 ml/kg/day (use Leo's most recent weigh-in; default 3.7 kg birth weight until updated)
- Wet nappies: 6+ per day after day 5
- Dirty nappies: 3+ per day in first month (then variable)
- Sleep: 14–17h total per 24h, in short blocks (2–4h max)
4–8 weeks expected ranges (Leo reaches this May 2026)
- Feeds: 6–10 per 24h; bottle volumes ~120–180ml
- Wet nappies: 6+ per day
- Dirty nappies: variable — some babies go 1–2 days between stools from ~6 weeks, especially formula-fed. Not a concern unless baby is uncomfortable.
- Sleep: 14–16h total; one longer stretch of 4–6h emerging
Flag when
- Feeds <8 in 24h (0–4 weeks) or <6 (4–8 weeks) → "Lower feed count than typical — watch alertness and wet nappies"
- Wet nappies <6 in 24h (after day 5) → "Fewer wet nappies than expected — consider a GP/HV check if it continues"
- No dirty nappy in 48h in first month → "No dirty nappy logged in 48h — normal variation possible but worth noting". From ~6 weeks, formula-fed babies can skip 1–2 days without concern — don't flag unless 4+ days.
- Total intake outside 150–200 ml/kg/day sustained over 3+ days → "Intake trending {high/low} — recalculate at next weigh-in"
- Sleep total <12h or >18h → "Sleep total outside typical range for age"
Keep flags factual and brief. Don't alarm — the health visitor voice: "worth noting", not "call NHS 111".
5c. Weight / Growth Handling
Weigh-ins go to a separate log: baby/logs/growth.jsonl (seeded with all readings since birth — clinic and home, with grade: "clinic" | "home").
On /track-feed weight {kg} (or "Leo weighs 6.25", "weighed Leo today"):
- Append:
{"ts": "YYYY-MM-DD", "age_days": N, "weight_kg": X, "source": "...", "grade": "home"}— clinic visits get"grade": "clinic"and any height/head measurements (height_cm,head_cm). - Show the growth trend instead of the 24h summary:
- Gain rate since the previous entry AND since the last clinic-grade entry, in g/day (clinic-to-clinic is the reliable signal; home scales fill the gaps)
- WHO weight-for-age centile for boys at his age, and the direction of travel vs the last few readings
- Context line: Leo's established pattern is ~55–60 g/day (≈2× newborn median), centile path 75th → 91st → ~93rd, symmetric with height/head — crossing centiles alone is not a flag for him; weight crossing while height/head stay put would be (see baby/context.md Watch Items)
- Flags: gain <20 g/day sustained across 2+ weeks before 3 months → "worth mentioning to HV/GP"; weight loss outside the newborn-nadir window → same; >97th centile AND asymmetric vs height → note for the next check. Health-visitor tone, no alarm.
- Remind of the scale protocol if the entry looks off-protocol (daily weighing, post-feed): baby scale, weekly, nude pre-feed, morning after first dirty nappy.
On /track-feed growth: skip logging, show the trend table (last ~6 entries: date, age, kg, centile, g/day) + the trend read.
5b. Symptom Handling
When the entry is a symptom, the goal is a timeline, not a diagnosis. After logging:
- Show the recent history of that symptom alongside the 24h summary — e.g. "3rd fever reading since the jabs: 37.5 → 37.8 → 37.5°C over 26h, all below the 38°C fever line." This is the whole value: the user stops re-explaining and you stop re-asking.
- Surface escalation thresholds for that symptom, factually. Don't escalate for normal readings — state where the line is:
- Fever: 38°C+ in a baby under 3 months → contact GP/111 same day (NHS line). Post-vaccine low-grade fever (37.5–37.9°C) is expected, especially after MenB — Calpol protocol per gov.uk. Flag if 38°C+ or not settling with Calpol or lasting >48h.
- Vomiting: flag if projectile + repeated (≥3 of 5 feeds), any green/yellow (bile) or blood, or paired with reduced wet nappies/lethargy → GP. Occasional posset/milky spit-up is normal.
- Rash: flag any non-blanching rash (glass test) → 999/111 immediately. Otherwise note distribution + duration; most newborn rashes are benign and self-limiting.
- Nosebleed: known pattern for Leo (delicate nasal capillaries + Valsalva on hard crying) — flag only if >15 min, recurs within 24–48h, or fresh blood elsewhere. See
baby/context.mdwatch items. - Other: log it, note duration/trigger, point to the relevant escalation line if one applies.
- Don't auto-update
context.mdfrom a symptom log — the log is the event stream. But if a symptom is clearly a new persistent watch item (not a one-off), suggest adding it tobaby/context.mdActive Decisions & Watch Items.
This is logging + signposting, not triage. For a worried parent asking "is this normal?", answer in the conversation as the health-visitor persona (see baby/CLAUDE.md) — the log just gives you the history to answer well.
6. Handle Special Commands
summaryor24h— Skip logging, just show the summary (include a symptom line if any symptoms logged in the window)- No arguments — Ask: "What are we logging? (bottle/breast/sleep/nappy/symptom)"
If user says "fed him at 2am" and it's now 7am, parse "2am" as the timestamp. Don't refuse backdated entries — night-feed logging is the main use case.
Ambiguous Type
"Fed Leo 90" — assume bottle (most common). "Fed Leo for 15" — assume breast. When truly ambiguous, ask once.
Missing Log File
Create baby/logs/ and feeds.jsonl on first use. Don't error out — a first entry should always succeed.
Malformed Line in Log
If a line doesn't parse as JSON during summary, skip it silently. Don't block the summary on a corrupt line. Note in output: "(1 entry skipped — unreadable)"
Very Sparse Log (<3 entries in 24h)
Don't flag anomalies — there's not enough data. Just show what's there: "Only {N} entries in last 24h — logging is catching up."
Multiple Logs in Same Minute
Keep them all. Duplicate timestamps are fine in JSONL.
Multiple Events in One Message
If the user says "fed Leo 90ml and changed a dirty nappy", treat as two separate entries with the same (or near) timestamp. Append both lines, then show the summary once — don't show it twice.
Leo Outside Newborn Range
As Leo grows past 4 weeks, the expected ranges shift. Read baby/reference.md if anomaly logic needs updating — but for now, ranges are fine through week 6.
Logged: 95ml bottle at 03:14.
## Last 24h — Leo (14 days old)
| | |
|--|--|
| Feeds | 9 (7 bottle / 2 breast) |
| Total volume | ~640ml bottle + 32min breast |
| Sleep | 14.5h across 6 blocks (longest: 3h 20m) |
| Nappies | 7 wet / 3 dirty |
All within typical newborn ranges.
Example: /track-feed symptom fever 37.5 (evening of 8-week jabs)
Logged: fever 37.5°C at 19:30.
## Last 24h — Leo (9 weeks old)
| | |
|--|--|
| Feeds | 7 (7 bottle) |
| Total volume | ~870ml bottle |
| Sleep | 13h across 5 blocks (longest: 4h 30m) |
| Nappies | 6 wet / 1 dirty |
| Symptoms | fever ×2 (37.4 → 37.5°C) |
This is the expected MenB reaction the evening after the 8-week jabs — both readings are below the 38°C fever line for an under-3-month-old. Keep to the Calpol protocol (gov.uk: dose at jab, then 2 more 4–6h apart). Escalate to GP/111 if it reaches 38°C, won't settle with Calpol, or lasts past 48h. Slightly down on feeds + a quieter day are both normal post-jab.
Example: /track-feed nappy wet with low count
Logged: wet nappy at 09:02.
## Last 24h — Leo (14 days old)
| | |
|--|--|
| Feeds | 8 (6 bottle / 2 breast) |
| Total volume | ~540ml bottle + 24min breast |
| Sleep | 16h across 5 blocks (longest: 4h 10m) |
| Nappies | 4 wet / 2 dirty |
Wet nappy count lower than typical (6+ expected after day 5). Worth watching today — if it stays low, mention at next health visitor contact.
Example: /track-feed summary
## Last 24h — Leo (14 days old)
| | |
|--|--|
| Feeds | 10 (8 bottle / 2 breast) |
| Total volume | ~720ml bottle + 28min breast |
| Sleep | 15h across 7 blocks (longest: 3h 45m) |
| Nappies | 8 wet / 4 dirty |
All within typical newborn ranges. Longest stretch is creeping up — good sign.