[GH-ISSUE #4408] [Feature]: Summarize messages since the latest active summary #2394

Closed
opened 2026-10-21 05:47:51 +07:00 by bsakaguchi · 5 comments
Owner

Originally created by @olegpro171 on GitHub (Aug 1, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4408

Originally assigned to: @SpicyMarinara on GitHub.

What problem does this solve?

Roleplay stories naturally progress through logical arcs, but automatic Chat Summary generation runs on a fixed message interval. The interval can split an ongoing arc or fail to align with the point where the user wants to begin something new.

Users can currently create a manual summary using the last N messages or an explicit message-number range. However, determining how many messages remain unsummarized and entering that value or range manually is tedious.

A quick way to summarize the current unsummarized tail would let users close an arc at a meaningful point and prepare the roleplay context for what comes next.

Proposed solution

Add two context-sensitive actions to the Roleplay Chat Summary popover.

When Summary Scope: Last is selected:

  • Show a new Summarize new messages button.
  • Position it between Write and Generate.
  • Suggested tooltip: "Summarize messages after the latest active summary through the newest message."
  • Clicking it should immediately generate a summary for the current unsummarized tail.

When Summary Scope: Range is selected:

  • Show a new Select unsummarized tail button near the From and To inputs.
  • Suggested tooltip: "Set the range to messages after the latest active summary through the newest message. You can adjust it before generating."
  • Clicking it should populate the range without generating immediately, so the user can adjust it before clicking Generate.

Both controls should only appear for their corresponding Summary Scope.

For generated summaries, the latest reliable boundary can be derived from the exact messageIds already stored on summary entries:

  1. Consider enabled summary entries with message provenance.
  2. Match their messageIds against the current ordered chat history.
  3. Find the newest current message covered by any of those entries.
  4. Select the following message through the newest message.

The boundary should be resolved server-side against the complete current history as the client may only have a paginated portion of chat loaded.

A successful manual flush should also be considered when calculating the next automatic-summary cadence. Otherwise, an automatic summary that was nearly due before the manual flush could trigger immediately after the first turn.

Alternatives considered

  • Continue relying on the automatic interval. This does not align summaries with logical story boundaries. Tedious to summarize manually.
  • Use lastAutomaticSummaryMessageId as the boundary. This is not reliable evidence that a summary was saved because it is a cadence marker and may advance when the model returns no durable summary or when approval is still pending.
  • Store a separate numeric "last summarized index." Existing per-entry message IDs are stronger because message numbers can shift after deletion.

Additional context

Relevant implementation and edge-case notes:

  • Generated manual and automatic summary entries already store the exact messageIds they covered, so no storage migration should be necessary for current structured summaries.
  • Disabled summaries should not establish the boundary because their content is not included in model context.
  • Overlapping summary entries can be handled by choosing the greatest current covered index.
  • Summary entries may retain references to messages that were later deleted. Ignore references that no longer match a current chat message. If none of an entry’s covered messages exist, that entry cannot establish the summary boundary.
  • Legacy summaries and hand-written summary entries have no message provenance. The UI should report that a reliable boundary is unavailable.
  • Editing a summarized message or changing its active swipe can make the summary stale while preserving the same message ID. Detecting semantic staleness would require storing source revisions or hashes and can remain outside the initial scope.
  • Messages manually hidden from AI should not independently establish a summary boundary because that flag is also used outside summary generation.
  • If more than the current 500-message limit remains, the action should explain the limit and use batching.
  • The current Summary Scope option "Last" has a five-message minimum and can expand its selection to reclaim a protected visible tail. A dedicated "since latest summary" request should instead use exact message anchors so one to four new messages can still be selected correctly.
  • Generating a summary should hide messages when Hide summarised messages is enabled. The protected recent-message tail should remain visible.
  • Branch creation already remaps eligible summary provenance to copied message IDs, which should allow the same boundary calculation to work in branches.

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @olegpro171 on GitHub (Aug 1, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4408 Originally assigned to: @SpicyMarinara on GitHub. ## What problem does this solve? Roleplay stories naturally progress through logical arcs, but automatic Chat Summary generation runs on a fixed message interval. The interval can split an ongoing arc or fail to align with the point where the user wants to begin something new. Users can currently create a manual summary using the last N messages or an explicit message-number range. However, determining how many messages remain unsummarized and entering that value or range manually is tedious. A quick way to summarize the current unsummarized tail would let users close an arc at a meaningful point and prepare the roleplay context for what comes next. ## Proposed solution Add two context-sensitive actions to the Roleplay Chat Summary popover. When **Summary Scope: Last** is selected: - Show a new **Summarize new messages** button. - Position it between **Write** and **Generate**. - Suggested tooltip: "Summarize messages after the latest active summary through the newest message." - Clicking it should immediately generate a summary for the current unsummarized tail. When **Summary Scope: Range** is selected: - Show a new **Select unsummarized tail** button near the From and To inputs. - Suggested tooltip: "Set the range to messages after the latest active summary through the newest message. You can adjust it before generating." - Clicking it should populate the range without generating immediately, so the user can adjust it before clicking **Generate**. Both controls should only appear for their corresponding Summary Scope. For generated summaries, the latest reliable boundary can be derived from the exact `messageIds` already stored on summary entries: 1. Consider enabled summary entries with message provenance. 2. Match their `messageIds` against the current ordered chat history. 3. Find the newest current message covered by any of those entries. 4. Select the following message through the newest message. The boundary should be resolved server-side against the complete current history as the client may only have a paginated portion of chat loaded. A successful manual flush should also be considered when calculating the next automatic-summary cadence. Otherwise, an automatic summary that was nearly due before the manual flush could trigger immediately after the first turn. ## Alternatives considered - Continue relying on the automatic interval. This does not align summaries with logical story boundaries. Tedious to summarize manually. - Use `lastAutomaticSummaryMessageId` as the boundary. This is not reliable evidence that a summary was saved because it is a cadence marker and may advance when the model returns no durable summary or when approval is still pending. - Store a separate numeric "last summarized index." Existing per-entry message IDs are stronger because message numbers can shift after deletion. ## Additional context Relevant implementation and edge-case notes: - Generated manual and automatic summary entries already store the exact `messageIds` they covered, so no storage migration should be necessary for current structured summaries. - Disabled summaries should not establish the boundary because their content is not included in model context. - Overlapping summary entries can be handled by choosing the greatest current covered index. - Summary entries may retain references to messages that were later deleted. Ignore references that no longer match a current chat message. If none of an entry’s covered messages exist, that entry cannot establish the summary boundary. - Legacy summaries and hand-written summary entries have no message provenance. The UI should report that a reliable boundary is unavailable. - Editing a summarized message or changing its active swipe can make the summary stale while preserving the same message ID. Detecting semantic staleness would require storing source revisions or hashes and can remain outside the initial scope. - Messages manually hidden from AI should not independently establish a summary boundary because that flag is also used outside summary generation. - If more than the current 500-message limit remains, the action should explain the limit and use batching. - The current Summary Scope option "Last" has a five-message minimum and can expand its selection to reclaim a protected visible tail. A dedicated "since latest summary" request should instead use exact message anchors so one to four new messages can still be selected correctly. - Generating a summary should hide messages when **Hide summarised messages** is enabled. The protected recent-message tail should remain visible. - Branch creation already remaps eligible summary provenance to copied message IDs, which should allow the same boundary calculation to work in branches. ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:47:51 +07:00
Author
Owner

@olegpro171 commented on GitHub (Aug 1, 2026):

If this request is approved, I can also proceed with implementing the feature and its regression and browser coverage.

<!-- gh-comment-id:5151841555 --> @olegpro171 commented on GitHub (Aug 1, 2026): If this request is approved, I can also proceed with implementing the feature and its regression and browser coverage.
Author
Owner

@SpicyMarinara commented on GitHub (Aug 1, 2026):

Hey pookie, you can already choose to hide summarized messages and summarize the last X messages in each selected interval. Recently, we also added an option to summarize summaries.

<!-- gh-comment-id:5151895534 --> @SpicyMarinara commented on GitHub (Aug 1, 2026): Hey pookie, you can already choose to hide summarized messages and summarize the last X messages in each selected interval. Recently, we also added an option to summarize summaries.
Author
Owner

@olegpro171 commented on GitHub (Aug 1, 2026):

@SpicyMarinara I know that its already a feature to summarize last X messages, I only proposed to automatically set that X to the count of unsummarized tail so manual summarize does not require to enter range manually each time and instead is is a one-click action

<!-- gh-comment-id:5151911073 --> @olegpro171 commented on GitHub (Aug 1, 2026): @SpicyMarinara I know that its already a feature to summarize last X messages, I only proposed to automatically set that X to the count of unsummarized tail so manual summarize does not require to enter range manually each time and instead is is a one-click action
Author
Owner

@SpicyMarinara commented on GitHub (Aug 1, 2026):

Doesn't Backfill already fill this role?

<!-- gh-comment-id:5152273683 --> @SpicyMarinara commented on GitHub (Aug 1, 2026): Doesn't Backfill already fill this role?
Author
Owner

@olegpro171 commented on GitHub (Aug 1, 2026):

Backfill partially overlaps, but it was designed for retrospective recovery. It divides the history into fixed-sized batches, which works good for long chat history. The proposed feature however is more like a story checkpoint. It summarizes the current tail after the latest active summary entirely as one batch, provided it fits within the reasonable limits.

That distinction can affect summary quality. A single batch lets the summarizer have clearer picture of the event: its setup, development, outcome, and remaining threads together. With backfill, those elements will be split into different batches by arbitrary batch boundary. Current Backfill feature preserves continuity by providing each batch with the compiled summaries from preceding batches, but not their original messages. This can fragment or omit details compared with summarizing the complete event as one deliberately selected range.

Backfill remains preferable for hundreds of older messages. A single range is not automatically better when it becomes very large. The proposed feature is intended to be used frequently after smaller, coherent events.

Thinking again, with the similarities to the backfill in mind, it might be better to implement it as simply one button near the button for ordinary backfill to simplify the UI.

<!-- gh-comment-id:5152392492 --> @olegpro171 commented on GitHub (Aug 1, 2026): Backfill partially overlaps, but it was designed for retrospective recovery. It divides the history into fixed-sized batches, which works good for long chat history. The proposed feature however is more like a story checkpoint. It summarizes the current tail after the latest active summary entirely as one batch, provided it fits within the reasonable limits. That distinction can affect summary quality. A single batch lets the summarizer have clearer picture of the event: its setup, development, outcome, and remaining threads together. With backfill, those elements will be split into different batches by arbitrary batch boundary. Current Backfill feature preserves continuity by providing each batch with the compiled summaries from preceding batches, but not their original messages. This can fragment or omit details compared with summarizing the complete event as one deliberately selected range. Backfill remains preferable for hundreds of older messages. A single range is not automatically better when it becomes very large. The proposed feature is intended to be used frequently after smaller, coherent events. Thinking again, with the similarities to the backfill in mind, it might be better to implement it as simply one button near the button for ordinary backfill to simplify the UI.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#2394
No description provided.