agentleFS
dhruba-dattadhruba-datta/claude-papercuts/skills/unclear/SKILL.md

unclear

Skill0 starsChanged 7 months agoMITView on GitHub

Restore Claude Code conversation context after an accidental /clear. Use this skill when the user types /claude-papercuts:unclear, mentions accidentally clearing the conversation, asks to undo /clear, or wants to recover lost context from a recent session. Reads the most recent automatic snapshot from .papercuts/snapshots/ and reconstructs what was being discussed.

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 4 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    When the user invokes this skill (via /claude-papercuts:unclear or by mentioning a recovery phrase), it reads the most recent snapshot and …

    line 24
  2. Distinctive:

    When invoked, follow these steps exactly.

    line 41
  3. Distinctive:

    Run this in the shell:

    line 45
  4. Distinctive:

    If the output is empty, the Stop hook has not run yet in this project.

    line 51
  5. Very specific:

    Use the Read tool to load the most recent snapshot file (the first line of the ls output).

    line 63
  6. Distinctive:

    After printing the recap, do not take any further action.

    line 123

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

unclear — undo /clear

Fixes: anthropics/claude-code#39975 (open feature request, no fix on roadmap)

What this prevents

"Muscle memory, typo, or misclick. The session is gone. There is no undo, no confirmation prompt, and no way to get back." — issue #39975

How it works

  1. A Stop hook runs at the end of every assistant turn and writes a snapshot of the current conversation transcript to .papercuts/snapshots/<timestamp>.jsonl (project-local, gitignored).
  2. The 5 most recent snapshots are kept; older ones are pruned.
  3. When the user invokes this skill (via /claude-papercuts:unclear or by mentioning a recovery phrase), it reads the most recent snapshot and reconstructs a summary of what was being worked on so work can continue cleanly.

When you (the model) should invoke this skill

Auto-invoke when the user:

  • Runs the /claude-papercuts:unclear slash command
  • Says "I accidentally cleared the conversation"
  • Says "can you remember what we were working on"
  • Says "undo /clear"
  • Asks to recover or restore prior context

Recovery procedure

When invoked, follow these steps exactly.

Step 1 — Locate snapshots

Run this in the shell:

ls -1t .papercuts/snapshots/*.jsonl 2>/dev/null | head -5

If the output is empty, the Stop hook has not run yet in this project. Tell the user:

No snapshots found in .papercuts/snapshots/. The Stop hook writes a snapshot at the end of every assistant turn, so a brand-new session has no recovery point. Future sessions in this project will be recoverable.

Then stop.

Step 2 — Read the newest snapshot

Use the Read tool to load the most recent snapshot file (the first line of the ls output). It's a JSONL file where each line is one JSON object representing a turn in the prior conversation. The schema is roughly:

{"type": "user" | "assistant" | "summary" | "tool_use" | "tool_result",
 "message": {"role": "...", "content": [...]},
 "timestamp": "ISO-8601",
 ...}

Different Claude Code versions may use slightly different schemas. Be permissive — read whatever's there.

Step 3 — Summarize the prior conversation

Extract from the snapshot:

  • What was being worked on — read the first 2-3 user messages and the last assistant message to bracket the topic
  • Files being edited — scan tool_use entries for Edit, Write, Read and collect unique paths
  • Recent decisions — look for lines in assistant messages starting with "Decision:", "Next:", "Blocker:", or explicit conclusions
  • Anything the user explicitly asked you not to do — these are often the most important signals to preserve

Step 4 — Present the recap

Output exactly this format (terminal-friendly, no emoji, no exclamation marks):

─── /unclear: snapshot restored ───
Source: <relative path to snapshot file>
Timestamp: <ISO-8601 from the snapshot filename, decoded>
Turns recovered: <count>

Last topic
  <one-sentence summary>

Files in play
  <path 1>
  <path 2>
  ...

Recent decisions
  • <decision 1>
  • <decision 2>
  • <decision 3>

Picking up from
  "<verbatim final user message, or final assistant turn if no
   pending user turn>"
─────────────────────────────────

Step 5 — Wait

After printing the recap, do not take any further action. Wait for the user to confirm or redirect. They may want to:

  • Resume exactly where they left off (most common)
  • Pick one of the listed decisions to revisit
  • Discard the recap and start fresh

Match the user's intent on the next turn. Do not assume.

Edge cases

  • Multiple snapshots in the same UTC second: pick the alphabetically last one (timestamps are UTC and lexicographically ordered).
  • Snapshot is empty or malformed JSON: try the next-newest. If all recent snapshots are unreadable, tell the user honestly and stop.
  • Snapshot is from a different cwd than the current one: still read it, but flag in the recap: "Note: snapshot was taken from <other path> — context may not match this directory."

Configuration

Optional .papercuts/config.json in the project root:

{
  "unclear": {
    "snapshot_retention": 5,
    "snapshot_dir": ".papercuts/snapshots"
  }
}

Defaults are sensible. Most users never need to touch this.

What this skill does NOT do

  • It does not literally restore Claude's internal conversation history. Claude Code's transcript is internal state. The skill gives a human-readable + Claude-readable recap that lets the conversation continue from a known good point.
  • It does not auto-trigger on /clear. The Stop hook simply snapshots every turn so a snapshot is always available before the next /clear.
  • It does not store anything outside .papercuts/snapshots/ in your project. Add .papercuts/ to .gitignore if not already.

Privacy

The Stop hook writes the transcript to a local file in your project's .papercuts/ directory. No network calls. No telemetry. If you don't want local persistence either, disable the hook in your Claude settings — the slash command will simply report "no snapshots found."

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.