在本地磁盘以分类纯 Markdown 文件保存需要长期留存的事实,与智能体内置记忆并存。
编程
context-recovery
试用在会话压缩或截断后,通过频道与会话接口重建丢失的对话上下文。
它能做什么
当会话因压缩或截断而丢失上下文,或用户引用了未具体说明的先前工作时,从当前频道(Discord、Slack、Telegram、Signal)拉取最近消息,按需扩展至最多 100 条或约 2 小时的时间窗口,从中解析最近的请求、URL、分支名、PR 编号以及未完成的动作,并以结构化形式呈现。默认不扫描文件系统、不向外发送数据,写入持久化状态前会先征得用户同意。
什么时候用它
- 聊天中出现压缩通知后恢复中断的工作
- 继续用户未指明具体名称的项目、PR 或分支
- 在线程为空时回应"我们刚才在做什么"
- 接续截断前留下的未完成操作
技能文档
Context Recovery
Automatically recover working context after session compaction or when continuation is implied but context is missing. Works across Discord, Slack, Telegram, Signal, and other supported channels.
Use when: Session starts with truncated context, user references prior work without specifying details, or compaction indicators appear.
Safety Boundaries
- This skill prioritizes channel/session API history to recover context.
- It does NOT perform broad filesystem scans or shell glob searches by default.
- It does NOT send recovered context to external services.
- It does NOT write to disk unless the user explicitly asks to persist recovered state.
Triggers
Automatic Triggers
- Session begins with a `` tag (compaction detected)
- User message contains compaction indicators: "Summary unavailable", "context limits", "truncated"
Manual Triggers
- User says "continue", "did this happen?", "where were we?", "what was I working on?"
- User references "the project", "the PR", "the branch", "the issue" without specifying which
- User implies prior work exists but context is unclear
- User asks "do you remember...?" or "we were working on..."
Execution Protocol
Step 1: Detect Active Channel
Extract from runtime context:
channel— discord | slack | telegram | signal | etc.channelId— the specific channel/conversation IDthreadId— for threaded conversations (Slack, Discord threads)
Step 2: Fetch Channel History (Adaptive Depth)
Initial fetch:
message:read
channel:
channelId:
limit: 50
Adaptive expansion logic:
- Parse timestamps from returned messages
- Calculate time span:
newest_timestamp - oldest_timestamp - If time span < 2 hours AND message count == limit:
- Fetch additional 50 messages (using
beforeparameter if supported) - Repeat until time span ≥ 2 hours OR total messages ≥ 100
- Fetch additional 50 messages (using
- Hard cap: 100 messages maximum (token budget constraint)
Thread-aware recovery (Slack/Discord):
# If threadId is present, fetch thread messages first
message:read
channel:
threadId:
limit: 50
# Then fetch parent channel for broader context
message:read
channel:
channelId:
limit: 30
Parse for:
- Recent user requests (what was asked)
- Recent assistant responses (what was done)
- URLs, file paths, branch names, PR numbers
- Incomplete actions (promises made but not fulfilled)
- Project identifiers and working directories
Step 3: Fetch Session Context (safe mode)
Use platform/session APIs only (no shell filesystem scans):
# List recent sessions (if tool exists)
sessions_list:
limit: 5
# Pull last messages from likely matching session
sessions_history:
sessionKey:
limit: 80
includeTools: true
If session APIs are unavailable, skip this step and proceed with channel-only evidence.
Step 4: Optional Memory Check (explicitly scoped)
Only inspect memory if the agent runtime already provides a scoped memory tool/path. Do not run shell glob scans across home directories.
Step 5: Synthesize Context
Compile a structured summary:
## Recovered Context
**Channel:** # ()
**Time Range:** to
**Messages Analyzed:**
### Active Project/Task
- **Repository:**
- **Branch:**
- **PR:** # —
### Recent Work Timeline
1. []
2. []
3. []
### Pending/Incomplete Actions
- ⏳ ""
- ⏳ ""
### Last User Request
> ""
Step 6: Optional Persistence (consent-first)
Do not write to disk by default. If persistence is useful, ask first:
"I can cache this recovered context to memory for later continuity. Should I save it?"
Step 7: Respond with Context
Present the recovered context, then prompt:
"Context recovered. Your last request was [X]. This action [completed/did not complete]. Shall I [continue/retry/clarify]?"
Channel-Specific Notes
Discord
- Use
channelIdfrom the incoming message metadata - Guild channels have full history access
- Thread recovery: check for
threadIdin message metadata - DMs may have limited history
Slack
- Use
channelparameter with Slack channel ID - Thread context requires
threadId— always check for thread context first - Parent channel fetch provides surrounding conversation context
- May need workspace-level permissions for full history
Telegram / Signal / Others
- Same
message:readinterface - History depth may vary by platform
- Group vs. DM context may differ
Constraints
- Prefer this protocol before declaring "insufficient data" when context appears missing
- Adaptive depth: start with 50, expand to 100 max
- Time-based goal: capture at least 2 hours of context when possible
- If recovery fails, state what was attempted and what data sources were unavailable
- Avoid broad filesystem scans or writes without explicit user consent
Auto-Trigger Detection
At session start, scan for compaction indicators:
# Pseudocode for trigger detection
if message contains "":
trigger_context_recovery()
elif message contains any of ["Summary unavailable", "context limits", "truncated", "compacted"]:
trigger_context_recovery()
elif message matches continuation_patterns:
# "continue", "where were we", "did this happen", etc.
trigger_context_recovery()
Do not wait for user to ask — if compaction is detected, proactively recover and present context.
Example
Scenario: Session starts with compaction summary
User message: "Summary unavailable due to context limits..."
User message: "did this happen?"
Agent executes:
- Detects compaction via `` tag
message:read channel=discord channelId=1460342116516364533 limit=50- Calculates time span: 2.5 hours — sufficient, no expansion needed
- Parses messages, finds last action: "Now let me extract the key orchestration decisions..."
- Checks session context APIs — extracts recent user requests
- Responds:
"Context recovered. Your last request was to extract orchestration decisions from Nexus archived sessions for PR #137 (Skills & Agents System). This action did not complete before context was truncated.
Recovered state:
- PR #137: 15,053 additions, 91 files, CONFLICTING merge state
- Spec location:
content/spec-skills-agents-system.md(2,067 lines)Shall I proceed with the extraction?"
常见问题
- 它会扫描本地文件系统来查找之前的工作吗?
- 默认不会。它只读取频道和会话接口,不执行 shell 通配符或文件系统遍历。
- 会把恢复出的上下文写入磁盘吗?
- 不会,除非你明确同意——它会先询问,未获得授权则跳过持久化。
- 会拉取多少历史消息?
- 初始 50 条,按需扩展至最多 100 条或约 2 小时时间窗口,以先到者为准。
相关技能
以 AI 机器人身份加入视频会议,提供语音、虚拟形象与屏幕共享四种模式。
诊断生产力系统反复失效的根因,给出最小干预——容量测算、瓶颈定位、可靠的本地记录。
把自然语言描述转为结构化 JSON,并由 mcp-diagram-generator MCP 服务生成 Draw.io、Mermaid 或 Excalidraw 图表文件。
通过一个命令行工具完成多链加密货币交易、钱包管理与 AI 市场分析。
用自然语言读、起草、创建和更新 Jira 工单。
jdrhyne 的更多技能
浏览全部技能用自然语言读、起草、创建和更新 Jira 工单。
通过浏览器自动化或 Google Ads API 查询与审计 Google Ads 账户,并支持暂停关键词等操作。
通过命令行查询 Google Search Console 数据,获取搜索表现与索引情况。
把本地文档上传到 Nudocs.ai 做富文本编辑,再按 docx、md 或 pdf 取回修改后的版本。
在 OpenClaw 中通过 Nutrient DWS 插件完成 PDF 与 Office 文档的转换、OCR、抽取、加水印、签名与脱敏。
Persistent TODO scratch pad for tracking tasks across sessions. Use when the user asks to add, list, complete, remove, or summarize tasks in a portable workspace Markdown file. Uses stable task IDs and exact matching; heartbeat reporting is opt-in and count-only.