Skip to content

Hot retention: protect explicit saves; keep delivered history (stacked on #51) - #52

Open
jbwinters wants to merge 7 commits into
feat/checkpoint-git-statefrom
feat/hot-retention-by-use
Open

jbwinters wants to merge 7 commits into
feat/checkpoint-git-statefrom
feat/hot-retention-by-use

Conversation

@jbwinters

@jbwinters jbwinters commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Task Master 166. Stacked on #51. The commits under review are b93f0b7 and the review-fix commit after it; the merge commits only bring in base updates.

Problem. Hot memory kept the newest 12 checkpoints (72,000 characters), so newer turns evicted explicit remember saves like any other history.

Change, for every profile (local store and synced replica)

  • Retention order:

    1. the newest visible checkpoint;
    2. the latest three explicit saves per workspace (six in all, within half the character budget);
    3. the rest.

    Disputed or superseded saves are not protected.

  • Determinism. The replica's order doesn't depend on any device, so every device keeps the same set. Devices still on an older client retain by recency until they upgrade.

Change, for local-only profiles only

  • Ranking by use: the rest of history is ordered by the later of capture time and the last time it was delivered to a session on this machine.
  • Synced profiles retain through the replica, which ignores local use.
  • The use log (state/hot-checkpoint-use.json) is still written on full deliveries for every profile. The adapter can't tell whether the active profile is local-only, and a profile can switch between modes. The write is one small JSON file of at most 256 entries, written only when a checkpoint is delivered in full, which after Hot memory: send each checkpoint once per session; checkpoint wording #50 happens about once per session. It is read only when retention actually has to choose.

Not included. The displaced-history benchmark rerun on the free arm needs the paid task 161 pilot.

Verification

  • vitest run on Node 22.23.4 at the top of the stack: 83 files, 721 tests pass.
  • tests/runtime/hot-retention.test.ts covers:
    • save protection and its caps;
    • use-ranked eviction;
    • the newest capture surviving large saves in the replica;
    • disputed saves;
    • deterministic replica retention.
  • An independent review found defects: the replica could drop the newest capture, and use ranking had no effect on synced profiles. Both are fixed or described above.

…le history

Hot memory kept the newest 12 checkpoints (72,000 characters), so newer
turns evicted explicit 'remember' saves like anything else.

- Local store: the newest capture, then the latest three explicit saves
  per workspace (six in all), then the rest by most recent use or
  capture. Use is when a checkpoint was last delivered to a session on
  this machine (state/hot-checkpoint-use.json, local only). An entry
  that does not fit is skipped so a smaller one can still be kept.
- Synced replica: the same save protection, deterministic and without
  device-local use, so every device retains the same set.

The displaced-history benchmark rerun waits on the task 161 paid pilot.
Task Master 166.
… half the budget

- Replica: the newest visible checkpoint ranks above protected saves, so
  saves can no longer push the turn just captured out of the view.
- Protected saves are held to half the character budget (15,000 in the
  replica, 36,000 locally); disputed or superseded saves are not
  protected.
- Use-based ranking applies to local-only profiles; the use file is read
  only when retention has to choose. Docs say so, and note that older
  clients still retain by recency.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant