# `tracker@1`: habits, mood and other things you log by hand

Version **1.1.0** · published 2026-11-30 (1.0.0: 2026-11-29) · MIT · boards: habit-tracker, journal-mood · [changelog](../CHANGELOG.md)

One row of `trackers` is one thing a person tracks (a habit) with its target; one row of `entries` is one logged action:
a tap on a check-in card, a `dashremix log`, an assistant logging what the person said, or a row of a habit-app export.
`skips` are days the person excused on purpose. Habit Tracker reads it; Journal & Mood reads it for moods, activities and
journal entries (1.1); goals and weight boards will (wave 2).

## Conventions
- **Append-only entries.** Nothing rewrites or deletes an entry. Undoing a check is another entry with value `-1`. A
  tracker's **value on a day** is the sum of its entries that day for `check` and `count` trackers, and the latest entry
  (by `created_at`) for `scale`, `amount` and `duration` trackers. A check day is **done** when the sum is at least 1.
- **Dates** are the person's local calendar date (`YYYY-MM-DD`), the day the action counts for, not the instant it was
  logged. Instants (`created_at`, `imported_at`) are ISO 8601 UTC with a `Z`. Durations are seconds.
- **Targets.** `target` + `target_period` say how much counts as done:
  | Habit | kind | target | target_period | days_of_week |
  |---|---|---|---|---|
  | Walk every day | check | 1 | day | NULL |
  | Meditate on weekdays | check | 1 | day | 31 (Mon–Fri) |
  | Strength 3 times a week | check | 3 | week | NULL |
  | Call a friend once a week | check | 1 | week | NULL |
  | 8 glasses of water a day | count | 8 | day | NULL |
  | Mood (no target) | scale | NULL | NULL | NULL |

  For a `check` tracker a week or month target counts the **days done** in it. Weeks start on `meta.week_start`.
  `tracker_targets` (optional) keeps earlier targets so history is judged by the target that applied then.
- **Expected, done, skipped, missed.** A day is *expected* for a day target when it is on or after `active_from`, not
  after `archived_at`, and on a `days_of_week` day. An expected day in the past is *done* (value reaches the target),
  *skipped* (a row in `skips`), or *missed*. Boards decide streak rules; the standard only carries the rule inputs:
  `meta.forgive_per_week` (misses per week that do not break a streak) and `meta.week_start`.
- **IDs.** `entry_id` is the writer's own id (16 hex, minted once per action and reused on a retry), so folding the same
  entries files twice gives the same rows. Rows from an export use the first 16 hex of
  sha1(`source|tracker|date|n`). `skip_id` is the first 16 hex of sha1(`tracker|date`). `tracker_id` matches
  `[A-Za-z0-9][A-Za-z0-9_.-]{0,63}`, the shape `dashremix log` and the check-in card accept.
- **Unknown trackers.** An entry or skip whose tracker is not in `trackers` (a removed habit, a typo) is kept and
  reported, never counted. Removing a habit means setting `archived_at`, so its history stays.
- **Provenance:** `source`, `source_ref`, `imported_at` on trackers, entries and skips; `imported_at` is left out of
  `meta.data_hash`, so re-importing the same files gives the same hash.
