Pp function health

From mvanhorn/printing-press-library · View interactive version

Pp function health is an AI agent skill from the GitHub repository mvanhorn/printing-press-library. Every Function Health feature, plus a local SQLite store with biomarker trends across every round you've ever drawn Trigger phrases: `show me my function health labs`, `what's worst on my function panel`, `trend my apoB`, `make me a pdf for my doctor with my function history`, `what changed since my

How to use this skill

Skill file

<!-- GENERATED FILE — DO NOT EDIT.

This file is a verbatim mirror of library/other/function-health/SKILL.md,

regenerated post-merge by tools/generate-skills/. Hand-edits here are

silently overwritten on the next regen. Edit the library/ source instead.

See the repository agent guide, section "Generated artifacts: registry.json, cli-skills/". -->

Function Health — Printing Press CLI

Prerequisites: Install the CLI

This skill drives the function-health-pp-cli binary. You must verify the CLI is installed before invoking any command from this skill. If it is missing, install it first:

  1. Install via the Printing Press installer:

```bash

npx -y @mvanhorn/printing-press-library install function-health --cli-only

```

  1. Verify: function-health-pp-cli --version
  2. Ensure $GOPATH/bin (or $HOME/go/bin) is on $PATH.

If the npx install fails before this CLI has a public-library category, install Node or use the category-specific Go fallback after publish.

If --version reports "command not found" after install, the install step did not put the binary on $PATH. Do not proceed with skill commands until verification succeeds.

Function Health gives you a great single-round dashboard but no way to see what's drifting across years of draws — and no way to share a clean, branded lab history with your physician. function-health-pp-cli pulls every round into a local SQLite store with FTS5, exposes cross-round trend analysis nobody else offers (goat, biomarker trend, biomarkers trending, biomarkers oscillating), and renders a Function-branded PDF with your name and date of birth that an MD can read in 30 seconds.

When to Use This CLI

Reach for function-health-pp-cli whenever an agent is asked to reason about lab trends over time, to prioritize which biomarker the user should worry about, or to produce an artifact a clinician will actually read. It is the right tool when the question requires joining data across multiple test rounds, when the user wants a branded PDF for a doctor, or when an agent needs a focused Markdown context block for one biomarker rather than the entire JSON export. It is the wrong tool for one-off single-result lookups on a draw that hasn't been synced yet — for those, run sync first or query the Function web app directly.

When Not to Use This CLI

Do not activate this CLI for requests that require creating, updating, deleting, publishing, commenting, upvoting, inviting, ordering, sending messages, booking, purchasing, or changing remote state. This printed CLI exposes read-only commands for inspection, export, sync, and analysis.

Unique Capabilities

These capabilities aren't available in any other tool for this API.

Doctor-ready outputs

_When an agent needs to produce something the user will hand to a third party, this is the durable artifact — not a JSON blob._

```bash

function-health-pp-cli export pdf-for-doctor --out ~/Downloads/function-history.pdf

```

Local-SQL trend analysis

_When the agent is asked 'how has X changed', this is the one query that answers it without re-fetching anything._

```bash

function-health-pp-cli biomarker trend ApoB --json

```

_When the agent is asked 'what should I worry about', this is the one-call answer._

```bash

function-health-pp-cli goat --agent

```

_Lets the agent prioritize a long biomarker list without burning the user's context window on every reading._

```bash

function-health-pp-cli biomarkers trending --direction worse --last 3 --json

```

_Rolls up 100+ biomarkers into a single trajectory per body system, so the agent can summarize organ-level changes._

```bash

function-health-pp-cli category trend cardiovascular --json

```

_Distinguishes 'unstable measurement noise' from 'consistently bad' — important when the agent is reasoning about whether a single high reading matters._

```bash

function-health-pp-cli biomarkers oscillating --rounds 4

```

_Closes the loop between guidance and outcome — the agent can ask 'did the last fix work?' instead of 'what is recommended now?'._

```bash

function-health-pp-cli recommendations stale --json

```

Agent-native plumbing

_When the agent is being asked to draft a question for the user's clinician, this is the prefab context block._

```bash

function-health-pp-cli bundle ApoB --window 3rounds

```

Command Reference

biological_age — Biological-age and BMI calculations Function derives from your panels.

biomarkers — Function Health's full biomarker catalog with names, units, reference ranges, and Function's "optimal" ranges.

categories — The ~13 medical categories biomarkers are organized into (Heart, Hormones, Thyroid, Metabolic, Liver, Kidney, etc.).

notes — Clinician notes attached to your results.

notifications — Change notifications (new results landing, biomarker direction changes).

recommendations — Personalized health recommendations tied to your results.

requisitions — Lab requisitions — pending (in-progress draws) and completed (rounds with results).

results — Lab results — both the structured biomarker-level data and the raw requisition documents.

schedules — Upcoming scheduled lab-draw appointments.

user — Your Function Health member profile (id, name, contact info, membership status).

visits — Individual lab-collection events within a test round.

wearables — Wearable-device integrations (Apple Health, Garmin, Whoop, Oura, etc.).

Finding the right command

When you know what you want to do but not which command does it, ask the CLI directly:

function-health-pp-cli which "<capability in your own words>"

which resolves a natural-language capability query to the best matching command from this CLI's curated feature index. Exit code 0 means at least one match; exit code 2 means no confident match — fall back to --help or use a narrower query.

Recipes

Morning check-in

function-health-pp-cli sync check && function-health-pp-cli goat

Cheap incremental sync, then the single most-worrying biomarker right now — both calls are local after the first sync.

