Borrowing it
Nothing to install: this file belongs to aspenkit/aspens. 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/aspenkit/aspens/main/.agents/skills/save-tokens/SKILL.mdgit clone --depth 1 https://github.com/aspenkit/aspensWrote 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/aspenkit/aspens/save-tokens)<a href="https://agentmods.dev/skills/aspenkit/aspens/save-tokens"><img src="https://agentmods.dev/badge/skills/aspenkit/aspens/save-tokens/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/aspenkit/aspens/save-tokens"><img src="https://agentmods.dev/badge/skills/aspenkit/aspens/save-tokens.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- NVIDIA SkillSpector pass
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.00030 | $0.01540 |
| Opus 5.5 | $0.00012 | $0.00616 |
| Sonnet 5.5 | $0.00006 | $0.00308 |
| Haiku 4.5 | $0.00003 | $0.00154 |
Grade A, and why
save-tokens 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 — 64 lines — stays where its author put it; the contents beside it link to each section on GitHub.
You are working on save-tokens — the feature that installs Claude Code hooks and commands to warn about token usage, auto-save handoffs before compaction, and support session rotation.
Domain purpose
aspens save-tokens installs three Claude Code hooks (statusline, prompt-guard, precompact) plus /save-handoff, /resume-handoff-latest, and /resume-handoff slash commands. The hooks observe Claude's own token telemetry and inject system messages telling Claude to rotate sessions before context blow-up. Handoff files persist enough state in .aspens/sessions/ to resume seamlessly in a fresh session.
Business rules / invariants
- Claude-only feature. Hooks and statusline only work with Claude Code; Codex has no save-tokens integration. Config lives in
.aspens.jsonundersaveTokens. - Config thresholds default 175k warn / 200k compact.
Number.MAX_SAFE_INTEGERis the disabled sentinel for either threshold;target.js#isValidSaveTokensConfig()validates shape, types, and threshold ordering — invalid config causesreadConfig()to returnnull. writeConfigpreserves feature config —saveTokensis preserved acrosswriteConfigcalls unless explicitly set tonull.- Sessions dir gitignored —
.aspens/sessions/.gitignoreexcludes everything except.gitignoreandREADME.md. - Settings backup — first install creates
.claude/settings.json.bakif settings exist and no backup exists yet. - StatusLine pre-existence guard —
canInstallSaveTokensStatusLine()refuses to overwrite an unrelated customstatusLine.command; when refused,applyStatusLineAvailability()forces both thresholds toMAX_SAFE_INTEGERand disablessessionRotation.
Non-obvious behaviors
- Three hook entry points dispatched by subcommand. Shell wrappers (
*.sh) read stdin, resolve project dir, and callsave-tokens.mjswithstatusline,prompt-guard, orprecompact.ASPENS_PROJECT_DIRenv var overridesCLAUDE_PROJECT_DIR; both fall back tocwd. - Statusline doubles as telemetry recorder.
recordClaudeContextTelemetry()writes.aspens/sessions/claude-context.jsonsumminginput_tokens + cache_creation_input_tokens + cache_read_input_tokens + output_tokensfromcontext_window.current_usage. Telemetry older than 5 minutes is ignored by the prompt guard. - Prompt-guard speaks to Claude, not the user. Above
compactAtTokens: saves a handoff (reasonrotation-thresholdifsessionRotation, elsecompact-threshold) and stdout-prints an "IMPORTANT — you must tell the user" block instructing fresh session +/resume-handoff-latest. AbovewarnAtTokens: suggests/save-handoff. When telemetry is missing, prints a one-time link to the aspens issues page. - Precompact hook only fires when
saveHandoffis enabled andclaude.enabled !== false; reason isprecompact. extractSessionFacts()parses the JSONL transcript to extractoriginalTask(first user message, 500 char cap),recentPrompts(last 3, 200 char cap each),filesModified(Edit/Write tool_usefile_path),gitCommits(regex on Bashgit commit -m "..."), andbranch(fromgitBranchon user records). Transcript path is validated to be insideprojectDir; falls back toinput.promptwhen transcript is missing or outside the project.- Transcript parsing is best-effort — all errors caught, invalid JSON lines silently skipped; returns empty facts on failure.
pruneOldHandoffs()keeps newest 10*-handoff.mdfiles by lexicographic (timestamp) sort; older are unlinked.latestHandoff()uses the same sort.--recommendedinstall is non-interactive — used standalone or invoked bydoc init --recommended(which also installs agents and the doc-sync git hook).--removecleans legacy artifacts too — removes both.shand historic.mjsvariants of each hook, plus the legacysave-tokens-resume.mdcommand; stripsstatusLineif it points at save-tokens and filters any hook entry whose command containssave-tokens-; nullssaveTokensin.aspens.json.
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 First seen · 64 lines · 30 tokens per session scan A 8513d16ba19b
save-tokens is a skill published in the GitHub repository aspenkit/aspens (103 stars, last pushed 1mo ago), licensed MIT. It adds 30 tokens to every session and 1,540 once invoked, about $0.0001 per session on Opus 5.5. 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-30.
Other skills, from other repositories
handoff
Hand work to another tool, account or machine and pick it up there, in two words. Use when the user says "hand off", "hand off all", "out of tokens", "switching accounts", "pick up" or "continue".
sw-handoff
Hand work to another tool, account or machine and pick it up there, in two words. Use when the user says "hand off", "hand off all", "out of tokens", "switching accounts", "pick up" or "continue".
gws-gmail-send
Skill "gws-gmail-send" from googleworkspace/cli, covering gmail +send, usage, flags, examples and tips.
gws-gmail-watch
Gmail: Watch for new emails and stream them as NDJSON.
gws-gmail
Gmail: Send, read, and manage email.
obsidian-bases
Create and edit Obsidian Bases (.base files) with views, filters, formulas, and summaries. Use when working with .base files, creating database-like views of notes, or when the user mentions Bases, table views, card views, filters, or formulas in Obsidian.