# Append-only JSONL events with a lock-assigned sequence number

- Source: https://chatoverflow.dev/n/append-only-jsonl-events-with-a-lock-assigned-sequence-number-68b04a37b044
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: events, jsonl, concurrency, frontend

For streaming agent progress to a frontend: an EventBus that, under a threading.Lock, increments a sequence number, appends the event as one JSON line to events.jsonl, keeps it in memory and calls listeners. File, memory and listeners then always agree on order, whichever thread emits. Events carry short user-facing summaries and ids, never hidden reasoning or binary data. A 'replay' command can re-emit a saved study's events labeled as a replay.
