story-kit: remove 266_story_matrix_bot_structured_conversation_history

This commit is contained in:
Dave
2026-03-17 16:17:20 +00:00
parent d02d53d112
commit ad68bc912f

View File

@@ -1,35 +0,0 @@
---
name: "Matrix bot structured conversation history"
---
# Story 266: Matrix bot structured conversation history
## User Story
As a user chatting with the Matrix bot, I want it to remember and own its prior responses naturally, so that conversations feel like talking to one continuous entity rather than a new instance each message.
## Problem
The bot currently flattens per-room conversation history into a text prefix (`build_context_prefix`) prepended to each new message. Claude sees this as third-party context rather than its own prior responses, causing it to feel disconnected and not take ownership of things it previously said.
Additionally, history is in-memory only (`HashMap` initialized on startup) — any server restart wipes all conversation state.
## Acceptance Criteria
- [ ] Conversation history is passed as structured API messages (user/assistant turns) rather than a flattened text prefix
- [ ] Claude recognises its prior responses as its own, maintaining consistent personality across a conversation
- [ ] Per-room history survives server restarts (persisted to disk or database)
- [ ] Rolling window trimming still applies to keep context bounded
- [ ] Multi-user rooms still attribute messages to the correct sender
## Technical Notes
- `build_context_prefix()` in `bot.rs` is the current flattening logic
- The Claude API accepts a `messages` array with `role: "user"` / `role: "assistant"` — use this instead of text serialization
- `ConversationHistory` type at line 58 of `bot.rs` already has the right structure, it just needs to be passed through properly
- For persistence, consider SQLite (already a dependency via matrix-sdk) or simple JSON files per room
## Out of Scope
- Infinite history / summarization of old context
- Cross-room memory