# How do I get a daily Apple Health note in Obsidian?

Source: https://healthsql.app/obsidian · Updated 2026-11-30

Ask an agent that has HealthSQL to read yesterday's row from the `daily` view and last night from `nights`, and to write them as a Markdown note in your vault's folder. Obsidian notes are Markdown files, so the agent writes the file directly and no plugin is involved.

HealthSQL is an iPhone app and a command-line tool that copy your whole Apple Health record into a local SQLite database on your computer, so AI agents can query it with SQL or MCP. Any agent that can write files can do it: [Claude Code](https://healthsql.app/claude-code), [Codex](https://healthsql.app/codex), or an [always-on agent](https://healthsql.app/personal-agents) that does it each morning.

## The prompt

Paste this into your agent, with your vault's path:

```text
Use healthsql. Read yesterday's row from the daily view and last night's row from the nights view, and the 14 days before them. Write a note to ~/Notes/Health/YYYY-MM-DD.md (yesterday's date). Start it with YAML front matter: date, steps, active_kcal, resting_hr, hrv_ms, asleep_min, deep_min, weight_kg (leave out any that are empty). Then three short lines in plain words: sleep against the 14-day average, resting heart rate and HRV against the same, and steps. End with the time the phone last synced. If the answer has a problem line, write that instead. Do not give medical advice. Do not change any other file.
```

## The note it writes

Something like this (the numbers here are made up):

```markdown
---
date: 2026-11-29
steps: 8412
active_kcal: 512
resting_hr: 58
hrv_ms: 44.2
asleep_min: 431
deep_min: 62
---
Slept 7 h 11 min, 14 minutes more than your 14-day average.
Resting heart rate 58, one below your average; HRV 44 ms, about your average.
8,412 steps, a little under your usual 9,000.

Phone last synced 30 November, 07:41.
```

Front matter keeps the numbers as fields, so you can find, sort or chart them later in Obsidian with whatever you already use.

## Run it every day

- **An always-on agent** on your Mac can run the prompt each morning: [always-on agents](https://healthsql.app/personal-agents).
- **Your own schedule:** run your agent's non-interactive mode from a scheduler such as cron or launchd, with the prompt above.

Schedule it for after you usually unlock your phone in the morning: iOS lets no app read Health while the iPhone is locked, so last night's sleep reaches your Mac after the first unlock.

## Questions

### Does this send my health data anywhere?

The note stays in your vault. The rows the agent reads to write it go to its model provider, unless it runs a [local model](https://healthsql.app/local-models). If your vault syncs to another service, the note goes there too.

### Can the note include workouts?

Yes. Add "and yesterday's workouts from the workouts view, one line each" to the prompt.

### Why use daily rather than the raw samples?

`daily` holds Apple Health's own totals, counting steps once when several devices recorded them. [Why](https://healthsql.app/blog/apple-health-steps-double-counted).
