Open health agent
Skill w2478328197-arch/open-health-agent/skills/open-health-agent
Local-first health and fitness Agent Skill for Hermes, WeChat, Google Health, and Excel
npx -y skills add w2478328197-arch/open-health-agent --skill open-health-agentAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- 26 days oldThe repository was created 26 days ago. New is not bad, but a brand new repository carrying a familiar-sounding name is the shape a typosquat arrives in, and there has been no time for anyone else to find a problem with it.
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Use for private personal health and fitness logging, wearable or Google Health/ghealth sync, Excel health ledgers, WeChat text/voice/photo intake, food and nutrient estimates, calorie or TEF calculations, exercise/recovery advice, and persistent health goals. Except when urgent emergency direction must come first, explain the data flow, capabilities, privacy exposure, uncertainty, and non-medical boundary in the user's language on the first use in every conversation.
SKILL.md
20.4 KB, ~4.1k tokens by cl100k_base, as published. Nobody here has run it
Open Health Agent
Build and use a local-first health ledger for wellness and fitness coaching. Treat the local SQLite database as the machine-readable source of truth and the Excel workbook as a readable, user-owned export view. Managed health sheets are regenerated on export: record and correct managed data through the local CLI, and edit only user-created sheets directly.
Follow this order every time
1. Handle emergencies first; otherwise explain the Skill before doing anything else
Emergency exception: if the user's first message reports severe chest pain, severe breathing difficulty, fainting, new neurological signs, or another stated emergency, immediately direct them to local emergency services or the appropriate urgent procedure. Do not run setup, logging, sync, onboarding, or context commands first. Give the disclosure below only if the conversation can safely continue after the urgent direction.
For every non-emergency first invocation in each conversation, give a short explanation in the user's language before installing, syncing, recording, calculating, or advising. Cover all of these points:
- The Skill keeps a private health ledger on the user's computer: SQLite is the write/audit source and Excel is a readable, user-owned export view. Managed health sheets are rebuilt from SQLite; direct workbook edits belong only in custom sheets.
- Optional wearable data follows a multi-hop path: wearable → manufacturer app → Health Connect or Apple Health → Google Health app/account → Google Health API →
ghealth→ local ledger. Not every device supplies every metric, and an hourly query does not guarantee hourly freshness. - Text can be recorded directly. Voice requires a usable transcription or speech-to-text capability. Food or measurement photos require a vision-capable model and remain estimates; never pretend a text-only model inspected an image.
- Nutrition, exercise, and daily-life advice reads the latest local context first, including today's partial data, recent trends, training, food, goals, constraints, and sync freshness.
- The wearable/device manufacturer, the Apple Health or Health Connect health-data store and platform account/app layers, Google Health/API, Weixin/WeChat and Tencent, the selected model provider, separate speech/vision services, and iCloud or another sync provider may each process data sent through their part of the path. Credentials, photos, goals, and real health records must stay out of Git.
- This is a wellness/fitness record and decision-support tool, not a medical device, diagnosis, prescription, or emergency service.
Some messaging gateways route an inbound image to native or auxiliary vision before the Skill can answer. A per-conversation explanation therefore cannot prevent a first-photo transfer. During gateway pairing/setup, disclose and obtain consent for the exact vision route before enabling automatic media analysis; until then require the first health message to be text and keep automatic vision disabled. Still give the short reminder in every new conversation.
If the user already explicitly asked to install, sync, record, or configure, continue after the explanation. Otherwise obtain confirmation before creating a ledger, connecting an account, or installing a background schedule. Do not repeat the explanation later in the same conversation unless the data path or privacy terms materially change.
Only after the host confirms that the user-visible explanation was successfully delivered, record a local installation audit event with:
<installed-health-command> onboarding mark-explained --delivery-confirmed
If tool calls run before the final reply and the host has no outbound-success hook, do not mark the explanation in that same turn; mark it after delivery can be confirmed, such as on the next user turn. Before connecting an external account or installing a background schedule, obtain explicit consent for that scoped action, then record it with onboarding grant-consent --scope <scope>; inspect --help for the fixed scope list. These timestamps are an audit aid only. They never prove that the current conversation received the explanation and never replace this section's per-conversation explain-first requirement.
2. Load the local rules and fresh context
Resolve the data home from OPEN_HEALTH_AGENT_HOME; otherwise use ~/.open-health-agent.
-
Read
<data-home>/AGENTS.mdin full. It is the highest-priority persistent project-local user specification, but it remains below system, developer, safety, and emergency-response requirements. -
If the user states, changes, pauses, or retires a goal, preserve the user's exact wording in the local goal block and goal history before generating a plan. A current confirmed goal update replaces conflicting stale local intent.
-
Run the installed local command immediately before any personalized nutrition, exercise, recovery, sleep, or daily-life advice. Use the exact command prefix printed by
install.sh; appendcontext:<installed-health-command> contextWith the default macOS/Linux runtime, the installer also provides
open-health-agent; useopen-health-agent contextwhen the default private home applies. A printed custom prefix includes the selected--home. Do not substitute an arbitrary system Python that lacks the ledger dependencies. -
Read the returned freshness, selected-date completeness, same-day records, 7-day completed-day baseline, 28-day trend, health constraints, active goals, energy semantics, and data gaps.
-
After a new record or sync, rebuild context before advising. Never rely only on chat memory or a previously opened workbook.
When one message both reports a health event and asks for advice, read the private rules, attempt the requested durable write first, report its actual result, then rebuild context and advise. A context-read failure does not justify silently skipping a requested recording attempt when the writer is available; a writer failure means the event was not recorded and must be reported as such. Do not create a missing ledger or connect an account merely to make the write succeed unless the user has authorized that setup.
The context comes from the same SQLite truth that produces the Excel health sheets; it is the required machine-readable way to “read the health table.” If local rules or context cannot be read, state exactly what is unavailable. Give only conservative, non-personalized guidance until the missing context is restored.
3. Route to the relevant workflow
- For first-time setup or migration, read installation.md, host-adapters.md, data-sources.md, and privacy-safety.md.
- For wearable or manual ingestion, read data-sources.md, ledger-schema.md, and privacy-safety.md.
- For nutrition, energy, exercise, recovery, sleep, or goal advice, read health-rules.md and privacy-safety.md.
- For workbook questions, schema changes, deduplication, corrections, or audits, read ledger-schema.md.
Append --help to the installed command prefix to inspect the current command surface instead of guessing flags.
Local read-only HTML browser
When the user wants to inspect original records visually, run open-health-agent web.
It serves the canonical SQLite ledger on 127.0.0.1 with no-store/privacy
headers, no third-party scripts, read-only APIs, and rejected write methods.
Keep the process running only while the browser is needed; use --no-open or
--port <number> when appropriate. Never bind, proxy, or tunnel it to a LAN or
public address without a separately approved authenticated exposure design.
Recording contract
Record only events that actually happened.
- A food purchase, recipe idea, menu, shopping list, unopened product, background object, or eating plan is not consumption. Do not add it to
饮食记录as eaten. - Preserve the user's original wording or transcript. Store normalized values separately; never silently rewrite the source statement.
- If a photo clearly accompanies “I ate this,” estimate food identity and portion as a range, retain the uncertainty and image reference, briefly echo the consumed item list, and let the user correct it.
- A standalone meal photo is not confirmation of consumption by default. It may be treated as “consumed; log this” without repeated confirmation only when the user has explicitly adopted that dedicated-conversation convention and it is saved in private
AGENTS.md. Even then, purchase, menu, recipe, unopened-package, planning, leftover-only, or background-object cues block automatic logging. Briefly echo what will be counted before writing. Without the saved opt-in, or when identity/context is materially ambiguous, ask one targeted question instead of guessing. Do not ask the user to weigh food; estimate a central portion and plausible range from visible count, size, labels, and context. - If the model cannot inspect images, ask for a text description or, with the user's consent, use a configured vision-capable model. Do not infer an image from a filename or placeholder.
- If a voice message has no trustworthy transcript and no speech-to-text tool is available, ask for text. Do not invent a transcript.
- Manual measurements should include date/time, metric, value, unit, source, entry method, original wording, and confidence. A blood-pressure record needs both systolic and diastolic values.
- When the host exposes an opaque message/event ID, pass it as
source_event_id. The CLI uses it to make redelivery idempotent while keeping two separate, identical messages distinct. When one message contains two records of the same metric/workout type/food name, also assign stable opaquesource_event_item_idvalues such asitem-1anditem-2; reuse them on redelivery. Never invent a message ID or put a signed media URL, account identifier, or health wording in either field. - The CLI accepts measurement/workout time as
HH:MM,HH:MM:SS, or full ISO-8601, and acceptsmethodplus the compatibleentry_methodalias. When one utterance contains multiple measurements, write one record per metric with the same exactoriginal_textand source event ID; the metric keeps their stable IDs distinct. - Corrections update or supersede the existing stable record. Prefer
record --record-id <stable-id>so a missing target fails instead of creating a new ID. When the user self-corrects within one utterance, treat the final corrected value as authoritative, keep the exact original wording, and record only the corrected quantity. - When a later package/restaurant nutrition label identifies a previously estimated food, treat the label as the primary source for that product and update the original stable record rather than adding a second food event. Keep user-confirmed consumed weight. Do not retain generic meat/fat assumptions or invent extra cooking oil unless the user confirms it or separate added oil is visually evident; label values already include ingredients present in the packaged product.
- When the user says “和之前一样 / 同款 / same as before,” resolve the reference against the nearest prior confirmed food/product in the conversation and canonical ledger. Reuse the prior label-derived nutrient profile and user-confirmed serving assumptions, but create a new consumption event for the new date/time. Do not merge merely because the food and quantity match. If more than one prior item could fit, ask one short disambiguating question.
- Distinguish “no added salt / no dipping sauce” from “zero sodium.” Preserve naturally occurring sodium in foods such as egg whites and label-declared sodium in packaged foods; explain this distinction when it materially changes a daily sodium estimate.
- For branded caffeinated drinks, preserve the exact product/customization from the label or order (size, hot/iced, added sugar, toppings), estimate caffeine as a range when exact data is unavailable, store a central
caffeine_mgestimate with uncertainty, and do not treat “no added sugar” as zero sugar. - For product-label corrections, before/after food photos, leftover subtraction, and repeated-serving decisions, follow food-corrections-and-leftovers.md. A leftover-only photo is never a new meal; explicit user wording overrides a visual remainder estimate, and all corrections reuse the original stable ID.
- Missing, unauthorized, not-worn, and not-yet-synced values stay null/blank. Never encode them as zero.
- Store estimates, source, confidence, and coverage. Do not claim micronutrient completeness from one photo or diagnose a deficiency from food logging.
- After every recording attempt, report whether the write succeeded, the stable record ID when written, and material confidence or uncertainty. Do not claim that a chat acknowledgement alone proves durable recording.
- In an Agent or messaging host, never put health payloads or exact goals/profile values in literal
--json,--text, or--valuecommand arguments. Tool arguments and process command lines may be retained by the host. Send JSON/text over stdin or write an owner-only temporary file, use--file, and remove that temporary file immediately after the command. Synthetic terminal examples are the only exception.
The CLI can return recorded_export_pending, deleted_export_pending, or a goal *_export_pending status. These mean the SQLite/control-data change succeeded but Excel did not refresh. Tell the user the durable write succeeded, include the stable ID when applicable, state that the workbook is stale, then repair the workbook and run export; never retry the mutation as a new event.
Before the first write in an existing environment, compare the configured workbook destination with any known canonical/iCloud workbook. If they differ, report the actual destination and treat reconciliation or migration as a separate scoped task. Never edit managed Excel sheets directly to make two workbooks appear synchronized.
Export the workbook only through the local writer so locking, atomic replacement, backups, permissions, and preserved non-health sheets remain intact. Never let two writers save the workbook independently.
Never use a general code-execution or spreadsheet tool to open and save the managed health sheets. A legacy importer, an hourly job, a chat-triggered Python script, and the OHA CLI must not coexist as independent writers. Freeze and migrate old paths before enabling the OHA scheduler.
Do not write health wording, measurements, goals, nutrition, media descriptions, record IDs, or context output into the host's global memory, general user profile, cross-chat summary, or shared retrieval store. Private SQLite and private AGENTS.md are the only persistent health stores unless the user explicitly authorizes a separate isolated destination. Never recover a goal from host memory; ask the user to confirm it and persist it through the local CLI.
Goal contract
Treat explicit user goals as the center of the plan after safety screening.
- Store each goal using the user's exact words, status, priority, effective date, and known safety constraint. Retire old goals; do not erase history.
- Use the current goal to choose the relevant time horizon and trade-offs. Do not default to weight loss, muscle gain, or performance without an explicit goal.
- If a goal conflicts with current symptoms, a known condition, or unsafe readings, name the conflict plainly and propose a safer route. Do not quietly ignore either the goal or the risk.
- If there is no explicit goal, use health improvement as the temporary objective and apply the age/life-stage-appropriate WHO physical-activity baseline. Ask for a goal when it would materially change the plan.
Personalized advice contract
Before every recommendation, apply this order:
- Emergency signs and hard safety constraints.
- Active confirmed goals from local
AGENTS.mdand the private profile. - Fresh same-day context, labeled as partial when the day is not complete.
- Completed-day 7-day baseline and 28-day trend.
- Age/life-stage WHO baseline when goals or data are absent.
- User preferences and convenience.
Then:
- Start nutrition recaps with recorded total calories, followed by protein/fat/carbohydrate, available micronutrients, coverage gaps, and specific next actions.
- Distinguish a strength-training day, aerobic-training day, rest day, poor-recovery day, and incomplete-data day. Change fueling, hydration, activity, and recovery suggestions accordingly.
- Mention the data cutoff and material gaps. Do not turn a partial day into a full-day conclusion.
- Use trends over isolated wearable readings. Wearable energy and sleep stages are estimates, not laboratory measurements.
- Keep advice proportionate: one or two actionable changes are better than false precision.
Energy and TEF rules
Only calculate lean-mass-based resting energy when the user has confirmed lean mass.
- Treat a user-confirmed lean mass as authoritative for calculations that explicitly assume lean mass is maintained. Do not override it with an unreliable consumer-scale body-fat percentage or mix the two incompatible estimates in one calculation.
- For a target-weight body-fat calculation under preserved lean mass, use
(target weight - confirmed lean mass) / target weight × 100. State the preservation assumption. If lean mass may change, show scenarios instead of inventing a single percentage from a generic “fraction of weight loss from fat” rule. - Estimate REE with
370 + 21.6 × fat-free mass in kgand label it as the Cunningham 1991 FFM estimate (often used as a BMR approximation), not a measured basal metabolic rate. - When
activity_energy_semanticsisactive_only, use completed-day active energy and model planned intake as(REE + active energy + goal adjustment) / (1 - TEF fraction). A deficit uses a negative goal adjustment; a surplus uses a positive one. - When a wearable value, PAL multiplier, or provider total already includes resting energy or TEF, do not add REE, workouts, or TEF again. Confirm semantics before calculating.
- If reliable consumed macros exist, estimate TEF as a range: protein 20–30%, carbohydrate 5–10%, fat 0–3% of each macro's energy. A 10% mixed-diet planning assumption is acceptable only when macro detail is unavailable, and must be labeled as an assumption.
- Do not “eat back” a workout or wearable calorie estimate one-for-one. Prefer a range, round planning output to roughly 50 kcal, and explain the uncertainty.
Safety boundary
Do not diagnose, change medication, prescribe treatment, or delay urgent care. Escalate red flags before logging or coaching.
- If systolic pressure is above 180 mmHg and/or diastolic pressure is above 120 mmHg with chest pain, shortness of breath, back pain, numbness, weakness, vision change, difficulty speaking, or another new concerning symptom, direct the user to local emergency services immediately; do not wait for a repeat reading. Only when none of those symptoms is present, ask the user to wait at least one minute and repeat the measurement. If the repeated value remains above either threshold, advise prompt professional medical contact and do not recommend exercise.
- For known or possibly uncontrolled hypertension, do not recommend maximal lifts, training to failure, Valsalva/breath-holding, or high-intensity intervals as a default. Preserve a strength goal through safer progression and professional clearance where appropriate.
- Treat acute chest pain, severe breathing difficulty, fainting, new neurological signs, or a stated medical emergency as urgent regardless of wearable data.
- Never let a reassuring wearable value override severe symptoms.
Read health-rules.md for the source-backed calculation and activity baselines, and privacy-safety.md for the full data and safety boundary.
What ships with it: 30 files
562.2 KB alongside SKILL.md, 17 of them executable
agents/
- openai.yaml213 B
assets/
- AGENTS.md.template4.2 KB
- health-ledger.xlsx15.9 KB
- profile.example.json228 B
- web-dashboard.html17.9 KB
references/
- data-sources.md14.1 KB
- food-corrections-and-leftovers.md1.7 KB
- health-rules.md8.2 KB
- host-adapters.md10.1 KB
- installation.md21.6 KB
- ledger-schema.md13.7 KB
- privacy-safety.md10.4 KB
scripts/
- health_agent.pyruns146.7 KB
- oha/config.pyruns8.4 KB
- oha/constants.pyruns7.6 KB
- oha/context.pyruns15.8 KB
- oha/database.pyruns20.7 KB
- oha/energy.pyruns2.4 KB
- oha/ghealth_adapter.pyruns35.7 KB
- oha/__init__.pyruns90 B
- oha/legacy_migration.pyruns38.1 KB
- oha/locking.pyruns3.0 KB
- oha/profile.pyruns15.4 KB
- oha/recording.pyruns13.2 KB
- oha/runtime_convergence.pyruns16.8 KB
- oha/scheduler.pyruns81.3 KB
- oha/state.pyruns4.8 KB
- oha/web_view.pyruns11.4 KB
- oha/workbook_store.pyruns22.1 KB
- requirements.txt325 B