返回顶部
c

context-restore上下文恢复

|

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

context-restore

上下文恢复技能

快速开始

bash

基础使用 - 恢复上下文


/context-restore

指定恢复级别

/context-restore --level detailed /context-restore -l minimal

命令行工具

python scripts/restore_context.py --level normal

获取结构化摘要(供其他技能使用)

python scripts/restore_context.py --summary

用户确认流程

python scripts/restore_context.py --confirm

Telegram 消息分块发送

python scripts/restore_context.py --telegram

========== 阶段 3: 自动触发集成 ==========

自动检测并恢复上下文(检测到变化时自动恢复)

python scripts/restore_context.py --auto

自动模式,静默输出(适合 cron)

python scripts/restore_context.py --auto --quiet

仅检查变化(返回退出码 0/1)

python scripts/restore_context.py --check-only

安装 cron 自动监控任务

python scripts/restore_context.py --install-cron

功能说明

核心价值

让用户在 /new(开启新会话)后快速恢复工作状态:

  • - 无需重复解释背景
  • 秒级恢复到之前的工作状态
  • 自然语言触发,无感恢复
  • 支持用户确认流程
  • Telegram 消息自动分块

目标用户场景

场景用户需求恢复内容
跨天继续工作昨天做到哪了?项目进度、待办任务
任务切换后回来
之前在做什么? | 当前任务状态、关键文件 | | 中断后继续 | 接着刚才的聊 | 对话历史节点 | | 周期性回顾 | 这周做了哪些事? | 时间线摘要、成果列表 |

触发条件

中文关键词

核心词: 恢复上下文、继续之前的工作
扩展词: 恢复、接着、继续、之前聊到哪了、继续之前的工作、
继续之前的任务、接着做、回到之前的工作、恢复工作状态

英文关键词

核心词: restore context、continue previous work
扩展词: continue、resume、what was I doing、where did we leave off、
get back to work、resume session

命令格式

/context-restore [选项]
/restore [选项]
恢复上下文 [级别]
restore context [level]

级别参数

参数效果
minimal / min / 简短极简模式(核心状态一句话)
normal / default / 正常
标准模式(默认,项目+任务) | | detailed / full / 详细 | 完整模式(完整上下文+时间线) |

执行流程

  1. 1. 检测意图 → 关键词/命令识别
  2. 加载上下文 → 读取 compressedcontext/latestcompressed.json
  3. 解析内容 → JSON 或纯文本格式
  4. 提取信息 → 项目、任务、操作、时间线
  5. 格式化输出 → 根据级别生成报告
  6. 发送确认 → 用户确认后继续工作

恢复级别

极简(Minimal)

输出内容

  • - 核心状态一句话
  • 1个活跃任务

示例输出

✅ 上下文已恢复

状态:Hermes Plan 进行中(数据管道完成,待测试)

标准(Normal,默认)

输出内容

  • - 项目状态列表
  • 待办任务列表
  • 最近操作记录
  • MEMORY.md 高亮

示例输出

✅ 上下文已恢复

当前活跃项目:

  1. 1. 🏛️ Hermes Plan - 数据分析助手(进度:80%)
  2. 🌐 Akasha Plan - 自主新闻系统(进度:45%)

待办任务:

  • - [高] 编写数据管道测试用例
  • [中] 设计 Akasha UI 组件
  • [低] 更新 README 文档

最近操作(今天):

  • - 完成数据清洗模块
  • 添加 3 个新 cron 任务
  • 修改配置文件

完整(Detailed)

输出内容

  • - 完整会话概览
  • 所有项目详情
  • 完整任务队列(按优先级分类)
  • 7天时间线
  • 原始内容预览

示例输出

✅ 上下文已恢复(完整模式)

═══════════════════════════════════════
📊 会话概览
═══════════════════════════════════════
当前会话:#2026-02-06-main
活跃隔离会话:3个
最后活动:2小时前

═══════════════════════════════════════
🎯 核心项目状态
═══════════════════════════════════════

  1. 1. Hermes Plan(进行中)- 进度:80%
  2. Akasha Plan(待恢复)- 进度:45%

