SelfscribeDownloadOpen the app

Habit tracker

Tick switches, rate your day and watch streaks build, all saved as lines of text.

Interactive · Simple · uses table, totals, calendar

Edit it in the playgroundRead the file

What it shows

Track daily habits with switches, stars and streaks.

What you learn

Switch and star columns, a column of suggested words, tiles that count shares and streaks, a streak log, cards for the good days, a calendar, averages in a view.

Try this

  • Switch off water for 25 November, and that day's line in the text changes from yes to no.
  • Give 13 November four stars, and it joins "The good days".
examples/habit-tracker.self · 136 lines
~~~ selfscribe
# Lesson: Track daily habits with switches, stars and streaks.
# You learn: switch and star columns, a column of suggested words, tiles that count shares and streaks, a streak log, cards for the good days, a calendar, averages in a view.
# Try this: switch off water for 25 November, and that day's line in the text changes from yes to no.
# Try this: give 13 November four stars, and it joins "The good days".
# summary: Tick switches, rate your day and watch streaks build, all saved as lines of text.
# category: apps
# tags: interactive, simple, home
# uses: table, totals, calendar
#
# ---- "```data NAME" ... "```": a table of rows, and "view: NAME ..." to show it again -------
# `use data` brings the Markdown rules plus data blocks and `view:` lines. A column's type
# chooses how you edit it: `toggle` is a switch, `rating` is five stars, and
# `suggest(...)` offers words while still taking any other.
use data
set title Habit tracker
set style sans

# ---- "lead ..." on its own line: a larger, quieter opening line --------------------------
line   lead _      -> p.lead { font-size: 1.12em; opacity: 0.75; max-width: 34em; margin-top: -0.4em }  as ht-lead

# ---- "```habit" ... "```": a streak log, one line a day with the date and what you did ----
block  ``` habit ... ```  -> habit  verbatim
~~~
# November

lead One line a day, ticked before bed. The file stays a plain log I can still read in ten years.

view: days as stats columns walk, read, water avg mood plain

```habit
# Practice streaks
habits: spanish, piano, sketch
days: 28
2026-11-01 spanish sketch
2026-11-02 spanish piano
2026-11-03 spanish
2026-11-04 spanish piano
2026-11-05 spanish
2026-11-06 spanish piano
2026-11-07 spanish sketch
2026-11-08 spanish piano sketch
2026-11-09 spanish
2026-11-10 spanish piano
2026-11-11 spanish
2026-11-14 spanish sketch
2026-11-15 spanish piano sketch
2026-11-16 spanish piano
2026-11-17 spanish
2026-11-18 spanish piano
2026-11-19 spanish
2026-11-20 spanish piano
2026-11-21 spanish sketch
2026-11-22 spanish piano sketch
2026-11-23 spanish piano
2026-11-24 spanish
2026-11-25 spanish piano
```

## The last seven days

view: days as table filter day >= 2026-11-19 sort day desc columns day, walk, read, water, mood, note plain

## The good days

`filter mood >= 4` keeps the days with four stars or more.

view: days as cards filter mood >= 4 columns day, mood, note sort mood desc

## The month

view: days as calendar by day columns note, day

## How often did I walk?

`filter walk` keeps the days with the walk switch on. `avg mood` shows the mood on those days.

view: days as table columns day, walk, read, water, mood filter walk sum mood avg mood count

## Every day

```data days as table sort day desc
day:date, walk:toggle, read:toggle, water:toggle, mood:rating, note:suggest(tired|good|great|busy)
2026-11-01, no, yes, yes, 3, rain all day
2026-11-02, yes, yes, no, 4, good
2026-11-03, yes, no, yes, 3, busy
2026-11-04, yes, yes, yes, 4, good
2026-11-05, no, yes, no, 2, tired
2026-11-06, yes, yes, yes, 5, great
2026-11-07, yes, no, yes, 4, park run
2026-11-08, yes, yes, no, 4, good
2026-11-09, no, yes, yes, 3, busy
2026-11-10, yes, no, yes, 3, busy
2026-11-11, yes, yes, yes, 4, good
2026-11-12, no, no, no, 2, a cold coming on
2026-11-13, no, yes, yes, 2, tired
2026-11-14, yes, yes, yes, 4, good
2026-11-15, yes, yes, no, 5, great
2026-11-16, yes, no, yes, 3, busy
2026-11-17, yes, yes, yes, 4, good
2026-11-18, no, yes, yes, 3, late meeting
2026-11-19, yes, yes, no, 4, good
2026-11-20, yes, yes, yes, 4, good
2026-11-21, yes, yes, yes, 5, great
2026-11-22, yes, yes, yes, 5, lunch with Mum
2026-11-23, yes, yes, yes, 4, good
2026-11-24, yes, yes, yes, 3, busy
2026-11-25, yes, yes, yes, 4, good
```

Some notes are not one of the suggested words. A `suggest` column takes them anyway.

## How it's made

Each day is one line of the table under "Every day":
`2026-11-25, yes, yes, yes, 4, good`. The first line of the block types the columns, so a
`toggle` is a switch, a `rating` is five stars and `suggest(…)` offers words as you type. Flip a
switch or click a star anywhere on the page, and that line changes.

- The tiles are `view: days as stats columns walk, read, water avg mood plain`. A switch column
  becomes its share of days, and the first tile counts the days in a row with every switch on.
- "The last seven days" is the same table, filtered by date and drawn `plain`.
- The practice streaks are a fenced block named `habit`, a log of its own: one line a day,
  the date and the habits done. It counts each habit's current and best run, and the button in
  front of a row ticks today by writing today's line.

## Try it yourself

1. Switch off water for 25 November. That day's line in the text changes from yes to no, and
   the run of days in the first tile ends.
2. Give 13 November four stars. It joins "The good days".
3. Add a line `2026-11-26, yes, yes, yes, 4, good` to the table. It shows on the calendar and
   in each view.
4. In the practice log, add `2026-11-12 spanish`. Spanish's best run grows.

Next: *Book club* links tables together; *Kanban board* puts rows on a board.