# fix\(relay\): stop replaying the whole event store into the awareness relay · pingdotgg/t3code

[View on GitCafe](https://git.cafe/pingdotgg/t3code/commit/349347147dde2a204aa131c3408148a42901b655)

Repository: [pingdotgg/t3code](https://git.cafe/pingdotgg/t3code)

Visibility: public

Requested revision: 349347147dde2a204aa131c3408148a42901b655

Requested commit: 349347147dde2a204aa131c3408148a42901b655

Commit: 349347147dde2a204aa131c3408148a42901b655

Tree: 9099e028918ddc9f4a13e64102b1137ee7cfad06

Author: Julius Marminge

Committer: Julius Marminge

## Message

```
fix(relay): stop replaying the whole event store into the awareness relay

Live profiling of the built app (debugger pause inside the hot sqlite
call) showed AgentAwarenessRelay.publishThread grinding at ~8 full shell
snapshots per second after boot. Two causes:

- streamDomainEvents was eventSink.stream() with no cursor, which
  replays every stored event from genesis before going live — so each
  boot fed the relay the entire event history as fresh activity, and it
  queued a publish per activity-relevant event for hours. It now tails
  from the current high-water mark; the relay's startup snapshot publish
  already covers initial state, and the sink subscribes before reading
  the cursor so no live event is lost.
- publishThreadUnsafe materialized the full shell snapshot to find one
  thread; it now uses getThreadShell (archived/deleted map to the
  tombstone path exactly as the active-list lookup did).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

```

## Parents

- [3025e7d5246cda4f645cd8ddf5afdde91a13c287](https://git.cafe/pingdotgg/t3code/commit/3025e7d5246cda4f645cd8ddf5afdde91a13c287?format=markdown)

[Source at this commit](https://git.cafe/pingdotgg/t3code/tree/349347147dde2a204aa131c3408148a42901b655?format=markdown)
