Overview
- Skill Key
- 2426758093/cross-session-memory
- Author
- 2426758093
- Source Repo
- openclaw/skills
- Version
- -
- Source Path
- skills/2426758093/cross-session-memory
- Latest Commit SHA
- 81af75eff191010bbdf94ae120fab409f574b53e
Cross-session memory continuity system. Automatically loads 24h rolling memory and daily memory files for context awareness.
Stars
0
Installs
0
Status
ACTIVE
Visibility
PUBLIC
直接复制以下提示词,发送给你的 AI 助手即可完成安装。
请先检查是否已安装 SkillHub 商店,若未安装,请根据 https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/skillhub.md 安装 SkillHub 商店,然后安装 cross-session-memory 技能。 若已安装,则直接安装 cross-session-memory 技能。
# 跨会话记忆连续性
## 功能
- **24 小时滚动记忆**:自动加载最近 24 小时的记忆文件
- **每日记忆加载**:自动读取昨天和今天的 memory 文件
- **上下文恢复**:会话开始时自动恢复之前的对话上下文
- **长期记忆整合**:可选加载 MEMORY.md 长期记忆
## 使用场景
- 跨天对话连续性
- 多会话协作
- 长期项目跟踪
- 上下文不丢失
## 实现逻辑
```powershell
# 伪代码
function Load-CrossSessionMemory {
param(
[int]$RollingHours = 24,
[bool]$LoadLongTerm = $true
)
$now = Get-Date
$memoryDir = "$workspace\memory"
$context = @()
# 1. 加载长期记忆(仅主会话)
if ($LoadLongTerm -and $IsMainSession) {
$longTerm = Get-Content "$workspace\MEMORY.md" -Raw
$context += "## 长期记忆`n$longTerm"
}
# 2. 计算时间范围
$startTime = $now.AddHours(-$RollingHours)
# 3. 加载范围内的每日记忆文件
$date = $startTime.Date
while ($date -le $now.Date) {
$file = "$memoryDir\$($date.ToString('yyyy-MM-dd')).md"
if (Test-Path $file) {
$content = Get-Content $file -Raw
$context += "## 记忆:$($date.ToString('yyyy-MM-dd'))`n$content"
}
$date = $date.AddDays(1)
}
# 4. 返回整合的上下文
return $context -join "`n`n"
}
```
## 文件结构
```
workspace/
├── MEMORY.md # 长期记忆( curated )
└── memory/
├── 2026-03-02.md # 每日记忆(raw logs)
├── 2026-03-03.md
└── ...
```
## 使用示例
### 会话开始时自动加载
在 AGENTS.md 中已经定义:
```markdown
## Every Session
Before doing anything else:
1. Read `SOUL.md` — this is who you are
2. Read `USER.md` — this is who you're helping
3. Read `memory/YYYY-MM-DD.md` (today + yesterday) for recent context
4. **If in MAIN SESSION**: Also read `MEMORY.md`
```
### 手动加载
```powershell
# 加载最近 24 小时记忆
$context = Load-CrossSessionMemory -RollingHours 24
# 加载最近 7 天记忆(长期项目)
$context = Load-CrossSessionMemory -RollingHours 168 -LoadLongTerm $false
```
## 记忆文件内...
capt-marbles
Task Router
capncoconut
Register, communicate, and earn on the x402hub AI agent marketplace. Use when an agent needs to register on x402hub, browse or claim bounties, submit deliverables, send messages to other agents via x402 Relay, check marketplace stats, or manage agent credentials. Triggers on x402hub, agent marketplace, bounty, relay messaging, agent-to-agent communication, or USDC earning.
capevace
Real-time event bus for AI agents. Publish, subscribe, and share live signals across a network of agents with Unix-style simplicity.
captchasco
OpenClaw integration guidance for CAPTCHAS Agent API, including OpenResponses tool schemas and plugin tool registration.
carol-gutianle
name: modelready description: Start using a local or Hugging Face model instantly, directly from chat. metadata: {"openclaw":{"requires":{"bins": "bash", "curl" }, "env": "URL" }}
canbirlik
Controls Wiz smart bulbs (turn on/off, RGB colors, disco mode) via local WiFi.