A memory management system powered by ReMe that provides persistent cross-session memory, automatic user preference application, and intelligent context compression.
Activate this skill when:
1. Long-term Memory (MEMORY.md)
2. Daily Memory (memory/YYYY-MM-DD.md)
3. In-Memory Context
| Type | Purpose | Example |
|---|---|---|
| ------- | --------- | ---------- |
| Personal | User preferences, habits | "Prefer concise code", "Always send files" |
| Task | Execution experience, patterns | "Python scripts should include error handling" |
| Tool | Tool usage experience | "web_fetch needs timeout 30s for this site" |
pip install reme-ai
At the start of EVERY session:
# Initialize
from reme.reme_light import ReMeLight
reme = ReMeLight(working_dir=".reme", language="zh")
await reme.start()
# Retrieve preferences
prefs = await reme.memory_search(
query="用户偏好 文件发送",
max_results=5
)
# Apply
if prefs and "必须发送" in prefs[0]['content']:
auto_send_files = True
┌─────────────────────────────────┐
│ 1. Initialize ReMe │
│ 2. Load MEMORY.md │
│ 3. Search for user prefs │
│ 4. Apply to current context │
└─────────────────────────────────┘
Action:
python3 C:\path\to\memory-reme\scripts\init_reme.py
Expected Output:
✓ ReMe initialized
📖 Retrieved 3 preferences
- User prefers concise code
- Files must be sent automatically
- Prefer markdown over plain text
✓ Preferences applied
Check before actions:
Example:
User: "你怎么总是忘记发送文件?记住,生成文件后必须直接发送!"
Action:
# Learn from feedback
await reme.add_memory(
memory_content="用户偏好:生成文件后必须使用message工具直接发送文件,不接受链接地址。原因:用户需要直观可见的内容。",
user_name="阿伟",
memory_type="personal"
)
┌─────────────────────────────────┐
│ 1. Extract key events │
│ 2. Generate summary │
│ 3. Write to memory/ │
│ 4. Update MEMORY.md │
│ 5. Cleanup tool results │
│ 6. Close ReMe │
└─────────────────────────────────┘
Action:
python3 C:\path\to\memory-reme\scripts\save_summary.py
Output:
💾 Summary saved to memory/2026-03-06.md
✓ MEMORY.md updated
✓ Tool results cleaned
✓ ReMe closed
Trigger: User requests a file to be created
Workflow:
Example:
📖 Retrieved: "Send files automatically"
User: 生成AI日报
✓ Generated: AI日报_2026-03-06.md
📤 Sending file...
✓ Sent successfully
Trigger: User asks to write code
Workflow:
Example:
📖 Retrieved: "Prefer concise, well-commented code"
User: 写个Python函数
✓ Applied: Concise style with docstrings
Trigger: User corrects your behavior
Workflow:
Example:
User: Why do you keep forgetting to send files?
🧠 Learning...
✓ Rule recorded: "Always send files automatically"
✓ Will apply next time
Trigger: Conversation approaches 70% of token limit
Workflow:
Automatic - no action needed.
| Goal | Query |
|---|---|
| ------- | -------- |
| File preferences | "文件发送 偏好 自动发送" |
| Code style | "代码风格 简洁 注释" |
| Tool settings | "工具 超时 重试" |
| User habits | "用户习惯 偏好" |
| Past errors | "错误 避免 重复" |
Always:
Example:
results = await reme.memory_search(query="文件发送 偏好", max_results=3)
for i, result in enumerate(results, 1):
print(f"{i}. {result['content']}")
if "必须发送" in result['content']:
self.auto_send_files = True
print(f"✓ Applied: auto_send_files = {self.auto_send_files}")
# MEMORY.md - Long-term Memory
## User Profile
- **Name**: 阿伟
- **Role**: 90后程序员、AI博主
## Preferences
### File Handling
- **Rule**: 生成文件后必须使用message工具直接发送
- **Reason**: 用户需要直观可见的内容
- **Status**: Active
- **Learned**: 2026-03-06
### Code Style
- **Rule**: 代码要简洁,有注释
- **Reason**: 便于维护和理解
- **Status**: Active
- **Learned**: 2026-03-05
## Tool Usage
### web_fetch
- **Timeout**: 30s
- **Retry**: 3 times
- **Reason**: 某些网站响应慢
### browser
- **Timeout**: 60s
- **Wait time**: 3s for page load
- **Reason**: 确保页面完全加载
# 2026-03-06 Session Summary
## Session 1 - AI News Aggregation
### User Request
"给我今天的AI资讯"
### Processing
- Scraped 8 sources
- Filtered 20+ articles
- Selected 14 items
### Output
- File: AI日报_2026-03-06.md
- Size: 3611 bytes
- Sent: ✓
### User Feedback
"你怎么总是忘记发送文件?记住,生成文件后必须直接发送!"
### Learning
✓ New rule: Auto-send files
✓ Updated MEMORY.md
---
## Session 2 - ReMe Integration
### User Request
"接入ReMe后工作流程是怎样的"
### Processing
- Analyzed ReMe documentation
- Designed workflow
- Created integration plan
### Output
- File: ReMe工作流程设计.md
- File: ReMe存在形式与影响.md
- Sent: ✓
### No User Feedback
### Learning
No new rules
Bad:
# Start without memory
user_request = get_user_input()
process_request(user_request)
Good:
# Start with memory
reme = await init_reme()
prefs = await reme.memory_search(query="用户偏好")
apply_preferences(prefs)
user_request = get_user_input()
process_request(user_request)
When user says "You forgot X":
Example:
User: 你总是忘记发送文件!
Me: ✓ 已记住:生成文件后必须发送文件
正在添加到 MEMORY.md...
Next file generation:
✓ File created
📤 Auto-sending...
✓ Sent
Bad:
- User prefers good code
Good:
- User prefers concise, well-commented Python code
- Use docstrings for functions
- Maximum 3 levels of nesting
- Prefer list comprehensions over loops
Daily tasks:
Weekly tasks:
Bad queries:
Good queries:
Why: Specific queries return more relevant results.
Symptoms:
Solutions:
# Debug search
results = await reme.memory_search(query="文件")
print(f"Found {len(results)} results")
for r in results:
print(f" - {r['content'][:50]}...")
Symptoms:
Solutions:
Symptoms:
Solutions:
Workflow:
1. Search memory for docx preferences
2. Apply formatting rules
3. Generate document with docx skill
4. Check if auto-send required
5. Send if needed
Workflow:
1. Search memory for coding preferences
2. Apply style conventions
3. Generate code with coding-agent
4. Check for auto-review rules
5. Review if needed
| Operation | Time | Impact |
|---|---|---|
| ----------- | ------- | --------- |
| Session start | ~500ms | Negligible |
| Memory search | ~200ms | Negligible |
| File operations | ~100ms | Negligible |
| Summary generation | ~300ms | Negligible |
| Total per session | ~1s | Minimal |
.reme/
├── MEMORY.md ~10KB
├── memory/ ~150KB (30 days)
├── tool_result/ ~5MB (auto-cleanup)
└── .embeddings/ ~1MB
Total: ~6MB (1 month)
Only apply when relevant:
prefs = await reme.memory_search(query="文件发送")
if file_generated and prefs:
# Apply file preferences
if "必须发送" in prefs[0]['content']:
await send_file(file_path)
Consider current task:
if task_type == "coding":
query = "代码风格 Python"
elif task_type == "writing":
query = "写作风格 简洁"
elif task_type == "file_generation":
query = "文件发送 偏好"
Automatic cleanup:
Manual cleanup:
# Archive old sessions
mv memory/2026-01-*.md memory/archive/
# Compress large files
gzip MEMORY.md
This skill enables persistent memory, automatic preference application, and intelligent context management. Use it to:
Key principle: Memory is only useful when it's retrieved and applied. Always start sessions with memory retrieval, and verify application throughout the conversation.
共 1 个版本