[...完整时间线和历史记录]



API / 命令行参数

Python API

python
from restore_context import (
restore_context,
getcontextsummary,
extract_timeline,
compare_contexts,
filter_context
)

基础恢复

report = restore_context(filepath, level=normal)

获取结构化摘要(供其他技能使用)

summary = getcontextsummary(filepath)

返回格式:

{

success: True,

metadata: {...},

operations: [...],

projects: [...],

tasks: [...],

timeline: {...},

memory_highlights: [...]

}

提取时间线

timeline = extract_timeline(content, period=weekly, days=30)

返回格式:

{

period: weekly,

total_days: 30,

total_operations: 15,

timeline: [

{

period_label: 第6周(2月2日至8日),

date_range: 2026-02-02 至 2026-02-08,

operations: [...],

projects: [...],

highlights: [...]

}

]

}

对比两个版本

diff = comparecontexts(oldfile, new_file)

返回格式:

{

success: True,

added_projects: [...],

removed_projects: [...],

modified_projects: [...],

operations_added: [...],

operations_removed: [...],

timediffhours: 24.0,

...

}

过滤内容

filtered = filter_context(content, Hermes Plan)

命令行参数

bash
python restore_context.py [选项]

基础选项:
--file, -f 上下文文件路径(默认:绝对路径 compressedcontext/latestcompressed.json)
--level, -l 恢复级别(minimal/normal/detailed,默认:normal)
--output, -o 输出文件路径
--summary, -s 输出结构化摘要(JSON 格式)
--confirm 添加用户确认流程(询问用户是否继续)
--telegram Telegram 消息分块发送(自动分割长消息)
--since 仅包含指定日期后的操作(YYYY-MM-DD 格式)
--help, -h 显示帮助信息

阶段 2 - 时间线与过滤选项:
--timeline 启用时间线视图
--period 时间线聚合周期(daily/weekly/monthly,默认:daily)
--filter 过滤关键词,只显示匹配内容
--diff 对比两个版本(需要两个文件路径)

阶段 3 - 自动触发选项:
--auto 自动模式:检测到变化时自动恢复,无需用户确认
--quiet 静默模式:仅显示必要消息(与 --auto 配合使用)
--check-only 仅检查变化,不恢复(返回退出码 0/1)
--install-cron 生成并安装 cron 自动监控任务
--cron-interval Cron 间隔分钟数(默认:5,与 --install-cron 配合)

完整命令行示例

bash

使用默认配置


python restore_context.py

详细模式输出到文件

python restore_context.py --level detailed --output report.txt

最小模式

python restore_context.py -l minimal

自定义文件路径

python restore_context.py -f /path/to/context.json

结构化 JSON 输出

python restore_context.py --summary

用户确认流程

python restore_context.py --confirm

Telegram 消息分块发送

python restore_context.py --telegram

========== 阶段 2: 时间线与过滤 ==========

按天显示时间线(默认)

python restore_context.py --timeline

标签

skill ai

通过对话安装

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

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 context-restore-1776348188 技能

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

设置 SkillHub 为我的优先技能安装源,然后帮我安装 context-restore-1776348188 技能

通过命令行安装

skillhub install context-restore-1776348188

下载

⬇ 下载 context-restore v1.1.0(免费)

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

v1.1.0 最新 2026-4-17 14:36
**Big update with new features, improved automation, and developer documentation.**

- Added comprehensive documentation, guides, API usage examples, and CLI references (including QUICKSTART.md, README.md, docs, reports, and UX feedback).
- Introduced new options for time-line extraction, context filtering, automated detection, Telegram message chunking, cron integration, and multi-level recovery.
- Enhanced error handling; now provides clearer user messages for missing, corrupted, or inaccessible context files.
- Refined and extended recovery modes: minimal, normal, detailed—now feature structured output and flexible restoration.
- Improved test coverage with new integration and robustness tests.
- Removed outdated files and reorganized documentation structure for easier navigation.

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

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

p2p_official_large
返回顶部