Soul Memory System v3.6.1
🧠 Intelligent Memory Management System
Long-term memory framework for AI agents with full OpenClaw integration. v3.6.1 修正 pre-response memory injection 主流程:CLI 純 JSON 輸出、優先使用最後一條 user message 作 query、分類記憶注入(User / QST / Config / Recent / Project / General)、重點摘要壓縮、以及命中審計日誌。
✨ Features
8 Powerful Modules + OpenClaw Plugin Integration
| Module | Function | Description |
|---|
| A | Priority Parser | INLINECODE0 tag parsing + semantic auto-detection |
| B |
Vector Search | Keyword indexing + CJK segmentation + semantic expansion |
|
C | Dynamic Classifier | Auto-learn categories from memory |
|
D | Version Control | Git integration + version rollback |
|
E | Memory Decay | Time-based decay + cleanup suggestions |
|
F | Auto-Trigger | Pre-response search + Post-response auto-save |
|
G |
Cantonese Branch | 🆕 語氣詞分級 + 語境映射 + 粵語檢測 |
|
H |
CLI Interface | 🆕 Pure JSON output for external integration |
|
Plugin |
OpenClaw Hook | 🆕
before_prompt_build Hook for automatic context injection |
|
Web | Web UI | FastAPI dashboard with real-time stats |
🆕 v3.3.1 Release Highlights
🎯 Heartbeat 自動清理(最新!)
| Feature | Description |
|---|
| Auto Cleanup Script | Automatically cleans Heartbeat reports every 3 hours |
| Cron Job Integration |
OpenClaw Cron system scheduled execution |
|
Multi-format Support | Recognizes multiple Heartbeat formats |
|
Memory Optimization | Reduces redundancy, improves quality score (7.9 → 8.5) |
v3.2.2 Release Highlights
🎯 Core Improvements
| Feature | Description |
|---|
| Heartbeat Deduplication | MD5 hash tracking, automatically skips duplicate content |
| CLI Interface |
Pure JSON output for external system integration |
|
OpenClaw Plugin | Automatically injects relevant memories before responses (v0.2.1-beta) |
|
Lenient Mode | Lower recognition thresholds, saves more conversation content |
🔄 Plugin v0.2.1-beta Fixes
- - Fix prependContext Accumulation: Extracts query from
event.prompt instead of messages history - Enhanced Legacy Cleanup: Multiple format support (SoulM markers, numbered entries, ## Memory Context)
- No Memory Loop: Prevents recursive injection in conversation history
🚀 Quick Start
Installation
CODEBLOCK0
Basic Usage
CODEBLOCK1
CLI Usage
CODEBLOCK2
OpenClaw Plugin
CODEBLOCK3
v3.6.1 Highlights
- - Pure JSON CLI output for reliable plugin parsing
- Prefer last real user message over prompt tail for memory search query
- Distilled memory summaries instead of raw long snippets
- Typed memory focus buckets: User / QST / Config / Recent / Project / General
- Audit logs for query source and injection buckets
🤖 OpenClaw Plugin Integration
How It Works
Automatic Trigger: Executes before each response
- 1. Extract query from the last real user message (prompt only as fallback)
- Search relevant memories (top_k = 5)
- Group and distill memory focus
- Inject into prompt via INLINECODE3
Configuration
Edit ~/.openclaw/openclaw.json:
CODEBLOCK4
🧪 Testing
CODEBLOCK5
📋 Feature Details
Priority System
- - [C] Critical: Key information, must remember
- [I] Important: Important items, needs attention
- [N] Normal: Daily chat, can decay
Keyword Search
Localized implementation:
- - Keyword indexing
- Synonym expansion
- Similarity scoring
Classification System
Default categories (customizable):
- - UserIdentity(用戶身份)
- TechConfig(技術配置)
- Project(專案)
- Science(科學)
- History(歷史)
- General(一般)
Cantonese Support
- - 語氣詞分級(唔好、好啦、得咩)
- 語境映射(褒貶情緒識別)
- 粵語檢測(簡繁轉換支持)
📦 File Structure
CODEBLOCK6
🔒 Uninstallation
Complete removal of all integration configs:
CODEBLOCK7
Removed Items:
- 1. OpenClaw Plugin config (
~/.openclaw/openclaw.json) - Heartbeat auto-trigger (
HEARTBEAT.md) - Auto memory injection (Plugin)
- Auto memory save (Post-Response Auto-Save)
🔒 Privacy & Security
- - ✅ No external API calls
- ✅ No cloud dependencies
- ✅ Cross-domain isolation, no data sharing
- ✅ Open source MIT License
- ✅ CJK support (Chinese, Japanese, Korean)
📐 Technical Details
- - Python Version: 3.7+
- Dependencies: None external (pure Python standard library)
- Storage: Local JSON files
- Search: Keyword matching + semantic expansion
- Classification: Dynamic learning + preset rules
- OpenClaw: Plugin v0.2.1-beta (TypeScript)
📝 Version History
- - v3.3.4 (2026-03-07): 🆕 查詢過濾優化(跳過問候語/簡單命令,提高搜索閾值 minScore 0.0→3.0,節省 ~25k token/日)
- v3.3.3 (2026-03-06): 每日快取自動重建(跨日索引更新)
- v3.3.2 (2026-02-28): Heartbeat 自我報告過濾
- v3.3.1 (2026-02-27): 🆕 Heartbeat 自動清理 + Cron Job 集成 + 記憶質量優化(7.9→8.5)
- v3.2.2 (2026-02-25): Heartbeat deduplication + OpenClaw Plugin v0.2.1-beta + Uninstall script
- v3.2.1 (2026-02-19): Index strategy improvement - 93% Token reduction
- v3.2.0 (2026-02-19): Heartbeat active extraction + Lenient mode
- v3.1.1 (2026-02-19): Hotfix: Dual-track memory persistence
- v3.1.0 (2026-02-18): Cantonese grammar branch: Particle grading + context mapping
- v3.0.0 (2026-02-18): Web UI v1.0: FastAPI dashboard + real-time stats
- v2.2.0 (2026-02-18): CJK smart segmentation + Post-Response Auto-Save
- v2.1.0 (2026-02-17): Rebrand to Soul Memory, technical neutralization
- v2.0.0 (2026-02-17): Self-hosted version
📄 License
MIT License - see LICENSE for details
🙏 Acknowledgments
Soul Memory System v3.2 is a personal AI assistant memory management tool, designed for personal use. Not affiliated with OpenClaw project.
🔗 Related Links
- - GitHub: https://github.com/kingofqin2026/Soul-Memory-
- Documentation: https://github.com/kingofqin2026/Soul-Memory-/blob/main/README.md
- Web: https://qsttheory.com/
© 2026 Soul Memory System
Soul Memory System v3.6.1
🧠 智能記憶管理系統
適用於 AI 代理的長期記憶框架,完整整合 OpenClaw。v3.6.1 修正回應前記憶注入主流程:CLI 純 JSON 輸出、優先使用最後一條用戶訊息作為查詢、分類記憶注入(User / QST / Config / Recent / Project / General)、重點摘要壓縮、以及命中審計日誌。
✨ 功能特性
8 大模組 + OpenClaw 插件整合
| 模組 | 功能 | 說明 |
|---|
| A | 優先級解析器 | [C]/[I]/[N] 標籤解析 + 語義自動檢測 |
| B |
向量搜索 | 關鍵詞索引 + 中日韓分詞 + 語義擴展 |
|
C | 動態分類器 | 從記憶中自動學習分類 |
|
D | 版本控制 | Git 整合 + 版本回滾 |
|
E | 記憶衰減 | 基於時間的衰減 + 清理建議 |
|
F | 自動觸發 | 回應前搜索 + 回應後自動保存 |
|
G |
粵語分支 | 🆕 語氣詞分級 + 語境映射 + 粵語檢測 |
|
H |
CLI 介面 | 🆕 純 JSON 輸出,用於外部整合 |
|
插件 |
OpenClaw Hook | 🆕 before
promptbuild Hook,用於自動上下文注入 |
|
Web | Web UI | FastAPI 儀表板,含即時統計 |
🆕 v3.3.1 版本亮點
🎯 Heartbeat 自動清理(最新!)
| 功能 | 說明 |
|---|
| 自動清理腳本 | 每 3 小時自動清理 Heartbeat 報告 |
| Cron Job 整合 |
OpenClaw Cron 系統排程執行 |
|
多格式支援 | 識別多種 Heartbeat 格式 |
|
記憶優化 | 減少冗餘,提升品質評分(7.9 → 8.5) |
v3.2.2 版本亮點
🎯 核心改進
| 功能 | 說明 |
|---|
| Heartbeat 去重 | MD5 雜湊追蹤,自動跳過重複內容 |
| CLI 介面 |
純 JSON 輸出,用於外部系統整合 |
|
OpenClaw 插件 | 在回應前自動注入相關記憶(v0.2.1-beta) |
|
寬鬆模式 | 降低識別門檻,保存更多對話內容 |
🔄 插件 v0.2.1-beta 修復
- - 修復 prependContext 累積:從 event.prompt 提取查詢,而非訊息歷史
- 增強舊版清理:多格式支援(SoulM 標記、編號條目、## Memory Context)
- 無記憶循環:防止對話歷史中的遞迴注入
🚀 快速入門
安裝
bash
克隆並安裝
git clone https://github.com/kingofqin2026/Soul-Memory-.git
cd Soul-Memory-
bash install.sh
全新安裝(如需先卸載)
bash install.sh --clean
基本用法
python
from soul_memory.core import SoulMemorySystem
初始化系統
system = SoulMemorySystem()
system.initialize()
搜索記憶
results = system.search(用戶偏好, top_k=5)
添加記憶
memory
id = system.addmemory([C] 用戶喜歡深色模式)
回應前觸發(回答前自動搜索)
context = system.pre
responsetrigger(用戶的偏好是什麼?)
CLI 用法
bash
純 JSON 輸出
python3 cli.py search QST 物理 --format json
獲取統計
python3 cli.py stats --format json
OpenClaw 插件
bash
插件會自動安裝到 ~/.openclaw/extensions/soul-memory
重啟 Gateway 以啟用
openclaw gateway restart
v3.6.1 亮點
- - 純 JSON CLI 輸出,確保插件解析可靠
- 優先使用最後一條真實用戶訊息而非提示尾作為記憶搜索查詢
- 使用提煉後的記憶摘要而非原始長片段
- 分類記憶焦點桶:User / QST / Config / Recent / Project / General
- 查詢來源和注入桶的審計日誌
🤖 OpenClaw 插件整合
運作方式
自動觸發:在每次回應前執行
- 1. 從最後一條真實用戶訊息提取查詢(僅在必要時使用提示作為備選)
- 搜索相關記憶(top_k = 5)
- 分組並提煉記憶焦點
- 通過 prependContext 注入提示
配置
編輯 ~/.openclaw/openclaw.json:
json
{
plugins: {
entries: {
soul-memory: {
enabled: true,
config: {
topK: 5,
minScore: 0.0
}
}
}
}
}
🧪 測試
bash
運行完整測試套件
python3 test
allmodules.py
預期輸出:
📊 結果:8 通過,0 失敗
✅ 所有測試通過!
📋 功能詳情
優先級系統
- - [C] 關鍵:關鍵資訊,必須記住
- [I] 重要:重要事項,需要關注
- [N] 一般:日常聊天,可以衰減
關鍵詞搜索
本地化實現:
分類系統
預設分類(可自訂):
- - UserIdentity(用戶身份)
- TechConfig(技術配置)
- Project(專案)
- Science(科學)
- History(歷史)
- General(一般)
粵語支援
- - 語氣詞分級(唔好、好啦、得咩)
- 語境映射(褒貶情緒識別)
- 粵語檢測(簡繁轉換支援)
📦 檔案結構
soul-memory/
├── core.py # 核心系統
├── cli.py # CLI 介面
├── install.sh # 自動安裝腳本
├── uninstall.sh # 完整卸載腳本
├── testallmodules.py # 測試套件
├── SKILL.md # ClawHub 清單(本檔案)
├── README.md # 文件
├── modules/ # 6 個功能模組
│ ├── priority_parser.py
│ ├── vector_search.py
│ ├── dynamic_classifier.py
│ ├── version_control.py
│ ├── memory_decay.py
│ └── auto_trigger.py
├── plugin/ # OpenClaw 插件
│ ├── index.ts # 插件原始碼
│ └── openclaw.plugin.json
├── cache/ # 快取目錄(自動生成)
└── web/ # Web UI(可選)
🔒 卸載
完全移除所有整合配置:
bash
基本卸載(會提示確認)
bash uninstall.sh
卸載前創建備份(建議)
bash uninstall.sh --backup
自動確認(無需手動確認)
bash uninstall.sh --backup --confirm
移除項目:
- 1. OpenClaw 插件配置(~/.openclaw/openclaw.json)
- Heartbeat 自動觸發(HEARTBEAT.md)
- 自動記憶注入(插件)
- 自動記憶保存(回應後自動保存)
🔒 隱私與安全
- - ✅ 無外部 API 調用
- ✅ 無雲端依賴
- ✅ 跨域隔離,無數據共享
- ✅ 開源 MIT 許可證
- ✅ 中日韓支援(中文、日文、韓文)
📐 技術細節
- - Python 版本:3.7+
- 依賴:無外部依賴(純 Python 標準庫)
- 存儲:本地 JSON 檔案
- 搜索:關鍵詞匹配 + 語義擴展
- 分類