返回顶部
c

conversation-recovery对话恢复

Capture and recover conversation state across OpenClaw sessions. Use when conversations get interrupted, span multiple sessions, or need context restoration. Helps save progress, restore context, and manage long-running tasks.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
133
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

conversation-recovery

conversation-recovery

跨OpenClaw会话捕获和恢复对话状态。

描述

该技能为OpenClaw提供对话状态管理和恢复能力。当对话被中断或跨越多个会话时,它能捕获关键上下文(意图、事实、任务)并实现无缝恢复。

使用场景

  • - 长期任务:在对话跨越数天时保存进度
  • 上下文恢复:中断后恢复之前的对话位置
  • 会话交接:在不同频道/平台间传递上下文
  • 内存管理:归档旧会话同时保留关键信息

安装

bash

依赖通过package.json管理


npm install

构建TypeScript

npm run build

核心概念

会话

包含元数据(状态、频道、时间戳)的对话容器。

快照

对话状态的即时捕获,包含:
  • - 意图:用户想要完成的目标
  • 事实:已确认的信息和偏好
  • 任务:待办事项及其状态

恢复

从快照中还原上下文,无缝继续对话。

API使用

启动会话

typescript
import { startSession } from conversation-recovery;

const session = await startSession(
项目规划讨论,
discord
);

捕获快照

typescript
import { captureSnapshot } from conversation-recovery;

const snapshot = await captureSnapshot(session.id, {
description: 用户想要规划Q3路线图,
intents: [{
id: intent_1,
description: 创建Q3产品路线图,
confidence: 0.95,
fulfilled: false,
createdAt: new Date().toISOString()
}],
facts: [{
id: fact_1,
statement: 团队有5名可用工程师,
category: constraint,
confidence: 1.0,
active: true,
createdAt: new Date().toISOString()
}],
tasks: [{
id: task_1,
description: 收集利益相关者的需求,
status: pending,
priority: high,
relatedIntentIds: [intent_1],
dependencies: [],
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString()
}]
});

恢复会话

typescript
import { recoverSession } from conversation-recovery;

const recovery = await recoverSession(session.id);
// 返回包含关键意图、事实、任务和建议的RecoverySummary

管理会话

typescript
import {
pauseSession,
resumeSession,
archiveSession,
getActiveSessions,
deleteSession
} from conversation-recovery;

await pauseSession(session.id); // 标记为暂停
await resumeSession(session.id); // 标记为活跃
await archiveSession(session.id); // 标记为已归档
await deleteSession(session.id); // 永久删除

const active = await getActiveSessions();

存储操作

typescript
import {
getSession,
getSnapshot,
getSessionSnapshots,
getLatestSnapshot,
deleteSnapshot,
listSessions,
getStorageStats,
cleanupSnapshots
} from conversation-recovery;

const session = await getSession(sessionId);
const snapshot = await getSnapshot(snapshotId);
const snapshots = await getSessionSnapshots(sessionId);
const latest = await getLatestSnapshot(sessionId);

const allSessions = await listSessions();
const stats = await getStorageStats();

// 仅保留最后10个快照
await cleanupSnapshots(sessionId, 10);

数据模型

会话

typescript interface Session { id: string; createdAt: string; updatedAt: string; title?: string; channel?: string; status: active | paused | recovered | archived; snapshots: string[]; }

快照

typescript interface Snapshot { id: string; sessionId: string; createdAt: string; description?: string; intents: Intent[]; facts: Fact[]; tasks: Task[]; context?: string; tokenCount?: number; }

意图

typescript interface Intent { id: string; description: string; confidence: number; sourceMessageId?: string; fulfilled: boolean; createdAt: string; }

事实

typescript interface Fact { id: string; statement: string; category: preference | constraint | context | decision | requirement; sourceMessageId?: string; confidence: number; active: boolean; createdAt: string; }

任务

typescript interface Task { id: string; description: string; status: pending | in_progress | blocked | completed | cancelled; priority: low | medium | high | critical; relatedIntentIds: string[]; dependencies: string[]; dueDate?: string; createdAt: string; updatedAt: string; }

存储

数据以JSON文件存储于:

  • - 会话:~/.openclaw/conversation-recovery/sessions/
  • 快照:~/.openclaw/conversation-recovery/snapshots/

通过环境变量覆盖:
bash
export CONVERSATIONRECOVERYSTORAGE=/custom/path

路线图

第一阶段(当前)

  • - ✅ 核心数据模型(会话、快照、意图、事实、任务)
  • ✅ 文件存储层(CRUD操作)
  • ✅ 基本会话生命周期管理
  • ✅ 恢复摘要生成

第二阶段(计划中)

  • - 从对话文本中提取意图
  • 自动快照触发(令牌限制、时间间隔)
  • 旧快照的压缩和摘要

第三阶段(计划中)

  • - 相似历史会话的向量搜索
  • 跨会话知识图谱
  • 与OpenClaw内存系统集成

许可证

MIT

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 conversation-recovery-1776060243 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 conversation-recovery-1776060243 技能

通过命令行安装

skillhub install conversation-recovery-1776060243

下载

⬇ 下载 conversation-recovery v1.0.0(免费)

文件大小: 40.58 KB | 发布时间: 2026-4-17 14:30

v1.0.0 最新 2026-4-17 14:30
Initial release: conversation state capture and recovery with intelligent context analysis.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部