story-kit: create 266_story_matrix_bot_structured_conversation_history
This commit is contained in:
@@ -16,6 +16,16 @@ As a user chatting with the Matrix bot, I want it to remember and own its prior
|
||||
- [ ] Rolling window trimming still applies to keep context bounded
|
||||
- [ ] Multi-user rooms still attribute messages to the correct sender
|
||||
|
||||
## Investigation Notes (2026-03-18)
|
||||
|
||||
The current implementation attempts session resumption via `--resume <session_id>` but it's not working:
|
||||
|
||||
1. **No session_id captured:** `matrix_history.json` contains conversation entries but no `session_id` field. The `RoomConversation.session_id` is always `None`.
|
||||
2. **Root cause:** `claude -p --output-format stream-json` may not emit a `session_id` in its JSON events, or the PTY stream parser (`process_json_event` in `claude_code.rs:348`) isn't finding it. The oneshot channel (`sid_rx`) never receives a value.
|
||||
3. **Effect:** Every message spawns a fresh Claude Code process with no `--resume` flag. Each turn is a blank slate — the bot has no memory of prior messages despite the history being persisted.
|
||||
4. **The history entries are persisted and loaded correctly** — the serialization round-trip works (confirmed by tests). The problem is purely that `--resume` is never invoked.
|
||||
5. **To fix:** Verify what `claude -p --output-format stream-json` actually emits for `session_id`. If it doesn't emit one, an alternative approach may be needed (e.g. passing history as a system prompt prefix, or using the Claude API directly instead of the CLI).
|
||||
|
||||
## Out of Scope
|
||||
|
||||
- TBD
|
||||
|
||||
Reference in New Issue
Block a user