context-recoveryAutomatically recover working context after session compaction or when continuation is implied but context is missing. Works across Discord, Slack, Telegram,...
Install via ClawdBot CLI:
clawdbot install jdrhyne/context-recoveryAutomatically 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.
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, 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:
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: <candidate-session-key>
limit: 80
includeTools: true
If session APIs are unavailable, skip this step and proceed with channel-only evidence.
Only inspect memory if the agent runtime already provides a scoped memory tool/path.
Do not run shell glob scans across home directories.
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>"
### Last User Request
> "<quoted request that may not have been completed>"
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?"
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:
tagmessage:read channel=discord channelId=1460342116516364533 limit=50"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?"
Generated Mar 1, 2026
A development team uses Slack for daily stand-ups and code reviews. When a session compacts due to message limits, the skill recovers the context of ongoing PR discussions, branch names, and incomplete tasks, ensuring seamless continuation of technical conversations without manual context re-entry.
A support agent handles user inquiries in Discord channels. After session truncation, the skill automatically fetches recent message history to recall the user's issue, previous troubleshooting steps, and pending actions, enabling efficient and personalized support without asking the user to repeat details.
A remote project team coordinates tasks via Telegram groups. When context is lost due to compaction, the skill recovers project identifiers, recent updates, and incomplete action items from channel history, helping team members quickly resume work on shared goals without disruption.
A tutor assists students with homework via Signal. If the session compacts, the skill retrieves prior lesson topics, student questions, and unresolved problems from message history, allowing the tutor to provide continuous, context-aware guidance without repeating instructions.
Content creators collaborate on scripts and edits in Discord threads. After context truncation, the skill recovers thread-specific messages and parent channel context to restore details like draft versions, feedback points, and next steps, streamlining the creative workflow.
Offer the skill as part of a premium AI agent package for teams, charging a monthly fee per user or channel. This model targets businesses needing reliable context recovery across platforms like Slack and Discord, with revenue generated from recurring subscriptions based on usage tiers.
Sell annual licenses to large organizations for integration into their internal communication tools. This model focuses on custom deployments with enhanced security and support, generating revenue through upfront licensing fees and ongoing maintenance contracts.
Provide a free basic version with limited message recovery depth, then upsell to premium features like advanced history fetching, multi-platform support, and persistence options. This model attracts individual users and small teams, converting them to paid plans for enhanced functionality.
💬 Integration Tip
Ensure the AI agent has proper API permissions for each platform (e.g., Slack's channels:history scope) and test adaptive depth logic to balance token usage with context recovery effectiveness.
Captures learnings, errors, and corrections to enable continuous improvement. Use when: (1) A command or operation fails unexpectedly, (2) User corrects Clau...
Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.
Search and analyze your own session logs (older/parent conversations) using jq.
Typed knowledge graph for structured agent memory and composable skills. Use when creating/querying entities (Person, Project, Task, Event, Document), linking related objects, enforcing constraints, planning multi-step actions as graph transformations, or when skills need to share state. Trigger on "remember", "what do I know about", "link X to Y", "show dependencies", entity CRUD, or cross-skill data access.
Ultimate AI agent memory system for Cursor, Claude, ChatGPT & Copilot. WAL protocol + vector search + git-notes + cloud backup. Never lose context again. Vibe-coding ready.
Headless browser automation CLI optimized for AI agents with accessibility tree snapshots and ref-based element selection