- **Mood and activities (1.1).** `trackers.role` says what a tracker is for: `habit` (NULL means habit), `mood` (a
  `scale` tracker with `scale_min`..`scale_max`, higher is better; its day value is the latest entry, as for any scale)
  or `activity` (a `check` tracker with no target: something that happened that day, a tag such as *exercise* or
  *friends*; tapped on the check-in card or read from a mood app's activities). `scale_labels` keeps the words for the
  points of a scale (a mood app's own names: 5 = rad ... 1 = awful). A mood and an activity are linked only by their
  date: boards compare days, and say so (association, never cause).
- **Journal entries (1.1).** `journal_entries` holds what the person wrote, one row per entry, with its local date (the
  zone it was written in, `tz`), an optional title, the body, a word count and the source's tags. **The title and body
  are private text**: a board never puts them into a static export, a screenshot, a note, an insight or the catalog
  unless the person opts in; the word count is safe to share. Ids are the source's own (`dayone:<uuid>`), else the first
  16 hex of sha1(`source|date|time|n`), so importing the same export twice gives the same rows.
- meta required keys: `schema`, `schema_version`, `as_of`, `data_hash`. Recommended (checked at `warn`):
  `source_built_at`, `week_start`, `forgive_per_week`; `entries_imported_at` is information only.

## Sources that fill it
| Source | Lane | Fills |
|---|---|---|
| The person's habit list (`data/habits.yaml`, written by them or their assistant) | 1 | trackers, tracker_targets, skips (`source = habits-yaml`) |
| Entries files written by the check-in card, DashRemix Home and `dashremix log` (`data/entries/YYYY-MM/<writer>.jsonl`, framework "Entries") | 1 | entries (`source` = app, cli or chat) |
| Loop Habit Tracker export (Checkmarks.csv, wide or per habit: `Date,Value,Notes`) | 1 | entries for `YES_MANUAL` days, skips for `SKIP`; `YES_AUTO`, `NO` and `UNKNOWN` add nothing (`source = csv`) |
| Streaks export or import file (`title,entry_type,entry_date`) | 1 | entries for `completed_manually`, skips for `skipped_manually` (`source = csv`) |
| Daylio CSV export (`full_date,date,weekday,time,mood,activities,note_title,note`; older `year,date,weekday,time,mood,activities,note`) | 1 | the mood (an entry of the `mood` tracker, by the person's mood names), its activities (entries of `activity` trackers), its note (`journal_entries`) (`source = csv`) (1.1) |
| Day One export (JSON `Journal.json`, or the plain-text / Markdown export) | 1 | `journal_entries` (1.1) |

## Compatibility
- A board that declares `tracker@1 >=1.0` keeps working on any later 1.x database.
- Remixes that add only metrics, pages and `x_<owner>_` tables survive every minor.
- Breaking changes go to `tracker@2` with a migration and `metrics-codemod.py` (see `../../README.md`, Semver).
- Planned minors: an entry `kind` so a skip can travel on an entry line, and a lower-is-better target direction.
- 1.1 added only optional columns and tables: every 1.0 database is a valid 1.1 database (new columns NULL, new tables
  empty), and 1.0 boards (Habit Tracker) read it unchanged.

## Fields

<!-- fields:begin (generated from schema.sql by spec/build.py; edit the DDL comments) -->

### `meta` (required table)

Key/value facts about this database. Required: schema, schema_version, as_of, data_hash. Recommended (checked at warn): source_built_at (ISO 8601 UTC instant the importer wrote it), week_start (mon..sun, vocab weekdays: the first day of a week for weekly targets), forgive_per_week (whole number >= 0: misses per week that do not break a streak), entries_imported_at (the newest entry created_at folded in; information only).

| Field | Type | Required | Meaning |
|---|---|---|---|
| `key` | TEXT | no |  |
| `value` | TEXT | no |  |

### `trackers` (required table)

What the person tracks. Written from the person's own definition file (a habits.yaml), never from entries.

| Field | Type | Required | Meaning |
|---|---|---|---|
| `tracker_id` | TEXT | **yes** | letters, digits, _ . - (up to 64; the id entries name), e.g. walk |
| `name` | TEXT | **yes** | display name, e.g. Walk 30 minutes |
| `kind` | TEXT (vocab `tracker_kinds`) | **yes** | check \| count \| duration \| scale \| amount (vocab tracker_kinds) |
| `unit` | TEXT | no | count/amount unit as the person says it (glasses, pages); duration trackers use seconds |
| `target` | REAL | no | how much counts as done in one target period: 1 for a daily check, 3 for 3 times a week, 8 glasses a day |
| `target_period` | TEXT (vocab `target_periods`) | no | day \| week \| month (vocab target_periods); NULL = no target (logged only) |
| `days_of_week` | INTEGER | no | day targets only: bit mask of the days it is expected, Mon=1 Tue=2 Wed=4 Thu=8 Fri=16 Sat=32 Sun=64 (31 = weekdays); NULL = every day |
| `active_from` | TEXT (date) | no | first day it is expected (YYYY-MM-DD); NULL = from its first entry |
| `archived_at` | TEXT (date) | no | last day it was tracked (YYYY-MM-DD) when the person stopped; NULL = active. Entries are kept |
| `color_idx` | INTEGER | no | stable index into the chart palette tokens |
| `group` | TEXT | no | optional grouping the person chose (Health, Mind, Home) |
| `description` | TEXT | no | why it matters to the person, in their words (used by coaching skills) |
| `ord` | INTEGER | no | display order (1 = first) |
| `source` | TEXT | no | connector id that wrote the row: habits-yaml \| loop-csv \| streaks-csv |
| `source_ref` | TEXT | no | where in the source: data/habits.yaml:walk |
| `imported_at` | TEXT (instant) | no | ISO 8601 UTC instant of the import (left out of meta.data_hash) |
| `role` | TEXT (vocab `tracker_roles`) | no | 1.1: what it is for (vocab tracker_roles): habit \| mood \| activity; NULL = habit |
| `scale_min` | REAL | no | 1.1: scale trackers: the lowest point of the scale (1 on a 1 to 5 mood scale); NULL = not bounded |
| `scale_max` | REAL | no | 1.1: scale trackers: the highest point (5); higher is better. Set together with scale_min |

### `tracker_targets`

Optional: earlier targets, so history is judged against the target that applied then. A day uses the row with the latest from_date on or before it; days before every row use trackers.target.

| Field | Type | Required | Meaning |
|---|---|---|---|
| `tracker_id` | TEXT | **yes** | the tracker |
| `from_date` | TEXT (date) | **yes** | first day this target applied (YYYY-MM-DD) |
| `target` | REAL | **yes** | as trackers.target |
| `target_period` | TEXT (vocab `target_periods`) | **yes** | as trackers.target_period (vocab target_periods) |
| `days_of_week` | INTEGER | no | as trackers.days_of_week |
| `note` | TEXT | no | why it changed, in the person's words |

### `entries` (required table)

One logged action. Append-only: a correction is another entry (value -1 undoes a check).

| Field | Type | Required | Meaning |
|---|---|---|---|
| `entry_id` | TEXT | **yes** | the writer's id (16 hex, minted once per tap or dashremix log and kept on retry); imports: sha1 of source\|tracker\|date\|n, first 16 hex |
| `tracker_id` | TEXT | **yes** | the tracker it is for (entries for unknown trackers are kept, not counted) |
| `date` | TEXT (date) | **yes** | the person's local calendar date it counts for (YYYY-MM-DD) |
| `value` | REAL | **yes** | 1 for a check (-1 undoes one); a count step; a scale, amount or duration (seconds) value |
| `note` | TEXT | no | one line the person wrote with it |
| `source` | TEXT (vocab `entry_sources`) | no | app \| chat \| cli \| csv \| import (vocab entry_sources): app = the check-in card, chat = an assistant |
| `created_at` | TEXT (instant) | no | ISO 8601 UTC instant it was logged, with milliseconds (…T08:14:03.120Z) |
| `source_ref` | TEXT | no | where it came from: data/entries/2026-11/cli.jsonl, or file:line of an export |
| `imported_at` | TEXT (instant) | no | ISO 8601 UTC instant of the import (left out of meta.data_hash) |

### `scale_labels`

1.1, optional: the words for the points of a scale tracker (a mood app's own names: 5 = rad, 1 = awful). Boards show the label next to the number; a scale without labels shows the number only.

| Field | Type | Required | Meaning |
|---|---|---|---|
| `tracker_id` | TEXT | **yes** | a scale tracker |
| `value` | REAL | **yes** | a point of its scale, from scale_min to scale_max |
| `label` | TEXT | **yes** | the word for it, as the person or their app names it (good, meh) |

### `journal_entries`

1.1, optional: journal entries (free text the person wrote, with a date). PRIVATE BY DEFAULT: boards never put body or title into a static export, a screenshot, a note, an insight or the catalog unless the person opts in. Entries in `entries` carry the numbers (a mood, an activity done); a journal entry carries words, linked to them only by date.

| Field | Type | Required | Meaning |
|---|---|---|---|
| `journal_id` | TEXT | **yes** | the source's own id when it has one (dayone:<uuid>), else first 16 hex of sha1(source\|date\|time\|n) |
| `date` | TEXT (date) | **yes** | the person's local calendar date it was written for (YYYY-MM-DD), in the zone it was written in |
| `created_at` | TEXT (instant) | no | ISO 8601 UTC instant it was written, when the source gives one |
| `tz` | TEXT | no | IANA zone the date was taken in (Europe/London), when the source gives one or the board assumed one |
| `title` | TEXT | no | a title, when the source has one (private text) |
| `body` | TEXT | no | the text as written, Markdown or plain (private text) |
| `words` | INTEGER | no | words in title and body (a count, safe to share) |
| `tags` | TEXT | no | JSON array of the source's own tags (["travel"]), or NULL |
| `source` | TEXT | no | connector id that wrote the row: dayone-json \| dayone-text \| daylio-csv \| ... |
| `source_ref` | TEXT | no | where it came from: file:line, or file#uuid |
| `imported_at` | TEXT (instant) | no | ISO 8601 UTC instant of the import (left out of meta.data_hash) |

### `skips`

Days the person excused on purpose. A skipped day neither counts as done nor breaks a streak.

| Field | Type | Required | Meaning |
|---|---|---|---|
| `skip_id` | TEXT | **yes** | sha1 of tracker\|date, first 16 hex (one skip per tracker and day) |
| `tracker_id` | TEXT | **yes** | the tracker |
| `date` | TEXT (date) | **yes** | the local date skipped (YYYY-MM-DD) |
| `reason` | TEXT | no | in the person's words (ill, travelling) |
| `source` | TEXT | no | habits-yaml \| loop-csv \| streaks-csv |
| `source_ref` | TEXT | no | where it came from |
| `imported_at` | TEXT (instant) | no | ISO 8601 UTC instant of the import |

### `data_issues`

What the importer could not read or decided: rows skipped, unknown trackers, files it could not open.

| Field | Type | Required | Meaning |
|---|---|---|---|
| `issue_id` | TEXT | **yes** | stable id |
| `severity` | TEXT (vocab `severities`) | **yes** | info \| warn \| error (vocab severities) |
| `kind` | TEXT | **yes** | rows_skipped \| unknown_tracker \| before_start \| file \| ... |
| `title` | TEXT | **yes** | one line |
| `detail` | TEXT | **yes** | what and where (file:line), never the person's notes |
| `source_ref` | TEXT | no | file, or file:line |
| `handling` | TEXT | **yes** | what the importer did about it |

### `annotations`

Notes on metrics and pages (platform table, as finance@2). Numbers only through {{metric:...}} placeholders.

| Field | Type | Required | Meaning |
|---|---|---|---|
| `annotation_id` | TEXT | **yes** | stable id |
| `target` | TEXT | **yes** | metric id or page id |
| `kind` | TEXT | **yes** | note \| caveat \| flag \| decision \| open_item |
| `body` | TEXT | **yes** | the note text |
| `author` | TEXT | no | person or assistant |
| `source_ref` | TEXT | no | where it came from |
| `created_at` | TEXT | no | ISO 8601 instant |
| `data_hash` | TEXT | no | hash of the cited metric values when written (stale when they change) |
| `status` | TEXT | no | active \| stale \| retired |

### `metric_registry`

| Field | Type | Required | Meaning |
|---|---|---|---|
| `metric_id` | TEXT | **yes** | e.g. habits.today |
| `version` | INTEGER | no | the metric's own version |
| `unit` | TEXT | no | rows \| pct \| count \| days ... |
| `params` | TEXT | no | comma list of parameters it honours |
| `description` | TEXT | no | the @desc line |
| `sql` | TEXT | no | expanded SQL |
| `test` | TEXT | no | the @test line (check that covers it) |

<!-- fields:end -->

## Vocabularies
- `tracker_kinds.csv`: `trackers.kind` and how a day's value is formed.
- `target_periods.csv`: `trackers.target_period`, `tracker_targets.target_period`.
- `entry_sources.csv`: `entries.source`.
- `weekdays.csv`: `meta.week_start` values and the `days_of_week` bit of each day.
- `severities.csv`: `data_issues.severity`.
- `tracker_roles.csv` (1.1): `trackers.role`.

## Conformance checks
See `checks.yaml`. `dashremix spec check <db> tracker@1` runs them after the DDL diff, the meta keys and the JSON
Schema. The fixtures (`fixtures/`) are a fictional golden set: a daily habit with a tap and its undo, a weekly target
that changed, a weekday-only count, an archived habit, a scale tracker whose latest entry wins, a skip and an
export row; (1.1) a bounded mood scale with its labels, an activity tracker with a Daylio entry, and two journal entries
(Day One with its zone, Daylio with a title).
