Agent skill

Context Recovery

by aAAaqwq in aAAaqwq/AGI-Super-Team

Automatically recover working context after session compaction or when continuation is implied but context is missing.

MITAuto-check passed

Install Context Recovery

skills CLI
$ npx skills add aAAaqwq/AGI-Super-Team --skill context-recovery -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install aAAaqwq/AGI-Super-Team context-recovery --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/aAAaqwq/AGI-Super-Team.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/context-recovery .claude/skills/context-recovery && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
context-recovery
GitHub stars
105
Used in
1 other repo
Token cost
~2k tokens
SKILL.md length
601 words
Files
3
Skills in repo
167
Repo updated
First seen
Licence
MIT

At a glance

Automatically recover working context after session compaction or when continuation is implied but context is missing.

  • Works in 7 steps: Detect Active Channel → Fetch Channel History (Adaptive Depth) → Fetch Session Logs (if available) → …
  • SKILL.md covers Triggers, Execution Protocol, Channel-Specific Notes and Constraints, plus 2 more sections
  • Calls jq

What it does

Context Recovery is an agent skill from aAAaqwq/AGI-Super-Team. 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.

Its SKILL.md is about 2k tokens, which your agent loads only when the skill is triggered. The skill folder holds 3 other files (for example `.clawhub/origin.json` and `_meta.json`).

It works with Discord, Telegram and Slack. The repository describes itself as: An installable, cross-framework AI organization: C-suite agents, expert subagents, curated skills, independent review, and one-command setup across 18 AI client/runtime adapters. The licence is MIT.

Example prompts

  • “/context-recovery”

Requirements

  • Python 3

Workflow steps

7 steps, taken from the step headings in SKILL.md.

  1. Detect Active Channel
  2. Fetch Channel History (Adaptive Depth)
  3. Fetch Session Logs (if available)
  4. Check Shared Memory
  5. Synthesize Context
  6. Cache Recovered Context
  7. Respond with Context

What it can do on your machine

Read from SKILL.md and the folder at commit 331ecd3. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • jq

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Context Recovery loads about 2k tokens when it runs. Until then it costs about 53 tokens; SKILL.md has 601 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~53
When it runs · the whole SKILL.md, loaded when a task matches
~2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from aAAaqwq/AGI-Super-Team at commit 331ecd3, republished under its MIT licence (© aAAaqwq). 601 words, ~1,999 tokens.

Download SKILL.mdSave it as .claude/skills/context-recovery/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
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.
author
Daniel Li

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
  4. 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)
bash
# 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
bash
# 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:

markdown
## 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:

bash
# 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
Show full SKILL.md (226 more words)Show less
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:

python
# 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?"

© aAAaqwq, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 2 other files in skills/context-recovery of aAAaqwq/AGI-Super-Team.

  • SKILL.md
  • .clawhub/origin.json
  • _meta.json

Open the folder on GitHubat commit 331ecd3

Used in 1 other repository

We found 2 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 1 other GitHub owner. This page covers the copy in aAAaqwq/AGI-Super-Team, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Context Recovery next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Context Recovery compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Context Recovery this skillaAAaqwq/AGI-Super-Team1051 repos~2kAutomated safety check: PassMIT
n8n Binary Data Handlingczlonkowski/n8n-skills6.4k—~3.9kAutomated safety check: PassMIT
OpenClaw to NanoClaw Migrationnanocoai/nanoclaw31k—~6kAutomated safety check: NotesMIT
Chat SDKdatabuddy-analytics/Databuddy1.2k—~2.6kAutomated safety check: PassAGPL-3.0
Traul Message Searchdandaka/traul113—~3.9kAutomated safety check: NotesAGPL-3.0
Add Channel Connect Buttonnovuhq/novu40k—~1.6kAutomated safety check: PassCustom licence

