feat(memory): tag all memories with source persona (miku/evil_miku)

Step 1 of memory system overhaul: persona tagging.

- discord_bridge: tag user messages with 'persona' metadata at storage time
- memory_consolidation: tag Miku's own responses with 'persona' metadata
- memory_consolidation: tag declarative facts with source persona during extraction
- memory_consolidation: pass persona context to LLM extraction prompt
- memory_consolidation: annotate cross-persona facts in prompt injection
  (e.g., '(learned as Evil Miku)' when Evil facts appear for Normal Miku)
- Web UI: show persona badge (🎤 Miku / 😈 Evil Miku) on facts and episodic
  memories in the Memory Management tab

This lets both personas know which version of Miku each memory came from,
enabling Evil Miku to distinguish her own memories from Normal Miku's.
This commit is contained in:
2026-05-12 15:12:49 +03:00
parent 9eb081efb1
commit e6e81885b3
3 changed files with 68 additions and 18 deletions

View File

@@ -97,8 +97,12 @@ def before_cat_stores_episodic_memory(doc, cat):
if author_name:
doc.metadata['author_name'] = author_name
# Tag with persona so Evil Miku and Normal Miku know whose memory this is
evil_mode = cat.working_memory.get('evil_mode', False)
doc.metadata['persona'] = 'evil_miku' if evil_mode else 'miku'
print(f"💾 [Discord Bridge] Storing memory (unconsolidated): {message[:50]}...")
print(f" User: {cat.user_id}, Guild: {guild_id}, Author: {author_name}")
print(f" User: {cat.user_id}, Guild: {guild_id}, Author: {author_name}, Persona: {doc.metadata['persona']}")
return doc