diet

← Home · ~/diet · updated 5 days ago

diet

Per-day food log: iMessage photo → vision macro extraction → daily markdown file → nightly digest. Zero web UI, zero database — just markdown files at ~/diet/YYYY-MM-DD.md.

Status: Shipped 2026-04-21 — replaced the prior SQLite/HTTP MVP wholesale. Extracted 2026-05-30 from the ~/agents monorepo into this standalone repo. The implementation is two Claude Code skills, diet-log/ and diet-digest/, which install.sh symlinks into ~/.claude/skills/.

Layout

This repo lives at ~/diet/ — the same directory that holds the day-logs. Code and docs are tracked; the day-logs are not.

~/diet/
  diet-log/            # skill: photo → macros → append today's log
  diet-digest/         # skill: nightly digest + 90-day purge
  install.sh           # symlink skills → ~/.claude/skills/, install cron, register polls
  verify.sh            # ship gate (run after install.sh)
  README.md            # this spec  ─┐ tracked
  ARCHITECTURE.md      # mermaid     ─┘
  YYYY-MM-DD.md        # day-logs — gitignored, purged at 90 days

The ????-??-??.md day-logs are private health data and are gitignored; they are never committed. The 02:00 purge (below) matches only that date-named pattern, so it never touches the tracked README.md / ARCHITECTURE.md despite sharing the directory.

Scope

  • On-image-arrival via the imessage plugin channel: invoke diet-log. The Python worker drops a poll event; the long-lived diet-log poll session does vision over the photo, extracts kcal/P/C/F/fiber + dish name, appends a row to today's ~/diet/YYYY-MM-DD.md, and replies via bb-send.sh. The source image is never deleted.
  • Nightly digest (cron 21:00 local): diet_digest.sh reads the prior 7 days, drops a poll event, and the diet-digest poll session writes a trend/anomaly paragraph that the wrapper iMessages.
  • Nightly purge (cron 02:00 local): diet_digest_purge.sh deletes date-named day-logs (~/diet/YYYY-MM-DD.md) older than 90 days.

Out of scope (and removed in f8d33e6): SQLite, HTTP dashboard, /diet endpoint, photo retention.

Architecture

iPhone photo ─► imessage plugin ─► diet-log skill ─► diet-log poll (vision)
                                          │                 │
                                          │                 ▼
                                          │       ~/diet/YYYY-MM-DD.md
                                          ▼                 │
                                  bb-send.sh         ┌──────┴───────┐
                                                     ▼              ▼
                                            cron 21:00 digest   cron 02:00 purge
                                                     │              │
                                              digest poll      rm *.md > 90d
                                                     │
                                             bb-send.sh

See ARCHITECTURE.md for the mermaid version.

Interface

  • Input: iMessage photo from +17076556006.
  • Reply per photo: Logged: <dish> — <kcal> kcal / <P>P / <C>C / <F>F / <Fi>Fi.
  • Nightly digest reply: one paragraph at 21:00 local.
  • Storage: ~/diet/YYYY-MM-DD.md only.
  • Skill source:
  • ~/diet/diet-log/ (symlinked to ~/.claude/skills/diet-log/ by install.sh)
  • ~/diet/diet-digest/ (symlinked to ~/.claude/skills/diet-digest/ by install.sh)
  • Cron entries (crontab -l | grep diet; installed idempotently by install.sh, pointed straight at this repo so they don't depend on the skill symlink):
  • 0 21 * * * ~/diet/diet-digest/diet_digest.sh
  • 0 2 * * * ~/diet/diet-digest/diet_digest_purge.sh

Deps

  • diet-log and diet-digest poll sessions (started by poll-bringup); both run on the poll default (Opus).
  • bb-send.sh (BlueBubbles → iMessage).
  • macOS cron. Python 3 stdlib only.