Skip to content

Session storage and continuity for large historical stores #583

Closed
13 of 13 issues completed
Closed

Description

@JAORMX

Context

Live debugging of mecatui sessions and /sessions against real historical stores exposed several coupled storage and UX failures:

  • mecatl workspace: 12 GB / 807 snapshots; ToolHive: 3 GB / 157 snapshots.
  • 645/807 latest records exceed the 64 KiB tail window, causing full-file scans.
  • A live process allocated 78.5 GB and ran 1,113 GCs in ~156s while listing.
  • inventory paging currently bounds response size, not work; the client fetches all pages before rendering.
  • 800/807 mecatl and 156/157 ToolHive snapshots predate durable kind, so they appear under Other and are inspect-only.
  • retention and stale-session reconciliation traverse the same expensive inventory.

Outcome

Large historical stores remain responsive and manageable without data loss:

  1. latest-record reads are bounded by the latest record, not file history;
  2. current snapshots stop growing quadratically;
  3. inventory pagination is work-bounded and progressive;
  4. legacy sessions can be explicitly adopted as writable chats from the TUI without silently escalating unknown records;
  5. storage migration/compaction and destructive cleanup are distinct, safe workflows;
  6. automatic retention is configurable and observable.

Delivery phases

Phase 0 — immediate safety and relief

  • protect unknown sessions from automatic retention;
  • bounded reverse latest-record reader.

Phase 1 — storage and inventory

  • versioned atomic current snapshots;
  • rebuildable metadata catalog, true pagination, narrower locking;
  • progressive Sessions TUI.

Phase 2 — management APIs

  • resumable storage migration/compaction;
  • retention planner/manual cleanup;
  • storage health;
  • server-side legacy adoption.

Phase 3 — operator UX

  • retention configuration;
  • TUI adoption;
  • TUI cleanup/optimization;
  • systemd/macOS operations documentation.

Non-goals / separations

  • Physical format migration must not reclassify unknown as main.
  • Storage compaction (preserves sessions) must not share consent with cleanup (deletes sessions).
  • Legacy adoption is an explicit trust decision and must remain separate from physical migration.
  • The TUI must call authenticated server operations; it must never edit store files directly.
  • External cron/find deletion is unsupported; daemon-owned retention remains the normal automatic path.

Sub-issues

Sub-issues

13 of 13 Issues completed
Loading 13 sub-issues

Metadata

Metadata

Assignees

Labels

enhancementux

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions