home / skills / pchalasani / claude-code-tools / recover-context
This skill extracts the most recent task context from the parent session lineage using sub-agents to avoid context bloating.
npx playbooks add skill pchalasani/claude-code-tools --skill recover-contextReview the files below or copy the command above to add this skill to your agents.
---
name: recover-context
description: Extract full context of the last task from the most recent parent session
shown in the session lineage. Strategically uses sub-agents to avoid bloating your
own context.
---
# recover-context
Use this skill to extract context from a parent session when a session lineage is
present (shown in the first user message of this conversation).
## Instructions
1. **Identify the most recent parent session** from the lineage chain (the last
file in the chronological list).
2. **Use sub-agents to explore** (to avoid bloating your own context):
- If you have the Task tool with subagent support, use the `session-searcher`
subagent (subagent_type: `session-searcher`) to analyze the most recent session
- If sub-agents are NOT available, use the `aichat:session-search` skill instead
3. **Extract the following from the most recent session:**
- What was the last task being worked on?
- What was the current state of that task (completed, in-progress, blocked)?
- Any pending items or next steps mentioned?
- Key decisions made or approaches chosen
4. **Also check for associated documents:**
- Issue specs or task descriptions referenced in the session
- Any markdown files created during that session (check WORKLOG/, issues/, etc.)
- Code files that were being modified
5. **Report back concisely:**
- State your understanding of the task context
- List any files you found that are relevant
- Ask the user how they'd like to proceed
## Example Sub-agent Prompt
If using the Task tool with `session-searcher` subagent:
```
Analyze the session file at [path from lineage] and extract:
1. The last task being worked on (look at the final 20-30 messages)
2. Current state of that task
3. Any referenced markdown files (issue specs, work logs, etc.)
4. Pending next steps or blockers
Return a concise summary.
```
## Constraints
- Do NOT read large session files directly into your own context
- ALWAYS delegate to sub-agents or the session-search skill
- Keep your summary concise - the user knows what they were working on
- Focus on the LAST task, not the entire session history
This skill extracts the full context of the last task from the most recent parent session shown in a session lineage. It delegates heavy inspection to sub-agents or a session-search skill to avoid inflating the active agent's context. The output is a concise summary of the last task, its state, relevant files, and suggested next steps.
The skill finds the most recent parent session in the provided lineage and delegates analysis to a session-searcher sub-agent (or the aichat:session-search skill if sub-agents are unavailable). The sub-agent scans the final messages and referenced artifacts, then returns a compact extraction: the last task, its status, any blockers or next steps, and a list of associated files. The skill formats that extraction and asks the user how they want to proceed.
What if sub-agents are not available?
The skill falls back to the aichat:session-search skill to analyze the most recent session and extract the same set of details.
Will the skill load entire session files into the current context?
No. It delegates inspection to sub-agents or the session-search skill to avoid bloating the active agent’s context.
What should I do after receiving the summary?
Choose a clear next action: continue the task, address blockers, inspect listed files, or close the task. The skill will proceed based on your instruction.