# tomorrow

Log anything that repeats. It prints the odds of the next one.

Take the binary for your machine from `dist/` (`tomorrow-linux-amd64`, `tomorrow-linux-arm64`, `tomorrow-darwin-amd64` or `tomorrow-darwin-arm64`), put it on your PATH as `tomorrow`, and make it executable with `chmod +x tomorrow`. No compiler is needed to use it. To build `dist/` yourself, with Go 1.22 or newer, from this folder:

    for o in linux darwin; do for a in amd64 arm64; do CGO_ENABLED=0 GOOS=$o GOARCH=$a go build -o dist/tomorrow-$o-$a .; done; done

## What it does

`tomorrow` keeps one plain log of outcomes, one yes or no per trial, and prints for each event the chance that the next trial is a yes, by Laplace's rule of succession: (yeses + 1) / (trials + 2).

    tomorrow run <event> -- <command> [args...]   run a command, record yes if it exits 0
    tomorrow record <event> <yes|no>              record an outcome by hand
    tomorrow table                                print the table (also: tomorrow)
    tomorrow help                                 print the help

For example:

    tomorrow record meeting-on-time yes
    tomorrow run build -- bun run build
    tomorrow table

Event names are 1 to 24 lowercase letters, digits, dots, underscores and hyphens, starting with a letter or digit.

## run

The command starts directly, without a shell. For pipes or redirects, write `-- sh -c '...'`.

The command gets your terminal's stdin, stdout and stderr as they are, the same working directory and the same environment. Its output is not copied or changed, and `tomorrow run` exits with its exit code (128 plus the signal number if a signal stopped it). After it ends, one line is added on stderr, here after `tomorrow run tests -- go test ./...`:

    tomorrow: tests: yes. 1 of 1. Tomorrow 66.7%.

Ctrl-C reaches the command as usual; `tomorrow` stays to record the result. A command that could not start (a typo, a file that is not executable) is not an outcome, so nothing is recorded and the exit code is 127 or 126. If the log cannot be written, you are told, and the exit code is still the command's.

## The table

After three yes records (output of a real session, with its log under `/tmp`):

    Tomorrow Table for 2026-10-14
    Record: /tmp/tmp.PBOKFQZvIX/tmp.9oA1QBfQAD/log.jsonl
    Method: rule of succession (Laplace, 1814). Each trial counted as independent.

    Event            Trials  Yes  Tomorrow*  To 90%  Last five
    meeting-on-time       3    3      80.0%       5  YYY

    * No event has been assigned certainty.

`Tomorrow` is the chance that the next trial is a yes, to one decimal. `To 90%` is how many more yeses in a row would bring it to 90% or more. `Last five` is the most recent outcomes, oldest on the left.

Each trial is counted as independent. Yours may not be. The last five are printed so you can see.

## The log

One file, the first that applies: `$TOMORROW_LOG`, else `$XDG_STATE_HOME/tomorrow/log.jsonl`, else `$HOME/.local/state/tomorrow/log.jsonl`. It is created on the first record and only ever appended to, one JSON object per line, as this one written by that run:

    {"at":"2026-10-13T14:52:46Z","event":"tests","ok":true,"how":"run","ms":1113}

A hand record has `"how":"hand"` and no `ms`.

There is no delete command. To forget an event, edit the file; it is plain text. A line that cannot be read is skipped and reported, never changed.

## Tests

    go test ./...
