بنقرة واحدة
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.
// 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.
Generate beautifully designed PDF reports with a Nordic/Scandinavian aesthetic. Use when creating polished executive briefings, analysis reports, or presentation-style PDF outputs from markdown and HTML via Nutrient DWS.
Daily wisdom review applying Charlie Munger's mental models to your work and thinking. Use when asked to review decisions, analyze thinking patterns, detect biases, apply mental models, do a "Munger review", or run the Munger Observer. Triggers on scheduled daily reviews or manual requests like "run munger observer", "review my thinking", "check for blind spots", or "apply mental models".
Query, audit, and optimize Google Ads campaigns. Supports two modes: (1) API mode for bulk operations with the google-ads Python SDK, (2) attached-browser mode for users without API access. Use when asked to check ad performance, pause campaigns or keywords, find wasted spend, audit conversion tracking, or optimize Google Ads accounts.
Bulk download images from login-protected gallery websites using an attached browser session. Use when asked to scrape, download, or save images from authenticated gallery pages, extract full-size images from thumbnails, or batch download from multi-page galleries.
Three-Layer Memory System — automatic fact extraction, entity-based knowledge graph, and weekly synthesis. Manages life/areas/ entities with atomic facts and living summaries.
Captures learnings, errors, and corrections to enable continuous improvement. Use when: (1) A command or operation fails unexpectedly, (2) User corrects Claude ('No, that's wrong...', 'Actually...'), (3) User requests a capability that doesn't exist, (4) An external API or tool fails, (5) Claude realizes its knowledge is outdated or incorrect, (6) A better approach is discovered for a recurring task. Also review learnings before major tasks.
| name | context-recovery |
| description | 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. |
| metadata | {"clawdbot":{"emoji":"🔄"}} |
| permissions | [{"exec":"Reads recent local session logs and memory files when recovery requires them."},{"file_write":"Appends a recovered-context note to the daily memory file for continuity."},{"network":"Reads recent channel history through the configured messaging integration for the active conversation."}] |
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.
<summary> tag (compaction detected)Extract from runtime context:
channel — discord | slack | telegram | signal | etc.channelId — the specific channel/conversation IDthreadId — for threaded conversations (Slack, Discord threads)Initial fetch:
message:read
channel: <detected-channel>
channelId: <detected-channel-id>
limit: 50
Adaptive expansion logic:
newest_timestamp - oldest_timestampbefore parameter if supported)Thread-aware recovery (Slack/Discord):
# If threadId is present, read thread messages first
message:read
channel: <detected-channel>
threadId: <thread-id>
limit: 50
# Then read the parent channel for broader context
message:read
channel: <detected-channel>
channelId: <parent-channel-id>
limit: 30
Parse for:
# 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
# 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
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>
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.
Present the recovered context, then prompt:
"Context recovered. Your last request was [X]. This action [completed/did not complete]. Shall I [continue/retry/clarify]?"
channelId from the incoming message metadatathreadId in message metadatachannel parameter with Slack channel IDthreadId — always check for thread context firstmessage:read interfaceAt 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.
Scenario: Session starts with compaction summary
User message: "<summary>Summary unavailable due to context limits...</summary>"
User message: "did this happen?"
Agent executes:
<summary> tagmessage:read channel=discord channelId=1460342116516364533 limit=50memory/YYYY-MM-DD.md"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?"
[REDACTED].