Similar skills

  • n8n Binary Data Handling

    czlonkowski/n8n-skills

    Explains how n8n keeps file bytes in $binary apart from structured $json data, and how to read, write and preserve binary across nodes, agent tools and chat.

    6.4k GitHub stars~3.9k tokensUpdated 23 days ago
    Productivity & AutomationAuto-check passed
  • Guides a conversational migration from an OpenClaw install to NanoClaw v2, carrying over identity, channel credentials, scheduled tasks and workspace files.

    31k GitHub stars~6k tokensUpdated 2 days ago
    Productivity & AutomationAuto-check: notes
  • Chat SDK

    databuddy-analytics/Databuddy

    Build multi-platform chat bots with Chat SDK (chat npm package).

    1.2k GitHub stars~2.6k tokensUpdated today
    Agent WorkflowsAuto-check passed
  • Drives the traul CLI to sync, search and monitor messages from Slack, Telegram, Discord, Linear, Gmail, WhatsApp, Claude Code sessions and Markdown files.

    113 GitHub stars~3.9k tokensUpdated 5 mo ago
    Productivity & AutomationAuto-check: notes
  • Build a new channel Connect button (e.g. An agent skill from novuhq/novu.

    40k GitHub stars~1.6k tokensUpdated today
    Backend & APIsAuto-check passed
  • Lettabot

    letta-ai/lettabot

    Set up and run LettaBot - a multi-channel AI assistant for Telegram, Slack, Discord, WhatsApp, and Signal.

    327 GitHub stars~3.4k tokensUpdated 4 mo ago
    Productivity & AutomationAuto-check passed

More from aAAaqwq/AGI-Super-Team

All 167 skills in this repo
  • Content Creator

    aAAaqwq/AGI-Super-Team

    Create SEO-optimized marketing content with consistent brand voice.

    105 GitHub starsUsed in 3 repos~1.9k tokens
    Auto-check passed
  • Financial Calculator

    aAAaqwq/AGI-Super-Team

    Advanced financial calculator with future value tables, present value, discount calculations, markup pricing, and compound interest.

    105 GitHub starsUsed in 1 repo~1.5k tokens
    Auto-check passed
  • Bankr Signals

    aAAaqwq/AGI-Super-Team

    Transaction-verified trading signals on Base blockchain. An agent skill from aAAaqwq/AGI-Super-Team.

    105 GitHub starsUsed in 2 repos~3.3k tokens
    Auto-check passed
  • Erc 8004

    aAAaqwq/AGI-Super-Team

    Register AI agents on Ethereum mainnet using ERC-8004 (Trustless Agents).

    105 GitHub starsUsed in 2 repos~1.2k tokens
    Auto-check passed
  • Frontend Design Ultimate

    aAAaqwq/AGI-Super-Team

    Create distinctive, production-grade static sites with React, Tailwind CSS, and shadcn/ui — no mockups needed.

    105 GitHub starsUsed in 2 repos~2.7k tokens
    Auto-check passed
  • Zsxq Smart Publish

    aAAaqwq/AGI-Super-Team

    Publish and manage content on 知识星球 (zsxq.com). An agent skill from aAAaqwq/AGI-Super-Team.

    105 GitHub stars~1.5k tokensUpdated today
    Auto-check passed

Questions about Context Recovery

What does Context Recovery do?

Automatically recover working context after session compaction or when continuation is implied but context is missing. Context Recovery is an agent skill from aAAaqwq/AGI-Super-Team. Automatically recover working context after session compaction or when continuation is implied but context is missing.

How do I install Context Recovery in Claude Code?

Run `npx skills add aAAaqwq/AGI-Super-Team --skill context-recovery -a claude-code`. Or copy the skill folder (skills/context-recovery in aAAaqwq/AGI-Super-Team) into .claude/skills/context-recovery in your project. Claude Code loads it when a task matches its description.

How do I install Context Recovery in Codex?

Run `npx skills add aAAaqwq/AGI-Super-Team --skill context-recovery -a codex`. Or copy the skill folder (skills/context-recovery in aAAaqwq/AGI-Super-Team) into .agents/skills/context-recovery in your project. Codex loads it when a task matches its description.

Can I use Context Recovery in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add aAAaqwq/AGI-Super-Team --skill context-recovery -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/context-recovery, .gemini/skills/context-recovery, .github/skills/context-recovery and .opencode/skills/context-recovery in your project.

What does Context Recovery need to run?

Going by SKILL.md and its folder, Context Recovery needs the command-line tools its instructions call (jq). Our summary lists: Python 3.

Does Context Recovery access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Context Recovery safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Context Recovery use?

Context Recovery is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Context Recovery use?

About 2k tokens (SKILL.md is roughly 8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Context Recovery?

Skills that share tags, products or a category with Context Recovery: n8n Binary Data Handling (czlonkowski/n8n-skills, 6.4k stars), OpenClaw to NanoClaw Migration (nanocoai/nanoclaw, 31k stars), Chat SDK (databuddy-analytics/Databuddy, 1.2k stars) and Traul Message Search (dandaka/traul, 113 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Context Recovery?

aAAaqwq (a GitHub user) maintains it in aAAaqwq/AGI-Super-Team, which has 105 GitHub stars. The repository holds 167 skills in this directory. The repository was last updated on October 8, 2026.

Source: aAAaqwq/AGI-Super-Team on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.