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 agentmods add skills/aspenkit/aspens/save-tokensnpx skills add aspenkit/aspens --skill save-tokensgit 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.svg" alt="Measured on agentmods" 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.00030 | $0.01540 |
| Opus 5 | $0.00015 | $0.00770 |
| Sonnet 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 6d 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.
- 6d ago First seen · 64 lines · 30 tokens per session scan A 8513d16ba19b
save-tokens is a skill published in the GitHub repository aspenkit/aspens (99 stars, last pushed 20d ago), licensed MIT. It adds 30 tokens to every session and 1,540 once invoked, about $0.0002 per session on Opus 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
plan-a-feature-to-confluence
Builds a feature specification from scratch with plan-a-feature and publishes it to a user-specified Confluence location, posting the spec as a parent page and each companion artifact (decision log, team findings, technical notes) as a child page beneath it. Use when the user wants a new feature planned, designed…
sw-handoff
Write a portable, secret-scrubbed handoff doc plus a diff of your uncommitted edits so another tool or machine resumes where you stopped. Use for "handoff", "out of tokens", "switch to Codex".
handoff
Write a portable, secret-scrubbed handoff doc so this work can continue in any AI tool or on any machine. Use when saying "handoff", "running out of tokens", or "continue elsewhere".
work-items-to-jira
Break a work-items.md file (produced by /plan-work-items) into independently-grabbable Jira tickets, one per slice, in a single Jira project. Use when you want to turn a work-items file into Jira tickets, publish work items as Jira issues, or create implementation tickets that can be worked on and tracked in Jira.…
spike-consumer-baseline
OI-3 spike harness — heavy consumer skill, BASELINE arm. Builds an incident post-mortem and sources the readability standard mid-workflow by reading a file directly, with NO Skill-tool call. Use only when explicitly invoked by the spike harness with a TRIALID and data path.
spike-consumer-adversarial
OI-3 spike harness — heavy consumer, ADVERSARIAL arm. Worst-case early-exit test: the mid-workflow Skill call has no continuation guardrail and the guidance skill ends with a final-sounding anchor. Use only when explicitly invoked by the spike harness with a TRIALID and data path.