claude-code-autoconfig: Command for Claude Code

.claude/commands/recover-context.md

recover-context is a command for Claude Code from design-and-deliver/claude-code-autoconfig. It costs 0 tokens per session (2,156 once invoked), scanned A, original, MIT.

A command that restores recent conversation context from an agent session transcript saved on disk. A transcript is the recorded text of an earlier session.

In plain words
What is it for?
Use it to recover the previous session automatically, retrieve a chosen time window, or locate a session by its process pointer.
Why use it?
It helps continue work after clearing the conversation or opening a fresh terminal without manually reconstructing the discussion.

Command for Claude Code

Written for Claude Code: $ARGUMENTS substitution. Also seen: reads .claude/ paths.

This is design-and-deliver/claude-code-autoconfig's own configuration. It tells Claude Code how to work on claude-code-autoconfig itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything claude-code-autoconfig configures →

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is python3 .claude/scripts/recover-session.py --no-plan-probe <MODE> 2>/dev/null \.

Reuse

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.

Copy the file
curl -O https://raw.githubusercontent.com/design-and-deliver/claude-code-autoconfig/main/.claude/commands/recover-context.md
Clone the repo
git clone --depth 1 https://github.com/design-and-deliver/claude-code-autoconfig

Made for: Claude Code.

Wrote 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.

agentmods badge for recover-context

README.md
[![agentmods](https://agentmods.dev/badge/commands/design-and-deliver/claude-code-autoconfig/recover-context/github.svg)](https://agentmods.dev/commands/design-and-deliver/claude-code-autoconfig/recover-context)
Your own site
<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.

agentmods 80×15 button for recover-context

Your own site · 80×15
<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>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,156 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.02156
Opus 5 $0.00000 $0.01078
Sonnet 5 $0.00000 $0.00431
Haiku 4.5 $0.00000 $0.00216

Measured 8d ago against content hash 8b91c6404797, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

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 8d 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.

.claude/commands/recover-context.md · 132 lines

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-guard 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-guard 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-guard's idle-return warning writes a numbered recovery pointer to .claude/hooks/.token-guard/recover.json in 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 accept pid N or --pid N) → pointer mode, pass --pid N.
  • Otherwise strip the leading - from the number → minutes mode, pass --minutes N.
  • Note whether --show is present (any mode).

Read the full file on GitHub · 132 lines

Changes

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.

  1. 8d ago First seen · 132 lines · 0 tokens per session scan A 8b91c6404797

Subscribe to this mod's changes

recover-context is a command published in the GitHub repository design-and-deliver/claude-code-autoconfig (2 stars, last pushed 5d 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.