The code for this extension was AI-generated, then manually edited and refactored so the final result is around 60% AI.
I'm a C++ programmer, and this is my first time touching JavaScript, hence the vibecoding.
This is a simple Summary/Memory extension. It allows you to select a range of messages in chat and summarise them using an LLM or manually. It then replaces the selected range with a summary message.
The original messages are stored away and hidden, but can be restored at any time.
Select a Start ( ) and an End (
) message using the two Message Action buttons.


Then the options for AI Summary ( ), Manual Summary (
), and Clear Range (
) will appear.

Click the AI Summary button and wait for the AI to finish generating.
Alternatively click the Manual Summary button, then edit the inserted message and write a manual summary.
Summary messages will contain an expandable header which contains the original messages. Click anywhere on the header (except the buttons) to expand it.

The Restore Original and Delete Summary ( ) button will detele the summary and restore the original messages.
The Re-Summarise (AI) ( ) will regenerate a new summary using the stored original messages.
/ils-summarise manual=[true|false] x y is avalable to generate a summary.
Usage: x and y are start and stop message indices, when manual is set to true inserts an placeholder summary message instead of using an AI (Same as the Manual Summary button).
/ils-summarise 1 10- summarise messages 1 through 10 inclusive using AI./ils-summarise manual=true 1 10- add a placeholder summary for messages 1 through 10.
When a range is selected, the extension creates a new empty summary message and inserts it into the chat.
The selected messages are stored in the extra data field of the new summary message.
A summary prompt is generated by taking the main summary prompt and adding a specified number of earlier messages for context (or the entire history if the setting is -1). The context is wrapped with Start/End markers as defined in the settings.
A mid-prompt is appended (also defined in the settings).
The messages to be summarised are then added, also wrapped in Start/End markers.
A end-prompt is appended (also defined in the settings).
This complete prompt is sent to the LLM using the current connection profile or a specific profile if the option is enabled.
Once the LLM is done, the contents of the summary message are replaced with the response. The chat is saved and refreshed.
When the Restore button is pressed, the summary message is deleted and the original messages are reinserted into the chat.
Settings in the Extension settings menu:
| Setting | Meaning |
|---|---|
| Setting Presets | Saved setting presets for the extension |
| Summary Prompt Start | Prompt text inserted at the start of the summary generation prompt |
| Historical Context Size | Number of messages to include in the summary generation prompt. -1 for auto (it will try to fit as many as it can to fill the allowed context window. 0 for none) |
| Historical Context Start Marker | Marker that indicates the start of the historical context |
| Historical Context End Marker | Marker that indicates the end of the historical context |
| Summary Prompt Middle | Prompt text inserted after the historical context, but before the messages to be summarised |
| Content Start Marker | Marker that indicates the start of the messages to be summarised |
| Content End Marker | Marker that indicates the end of the messages to be summarised |
| Summary Prompt End | Prompt text inserted after the messages to be summarised |
| Response Token Limit | Maximum summary length allowed in tokens, 0 to use value set in the preset |
| Use specified Connection Profile | Use the connection profile selected in the dropdown for generating summaries |
| Use specified API Preset | Use the API Preset selected in the dropdown for generating summaries |
| Auto Scroll to summarised message | Whether or not automatically scroll chat to the summarised message, summary generation causes that to refresh, and SillyTavern's default behaviour is to scroll to tbe bottom |
| Summary message sender name | Summary messages can have custom sender name, it can either be: User, Character or Custom. If your preset includes name prefixes, using a custom name might hint LLM that specific message is a summary |
Can I edit the summary?
Yes! They behave like any other message.
Can summary messages be summarised?
Yes. Nested summaries are supported. When summarising a summary message, the summary text will be used, not the original messages
What happens during chat exports?
If exported as JSON, the original messages will be in the file.
When exported as plain text, only the summary messages will be exported.
Are swipes supported on summary messages?
No. It shouldn’t break, but swipes will behave like regular message swipes without any awareness of the summary or the original messages attached to it.
Is it compatible with extension X?
No idea. This extension directly manipulates chat and stores/restores messages without altering them. As long as other extensions are okay with that, it should be compatible — but no promises.
Can I select a specific Connection Profile/Chat Completion Preset for the summary?
Yes. Since v1.0.2
⚠ Warning: Any unsaved changes to Connection Profile or API Presets or AI Reponse Template will be lost during profile change.
How accurate is the token counter on Original Messages?
It uses SillyTavern's token counting function, which might be different from the actual model used. The stats are calculated during summary generation and cached. The token count that SillyTavern specifies for a message includes Reasoning tokens as well, while summary and chat history only use message text, therefore Original Messages specifically only count message text, which may not match actual model tokens perfectly, will still be more accurate than including reasoning.
For older chats before this feature was added, the token counts supplied by SillyTavern will be used.
In theory, if only models via Kobold API are used, the token counts should be accurate.
Has anyone actually asked these questions?
Yes, the Connection Profile one.
Chat Style - Document
This specific style hides the Message Actions buttons from older messages, which also removes the buttons added by this extension. Bubbles and Flat styles do work.
Fixed Historical Context not being counted properly toward total prompt size.
Improved error messages when summary context size is exceeded.
Adjusted css style for Original Messages.
See changelog.md