feat: cross-session memory (summarize + inject context)#113
feat: cross-session memory (summarize + inject context)#113sogadaiki wants to merge 4 commits intoRichardAtCT:mainfrom
Conversation
AI秘書まいの人格をTelegram Botに統合し日本語対話を実現 - config/persona/mai.md: ペルソナ定義 - src/bot/i18n.py: 辞書ベース軽量i18n (ja/en) - settings.py: persona/knowledge/effort/permission_mode設定追加 - sdk_integration.py: ペルソナ読み込み+SDKオプション - orchestrator.py/auth.py/core.py: UIメッセージi18n化 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
SDK stream callbackでThinkingBlockのみのcontentをstr()変換して表示していた問題を修正 - sdk_integration.py: ThinkingBlockをスキップ、fallbackでも表示可能ブロックのみ通す - orchestrator.py: [ThinkingBlock(で始まるテキストを進捗表示から除外 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When a user starts a new session via /new, the previous session's conversation is summarized by Claude and stored in SQLite. On the next new session, stored summaries are injected into the system prompt, giving Claude context about prior work. - Migration 5: session_memories table - SessionMemoryModel + SessionMemoryRepository - SessionMemoryService (summarize + retrieve) - System prompt injection via memory_context parameter - Feature flag: ENABLE_SESSION_MEMORY (default false) - Background summarization on /new (fire-and-forget) - Unit tests for service and repository Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add `id DESC` tiebreaker to session memory query for deterministic ordering - Add `bot_language` to test mock settings (Pydantic spec compatibility) - Pin `bot_language="en"` in orchestrator test fixture to avoid .env leakage Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
7de6dfd to
c5129ab
Compare
|
PR Review Summary
What looks good
Issues / questions
Suggested tests
Verdict — Friday, AI assistant to @RichardAtCT |
|
PR Review Summary
What looks good
Issues / questions
Suggested tests
Verdict — Friday, AI assistant to @RichardAtCT |
RichardAtCT
left a comment
There was a problem hiding this comment.
Thanks for this feature! A few things need to be addressed:
- Merge conflicts — this PR has conflicts with main that need resolving
- CI failing — tests are not passing
- Unrelated files — please remove any files not directly related to the cross-session memory feature
Please rebase against current main, fix CI, and remove unrelated changes. Happy to re-review once cleaned up!
Summary
Implements the cross-session memory feature proposed in #105.
When a user starts a new session via
/new, the previous session's conversation is summarized by Claude and stored in SQLite. On the next new session, stored summaries are injected into the system prompt, giving Claude context about prior work.Changes
session_memoriestable with user+project scopingmemory_contextparameter flows through facade -> SDKENABLE_SESSION_MEMORY(defaultfalse, opt-in)/newtriggers async summarization (fire-and-forget)Configuration
Design Decisions
/new, so opt-inTest plan
ENABLE_SESSION_MEMORY=true, send several messages, run/newsession_memoriestablefalseCloses #105