]> git.giacomolli.uk - onechat/commit
Add the append-only message log
authorAnderson A. Giacomolli <agiacomolli@gmail.com>
Fri, 6 Nov 2026 14:30:56 +0000 (11:30 -0300)
committerAnderson A. Giacomolli <agiacomolli@gmail.com>
Fri, 6 Nov 2026 14:30:56 +0000 (11:30 -0300)
commit5023a5ff75de371f147392be54aec7737fca36a5
tree95b20a5aa1f977e9f0657c0122ad418790cdf462
parent6572373d4945cc5c504fc5f760d7de51fb245d3f
Add the append-only message log

The log of one chat stores each message as one JSON line, {i, kind,
text, size, date}, in main/YYYY-MM-DD.jsonl for the local day of the
write. Each append goes to the disk before it returns, and the log loads
all lines again at start. An exclusive lock on the chat makes sure that
only one process writes it. After a failed write the log refuses more
writes, because the end of the file is not known.

The kinds are user, unii, tool, echo, work, and note. Size is the UTF-8
byte length of the text. Tests use testify, so the Nix package gets a
vendor hash.

Issue: beb9a70
go.mod
go.sum [new file with mode: 0644]
journal.go [new file with mode: 0644]
log.go [new file with mode: 0644]
log_test.go [new file with mode: 0644]
nix/package.nix