M2Wise - Memory-to-Wisdom Engine
Enable AI companion robots to grow wisdom from experience
Overview
M2Wise is a Memory-to-Wisdom Engine for long-term memory and wisdom evolution in AI companion robots. It extracts memory from raw conversation data and further abstracts them into migratable, verifiable, and versionable wisdom strategies.
When to Use This Skill
Use M2Wise when you need:
- Long-term memory management for AI companions
- Extract user preferences, facts, and commitments from conversations
- Generate actionable wisdom from accumulated memories
- Track and evolve wisdom effectiveness over time
Core Features
1. Memory Subsystem
- Preference Memory: Extract explicit user preferences (e.g., "I prefer concise Chinese technical answers")
- Fact Memory: Record user's identity, background, and other factual information
- Commitment Tracking: Track user commitments and promises
- Affective Trace: Track user emotional changes over time
2. Wisdom Subsystem
- Wisdom Generation: Automatically generate actionable wisdom from memory clusters
- Counterexample Mining: Identify boundary cases where wisdom doesn't apply
- Confidence Tracking: Automatically track wisdom effectiveness
- Self-Evolution: Auto-adjust wisdom based on hit rates
3. Three-Phase Evolution Model
Online (Online Phase) → Sleep (Consolidation Phase) → Dream (Verification Phase)
↓ ↓ ↓
Real-time Interaction Memory Extraction + Clustering Counterexample Mining + Verification & Publishing
Quick Start
from m2wise import M2Wise, M2WiseConfig
# Initialize
config = M2WiseConfig(data_dir="./m2wise_data")
engine = M2Wise(config=config)
# Add user conversation
engine.add(
[{"role": "user", "content": "I prefer Chinese answers for technical questions"}],
user_id="alice"
)
# Search memories and wisdom
bundle = engine.search("How to answer technical questions?", user_id="alice")
print(bundle.as_prompt())
# Generate wisdom (Sleep phase)
sleep_report = engine.sleep(user_id="alice")
print(f"Generated {sleep_report.drafts_created} wisdom drafts")
# Verify and publish (Dream phase)
dream_report = engine.dream(user_id="alice")
print(f"Published {dream_report.published} wisdoms")
Technical Features
| Component | Features |
|---|---|
| Memory Extraction | Supports preference, fact, commitment, and more types |
| Similarity Calculation | Jaccard/Cosine/Levenshtein multi-strategy fusion |
| Confidence Evaluation | Time decay + evidence weight + hit rate weighting |
| Caching Strategy | LRU cache + TTL expiration, ~300x speedup |
Adapter Support
Compatible with multiple external memory systems:
- mem0 compatible
- Letta compatible
- Anthropic message format
Use Cases
- AI companion robots
- Personalized assistants
- Long-term user profiling systems
- Intelligent customer service
Installation
pip install m2wise
Version
Current Version: 1.0.0
License
Apache-2.0