Skip to content

feat: persistent pressure history log with top consumer at each snapshot #34

Description

@alecf

Problem

Total Recall only keeps 30 seconds of rolling data and resets on relaunch. When you notice your machine was slow an hour ago, there's no record of what happened — which app spiked, when pressure escalated, whether it recovered. You're left guessing.

Proposed Solution

Maintain a lightweight in-memory (and optionally on-disk) ring buffer of historical snapshots spanning ~30–60 minutes. Expose it as a scrollable "History" timeline view showing:

  • Memory pressure level over time (color-coded band: green/yellow/red)
  • Top 3 consumers at each point in time
  • Free memory trend

Implementation Notes

  • Add a HistoryStore actor in DataLayer/ holding a ring buffer of HistoryEntry structs: (timestamp, pressureLevel, freeMemory, topConsumers: [(name, footprint)]) — very compact, ~200 bytes/entry × 720 entries (1 hour at 5s) = ~140 KB
  • The systemOnly refresh already runs every 60s when the window is hidden — it can cheaply append to HistoryStore even in the background, giving coverage across the full session
  • Expose as a new "History" window or sheet, accessible from the menu bar dropdown
  • Visualization: a simple stacked area chart (SwiftUI Path) with time on X axis and memory breakdown on Y; a band below showing pressure level as a color

Optional

  • Persist to ~/Library/Application Support/TotalRecall/history.bin so history survives relaunches
  • Configurable retention window (30 min / 2 hr / 8 hr) in Settings

Why This Matters

Retrospective analysis is the missing piece for a developer who notices symptoms after the fact. "My build was slow at 3pm" — open History, see Chrome was at 4.2 GB and pressure hit Warning at 2:58pm. Actionable without requiring the window to be open proactively.

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

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions