Red-Green Pomodoro

Public

A pomodoro timer with a history and statistics, built the way an agent should build anything: one small rule at a time, the test before the code, and nothing called done until something other than the agent's word says so.

Fifteen short cycles and a gate. Every cycle is the same three steps, and the session asks for them in order: Red, a test of the new rule that fails; Green, the code that passes it; Refactor, the code improved while the tests stay as they were. Twelve rules come first, one small feature each: the clock face, the time left, the progress, a pause, the cycle of focus and breaks, your own lengths, the statistics, the week, a line for today, the export. Then two more levels of tests - the pieces together, then the real page in a real browser - and then a rule changes. The last task puts a gate in front of "done".

All the while the session tests your tests. At Red it runs them on its own correct rules: they must pass there and fail on yours. At Green it swaps your rules for copies with exactly one rule broken, the saboteurs: a test that fails caught one, a suite that stays green let it through. Coverage says which lines ran; a saboteur says whether anybody looked. A Test Integrity judge reads the history at the end: small steps and tests that survived the build earn points, and a test bent to get green takes them away.

Sessions

4

Visibility

Public

Category

Product Build

Slug

red-green-pomodoro

Duration

30 min

Judge reviews

~9 per session

Active session

No

Points

10–150

Tags
  • web
  • testing
  • tdd
  • verification
  • ai-adoption
  • 1

    The clock face

    10

    pts / check

    +10 pts per passing check · +10 for completing the task

    A pomodoro timer, built one rule at a time. Each task is one turn of
    the same cycle: a failing test, the code that passes it, a tidy-up.
    Never the code first.

    One cycle, three checks, asked in this order. Each comes back every
    10 to 30 seconds until it passes, and only then the next one starts:

    Red the console of your new test failing, saved into red/.txt before the code exists; and that test passes on the session's own rules
    Green your code passes your tests; copies of the rules with this rule broken do not
    Refactor the code under src/ changed since green, the tests did not, and they still pass

    What each check answered is in ololo session status: read it when a
    step does not move on.

    The bench, once:

    1. package.json with "type": "module".

    2. src/rules.js, an ES module. The session swaps this file for its
      own, so it exports exactly what the tasks name and nothing else.

    3. Unit tests under test/. They import from src/rules.js, need no
      browser, no network and no real clock, and answer in seconds.

    4. AGENTS.md with one line:

      unit:

    The first rule:

    | format(seconds) | the clock face, "MM:SS", two digits on each side: 1500 is "25:00", 65 is "01:05", 0 is "00:00" |

    Write the test, run it, and keep what the console printed while it
    failed: that file is what Red asks for, in every task. Then the code.
    Inputs are always valid; test what the brief promises and nothing
    more.

    Red wants the console of the failing run in red/face.txt.

    Judged by
  • 2

    Time left

    10

    pts / check

    +10 pts per passing check · +10 for completing the task

    The next rule, same cycle: Red, Green, Refactor.

    | remaining(startedAt, now, minutes) | the whole seconds left on the clock |

    the numbers startedAt and now are milliseconds; minutes is the length of the interval
    rounding a second that has started still counts: with 24:59.5 left the answer is 1500
    the end never below 0, however late now is

    src/rules.js now exports format and remaining.

    Red wants the console of the failing run in red/left.txt.

  • 3

    How far along

    10

    pts / check

    +10 pts per passing check · +10 for completing the task

    The next rule, same cycle: Red, Green, Refactor.

    | progress(startedAt, now, minutes) | how much of the interval is over, as a whole percent |

    rounding down: 99 until the interval is really over, then 100
    the ends 0 at the start; never above 100, however late now is

    src/rules.js now exports format, remaining and progress.

    Red wants the console of the failing run in red/progress.txt.

  • 4

    A pause

    10

    pts / check

    +10 pts per passing check · +10 for completing the task

    A rule grows, same cycle: Red, Green, Refactor.

    | remaining(startedAt, now, minutes, paused) | paused is the milliseconds the clock has stood still so far: they do not count as time spent |

    an example a 25-minute focus started 10 minutes ago, 4 of them on pause, has 19 minutes left
    left out without the fourth argument nothing changes: the tests you have stay as they are

    Red wants the console of the failing run in red/pause.txt.

  • 5

    What comes next

    10

    pts / check

    +10 pts per passing check · +10 for completing the task

    The next rule, same cycle: Red, Green, Refactor.

    | phaseAfter(history) | what comes next: "focus" or "short" |

    an entry { type, date, minutes, completed }: type is "focus", "short" or "long", date is "YYYY-MM-DD"; a history lists entries oldest first
    the cycle an empty history starts with a focus; a completed focus is followed by a short break; a break is followed by a focus; a focus that was abandoned (completed: false) is followed by a focus again

    The long break comes in the next task: do not build it yet.

    Red wants the console of the failing run in red/next.txt.

  • 6

    The long break

    10

    pts / check

    +10 pts per passing check · +10 for completing the task

    The next rule, same cycle: Red, Green, Refactor.

    DURATIONS { focus: 25, short: 5, long: 15 }, in minutes
    the long break phaseAfter gives "long" after every fourth completed focus (the 4th, the 8th, ...), counted over the whole history; abandoned ones do not count; a long break, like a short one, is followed by a focus

    src/rules.js now also exports DURATIONS.

    Red wants the console of the failing run in red/long.txt.

  • 7

    Your own lengths

    10

    pts / check

    +10 pts per passing check · +10 for completing the task

    The next rule, same cycle: Red, Green, Refactor.

    | nextInterval(history, custom) | { type, minutes } of the interval to start |

    type what phaseAfter(history) says
    minutes the length custom names for that type, when it is a number above 0: { focus: 50 } makes a focus 50 minutes and leaves the breaks alone
    default DURATIONS, when custom is left out or names nothing above 0 for that type

    Red wants the console of the failing run in red/lengths.txt.

  • 8

    Today and all time

    10

    pts / check

    +10 pts per passing check · +10 for completing the task

    The next rule, same cycle: Red, Green, Refactor.

    | stats(history, today) | { today: { focus, minutes }, total: { focus, minutes }, rate } |

    a focus counts only when completed; an abandoned one adds no focus and no minutes
    today, total the completed focuses and the sum of their minutes: on the date today, and over the whole history
    rate completed focuses out of all focuses, as a whole percent rounded to the nearest; 0 when there is no focus

    More fields come in the next task: a test that pins the whole object
    will have to change with it.

    Red wants the console of the failing run in red/totals.txt.

  • 9

    Streak and best day

    10

    pts / check

    +10 pts per passing check · +10 for completing the task

    The next rule, same cycle: Red, Green, Refactor.

    | stats(history, today) | now { today, total, streak, rate, best } |

    streak the days in a row with at least one completed focus, ending today - or yesterday, while today has none yet
    best { date, focus } of the day with the most completed focuses, the earliest on a tie; null when there is none

    Months end: a streak runs across the first of a month.

    Red wants the console of the failing run in red/streak.txt.

  • 10

    The week

    10

    pts / check

    +10 pts per passing check · +10 for completing the task

    The next rule, same cycle: Red, Green, Refactor.

    | week(history, today) | seven days as a list of { date, focus, minutes }, oldest first, the last one today |

    a day its completed focuses and the sum of their minutes
    no focus the day is still in the list, with 0 and 0
    the edges a week runs across the first of a month

    Red wants the console of the failing run in red/week.txt.

  • 11

    One line for today

    10

    pts / check

    +10 pts per passing check · +10 for completing the task

    The next rule, same cycle: Red, Green, Refactor.

    | summary(history, today) | today in words |

    some focus "3 focuses, 75 minutes today" - the completed focuses of today and their minutes
    just one "1 focus", and "1 minute" when it comes to that
    none "No focus yet today"

    Red wants the console of the failing run in red/summary.txt.

  • 12

    The export

    10

    pts / check

    +10 pts per passing check · +10 for completing the task

    The next rule, same cycle: Red, Green, Refactor.

    | toCsv(history) | the history as CSV text |

    the first line date,type,minutes,result
    an entry 2026-11-19,focus,25,completed - or abandoned
    the order newest first
    the lines joined by a line feed, none after the last

    src/rules.js now exports DURATIONS, format, remaining, progress,
    phaseAfter, nextInterval, stats, week, summary and toCsv.

    Red wants the console of the failing run in red/export.txt.

  • 13

    The timer keeps a history

    10

    pts / check

    +10 pts per passing check · +10 for completing the task

    A new level, same cycle. The rules are pure; now come two pieces that
    hold state, and the tests that run them together.

    a store is handed a storage (getItem, setItem) and keeps the history through it
    a timer is handed a clock and a store: it starts what nextInterval says, can be paused and resumed, records the interval as completed when the clock passes its end, and as abandoned when stopped early

    Integration tests under test/integration run the timer and the store
    together, on a clock the test turns and a storage the test can read
    back: no browser, and nobody waits 25 minutes.

    AGENTS.md gains one line:

    integration:

    Red red/history.txt holds the console of the integration test failing: the test is there, the timer is not
    Green the integration command passes, and so does the unit command
    Refactor the code changed since green, the tests did not, both commands pass
  • 14

    The page

    10

    pts / check

    +10 pts per passing check · +10 for completing the task

    The last level, same cycle: the real page in a real browser.

    Scenario: The timer
    When the page is open
    Then it shows what comes next, the clock face and how far along
    it is, with controls to start, pause and stop
    And when the clock reaches 00:00 the interval goes into the
    history as completed and the next one is offered

    Scenario: History and statistics
    When intervals have been recorded
    Then the history lists them newest first: date, kind, minutes,
    completed or abandoned
    And the statistics show the line for today, the total, the
    streak, the rate, the best day and the seven days of the week
    And one control exports the history as CSV
    And all of it is still there after a reload

    Scenario: On a narrow screen
    When the page opens on a phone
    Then the clock, the history and the statistics fit without
    scrolling sideways

    The page uses src/rules.js, your timer and your store: no second copy
    of a rule. One end-to-end test under e2e/ drives it: start a focus,
    let the test's clock run it out, find it in the history and in the
    statistics, reload. It does not sleep.

    AGENTS.md gains two lines:

    run:
    e2e:

    The session runs the e2e command in a copy of your folder with a free
    port in the PORT variable: serve the page there when it is set.

    Red red/page.txt holds the console of the end-to-end test failing: the test is there, the page is not
    Green the e2e, the integration and the unit command pass
    Refactor the code changed since green, the tests did not, all three pass
  • 15

    The rule changes

    10

    pts / check

    +10 pts per passing check · +10 for completing the task

    Rules change. Change them the way you built them: the test first.

    the long break after every third completed focus (was: fourth), and it lasts 20 minutes (was: 15)
    a daily goal new: goal(history, today, target) gives { done, left, reached }: done is the completed focuses of today, left is how many are still missing and never below 0, reached is true from the focus that makes done equal to target

    src/rules.js now also exports goal. The old rule is a saboteur now:
    rules that still give a long break after the fourth focus, or one of
    15 minutes, must fail a test of yours. Rewriting those tests is the
    rule changing, not a test bending.

    Red wants the console of the failing run in red/change.txt.

  • 16

    The gate

    150

    pt budget

    Open-ended — a panel of 8 judges splits a 150-pt budget

    Fifteen cycles, each one seen red before it was green. The last thing to
    build is the gate in front of "done", so that neither you nor your
    agent can say it while a test is failing - and an honest account of
    what all these tests verify.

    Scenarios:

    Scenario: The gate
    When the verify: command runs every level, the cheapest first,
    and stops at the first that fails
    Then it exits 0 only when all of them are green
    And .claude/hooks/verify.sh, registered as a Stop hook in
    .claude/settings.json, runs it and exits 2 while it fails, with
    the reason on standard error

    Scenario: The gate is tried
    When the session breaks five rules in a copy of your folder and
    calls the verify: command, then the hook the way Claude Code does
    Then both say no
    And the hook finds the copy in CLAUDE_PROJECT_DIR, not at a path
    it remembers

    Scenario: The last saboteurs
    When the session draws eight saboteurs from all the rules at once
    Then a unit test fails on every one

    AGENTS.md gains one line:

    verify: <every level, cheapest first>

    Write TESTING.md, for the next person who opens this project:

    1. Each level - unit, integration, e2e: how many tests, how long it
      takes, one bug it would catch that the level below would not,
      and one thing it cannot see.

    2. The cycles: one where Red surprised you - a test that passed
      when it should have failed, or failed for another reason - and
      one refactoring the tests made safe.

    3. The saboteurs: one that survived at first, or the one that the
      fewest tests catch, and the test that catches it.

    4. The gate: what verify: runs, in what order, and what happens when
      your agent tries to stop while it fails.

    5. Three things that nothing here verifies.

    6. Your tally, as two lines:

      tests:
      seen red first:

    A panel reads the result: the tests, the code the refactoring steps
    left behind, the page and TESTING.md. One judge will ask for two
    screenshots of the page with a few intervals in the history,
    desktop.png and mobile.png (about 375 px wide): have them ready, your
    e2e test is the natural place to take them. A Test Integrity judge reads the history
    of the repository: small steps, tests that survived the build and a
    gate that holds earn up to 50 points. Points are taken away for rules
    that recognise the tests' inputs, a test bent or switched off to get
    green, a fake in place of the thing under test, a gate switched off,
    and a claim the evidence contradicts.

    When you are done, write .ololo/red-green-pomodoro-done.md with a
    short description of what is verified and how (at least 10 words).