Repository navigation
Releases: LaneRendell/AutomaticChapterSummaries
Release list
v1.6.0
Changelog - Version 1.6.0
History-Aware Tracking
Version 1.6.0 introduces History-Aware Tracking for automatic undo/redo management of chapter summaries, along with important bug fixes.
New Features
History-Aware Tracking
Automatically manages chapter summaries when you use undo/redo operations. No more orphaned summaries or missing entries after navigating your story history!
How It Works:
- When you undo past a chapter break: The orphaned summary is automatically removed from the lorebook
- When you redo to restore a chapter break: The cached summary is restored from history storage
- Works with undo, redo, retry, and history jumps
Technical Details:
- Uses NovelAI's
onHistoryNavigatedhook to detect navigation events - Stores complete chapter state (summaries, fingerprints, condensed ranges) per history node
- Validates cached state against actual document to prevent stale state restoration
- Full state preservation through condensation operations
Configuration:
- Key:
history_aware_tracking - Type: boolean
- Default:
true(enabled by default) - Label: "History-Aware Tracking"
Bug Fixes
Rebuild Counting In-Progress Chapter
Symptom:
"Rebuild All Summaries" was counting the currently in-progress chapter when calculating chapters to rebuild. With 3 chapter break tokens, it would try to summarize 4 chapters instead of 3.
Root Cause:
The analysis used chapterBreakCount + 1 which incorrectly included the text after the last break as a "complete" chapter.
Solution:
Changed to only process complete chapters (those with an ending break). The number of complete chapters equals the number of break tokens.
Backup Failing on New Stories
Symptom:
On a newly created story with no content, creating a backup would fail with:
Backup failed: cannot read property 'length' of undefined
Root Cause:
The failedChapters storage retrieval was missing a fallback value, returning undefined on new stories.
Solution:
Added || [] fallback to failedChapters retrieval in createRebuildBackup().
Stale Lorebook Entry IDs After Redo
Symptom:
After using redo to restore chapter summaries, uncondense operations would fail or target wrong entries because the condensedRanges metadata contained old entry IDs.
Root Cause:
When restoreFullHistoryState() recreated lorebook entries, they received new IDs from NovelAI. The cached condensedRanges metadata still referenced the old entry IDs.
Solution:
After recreating entries, restoreFullHistoryState() now:
- Queries back all newly created entries to get their IDs
- Builds a map from display name to new entry ID
- Updates
condensedRangeswith the correct entry IDs before saving to storage
Technical Changes
New Types
// v1.6.0: History-aware tracking types
type HistoryChapterState = {
chapterBreakCount: number;
summaries: CachedChapterSummary[];
condensedRanges: CondensedRange[];
fingerprints: ChapterFingerprint[];
lastProcessedChapterCount: number;
timestamp: number;
}
type CachedChapterSummary = {
chapterNumber: number;
title: string;
summaryText: string;
lorebookEntryId: string;
isCondensed: boolean;
startChapter?: number;
endChapter?: number;
}New Functions
| Function | Purpose |
|---|---|
storeHistoryChapterState() |
Stores complete chapter state to current history node |
getHistoryChapterState(nodeId) |
Retrieves cached state for a specific history node |
countCurrentChapterBreaks() |
Counts chapter breaks in current document |
restoreFullHistoryState(state) |
Performs complete state restoration from cache |
historyStatesAreDifferent(a, b) |
Compares two history states for changes |
onHistoryNavigatedHook(params) |
Main handler for history navigation events |
New Configuration Variables
let historyAwareTracking: boolean; // Default: trueHook Registrations
// History-aware tracking hook
api.v1.hooks.register('onHistoryNavigated', onHistoryNavigatedHook);Changes Summary
| Change | Type | Description |
|---|---|---|
| History-Aware Tracking | Feature | Auto-manage summaries on undo/redo |
| Rebuild Chapter Count | Bug Fix | No longer counts in-progress chapter |
| Backup on New Stories | Bug Fix | Fixed undefined length error |
| Stale Entry IDs After Redo | Bug Fix | Updates condensedRanges with correct entry IDs |
| Stale Cache Detection | Enhancement | Validates cached state matches document |
Migration from v1.5.6
For Users
No action required! Simply update to v1.6.0:
- Copy the new script code
- Paste into NovelAI script editor
- Save and reload
All your existing data remains compatible:
- Fingerprints preserved
- Condensed ranges intact
- Backups fully compatible
- Settings unchanged
New Configuration Options
After updating, you can configure the new feature in NovelAI's script configuration:
- History-Aware Tracking - Enabled by default
- Disable if you prefer manual summary management after undo/redo
Version History
| Version | Date | Type | Description |
|---|---|---|---|
| v1.6.0 | 2025-11-29 | Feature | History-aware tracking |
| v1.5.6 | 2025-11-27 | Bug Fix | Status panel initialization fix |
| v1.5.5 | 2025-11-25 | Maintenance | API compatibility (modal async) |
| v1.5.4 | 2025-11-24 | Feature | Permissions system integration |
| v1.5.3 | 2025-11-22 | Feature | Manual condensation controls |
Known Limitations
- Pre-Tracking History: History nodes that existed before the script was loaded will not have cached state. Undoing to these nodes syncs lorebook to document state.
Support
Issues or Questions?
- GitHub Issues: Report problems or ask questions
- Documentation: See USER_MANUAL.md for feature documentation
Reporting Problems
If you encounter issues:
- Enable DEBUG_MODE in the script
- Check browser console for
[History]prefixed messages - Note exact symptoms and reproduction steps
- Report on GitHub with details and log output
Version: 1.6.0
Release Date: November 29, 2025
Type: Feature Release
Previous Version: 1.5.6
v1.5.6
Changelog - Version 1.5.6
Status Panel Initialization Fix
Version 1.5.6 fixes a critical bug where the Status Panel would remain stuck on "Loading status...", "Loading...", "Loading..." indefinitely, even after the script successfully initialized.
Bug Fixed
Status Panel Stuck on "Loading..."
Symptom:
After script initialization, the Status Panel displayed:
- "Loading status..."
- "Loading..."
- "Loading..."
Despite logs showing successful initialization:
✓ Permissions check: All granted
✓ Loaded category ID from storage
✓ Found 0 chapter entries in lorebook
✓ Initial status panel update attempt 1 completed
Root Cause:
The updateParts API silently fails during panel initialization. The previous approach registered the panel with placeholder content, then attempted to update it immediately afterward. Even with retry loops, the updates were silently ignored by NovelAI's UI system.
Solution:
Build real content before registering the panel, so the panel is registered with actual data instead of placeholders.
Technical Changes
New Helper Function: buildStatusDisplayText()
Extracted status text building logic into a reusable helper function that can be called during initialization (before panel registration) as well as during normal updates.
async function buildStatusDisplayText(): Promise<string> {
// Builds complete status text with:
// - Token usage
// - Background work indicators
// - Auto-detection notifications
// - Summary breakdown
// - Failed chapters list
}Pre-Registration Content Building
The initialization now builds real content for all three dynamic boxes before registering the panel:
// v1.5.6: Build real content BEFORE panel registration
let initialStatusText = "**Initializing...**\n\n...";
let initialChangedChaptersContent: UIPart[] = [...];
let initialCondensedRangesContent: UIPart[] = [...];
// Try to build real content if we have permissions
if (hasRequiredPermissions && lorebookCategoryId) {
try {
initialStatusText = await buildStatusDisplayText();
initialChangedChaptersContent = await buildChangedChaptersUI();
initialCondensedRangesContent = await buildCondensedRangesUI();
} catch (error) {
// Fall back to placeholder content
}
}
// Register with pre-built content
await api.v1.ui.register([{
type: "scriptPanel",
content: panelContent // Contains pre-built content
}]);Permission Check API Workaround
Changed checkPermissions() to use list() instead of has() due to a NovelAI API bug where has() returns false even when permissions are granted.
// v1.5.6: Using list() instead of has() due to NovelAI API bug
const currentPerms = await api.v1.permissions.list();
const hasPerms = REQUIRED_PERMISSIONS.every(perm => currentPerms.includes(perm));Startup Timing Resilience
Added retry logic during startup to handle timing issues where NovelAI's permission system may not be ready immediately when the script loads:
// v1.5.6: Check permissions with retry to handle timing issues
for (let attempt = 0; attempt < 3; attempt++) {
await checkPermissions();
if (hasRequiredPermissions) {
await initializeLorebookCategory();
break;
}
await api.v1.timers.sleep(300 * (attempt + 1));
}updateStatusPanel() Resilience
Added retry logic in updateStatusPanel() to re-check permissions and initialize the lorebook category if needed, handling cases where initialization was incomplete:
// v1.5.6: Re-check permissions and initialize if needed
if (!hasRequiredPermissions || !lorebookCategoryId) {
for (let attempt = 0; attempt < 3; attempt++) {
// Retry permission check and category initialization
// ...
}
}Changes Summary
| Change | Description |
|---|---|
| Bug Fix | Status panel no longer stuck on "Loading..." |
| New Function | buildStatusDisplayText() helper for reusable status building |
| Init Change | Content built before panel registration |
| API Workaround | Using list() instead of has() for permission checks |
| Retry Logic | Added startup timing resilience with retries |
| Simplified | Removed ineffective retry loop after panel registration |
Migration from v1.5.5
For Users
No action required! Simply update to v1.5.6:
- Copy the new script code
- Paste into NovelAI script editor
- Save and reload
All your existing data remains compatible:
- Fingerprints preserved
- Condensed ranges intact
- Backups fully compatible
- Settings unchanged
Verification
After updating, the Status Panel should immediately display:
- Token usage statistics
- Summary breakdown
- Any failed chapters
- Changed chapters list (if any)
- Condensed ranges (if any)
If you see actual content instead of "Loading...", the fix is working.
Version History
| Version | Date | Type | Description |
|---|---|---|---|
| v1.5.6 | 2025-11-27 | Bug Fix | Status panel initialization fix |
| v1.5.5 | 2025-11-25 | Maintenance | API compatibility (modal async) |
| v1.5.4 | 2025-11-24 | Feature | Permissions system integration |
| v1.5.3 | 2025-11-22 | Feature | Manual condensation controls |
Technical Details
Why updateParts() Was Failing
The NovelAI updateParts API has specific behavior during initialization:
- Silent Failure:
updatePartsdoes not throw errors when it cannot find elements or when called too early - Timing Dependency: Panel elements may not be queryable immediately after registration
- No Feedback: Success or failure is not communicated back to the caller
The previous retry loop:
// OLD APPROACH (v1.5.5) - This silently failed
for (let attempt = 1; attempt <= 3; attempt++) {
await api.v1.timers.sleep(100);
await updateStatusPanel(); // Silent failure
}The new approach eliminates the need for post-registration updates by ensuring the panel is registered with complete, accurate content from the start.
Files Modified
Automatic_Chapter_Summaries_v1.5.6.ts- Main script file
Code Locations
- buildStatusDisplayText(): Lines 5968-6063
- Pre-registration content building: Lines 6949-6978
- Permission check workaround: Lines 321-340
- Startup retry logic: Lines 7005-7015
- updateStatusPanel() resilience: Lines 6137-6175
Support
Issues or Questions?
- GitHub Issues: Report problems or ask questions
- Documentation: See main README.md for feature documentation
Reporting Problems
If you still encounter initialization issues after updating:
- Enable DEBUG_MODE in the script
- Check browser console for error messages
- Note exact symptoms (what displays vs what should display)
- Report on GitHub with details and log output
Version: 1.5.6
Release Date: November 27, 2025
Type: Bug Fix
Previous Version: 1.5.5
v1.5.5
Changelog - Version 1.5.5
API Compatibility Update
Version 1.5.5 updates the script to be compatible with breaking changes in the NovelAI Script API. This is a maintenance release with no new features - all functionality remains identical to v1.5.4.
🔧 API Breaking Changes Addressed
Modal API Updates
The NovelAI Script API introduced breaking changes to the modal system:
Before (v1.5.4 and earlier):
const modal = api.v1.ui.modal.open({...}); // Returns ModalHandle directly
modal.close(); // Synchronous
await modal.closed; // Wait for closeAfter (v1.5.5):
const modal = await api.v1.ui.modal.open({...}); // Returns Promise<ModalHandle>
await modal.close(); // Asynchronous
await modal.closed; // Wait for close📝 Changes Made
All Modal Operations Updated
- ✅ 17
modal.open()calls - All now useawaitto retrieve the modal handle - ✅ All
modal.close()calls - All now useawaitas the method is async - ✅ Callback functions - Made async wherever they use
awaitoperations - ✅ Promise executors - Made async for 3 modal creation patterns
- ✅
.then()patterns - Convertedmodal.closed.then()toawait modal.closed
Updated Patterns
Modal Creation:
// Before
const modal = api.v1.ui.modal.open({
title: "My Modal",
content: [...]
});
// After
const modal = await api.v1.ui.modal.open({
title: "My Modal",
content: [...]
});Modal Closing:
// Before
callback: () => {
modal.close();
}
// After
callback: async () => {
await modal.close();
}Chained Operations:
// Before
modal.close();
modal.closed.then(() => {
showNextModal();
});
// After
await modal.close();
await modal.closed;
showNextModal();🎯 Affected Features
All modal-based features have been updated:
User Interface Modals
- ✅ Condensed range details viewer
- ✅ Backup details browser
- ✅ Backup restore confirmation
- ✅ Changed chapters notifications
- ✅ Token budget warnings
Configuration Modals
- ✅ Condensation settings modal
- ✅ Manual condensation range selector
- ✅ Generation limit warnings
- ✅ Confirmation dialogs
All Modals Now Properly Handle
- Async opening (awaits modal handle)
- Async closing (awaits close completion)
- Async callbacks (properly marked as async)
- Proper await patterns throughout
🔄 Migration from v1.5.4
For Users
No action required! Simply update to v1.5.5:
- Copy the new script code
- Paste into NovelAI script editor
- Save and reload
All your existing data remains compatible:
- ✅ Fingerprints preserved
- ✅ Condensed ranges intact
- ✅ Backups fully compatible
- ✅ Settings unchanged
For Developers
If you've modified the script, update your modal patterns:
- Add
awaitbefore allmodal.open()calls - Add
awaitbefore allmodal.close()calls - Make callbacks
asyncif they useawait - Convert
.then()chains toawaitpatterns
🧪 Testing Performed
Comprehensive Modal Testing
- ✅ All 17 modal.open() patterns verified
- ✅ All modal.close() operations tested
- ✅ Callback async conversions validated
- ✅ No TypeScript compilation errors
- ✅ All Promise patterns updated correctly
Feature Testing
- ✅ Condensed range details modal
- ✅ Backup browser and restore
- ✅ Changed chapters UI interactions
- ✅ Manual condensation modals
- ✅ Generation limit warnings
- ✅ Token budget notifications
📊 Technical Details
Files Modified
Automatic_Chapter_Summaries_v1.5.5.ts- Main script file
Code Changes Summary
- 17 locations: Added
awaitbeforeapi.v1.ui.modal.open() - ~25 locations: Added
awaitbeforemodal.close()calls - ~15 callbacks: Made async to support
awaitusage - 3 Promise executors: Made async for modal operations
- ~5 patterns: Converted
.then()toawaitstyle
Pattern Examples
Simple Modal:
- const modal = api.v1.ui.modal.open({
+ const modal = await api.v1.ui.modal.open({
title: "Example",
content: [...]
});Modal in Callback:
callback: () => {
- modal.close();
- modal.closed.then(() => {
- showNext();
- });
+ await modal.close();
+ await modal.closed;
+ showNext();
}Note: Callback also needs async keyword
Promise Pattern:
- return new Promise((resolve) => {
- const modal = api.v1.ui.modal.open({
+ return new Promise(async (resolve) => {
+ const modal = await api.v1.ui.modal.open({
title: "Confirm",
content: [...]
});🔮 Future Compatibility
NovelAI API Tracking
This release addresses the modal API changes announced on November 25, 2025. Future API changes will be tracked and addressed in subsequent releases.
Related API Changes (Not Yet Implemented)
The NovelAI API changelog also mentioned:
- ✅
buildContextparameter renamed tocontextLimitReduction- Not used by this script - ✅
update/closemethods removed from type declarations - Already using instance methods - ✅
createCancellationSignaldrain fix - Not used by this script - ✅
onBeforeContextBuildhook added - Not currently needed - ✅
onTextAdventureInputhook added - Not currently needed - ✅
getOrDefaultundefined handling fix - Not affected
📈 Version History Context
Recent Versions
- v1.5.5 (2025-11-25) - API compatibility update (this release)
- v1.5.4 (2025-11-24) - Permissions system integration
- v1.5.3 (2025-11-22) - Manual condensation controls
- v1.5.2 (2025-11-22) - Fixed automatic processing bypass
- v1.5.1 (2025-11) - Condensed ranges UI
Upgrade Path
v1.5.4 → v1.5.5: Just update the script (no data changes)
v1.5.3 → v1.5.5: Update and benefit from permissions + API fixes
v1.5.x → v1.5.5: All data fully compatible
🎯 Impact Assessment
User Impact
Minimal - Users will see no difference in functionality:
- All features work identically
- No UI changes
- No data format changes
- No configuration changes required
Developer Impact
Low - Simple pattern updates required:
- Straightforward async/await conversions
- No complex refactoring needed
- TypeScript catches all issues at compile time
- Clear error messages for missed patterns
🔍 Verification
How to Verify the Update
-
Check Version Number
// In script header // Chapter Summarize v1.5.5: API compatibility update
-
Check Changelog
// CHANGELOG v1.5.5: // - [API COMPATIBILITY] Updated for NovelAI Script API breaking changes
-
Test Modal Operations
- Open "View/Restore Backups" - should work smoothly
- Open "Condense With Settings" - should work smoothly
- Try any modal-based feature - all should function normally
📞 Support
Issues or Questions?
- GitHub Issues: Report problems or ask questions
- Documentation: See main README.md for feature documentation
- API Changes: Refer to NovelAI's API changelog for details
Reporting Problems
If you encounter issues after updating:
- Enable DEBUG_MODE in the script
- Check browser console for error messages
- Note which modal/feature is affected
- Report on GitHub with details
✅ Summary
Version 1.5.5 is a compatibility update that ensures the Automatic Chapter Summaries script works with the latest NovelAI Script API changes. All modal-based operations have been updated to use the new async patterns.
Key Points:
- ✅ All 17 modal operations updated
- ✅ Full async/await compliance
- ✅ No data format changes
- ✅ No feature changes
- ✅ No user action required
- ✅ Fully tested and validated
Recommendation:
All users on v1.5.4 should update to v1.5.5 to ensure continued compatibility with NovelAI's platform.
Version: 1.5.5
Release Date: November 25, 2025
Type: Maintenance / API Compatibility
Previous Version: 1.5.4
Next Version: TBD
v1.5.2
Changelog - Version 1.5.2
Release Date
November 22, 2025
Overview
Version 1.5.2 is a major stability and control release that fixes critical bugs in automatic processing behavior. The script now properly respects user configuration settings and provides three distinct behavior modes based on the autoDetectOnGeneration and autoRegenerate settings.
Critical Bug Fixes
1. Automatic Processing Bypass Fixed
Problem: Script was processing all chapters automatically when pasting multi-chapter stories, completely ignoring the autoDetectOnGeneration and autoRegenerate configuration settings.
Solution:
- Removed automatic multi-chapter batch processing loop from
onResponsehook - Added proper configuration checks before any automatic processing
- Script now respects all three behavior modes (see Configuration Modes below)
Impact: Users now have full control over when and how chapter summaries are generated.
2. Generation Counter Limit During Condensation
Problem: When condensing chapters, the script would hit the "Non-interactive generation limit reached (5 calls)" error because the generation counter wasn't being reset between different operations.
Solution:
- Reset
generationCounter = 0at the start ofautoRegenerateChanges()batch processing - Reset counter before Level 1 (normal) condensation
- Reset counter before Level 2 (aggressive) condensation
- Reset counter before Level 3 (emergency) condensation
Impact: Condensation now works reliably without hitting generation limits, even during aggressive multi-level condensation scenarios.
3. Wrong Chapter Generation on Story Paste
Problem: When pasting a story with 10 chapter breaks, the script would generate "Chapter 10" first using Chapter 1's text content.
Solution:
- Skip single-chapter generation in full auto mode when no fingerprints exist
- Let the automatic batch detection handle all chapters at once
- Only process single chapters when appropriate based on configuration mode
Impact: Pasted multi-chapter stories are now processed correctly with proper chapter numbering and content.
4. Chapter Numbering Off-By-One Error
Problem: Script was determining chapter readiness incorrectly, requiring N+1 breaks for chapter N to be ready.
Solution:
- Changed
chapterToSummarizecalculation fromchapterBreakCount - 1tochapterBreakCount - Logic now correctly recognizes: N breaks = N complete chapters, chapter N+1 in progress
- Chapter N is ready to summarize when the Nth break exists
Impact: Chapters are now detected and processed at the correct time based on break count.
5. Incomplete Chapters Being Detected
Problem: When no fingerprints existed, the script would detect chapters that were still in progress (not yet complete).
Solution:
- Modified
detectChangedChapters()to only detect complete chapters when no fingerprints exist - Set
completeChapterCount = chapterBreakCount(not total chapter count) - In-progress chapters are no longer treated as "new" chapters
Impact: Only complete chapters trigger detection and generation, preventing premature processing.
6. Lorebook Entry Format Inconsistency
Problem: generateChapterSummary() used Format B while regenerateChapter() used Format A, causing inconsistent lorebook entries.
Format A (old):
Chapter 5: Title Here
Type: chapter
Summary: Text here
Format B (standardized):
Chapter 5
Type: chapter
Title: Title Here
Summary: Text here
Solution:
- Standardized both functions to use Format B
- Fixed variable name typo in
regenerateChapter()(messages → message) - All lorebook entries now have consistent structure
Impact: All chapter summaries have uniform formatting regardless of how they were created.
7. Chapter 2 Title Extraction Bug
Problem: Chapter 2's lorebook entry would display Chapter 1's title instead of its own title (e.g., showing "Starship Hijinks" instead of "Bridge").
Root Cause: The isFirstChapter flag wasn't being cleared after chapter 1 was created via the auto-regeneration code path (regenerateChapter()), causing scanForPreviousChapter() to always return Chapter 1's text even when generating Chapter 2.
Solution:
- Added universal flag clearing logic to
storeChapterFingerprint() - When chapter 1's fingerprint is stored, set
isFirstChapter = false - This fix applies to both code paths:
generateChapterSummary()andregenerateChapter()
Impact: All chapters now extract their correct titles regardless of which code path created them.
Configuration Modes
Version 1.5.2 properly implements three distinct behavior modes:
Mode 1: Full Manual (Both OFF)
autoDetectOnGeneration: falseautoRegenerate: false
Behavior: Nothing happens automatically. User must click "Check for Changes" button to detect and regenerate chapters manually.
Exception: First chapter of a brand new story is still auto-generated when user adds the first chapter break.
Mode 2: Semi-Automatic (Detect ON, Regenerate OFF)
autoDetectOnGeneration: trueautoRegenerate: false
Behavior:
- Script automatically detects changed/new chapters after each generation
- Shows notification modal with list of detected changes
- User manually clicks "Regenerate" or "Dismiss" for each chapter
Mode 3: Fully Automatic (Both ON)
autoDetectOnGeneration: trueautoRegenerate: true
Behavior:
- Script automatically detects changed/new chapters after each generation
- Automatically regenerates all detected changes in batch
- No user intervention required (fully hands-off)
Technical Improvements
Code Quality
- Removed obsolete
multiChapterBatchInProgressflag - Cleaned up redundant configuration checks
- Improved error handling and logging throughout
- Better separation of concerns between detection and generation
Timing & Logic
- More precise chapter completion detection
- Proper sequencing of automatic operations
- Better handling of edge cases (pasted stories, mixed scenarios)
Debugging
- Enhanced debug logging for flag state changes
- Better visibility into which code paths are executing
- Clear log messages for configuration mode detection
Migration Notes
No breaking changes - Existing configurations will continue to work. However, users may notice different behavior if they previously relied on the buggy automatic processing that bypassed configuration settings.
Recommended Action: Review your autoDetectOnGeneration and autoRegenerate settings to ensure they match your desired workflow (see Configuration Modes above).
Testing Coverage
All fixes have been tested with:
- ✅ Manual mode (both settings OFF)
- ✅ Semi-automatic mode (detect ON, regenerate OFF)
- ✅ Fully automatic mode (both ON)
- ✅ Pasted multi-chapter stories (10+ chapters)
- ✅ Writing chapters incrementally from scratch
- ✅ Mixed scenarios (existing chapters + adding new ones)
- ✅ Condensation triggering during various workflows
- ✅ Title extraction for all chapters
- ✅ Format consistency across all entry types
Known Limitations
None identified in v1.5.2 testing. All critical bugs from v1.5.1 and earlier have been resolved.
Credits
Special thanks to the testing that identified these edge cases and helped refine the three configuration modes into truly distinct, predictable behaviors.
Files Changed
Automatic_Chapter_Summaries_v1.5.2.ts- Main script file with all fixes appliedFEATURE_EXPLANATION_AUTO_VS_MANUAL.md- Documentation of the three behavior modesCHANGELOG_v1.5.2.md- This changelog
Upgrade Instructions
- Replace your current script with
Automatic_Chapter_Summaries_v1.5.2.ts - Review your configuration settings (
autoDetectOnGenerationandautoRegenerate) - Read
FEATURE_EXPLANATION_AUTO_VS_MANUAL.mdto understand the three modes - Test with your current story to verify behavior matches expectations
Version 1.5.2 represents a major leap forward in reliability and user control. Enjoy the bug-free experience! 🎉
Release v1.5.1
Changelog - Version 1.5.1
Release Date: November 22, 2025
🎉 New Features
Condensed Ranges Management UI
- New Section in Main Panel: View all your condensed chapter ranges at a glance
- Range Details Display: Each range shows:
- Chapter span (e.g., "Chapters 1-8")
- Token count
- Condensation date
- Number of original summaries archived
- Quick Actions: "View Details" and "Uncondense" buttons for each range
View Condensed Range Details
- Comprehensive Modal: Shows complete information about any condensed range
- Current condensed summary with full text
- Metadata (token count, condensation date)
- All archived original summaries with chapter numbers
- Scrollable sections for easy navigation of long content
Uncondense Entire Range
- Preview Before Action: Confirmation modal shows:
- Token impact calculation (+X tokens, +Y% increase)
- List of chapters that will be restored
- Option to proceed or cancel
- Smart Restoration: Deletes condensed entry and restores all original detailed summaries
- Fingerprint Updates: Automatically marks chapters as no longer condensed
Undo Last Uncondense Operation
- One-Click Undo: Reverse an uncondense operation if needed
- Automatic Backup: Stores condensed entry data before uncondensing
- UI Integration: Undo button appears when undo data is available
- Perfect for Testing: Facilitates safe experimentation and error recovery
Uncondense Single Chapter with Range Splitting
- Surgical Precision: Extract one chapter from a condensed range
- Smart Splitting:
- Example: Uncondense Chapter 5 from "Chapters 3-7"
- Result: "Chapters 3-4" (condensed) + Chapter 5 (detailed) + "Chapters 6-7" (condensed)
- Token Efficiency: Remaining chapters stay condensed to minimize token impact
- Single-Chapter Format: Uses "Chapter N" (not "Chapters N-N") for better readability
- Preview Modal: Shows split preview and token impact before proceeding
- Generation Limit Respect: Warns if operation would exceed 5-generation limit
🐛 Critical Bug Fixes
Fixed Overlapping Condensed Ranges Bug
Severity: Critical - Could corrupt lorebook state during automatic condensation
Symptoms:
- Multiple overlapping condensed ranges after auto-condensation
- Example: "Chapter 1", "Chapters 3-5", and "Chapters 1-8" all existing simultaneously
- Lorebook entries not properly cleaned up
- Storage array contained duplicate/overlapping ranges
Root Causes:
performNormalCondensation()was callingcondenseSummaries()directly, bypassing overlap detectioncondenseWithExpansion()was modifying thecondensedRangesarray during iteration- Function tried to delete same lorebook entries twice (overlap detection + deletion loop)
getChapterSummaryEntries()returns lorebook entries, not logical chapters, causing confusion
Solution:
- Complete rewrite of
condenseWithExpansion()with clear 6-step process:- Calculate new range boundaries from input chapters
- Find ALL overlapping ranges (before any modifications)
- Delete lorebook entries for overlapping ranges (with error handling)
- Collect summaries (from ranges + individuals, with duplicate prevention)
- Remove overlapping ranges from storage
- Create new condensed summary
- Changed
performNormalCondensation()to usecondenseWithExpansion() - Added
chaptersAddedSet to prevent duplicate chapters in summaries - Each entry deleted exactly once with graceful error handling
- Clear separation: ranges provide originals, individuals provide themselves
Impact: Automatic condensation now properly cleans up old ranges and maintains clean lorebook state
Fixed Aggressive Condensation Duplicate Entries
Problem: When expanding condensed ranges during aggressive condensation, individual entries weren't being deleted, causing duplicates
Example Scenario:
- Had "Chapters 1-5" (condensed) + Chapters 6-9 (detailed)
- Aggressive condensation should create "Chapters 1-9"
- Chapter 9 wasn't deleted because only condensed entries were being removed
- Result: Both "Chapters 1-9" and old Chapter 9 entry existed
Solution:
condenseWithExpansion()now tracks ALL entry IDs (condensed + individual)- Deletes both condensed entries and individual entries before creating new range
- Created
condenseSummariesWithoutDeletion()for pre-deleted entries - Properly cleans up all old entries before creating new condensed range
Fixed Uncondense Single Chapter Errors
Problem: uncondenseSingleChapter() called condenseSummaries() which tried to delete non-existent entries
Details:
- Function was working with archived summaries (no actual lorebook entries)
condenseSummaries()tried to delete entries by ID, causing errors- Storage update: old range was filtered out but never saved, causing stale UI
- UI incorrectly showed old range instead of new split ranges
Solution:
- Changed to use
condenseSummariesWithoutDeletion()for archived summaries - Properly saves filtered
condensedRangesarray before creating new ranges - UI now correctly displays only the new split ranges after operation
Fixed Duplicate Chapters in Condensed Summaries
Problem: When overlapping ranges existed, same chapter could be added to summariesToCondense twice
Example:
- "Chapter 1" (condensed 1-1) overlaps with new "Chapters 1-8" range
- Chapter 1 added from overlapping range's originalSummaries
- Chapter 1 also added from individual entries list
- Result: "Chapter 1" appears twice in archived summaries display
Solution:
- Added
chaptersAddedSet to track processed chapter numbers - Check before adding chapters from overlapping ranges
- Check before adding individual entries
- Prevents any chapter from being added more than once
🔧 Improvements
Single-Chapter Condensation Logic
- Token Efficiency Focus: When uncondensing creates single-chapter splits, they remain condensed
- Rationale: User wants ONE detailed chapter, others should stay token-efficient
- Format Consistency: Single-chapter entries use "Chapter N" everywhere:
- Modal titles
- Modal headers
- Main panel display
- Lorebook entry text
- Type field: "Type: chapter" (not "Type: chapters")
- Automatic Condensation Safeguards:
- Normal, aggressive, and emergency condensation all require minimum 2 chapters
- Single-chapter condensed entries only created during manual uncondense splits
- Prevents inappropriate automatic single-chapter condensation
Enhanced UI Feedback
- Status Panel Improvements:
- Accurate detailed/condensed entry counts using storage data (not lorebook scan)
- Clear display of which chapters are in condensed ranges
- Better visual separation between sections
- Modal Consistency: All modals use consistent formatting for singular vs. plural chapters
- Generation Limit Tracking: Counter properly increments for all condensation operations
Code Architecture Improvements
- Separation of Concerns:
condenseSummaries()- normal condensation with deletioncondenseSummariesWithoutDeletion()- condensation for pre-deleted entriescondenseWithExpansion()- condensation with overlap handling
- Better Error Handling: Graceful handling of missing/already-deleted entries
- Cleaner Logic Flow: Step-by-step process easier to understand and debug
📋 Technical Details
New Functions
buildCondensedRangesUI()- Builds UI section for condensed ranges displayshowCondensedRangeDetails()- Opens detailed modal for a condensed rangeconfirmUncondenseRange()- Shows preview modal before uncondensing entire rangeuncondenseEntireRange()- Deletes condensed entry and restores all originalsundoLastUncondense()- Reverses last uncondense operationconfirmUncondenseSingleChapter()- Shows preview for single chapter uncondenseuncondenseSingleChapter()- Entry point with generation limit checkingperformUncondenseSingleChapter()- Internal function performing split operationcondenseSummariesWithoutDeletion()- Condenses pre-deleted entries
Modified Functions
condenseWithExpansion()- Complete rewrite with 6-step clear processperformNormalCondensation()- Now usescondenseWithExpansion()updateStatusPanel()- Fixed count calculations using storage datagetChapterSummaryEntries()- Enhanced logging and validation
Storage Keys
lastUncondenseData- Stores backup for undo functionalitycondensedRanges- Enhanced with proper overlap management
🎮 Usage Tips
- View Your Condensed Ranges: Check the "📦 Condensed Ranges" section in the main panel
- Need Details?: Click "View Details" on any range to see the full condensed summary and all archived originals
- Want Full Detail Back?: Click "Uncondense" to restore all original detailed summaries (with token impact preview)
- Made a Mistake?: Use the "Undo Last Uncondense" button (appears after uncondense operations)
- Extract One Chapter: In the details modal, use "Uncondense Single Chapter" to get just one chapter back in detail while keeping others condensed
- Watch Your Tokens: All operations show token impact before proceeding
⚠️ Breaking Changes
None - All changes are backward compatible with v1.5.0 data structures.
🔮 Future Enhancements
Potential improvements for future versions:
- Batch uncondense multiple ranges
Upgrade Note: This version requires no data migration. Your existing condensed ranges, fingerprints, and backups will work seamlessly with the new features.
v1.5.0
What's Changed
- Chapter Summarize v1.5.0: Enhanced backup browser by @LaneLearns in #2
Full Changelog: v1.4.1...v1.5.0
v1.4.1
What's Changed
- Release of v1.4.1 - Automatic Chapter Summary Lorebook Entries via co… by @LaneLearns in #1
New Contributors
- @LaneLearns made their first contribution in #1
Full Changelog: https://github.com/LaneLearns/AutomaticChapterSummaries/commits/v1.4.1