# HafCaf

One-tap caffeine logging, with a side of MCP server.

From https://adeolonoh.com/apps/hafcaf/. MIT licensed.

Build me a one-tap caffeine tracker as a native mobile app. It answers exactly one question: how much caffeine have I had today? I open it, tap the drink I'm holding, the number goes up, I close it. Every caffeine app I tried treats what you drank as an open-ended question, which means logging costs a search, a disambiguation and a portion size. So I inverted it: the drinks are a small fixed set I configure once, each with its own size and milligram count, and the first screen is the day's total above a grid of them.

## Ask me first

- **Where the log lives.** On the phone in one local file, or in a hosted SQLite database with a small MCP server beside it so I can ask an assistant things like "which days did I go over 400?" (that needs an account with a host). On "you choose", keep it local and skip the server.

## What I want

**Log.** "Today" as a big serif headline with the running total right-aligned on the same baseline, the number over "OF 400 MG" in small letterspaced caps. Under it a hairline progress bar, three points tall, filling toward the limit. Then "WHAT ARE YOU DRINKING?" and a two-column grid of drink cards: each in the drink's own dark colour with a brighter edge bar down the left, a big emoji, the name, and "16 oz · 190 mg" underneath. Tapping a card logs it. A "View more" / "Show less" button follows if there are more than six drinks. Last, "TODAY": today's entries newest first, each a coloured dot, the name and "190 mg · 7:12 AM". Swipe left to delete.

**History.** A 7 Days / 30 Days pill toggle, then a bar chart of daily totals, oldest on the left, with a dashed line at the limit labelled at its right end. Three stat tiles: average mg per day, days logged out of the window, and days over the limit. Then "RECENT ENTRIES", the last five with date over time. Long-press one to delete it. An empty range says "No entries in this range".

**Settings.** "DRINKS": every drink as a row with its colour tile and emoji, the name, "16 oz · 190 mg" and a coloured dot. Tap to edit. Swipe a custom drink to delete it; the built-in ones edit but don't delete. "＋ Add drink" closes the group. "DAILY LIMIT": the number, "MG / DAY" and an Adjust button.

**Sheets.** Add/Edit Drink and Daily Limit are plain platform-standard forms with Cancel and Save. The drink form takes Name, Size (oz), Caffeine (mg), an emoji and a background colour, and Save stays disabled until it's valid. The limit form's footer reads "Your contract with yourself."

Three tabs, on a floating capsule tab bar that hovers over the content.

## What it is not

- Not a habit tracker. No streaks, no badges, no encouragement.
- Not a health app. It never tells me caffeine is bad or suggests I cut down.
- Not an account. No sign-up, no onboarding, no tour.
- Not a search box over forty thousand beverages. I have six drinks.
- No AI in the app, and no query screen. Questions belong somewhere else.

## Rules that matter

- One tap logs, with no confirm step. An app that takes six taps is an app I stop using by Thursday, and a log with days missing is a lie.
- Log first, save after. The entry appears the instant I tap. If the write fails, quietly take it back out. Never a spinner to record a coffee.
- Deleting shows a toast with Undo for a few seconds, then commits. No confirmation dialog.
- The grid shows the six most-logged drinks, not the most recent, recomputed on launch and after editing drinks, never between taps. The cards must not move under my thumb.
- The limit is a line, not a wall. Over it, the bar and that day's chart column go red and nothing else happens.
- Size is its own field. Three sizes of coffee are three drinks all called "Coffee".
- Two tables. `drinks`: name, mg, oz (optional), emoji, colour, is_default, sort_order. `logs`: drink id (nullable), drink name, mg, logged_at. A log keeps its own name and mg, so renaming a drink never rewrites history, and deleting a drink nulls the reference and leaves its logs standing.
- Timestamps are fixed-width UTC ISO-8601 with milliseconds, always 24 characters, so sorting them as text sorts them in time.
- The average counts only days with entries. A day I forgot to log isn't a day I drank nothing.
- It starts with six seeded drinks using real published caffeine figures, so it's usable before it's configured. The log starts empty.
- Accessibility: 44-point targets, delete reachable without swiping, cards labelled "Log Coffee, 16 ounces, 190 milligrams", reduced motion honoured.

## How it should feel

Editorial, not clinical, and dark only, because it gets opened at 6am and at 11pm. A serif for headlines and drink names, the system sans in small caps for labels, and a monospace with tabular digits for every number. One warm accent for everything interactive, and one muted red that means over the limit and nothing else.

## Building this

This is a mobile app. Build one that installs and runs on a phone, not a web page or a single HTML file. If the spec leaves the operating system or framework open, pick one and tell me which. The prototype is a web mock of it: a reference for layout, copy and behaviour, not code to port.
