-
Notifications
You must be signed in to change notification settings - Fork 0
feat: summarize on-going convo histories and convo themes #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
47a1820
feat: summarize conversation message history every 5 messages
claude 3cfb3b6
feat: make summarization threshold configurable via config
claude a7a6c3a
test: add tests for message history summarization
claude 3745ddf
Add conversation theme system implementation plan
claude 25aa16c
Fix race condition in conversation history summarization
claude 4188812
Improve summarization fix: use subList.clear() and decrement counter
claude 2795a4e
Extract magic number 4 into RECENT_MESSAGES_TO_KEEP constant
claude ee72178
Add conversation theme system
claude 2345a23
Fix theme memory leak, summarization race condition, and input saniti…
claude 912ff1a
Make summarizingConversations and activeThemes thread-safe
claude 508749c
test: fix tests
canefe 51a8b09
refactor: non-low-cost ai model summariser
canefe df0fccb
refactor: prompt for conversation summariser
canefe 5b30cb7
feat: conversation themes
canefe d3cec0d
fix: add sentinel check to ViolenceTheme.kt
canefe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| # Conversation Theme System - Implementation Plan | ||
|
|
||
| ## Architecture | ||
|
|
||
| ### Core abstractions (new package: `conversation/theme/`) | ||
|
|
||
| 1. **`ConversationTheme`** - Abstract base class that defines a theme | ||
| - `name: String` - unique identifier (e.g., "chat", "violence") | ||
| - `displayName: String` - human-readable name | ||
| - `compatibleWith: Set<String>` - theme names this can stack with | ||
| - `onActivate(conversation: Conversation)` - callback when theme becomes active | ||
| - `onDeactivate(conversation: Conversation)` - callback when theme is removed | ||
| - `onMessage(conversation: Conversation, message: ConversationMessage)` - called on each message | ||
|
|
||
| 2. **`ConversationThemeFactory`** - Interface for creating theme instances | ||
| - `fun create(): ConversationTheme` | ||
|
|
||
| 3. **`ConversationThemeRegistry`** - Singleton registry | ||
| - `register(name: String, factory: ConversationThemeFactory)` - register a theme type | ||
| - `unregister(name: String)` - remove a theme type | ||
| - `create(name: String): ConversationTheme` - instantiate from factory | ||
| - `getRegisteredThemes(): Set<String>` - list available themes | ||
|
|
||
| 4. **`ConversationThemeManager`** - Manages active themes per conversation (separate manager, observes conversations) | ||
| - `activateTheme(conversation: Conversation, themeName: String): Boolean` - activate a theme (checks compatibility with existing active themes) | ||
| - `deactivateTheme(conversation: Conversation, themeName: String): Boolean` | ||
| - `getActiveThemes(conversation: Conversation): List<ConversationTheme>` | ||
| - `hasTheme(conversation: Conversation, themeName: String): Boolean` | ||
| - `onConversationEnd(conversation: Conversation)` - cleanup | ||
| - `onMessage(conversation: Conversation, message: ConversationMessage)` - propagate to active themes | ||
|
|
||
| 5. **`ConversationThemeData`** - Data class held within `Conversation` | ||
| - `activeThemeNames: List<String>` (read-only view of active theme names) | ||
| - Kept minimal - just state, no logic | ||
|
|
||
| ### Example Themes | ||
|
|
||
| 6. **`ChatTheme`** - Default theme, compatible with everything | ||
| 7. **`ViolenceTheme`** - Activates on combat events, not compatible with "trade" | ||
|
|
||
| ### Integration Points | ||
|
|
||
| - Add `themeData: ConversationThemeData` field to `Conversation` | ||
| - `ConversationThemeManager` initialized in `Story.onEnable()` and stored on plugin | ||
| - Theme manager listens to `ConversationStartEvent` to apply default "chat" theme | ||
| - Theme manager listens to conversation messages via `ConversationManager` | ||
|
|
||
| ### File list | ||
| ``` | ||
| src/main/kotlin/com/canefe/story/conversation/theme/ | ||
| ├── ConversationTheme.kt # Abstract base | ||
| ├── ConversationThemeFactory.kt # Factory interface | ||
| ├── ConversationThemeRegistry.kt # Singleton registry | ||
| ├── ConversationThemeManager.kt # Per-conversation manager | ||
| ├── ConversationThemeData.kt # Data class for Conversation | ||
| ├── ChatTheme.kt # Example: default chat | ||
| └── ViolenceTheme.kt # Example: violence/combat | ||
|
|
||
| Modified files: | ||
| - Conversation.kt # Add themeData field | ||
| - Story.kt # Initialize theme manager + register defaults | ||
| ``` | ||
|
|
||
| ### Tests | ||
| ``` | ||
| src/test/kotlin/com/canefe/story/conversation/theme/ | ||
| ├── ConversationThemeRegistryTest.kt | ||
| ├── ConversationThemeManagerTest.kt | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.