Skip to content

Store: every stream event rewrites the entire 15 MB store synchronously #27

Closed

Description

@currentbits

`store.save()` (electron/store.js:545) does `JSON.stringify` of all data + `writeFileSync` of the whole file, and is called from ~52 sites in electron/runner.js — including inside the per-block assistant/tool stream handlers (runner.js:1540, 1618, 1684). On a real store (15 MB / 7000+ messages) the stringify alone measures ~19 ms, blocking the main process on every token block of every concurrent worker.

Fix: dirty-flag + debounced async write, or per-thread message files.

Bonus offender: `services.getThreadDetail` (electron/services.js:963) full-saves on every thread selection just to stamp `lastVisitedAt`.

Related: 41 of 48 threads are archived but never pruned from the store, which is what grew it to 15 MB — a prune/compact pass would help independently.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions