Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add eranw2000/claude-maintenance-skills --skill salvage-session-archivesgit clone --depth 1 https://github.com/eranw2000/claude-maintenance-skillsWrote 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/skills/eranw2000/claude-maintenance-skills/salvage-session-archives)<a href="https://agentmods.dev/skills/eranw2000/claude-maintenance-skills/salvage-session-archives"><img src="https://agentmods.dev/badge/skills/eranw2000/claude-maintenance-skills/salvage-session-archives/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/skills/eranw2000/claude-maintenance-skills/salvage-session-archives"><img src="https://agentmods.dev/badge/skills/eranw2000/claude-maintenance-skills/salvage-session-archives.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.00097 | $0.02094 |
| Opus 5 | $0.00048 | $0.01047 |
| Sonnet 5 | $0.00019 | $0.00419 |
| Haiku 4.5 | $0.00010 | $0.00209 |
Grade D, and why
salvage-session-archives scanned grade D with 2 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 12d 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.
Asks the agent to reveal its instructionsmediumSystem prompt leakage
Directions to print, repeat or translate the system prompt extract configuration the operator did not intend to expose.
- Output instructions: append (via Edit with a unique anchor at end of file, NOT Write) a section titled exactly `## Salvaged from session archives`. Organize by topic, not by session. Tight bullets. Plain language: no e Recursive force deletehighDestructive command
rm -rf with a variable or a broad path is one typo away from removing the wrong tree.
Ask the user to confirm before deleting. On confirmation, `rm -rf` each leftover folder identified in step 2. After deletion, run a quick `find` to confirm only the canonical project folder remains. Never delete the cano How it starts
The opening of the file, as written. The whole thing — 125 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Salvage session archives for a project
Goal: recover any durable knowledge that lives in old session .jsonl transcripts but never made it into the project's CLAUDE.md, then clean up.
The Claude Code harness writes transcripts into auto-named "leftover folders" with dashed paths (e.g. ~/.claude/projects/-Users-<username>--claude-projects-<ProjectName>/). Sessions that ended cleanly already distilled their content via an end-of-session save, but premature exits, subagent runs, and quietly-discovered gotchas often leave salvageable material behind.
When to run
- User asks to salvage / collect / extract / mine session archives or leftover folders.
- End-of-quarter cleanup pass across multiple projects.
Steps
1. Identify the project from the current working directory
Do NOT ask the user which project to work on. Derive <project_name> from the current working directory (pwd). Handle these cases:
pwdis~/.claude/projects/<ProjectName>/→ use<ProjectName>directly. This is the canonical project directory.pwdis the project's source repo (anywhere on disk) or a subdir of it → use the repo directory's basename as<ProjectName>. The canonical project directory is~/.claude/projects/<ProjectName>/.pwdis a dash-prefixed leftover folder like~/.claude/projects/-Users-<username>--claude-projects-<ProjectName>/→ use<ProjectName>(the trailing segment after the last-).pwdis~/.claudeitself or any other location that doesn't clearly map to a project → only in this case, list~/.claude/projects/and ask the user which project to target (show the 3-4 most recently-touched vials -lt).
State the inferred project name in one sentence before continuing, so the user can redirect if needed. Then proceed without waiting for confirmation.
2. Find every leftover folder for that project
Run find ~/.claude -maxdepth 3 -type d -iname "*<project_name>*" and inspect the results. Real leftover folders are the dash-prefixed ones (Claude Code encodes each session's working-directory path into the folder name, replacing every / with -, so a -Users-<username>-... prefix is just your $HOME dash-encoded). For example:
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.
- 12d ago First seen · 125 lines · 97 tokens per session scan D ba60003a68d8
salvage-session-archives is a skill published in the GitHub repository eranw2000/claude-maintenance-skills (5 stars, last pushed 14d ago), licensed MIT. It adds 97 tokens to every session and 2,094 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it D with 2 findings (asks the agent to reveal its instructions, recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
agents-md-improver
Audit and improve project-rules files (AGENTS.md, CLAUDE.md, .agents/instructions, local overrides) so the agent keeps accurate project context. Use when the user asks to check, audit, review, update, improve, or fix their AGENTS.md or CLAUDE.md, mentions "project rules maintenance" or "agent context optimization", or…
self-improve
Extract lessons from the current session, or sweep the project's past sessions when asked, and route them to the appropriate knowledge layer (project AGENTS.md, auto memory, existing skills, or new skills). Use when the user asks to "self-improve", "distill this session", "distill past sessions", "sweep past…
agents-md-revise
Capture learnings from the current session into the project-rules file (AGENTS.md, CLAUDE.md, or local override) so future sessions benefit. Use when the user says "revise the rules", "update AGENTS.md / CLAUDE.md with what we just learned", "save this to project memory", "remember this for next time", or at the end…
report
Writes the session final report to a file, then prints only the path and a one-line summary. Fires when the prompt contains "Report per memstack:report", and also when the prompt begins with a standing trigger configured through MEMSTACKREPORTONTASKPROMPTS or MEMSTACKREPORTTRIGGERS. Dormant otherwise.
token-optimization
Use when the user says 'token optimization', 'save tokens', 'context window', 'reduce tokens', 'token stack', or 'TokenStack', or asks about extending context window capacity. Covers TokenStack, the built-in compression proxy that shrinks Claude Code tool output before it reaches the Anthropic API. Do NOT use for…
compress
Use when the user says 'tokenstack', 'compression', 'token savings', 'proxy status', or asks about context window usage.