Skip to content

Feature: Compaction tombstones — preserve full chat history across /compact #394

@ovistoica

Description

@ovistoica

To upvote this issue, give it a thumbs up. See this list for the most upvoted issues.

Context

Spawned from #388.

Problem

When /compact runs, the server replaces the full chat history with a summary. The pre-compaction messages are gone from the server's perspective. The current buffer still shows them visually, but as soon as you resume or fork that chat, all prior history is lost — the only state the server has is the compaction summary.

If you later fork from a pre-compaction message, those turns would be included in the LLM request — but since the history was discarded, that fork point is gone entirely.

Proposed solution: tombstones

Instead of replacing history, compaction should insert a tombstone marker at the point where compaction occurred. The LLM receives only history after the tombstone (same effective behavior as today), but:

  • The full pre-compaction history is preserved on the server
  • The user can see the complete conversation in the chat buffer
  • Any message before the tombstone can be used as a fork/rollback point
  • Prompt caching is preserved for the post-tombstone context

From the LLM's perspective nothing changes. The tombstone is a server-side and UX concept only.

Current behavior

[message 1]
[message 2]        ← lost on resume
[message 3]        ← lost on resume
[/compact]
[summary]          ← only this survives resume/fork
[message 4]

Proposed behavior

[message 1]
[message 2]        ← still visible, still forkable
[message 3]        ← still visible, still forkable
─── compacted ─── ← tombstone marker
[summary]
[message 4]

Notes

  • The client (e.g. Emacs) could render the tombstone as a visual divider in the chat buffer
  • Fork/rollback to any pre-tombstone message should work the same as forking any other message
  • Multiple tombstones (multiple /compact cycles) should be supported naturally

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions