Skip to content

Client: bound history memory for visited threads #525

Description

@Tryanks

Summary

Bound client-side history memory. A client keeps the records of every thread it has visited for its whole lifetime, and loading older pages re-folds everything already held.

Current behaviour

  • session_records in crates/ui/src/store/mod.rs is a map by thread id that is never pruned; nothing in crates/ui/src removes entries.
  • Each earlier page re-folds all held records (crates/ui/src/store/history.rs), so scrolling up a long thread costs roughly the square of the pages loaded (inferred).
  • Prefetch keeps 6 screens above the viewport (HISTORY_WINDOW_SCREENS).

Proposal

  • Release a thread's records when it has not been viewed for a while (T3 Code uses a 5-minute idle TTL for thread snapshots), keeping the currently open thread and threads with running turns.
  • Fold incrementally, or fold per turn segment, so prepending a page does not re-fold the whole held window.
  • This matters most on phone clients and remote sessions.

Activity

  1. added
    performanceRuntime performance, latency, resource footprint
    on Sep 23, 2026
  2. Tryanks commented on Oct 6, 2026

    @Tryanks
    OwnerAuthor

    Not planned. The maintainer re-scoped the storage work on 2026-10-06: the requirement is data safety, not performance, and metadata plus event logs now live in one Turso database (#594, #601). This issue's premises (JSONL logs, host-loop parsing, redb index) no longer hold. A verified implementation of the idea exists in the closed draft #591 (commits on its branch were deleted; the PR keeps the diff) if it is ever wanted.

  3. Tryanks commented on Oct 6, 2026

    @Tryanks
    OwnerAuthor

    Reopened: closing this as "not planned" was my misreading. The maintainer's position is that performance is the first goal of the storage work; this item is deferred and to be re-evaluated on top of the Turso store (#594), not dropped.

  4. reopened this on Oct 6, 2026
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

    performanceRuntime performance, latency, resource footprint

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions