Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计异常

context-recoverycontext recovery 搜索

Agent Skill

context-recovery 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

675

周安装

29

GitHub Stars

52

下载量

237
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:context-recovery(context recovery 搜索)
来源仓库:https://github.com/aaaaqwq/claude-code-skills
仓库路径:skills/context-recovery
安装命令:
npx skills add https://github.com/aaaaqwq/claude-code-skills --skill context-recovery
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/aaaaqwq/claude-code-skills --skill context-recovery

简介

用于查找、检索和筛选相关信息以恢复工作上下文。

  • 适合在会话截断或用户引用先前工作时快速定位候选结果。
  • 支持自动触发和手动触发两种模式,适用于多种通信渠道。
  • 安装命令:npx skills add https://github.com/aaaaqwq/claude-code-skills --skill context-recovery
  • 使用前建议确认权限范围和维护状态,注意可能涉及联网操作。

SKILL.md

Context Recovery

  • Author: Daniel Li
  • Copyright © Daniel Li. All rights reserved.

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.


Triggers

Automatic Triggers

  • Session begins with a <summary> 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 ID
  • threadId — for threaded conversations (Slack, Discord threads)

Step 2: Fetch Channel History (Adaptive Depth)

Initial fetch:

message:read
  channel: <detected-channel>
  channelId: <detected-channel-id>
  limit: 50

Adaptive expansion logic:

  1. Parse timestamps from returned messages
  2. Calculate time span: newest_timestamp - oldest_timestamp
  3. If time span < 2 hours AND message count == limit:

- Fetch additional 50 messages (using before parameter if supported) - Repeat until time span ≥ 2 hours OR total messages ≥ 100

  1. Hard cap: 100 messages maximum (token budget constraint)

Thread-aware recovery (Slack/Discord):

# If threadId is present, fetch thread messages first
message:read
  channel: <detected-channel>
  threadId: <thread-id>
  limit: 50

# Then fetch parent channel for broader context
message:read
  channel: <detected-channel>
  channelId: <parent-channel-id>
  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 Logs (if available)

# Find most recent session files for this agent
SESSION_DIR=$(ls -d ~/.clawdbot-*/agents/*/sessions 2>/dev/null | head -1)
SESSIONS=$(ls -t "$SESSION_DIR"/*.jsonl 2>/dev/null | head -3)

for SESSION in $SESSIONS; do
  echo "=== Session: $SESSION ==="

  # Extract user requests
  jq -r 'select(.message.role == "user") | .message.content[0].text // empty' "$SESSION" | tail -20

  # Extract assistant actions (look for tool calls and responses)
  jq -r 'select(.message.role == "assistant") | .message.content[]? | select(.type == "text") | .text // empty' "$SESSION" | tail -50
done

Step 4: Check Shared Memory

# Extract keywords from channel history (project names, PR numbers, branch names)
# Search memory for relevant entries
grep -ri "<keyword>" ~/clawd-*/memory/ 2>/dev/null | head -10

# Check for recent daily logs
ls -t ~/clawd-*/memory/202*.md 2>/dev/null | head -3 | xargs grep -l "<keyword>" 2>/dev/null

Step 5: Synthesize Context

Compile a structured summary:

## Recovered Context

**Channel:** #<channel-name> (<platform>)
**Time Range:** <oldest-message> to <newest-message>
**Messages Analyzed:** <count>

### Active Project/Task
- **Repository:** <repo-name>
- **Branch:** <branch-name>
- **PR:** #<number> — <title>

### Recent Work Timeline
1. [<timestamp>] <action/request>
2. [<timestamp>] <action/request>
3. [<timestamp>] <action/request>

### Pending/Incomplete Actions
- ⏳ "<quoted incomplete action>"
- ⏳ "<another incomplete item>"

### Key References
| Type | Value |
|------|-------|
| PR | #<number> |
| Branch | <name> |
| Files | <paths> |
| URLs | <links> |

### Last User Request
> "<quoted request that may not have been completed>"

### Confidence Level
- Channel context: <high/medium/low>
- Session logs: <available/partial/unavailable>
- Memory entries: <found/none>

Step 6: Cache Recovered Context

Persist to memory for future reference:

# Write to daily memory file
MEMORY_FILE=~/clawd-*/memory/$(date +%Y-%m-%d).md

cat >> "$MEMORY_FILE" << EOF

## Context Recovery — $(date +%H:%M)

**Channel:** #<channel-name>
**Recovered context for:** <project/task summary>

### Key State
- <bullet points of critical context>

### Pending Items
- <incomplete actions>

EOF

This ensures context survives future compactions.

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 channelId from the incoming message metadata
  • Guild channels have full history access
  • Thread recovery: check for threadId in message metadata
  • DMs may have limited history

Slack

  • Use channel parameter 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:read interface
  • History depth may vary by platform
  • Group vs. DM context may differ

Constraints

  • MANDATORY: Execute this protocol before responding "insufficient data" or asking clarifying questions 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
  • Session log extraction: last 3 session files maximum
  • Memory cache: append to daily file, do not overwrite
  • If recovery fails, state what was attempted and what data sources were unavailable

Auto-Trigger Detection

At session start, scan for compaction indicators:

# Pseudocode for trigger detection
if message contains "<summary>":
    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>Summary unavailable due to context limits...</summary>"
User message: "did this happen?"

Agent executes:

  1. Detects compaction via <summary> tag
  2. message:read channel=discord channelId=1460342116516364533 limit=50
  3. Calculates time span: 2.5 hours — sufficient, no expansion needed
  4. Parses messages, finds last action: "Now let me extract the key orchestration decisions..."
  5. Checks session logs — extracts recent user requests
  6. Writes context summary to memory/YYYY-MM-DD.md
  7. 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) - Nexus sessions: ~/.clawdbot-duke-leto/archive/nexus-sessions/ (96 files) Shall I proceed with the extraction?"

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

36.48%
按下载量换算86

Claude

28.45%
按下载量换算67

Cursor

17.87%
按下载量换算42

Gemini CLI

8.95%
按下载量换算21

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

未通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills