add_entry
ChatGPTAppends a workout to the user's log and returns it as saved (M/D/YYYY (#id) -- text); show it to the user so they can spot mistakes. Call get_format_guide first and write the text according to it. Only what the user did goes here; put your observations about it in add_comment on the new #id. Food goes in add_meal, not here. Pass date as today's date from your own context (the user's local date), unless the user says the workout was on another day. If date is omitted the server uses today in America/Los_Angeles.
add_meal
ChatGPTAdds a meal to the user's meal log (a second log, next to workouts) and returns it as saved; show it to the user. Only the facts: what they ate and the amounts as they said them, optionally starting with a label like "lunch" or "post-gym" on its own line. Numbers never go in the text: pass kcal and protein_g for the amount eaten. Exact ones (the user gave them, or a nutrition label) as they are; your own estimate with estimated: true (a range via kcal_max / protein_g_max). They replace the app's automatic estimate. Pass date as today's date from your own context unless the user says otherwise; if omitted the server uses today in America/Los_Angeles.
get_format_guide
ChatGPTReturns the user's instructions for how workout log entries should be written. Call this before add_entry.
get_recent_meals
ChatGPTReturns the most recent meals from the user's meal log, newest first, as M/D/YYYY (meal #id, link) -- text, each followed by its nutrition, the numbers the user sees on their log page (Nutrition: …, each marked exact, estimate or automatic estimate), and its comments. Items are separated by a blank line. A meal that isn't logged is unknown, not skipped. Workouts are in get_recent_workouts.
get_recent_workouts
ChatGPTReturns the most recent workouts from the user's log, newest first, as M/D/YYYY (#id) -- text, each followed by its comments. Each workout's parentheses hold its #id and a link to it on the user's log page. Comments on dates alone (notes, weekly reviews) in the same period are mixed in as M/D/YYYY (note, author) -- text. A workout's text can span multiple lines; items are separated by a blank line. Meals are in get_recent_meals.
import_entries
ChatGPTBrings many past entries in at once from a note the user already keeps (Apple Notes, Obsidian, Google Docs, a spreadsheet), when they paste one in or ask to bring their history over. Not for everyday logging: that's add_entry and add_meal. Two steps. First call it with entries: nothing is saved, and it returns a preview (each entry's date, kind and first line, the duplicates it will skip, anything invalid) with a confirm token. Show the user that preview and ask them to check it. Only after they agree, call it again with confirm set to the token and nothing else: that saves exactly the previewed entries. Never confirm without the user's go-ahead; for changes, send the corrected entries again for a new preview. Splitting the note: one entry per workout, and one per meal (kind "meal") where food is mixed in, each with its own date as YYYY-MM-DD. Dates come written many ways (headings, "9/20", "Sep 20", "Mon 20th"): convert each; where the year isn't written, work it out from the note's order and the dates around it, and ask the user if it's unclear. Never guess a date for a block that has none: ask the user, and leave it out until they say. Keep each entry's text in the user's own words as the note has it, minus the date itself: don't reformat it per the format guide, summarize it, or add numbers or estimates. Entries already in the log (same date, kind and text) and repeats within the batch are skipped, so importing a note twice adds nothing. At most 200 entries and 64 KB of text per call: split a longer note into several batches (e.g. a month or two each), previewing and confirming each in turn. Future dates are refused.
search_entries
ChatGPTSearches the user's workouts and meals with a case-insensitive JavaScript regular expression over the entry text. Entries can span multiple lines; ^ and $ match at line starts and ends within an entry. Returns matches newest first as M/D/YYYY (#id) -- text (meals say meal #id and show their nutrition), each followed by its comments, separated by a blank line. Patterns are limited to 200 characters. Examples: "run", "deadlift|squat", "fran".
set_meal_nutrition
ChatGPTSets calories and/or protein on a meal already in the log (its meal #id), for the amount eaten: exact numbers (a nutrition label, the user) as they are, or your own estimate with estimated: true (a range via kcal_max / protein_g_max). A number left out keeps what was there. They replace the app's automatic estimate; an estimate never replaces an exact number.