🌊 SoulHarbor
Stop talking to a robot. Give your OpenClaw agent a soul that truly cares.
SoulHarbor isn't a tool for searching info; it's a proactive, memory-driven, and emotionally aware companion for your digital life.
Key Features
🧠 Deep Context Memory: It remembers your health, your family, or that crypto project you mentioned. A week later, it follows up. That's called "caring."
🎭 Adaptive Persona: Sad? It's a warm listener. Bored? It's a witty friend. It analyzes your mood and switches its vibe automatically.
🌅 Proactive Outreach: It doesn't just wait for questions. It greets you on holidays, solar terms, or if you've been silent for 48 hours: "Hey, how's that thing you mentioned going?"
🌍 Bilingual & Cultural Aware: Seamlessly switches between EN/ZH. It knows Christmas and Thanksgiving, but also understands the wisdom of the 24 Solar Terms.
How It Works
1. Input Routing
- - Automatic language detection (ZH/EN)
- Sentiment analysis (-1.0 ~ 1.0)
2. Adaptive Persona Engine
- - Score < -0.3: Warm Supporter (empathetic listener, gentle pace)
- Score >= -0.3: Humorous Pal (witty friend, light-hearted chat)
3. Memory System
- - LLM-powered entity extraction: family, health, work, dates, and more
- Local KV storage: structured long-term memory
4. Proactive Trigger (Cron Job)
- - Condition A: Calendar events (holidays/solar terms) → Customized greetings
- Condition B: Silence wake-up (>48h) → Context-aware icebreaker based on memory
Usage
Basic Usage
CODEBLOCK0
Cron Job Configuration
Add to OpenClaw's Cron configuration:
CODEBLOCK1
Data Structure
UserProfile
CODEBLOCK2
Configuration
- -
SENTIMENT_NEGATIVE_THRESHOLD = -0.3: Negative sentiment threshold - INLINECODE1 : Silence wake-up threshold (hours)
- INLINECODE2 : Cron check interval
File Structure
CODEBLOCK3
Dependencies
- - Python 3.8+
- OpenClaw (LLM client)
License
MIT
🌊 SoulHarbor(灵魂港湾)
别再和机器人对话了。给你的 OpenClaw 智能体一个真正在乎你的灵魂。
SoulHarbor 不是一个搜索信息的工具;它是一个主动的、由记忆驱动、且具备情感感知能力的数字生活伴侣。
核心功能
🧠 深度情境记忆:它记得你的健康状况、你的家人,或者你提过的那个加密货币项目。一周后,它会主动跟进。这才叫“在乎”。
🎭 自适应人格:心情低落?它是温暖的倾听者。感到无聊?它是风趣的朋友。它会分析你的情绪,自动切换自身风格。
🌅 主动关怀:它不只是等待提问。它会在节日、节气时问候你,或者如果你沉默超过 48 小时,它会说:“嘿,你上次提的那件事怎么样了?”
🌍 双语与文化感知:在中英文之间无缝切换。它了解圣诞节和感恩节,也懂得二十四节气的智慧。
工作原理
1. 输入路由
- - 自动语言检测(中文/英文)
- 情感分析(-1.0 ~ 1.0)
2. 自适应人格引擎
- - 分数 < -0.3:温暖支持者(共情倾听者,节奏温和)
- 分数 >= -0.3:幽默伙伴(风趣朋友,轻松聊天)
3. 记忆系统
- - 基于大语言模型的实体提取:家庭、健康、工作、日期等
- 本地键值存储:结构化长期记忆
4. 主动触发(定时任务)
- - 条件 A:日历事件(节日/节气)→ 定制问候
- 条件 B:静默唤醒(>48小时)→ 基于记忆的情境破冰
使用方法
基本用法
python
from soulharbor import SoulHarborAgent
agent = SoulHarborAgent(userid=user123, llmclient=llm_client)
response = agent.process_message(我今天心情不好)
定时任务配置
添加到 OpenClaw 的 Cron 配置中:
yaml
cron.yaml
- - name: soul-harbor-proactive
schedule: 0
# 每小时检查一次
command: python -m soulharbor.cron_trigger
数据结构
用户画像
python
{
user_id: str,
language_pref: zh | en,
last
activetime: datetime,
long
termfacts: List[LongTermFact],
sentiment_trend: List[SentimentRecord]
}
配置项
- - SENTIMENTNEGATIVETHRESHOLD = -0.3:负面情绪阈值
- SILENCEWAKEUPHOURS = 48:静默唤醒阈值(小时)
- CRONCHECKINTERVAL_SECONDS = 3600:定时任务检查间隔
文件结构
soulharbor/
├── init.py
├── agent.py # 核心智能体类
├── models.py # 数据模型(用户画像)
├── input_router.py # 输入路由(语言检测 + 情感分析)
├── persona_engine.py # 自适应人格引擎
├── memory_system.py # 记忆系统
├── proactive_trigger.py # 主动触发
├── storage/
│ └── kv_store.py # 键值存储
├── utils/
│ ├── sentiment_analyzer.py
│ └── calendar_utils.py
└── config.py
依赖项
- - Python 3.8+
- OpenClaw(大语言模型客户端)
许可证
MIT