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

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

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

Visibility: public

Requested revision: ae08dba10e974138e133a79321f11bd0ff9cff4e

Requested commit: ae08dba10e974138e133a79321f11bd0ff9cff4e

Commit: ae08dba10e974138e133a79321f11bd0ff9cff4e

Tree: 9e6fb0b4dce338b8880bc30a92c751249eb7216c

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

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

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