Borrowing it
Nothing to install: this file belongs to design-and-deliver/claude-code-autoconfig. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/design-and-deliver/claude-code-autoconfig/main/.claude/commands/recover-context.mdgit clone --depth 1 https://github.com/design-and-deliver/claude-code-autoconfigWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/commands/design-and-deliver/claude-code-autoconfig/recover-context)<a href="https://agentmods.dev/commands/design-and-deliver/claude-code-autoconfig/recover-context"><img src="https://agentmods.dev/badge/commands/design-and-deliver/claude-code-autoconfig/recover-context/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/commands/design-and-deliver/claude-code-autoconfig/recover-context"><img src="https://agentmods.dev/badge/commands/design-and-deliver/claude-code-autoconfig/recover-context.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00000 | $0.02156 |
| Opus 5.5 | $0.00000 | $0.00862 |
| Sonnet 5.5 | $0.00000 | $0.00431 |
| Haiku 4.5 | $0.00000 | $0.00216 |
Grade A, and why
recover-context scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 132 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Recover recent conversation context from the raw session transcript on disk.
Usage:
/recover-context— auto: recover the last session in this project (after a /clear or in a fresh terminal), no arguments needed/recover-context -60— last 60 minutes of conversation (any recent session)/recover-context pid=3— recover via a token-saver pointer: the exact stale session and cutoff its idle warning computed/recover-context -60 --show— same as minutes mode, but also opens the transcript in your editor
Three modes:
- Auto mode (no arguments): recovers the session that ran in THIS terminal before the current one. The terminal-title hook maintains a terminal-lineage registry: on every SessionStart (including /clear) it records which session this terminal held, and stamps the outgoing session as the incoming one's predecessor in
.claude/hooks/.titles/{sid}.lineage.json. Auto mode reads its own lineage file (keyed by$CLAUDE_CODE_SESSION_ID), falling back to the newest-other-transcript heuristic when no lineage exists. The cutoff ladder: a matching token-saver pointer (frozen at fire time) → the start of the previous session's final use-case thread per its title history ({sid}.history.jsonl), floored at ~15 min of real interaction and capped at 60 wall-clock minutes → the plain ~15-min walk-back. - Minutes mode: the number means "go back N minutes from now." The leading dash is optional.
- Pointer mode (
pid=N): token-saver's idle-return warning writes a numbered recovery pointer to.claude/hooks/.token-saver/recover.jsonin the project it fired in. The pid encapsulates the stale session's id and the recovery cutoff (frozen at fire time), so this mode recovers the right window no matter how long ago the warning fired — even if other sessions happened in between (which would fool auto mode).
Step 1: Parse the arguments
The arguments are: $ARGUMENTS
- Empty (no arguments beyond flags) → auto mode, no mode flag.
- Matches
pid=N(also acceptpid Nor--pid N) → pointer mode, pass--pid N. - Otherwise strip the leading
-from the number → minutes mode, pass--minutes N. - Note whether
--showis present (any mode).
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 1mo ago Changed 7d55aad99fc9
- 2mo ago First seen · 132 lines · 0 tokens per session scan A 8b91c6404797
recover-context is a command published in the GitHub repository design-and-deliver/claude-code-autoconfig (2 stars, last pushed 10d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,156 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other commands, from other repositories
context-stats
Display context window usage and token statistics.
sync
Session bootstrap - read project context, restore saved state, show status. Quick orientation with optional deep dive.
handoff
Write a session handoff document for continuity.
forge-compact-task
Compact context with dotforge-standardized hint that preserves decisions, files modified, pending TODOs, behaviors disabled, and last commit. Use at 80% context window instead of waiting for auto-compact.
checkpoint
Write a new link in the continuum chain summarizing decisions/changes since the last link.
dream
Roll up the last N links into a single phase-digest link; originals move to archived/ (never deleted).