Doctor-ready PDF

function-health-pp-cli export pdf-for-doctor --out ~/Downloads/heart.pdf --section Heart --out-of-range

Branded multi-round report with member name and DOB header, per-category sections, per-biomarker history. --out-of-range keeps only biomarkers outside Function's optimal range in their latest draw; --section <name> keeps only categories whose name contains the text (e.g. Heart, Liver, Nutrients); the two combine. Omit both for the full report.

Narrow JSON for agents

function-health-pp-cli biomarker trend ApoB --agent --select \\brounds.draw_date,rounds.value,rounds.status\\b

Strip the response down to the three fields an agent actually reasons about; --select accepts dotted paths into nested response objects.

LLM context bundle

function-health-pp-cli bundle hs-CRP --window 3rounds | pbcopy

Compose a Markdown context block — history + clinician notes + recommendations — and paste into Claude or ChatGPT for a focused conversation.

Stale-rec audit

function-health-pp-cli recommendations stale --group supplements --json

Recommendations (supplements / foods) whose target biomarker is still outside Function's optimal range, joined by Quest code. The endpoint carries no issued-date, so staleness is by outcome, not age; --min-rounds N tightens to persistence and --group focuses one set.

Auth Setup

Function Health blocks Firebase REST email/password sign-in at the project level, so function-health-pp-cli auth login with --email/--password does not work and auth login --chrome is unreliable. The working path is auth set-token: log in to https://my.functionhealth.com in Chrome, open DevTools (Cmd+Option+I) -> Network, copy the authorization: Bearer <token> value from any member-app-mid.functionhealth.com/api/v1/... request, then run function-health-pp-cli auth set-token <token>. The token is stored in ~/.config/function-health-pp-cli/config.toml (mode 0600) and lasts ~1 hour; re-run auth set-token on HTTP 401. Set FUNCTION_HEALTH_TOKEN to override for CI or one-shot use.

Run function-health-pp-cli doctor to verify setup.

Agent Mode

Add --agent to any command. Expands to: --json --compact --no-input --no-color --yes.

```bash

function-health-pp-cli biomarkers list --agent --select id,name,status

```

Response envelope

Commands that read from the local store or the API wrap output in a provenance envelope:

{
  "meta": {"source": "live" | "local", "synced_at": "...", "reason": "..."},
  "results": <data>
}

Parse .results for data and .meta.source to know whether it's live or local. A human-readable N results (live) summary is printed to stderr only when stdout is a terminal AND no machine-format flag (--json, --csv, --compact, --quiet, --plain, --select) is set — piped/agent consumers and explicit-format runs get pure JSON on stdout.

Agent Feedback

When you (or the agent) notice something off about this CLI, record it:

function-health-pp-cli feedback "the --since flag is inclusive but docs say exclusive"
function-health-pp-cli feedback --stdin < notes.txt
function-health-pp-cli feedback list --json --limit 10

Entries are stored locally at ~/.local/share/function-health-pp-cli/feedback.jsonl. They are never POSTed unless FUNCTION_HEALTH_FEEDBACK_ENDPOINT is set AND either --send is passed or FUNCTION_HEALTH_FEEDBACK_AUTO_SEND=true. Default behavior is local-only.

Write what surprised you, not a bug report. Short, specific, one line: that is the part that compounds.

Output Delivery

Every command accepts --deliver <sink>. The output goes to the named sink in addition to (or instead of) stdout, so agents can route command results without hand-piping. Three sinks are supported:

| Sink | Effect |

|------|--------|

| stdout | Default; write to stdout only |

| file:<path> | Atomically write output to <path> (tmp + rename) |

| webhook:<url> | POST the output body to the URL (application/json or application/x-ndjson when --compact) |

Unknown schemes are refused with a structured error naming the supported set. Webhook failures return non-zero and log the URL + HTTP status on stderr.

Named Profiles

A profile is a saved set of flag values, reused across invocations. Use it when a scheduled agent calls the same command every run with the same configuration - HeyGen's "Beacon" pattern.

function-health-pp-cli profile save briefing --json
function-health-pp-cli --profile briefing biomarkers list
function-health-pp-cli profile list --json
function-health-pp-cli profile show briefing
function-health-pp-cli profile delete briefing --yes

Explicit flags always win over profile values; profile values win over defaults. agent-context lists all available profiles under available_profiles so introspecting agents discover them at runtime.

Exit Codes

| Code | Meaning |

|------|---------|

| 0 | Success |

| 2 | Usage error (wrong arguments) |

| 3 | Resource not found |

| 4 | Authentication required |

| 5 | API error (upstream issue) |

| 7 | Rate limited (wait and retry) |

| 10 | Config error |

Argument Parsing

Parse $ARGUMENTS:

  1. Empty, help, or --help → show function-health-pp-cli --help output
  2. Starts with install → ends with mcp → MCP installation; otherwise → see Prerequisites above
  3. Anything else → Direct Use (execute as CLI command with --agent)

MCP Server Installation

Install the MCP binary from this CLI's published public-library entry or pre-built release, then register it:

claude mcp add function-health-pp-mcp -- function-health-pp-mcp

Verify: claude mcp list

Direct Use

  1. Check if installed: which function-health-pp-cli

If not found, offer to install (see Prerequisites at the top of this skill).

  1. Match the user query to the best command from the Unique Capabilities and Command Reference above.
  2. Execute with the --agent flag:

```bash

function-health-pp-cli <command> [subcommand] [args] --agent

```

  1. If ambiguous, drill into subcommand help: function-health-pp-cli <command> --help.
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.