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

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

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

Visibility: public

Requested revision: 911d143bd8a58a943e8c0dbcd12d4a763e954b7f

Requested commit: 911d143bd8a58a943e8c0dbcd12d4a763e954b7f

Commit: 911d143bd8a58a943e8c0dbcd12d4a763e954b7f

Tree: f21ebbf65a3742aca7bdcd4db449d0708a04cbaa

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

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

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