Skip to content
Back to skills

Kmp Token Saver

FSecurity

Token-saving workflow for KMP agent work across all assistant runtimes (Claude Code, Antigravity, Gemini CLI, Cursor, Windsurf, Codex). Use when the user asks to reduce token usage, shorten replies, compress noisy tool output, or choose the smallest correct solution. Covers Ponytail for YAGNI and overengineering checks, Caveman for terse replies, RTK for shell output compression, and universal AGENTS.md guardrails for environments without Claude plugin runtimes. Headroom stays optional until ...

  • 2 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 2, 2026
ai-agentsgokotlinshellbashnoderailstestinggitapibackend

Works with

  • claude code
  • cursor
  • terminal
  • cli
  • api

Security analysis

F0/100
  • criticalPipes output to a shell interpreter
  • criticalModifies startup scripts or system services for persistence
  • criticalDownloads and executes remote scripts — classic supply chain attack
  • criticalDownloads and executes remote scripts — classic supply chain attack
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro scans all 6 files and shows the line behind each finding

Scanned September 20, 2026

npx -y skills add ronjunevaldoz/kmp-agent-skills --skill kmp-token-saver --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Kmp Token Saver?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Kmp Token Saver
[![Security: F — Skills Directory](https://www.skillsdirectory.com/api/skills/ronjunevaldoz-kmp-token-saver/badge)](https://www.skillsdirectory.com/skills/ronjunevaldoz-kmp-token-saver)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: kmp-token-saver
description: >
  Token-saving workflow for KMP agent work across all assistant runtimes (Claude Code,
  Antigravity, Gemini CLI, Cursor, Windsurf, Codex). Use when the user asks to reduce token
  usage, shorten replies, compress noisy tool output, or choose the smallest correct
  solution. Covers Ponytail for YAGNI and overengineering checks, Caveman for terse
  replies, RTK for shell output compression, and universal AGENTS.md guardrails for
  environments without Claude plugin runtimes. Headroom stays optional until setup
  exists; do not block the task on it.
license: Apache-2.0
metadata:
  author: kmp-agent-skills
  last-updated: '2026-07-13'
  keywords:
    - token saver
    - prompt compression
    - context compression
    - terse replies
    - overengineering
    - caveman
    - ponytail
    - headroom
    - rtk
---

# Kotlin Multiplatform Token Saver

## When to Use This Skill

Use this skill when the request is about:
- token or context reduction
- shorter replies or less ceremony
- compressing verbose command output
- choosing the smallest correct implementation
- deciding whether a setup-heavy compressor is worth enabling yet

**Trigger keywords:** token saver, token reduction, prompt compression, context compression,
too much output, terse, caveman, ponytail, headroom, rtk, smallest correct solution, YAGNI.

## Recommendation First

These four are not equally available by default — verified against each tool's real
install method, not assumed:

1. **RTK** — real risk profile: low. Installs via `brew install rtk` (an official
   Homebrew bottle). Once installed and its hook wired, it runs automatically; nothing
   further to enable per-session.
2. **Ponytail** — real risk profile: low. Installs through Claude Code's own plugin
   marketplace (`/plugin marketplace add DietrichGebert/ponytail`, then
   `/plugin install ponytail@ponytail`) — these are slash commands the *user* runs
   interactively; an agent cannot invoke them on the user's behalf.
3. **Caveman** — real risk profile: elevated. Its documented install is
   `curl -fsSL .../install.sh | bash` (or the PowerShell equivalent) — executing a
   remote script directly from a personal GitHub account, with no package-manager
   verification step. Do not run this yourself; if the user wants it, they run the
   installer themselves after reviewing it.
4. **Headroom** — real risk profile: heaviest setup, not risk per se. It's a local
   proxy server (`headroom proxy --port 8787`) sitting between the agent and the LLM
   provider, requires a model backend (a real provider API key, or a local model like
   Ollama), and downloads a model from HuggingFace on first run. Package install and
   proxy start are not enough by themselves — Claude Code's own traffic only routes
   through it once `~/.claude/settings.json` has an `env` block pointing
   `ANTHROPIC_BASE_URL` at the proxy, a global settings change in the same class as
   RTK's hook wiring: the user edits it themselves. Never enter API keys into it on the
   user's behalf — that's a hard rule regardless of tool. Keep this optional until the
   user has set it up themselves; do not block a task on it.

RTK itself has two install phases with different authorization needs — the binary
install (`brew install rtk`) is safe to run directly, but the hook wiring
(`rtk init -g`, which patches global `settings.json`/`CLAUDE.md`) needs specific
confirmation of the exact diff, not a repeat of an earlier general go-ahead. See
`references/token-saving-tools.md` for the verified details — this was hit in
practice, not a hypothetical.

## Cross-Assistant Compatibility Matrix

Token saving strategies depend on the active assistant runtime:

| Assistant Runtime | Prompt / Terse Density | Anti-Overengineering (YAGNI) | Command Output Compression | Context Window Compression |
|---|---|---|---|---|
| **Claude Code** | Caveman plugin (`/caveman [level]`) | Ponytail plugin (`ponytail@ponytail`) | RTK via `PreToolUse` hook (`~/.claude/settings.json`) | Native compaction + Headroom proxy |
| **Google Antigravity & Gemini CLI** | Workspace `AGENTS.md` guardrail | Workspace `AGENTS.md` guardrail | Manual prefix `rtk run -- <cmd>` or shell alias in `~/.zshrc` | Native transcript checkpoints (`transcript.jsonl`) |
| **Cursor / Windsurf / Codex** | `.cursorrules` / `AGENTS.md` | `AGENTS.md` guardrail | Shell wrapper / terminal alias | Context window truncation |

### Antigravity & Gemini Runtime Notes

Antigravity executes terminal operations through a sandboxed execution runtime (`run_command`), completely bypassing `~/.claude/settings.json`, Claude plugins, and Claude slash commands.
To achieve equivalent token efficiency in Antigravity:
1. **Terse Density & YAGNI**: Rely on universal `AGENTS.md` operational guardrails (`Token saver / terse response density` and `Smallest correct solution`).
2. **Command Output Compression**: Use `rtk run -- <cmd>` explicitly for verbose test or build commands (e.g. `rtk run -- ./gradlew desktopTest`), or add shell aliases to `~/.zshrc`.
3. **Context Management**: Antigravity natively truncates and creates checkpoint summaries (`transcript.jsonl`) once session tokens approach the window limit.

## Tool Choice

Pick the narrowest tool that solves the problem — and check what's actually installed
before recommending one, rather than assuming all four are equally available:

- **Ponytail**: review/planning guardrail for "do we need this at all?" and
  "what is the smallest correct thing?" — real Claude Code plugin. Check
  `claude plugin list` first: `scope: project` + `enabled: false` means it's only
  active in one specific project, not "any project." Install (or re-install) at user
  scope with `claude plugin install ponytail@ponytail` (default scope is `user`) — a
  real, non-interactive CLI equivalent of `/plugin install`, wrapped idempotently in
  `scripts/install-ponytail.sh`. Still the user's call to run, not an agent's to run
  unprompted — it's a persistent, global config change.
- **Caveman**: make the model speak tersely without losing accuracy — real tool, but
  installs via `curl | bash` from an unverified source; recommend it, don't install it.
  Registers as a Claude Code plugin once installed — check
  `~/.claude/plugins/installed_plugins.json` for `caveman@caveman` rather than
  `which caveman` (it has no standalone CLI). Not active by default even when
  installed — needs `/caveman [level]` per session or `/caveman-init` for a
  persistent per-repo rule, both user-run. **Deliberately has no `install-*.sh`
  script**, unlike the other three tools — its install is `curl | bash` from an
  unverified personal account, so the point is that the user reviews and runs it
  themselves; wrapping it in a script would undercut that.
- **RTK**: compress command output before it reaches the model — the one most likely to
  already be installed; check with `rtk --version` before assuming it needs setup.
  `scripts/install-rtk.sh` handles Phase 1 only (`brew install rtk`, safe to run
  directly) and then runs `rtk init -g --dry-run` to preview the Phase 2 hook-wiring
  diff — it never applies Phase 2 itself; the user runs `rtk init -g` after reviewing
  the preview.
- **Headroom**: compress tool output, logs, files, and RAG chunks when the host is
  already set up — needs a running local proxy, a model backend, and
  `~/.claude/settings.json` wired to route through it; heaviest setup of the four,
  never something to "just enable". Check `pip3 show headroom-ai` before assuming it's
  absent — found genuinely already installed (v0.30.0) on this machine during this
  skill's own verification. `scripts/install-headroom.sh` wraps only the
  `pip install "headroom-ai[all]"` step, idempotently — it never collects API keys,
  starts the proxy, or touches `settings.json`; all three are printed as next steps
  for the user to do themselves. Package install + running proxy alone still don't
  route anything — that only happens once `settings.json`'s `env` block points
  `ANTHROPIC_BASE_URL` at the proxy (verified against a real, working setup;
  see `references/token-saving-tools.md`).

## Default Rules

- Prefer the standard library or existing repo tooling before adding a new helper.
- Prefer the smallest correct change before adding a wrapper or abstraction.
- Prefer terse outputs, but never drop technical facts that change the answer.
- Do not make setup-heavy tools mandatory until the environment is actually configured.

**Freshness rule:** recheck the upstream setup docs for Ponytail, Caveman, Headroom, and
RTK before changing installation guidance or host integration notes, because token-saving
tooling changes quickly.

## Testing

Validate this skill with short prompt-routing checks, not heavy integration scaffolds.

- `@Test` the trigger map: token-saving prompts should route to this skill, not to a feature skill.
- `runTest` the fallback rule: if Headroom is unavailable, the skill should still recommend Ponytail,
  Caveman, or RTK.
- Use a fake/no-op host setup when verifying that "Headroom optional until setup" stays true.

## Common Anti-Patterns

- loading Headroom before the host has it configured
- adding a wrapper when stdlib or an existing command is enough
- using a verbose reply when a shorter one preserves the same facts
- enabling every compressor at once
- treating Ponytail as a replacement for architecture judgment
- running `rtk init -g --auto-patch` on a generic "go ahead" — global config patches need confirmation of the specific diff, not a repeat of an earlier general approval; show `--dry-run` output first or have the user run it themselves interactively
- assuming the RTK hook is active immediately after `rtk init -g` — it only applies to Bash commands in sessions started after install completes, not the current one
- expecting `rtk gain` to show data right after install — it stays empty until the hook has actually processed commands in a fresh session; use `rtk discover` for a retroactive estimate instead
- running Caveman's `curl | bash` installer directly instead of telling the user to run it themselves — executing a remote script from an unverified source is a real risk, not a hypothetical one, regardless of what the script claims to do
- entering the user's LLM provider API key into Headroom's config on their behalf — never handle credentials for the user, even for a token-saving tool
- presenting all four tools as equally available defaults without checking what's actually installed first (`rtk --version`, checking for a Ponytail/Caveman/Headroom install) — recommending an uninstalled tool as if it's ready to use wastes the user's time chasing a setup step that was never mentioned
- assuming a plugin found in `claude plugin list` is available everywhere without checking its `scope` — `scope: project` + `enabled: false` means it's only active in the one project it was installed from, not "any project"
- running `scripts/install-ponytail.sh` (or any plugin install) automatically instead of having the user run it — it's a persistent, global change to their Claude Code environment
- assuming Headroom is absent without checking `pip3 show headroom-ai` first — it was found genuinely already installed once, and `scripts/install-headroom.sh` skips the install step entirely when that's true rather than re-installing
- telling the user Headroom is "set up" once the package is installed and the proxy is running — nothing actually routes through it until `~/.claude/settings.json`'s `env` block points `ANTHROPIC_BASE_URL` at the proxy, a step this skill originally missed entirely
- assuming Headroom always needs a paid provider API key — a real observed setup routed it to a local Ollama model instead, with `ANTHROPIC_AUTH_TOKEN` set to a placeholder, not a real credential
- assuming Claude-only hooks and plugins function in Antigravity or other agent runtimes without shell or `AGENTS.md` configuration — Antigravity executes in isolated runtimes and does not evaluate `~/.claude/settings.json` hooks or slash commands

## Related Skills

- `kmp-code-quality` — guardrails for simpler code and cleaner repo hygiene
- `kmp-project-docs-maintainer` — keep docs thin and aligned with the project
- `kmp-expert` — route the smallest useful skill set first
- `kmp-audit` — verify the simplification did not hide a real problem

## Output Style

1. Recommend the default.
2. Say whether setup is required.
3. Name the exact tool.
4. Give the fallback if setup is missing.

Keep it terse and factual.

## Reference

See [token-saving-tools.md](references/token-saving-tools.md) for tool-by-tool setup notes and source links.

## Changelog

| Date | Change |
|---|---|
| 2026-09-12 | Added Cross-Assistant Compatibility Matrix covering Claude Code, Google Antigravity & Gemini CLI, and Cursor / Windsurf / Codex. Documented why Antigravity bypasses Claude-specific `settings.json` hooks, and codified the equivalent token-saving workflow via `AGENTS.md` response density directives, manual/aliased `rtk` command execution, and native context checkpoint management. |
| 2026-07-13 | Fixed a real gap: this skill never documented that Headroom needs `~/.claude/settings.json`'s `env` block wired with `ANTHROPIC_BASE_URL` pointed at the local proxy — package install and a running proxy alone route nothing. Verified against a real, working setup (found by the user) that also showed the backend doesn't have to be a paid provider key; it can point at a local model (observed: Ollama). Updated `scripts/install-headroom.sh`'s printed next-steps, `references/token-saving-tools.md`, and 2 new anti-patterns. This settings.json wiring is treated the same as RTK's hook wiring — the user edits it, not this skill's script. |
| 2026-07-13 | Added `scripts/install-rtk.sh` — Phase 1 (`brew install rtk`) runs directly, then previews Phase 2 via `rtk init -g --dry-run` without applying it, matching the existing two-phase authorization rule. Also ran the previously-blocked `scripts/install-ponytail.sh` after the user gave specific confirmation naming that exact script: verified `ponytail@ponytail` is now installed at `scope: user`, `enabled: true` (was previously only `scope: project`, disabled, for one project). |
| 2026-07-13 | Added `scripts/install-headroom.sh`, scoped deliberately to the `pip install "headroom-ai[all]"` step only — idempotent (`pip show headroom-ai` first), never collects API keys or starts the local proxy, both left as printed next-steps for the user. Also discovered Headroom was already genuinely installed on this machine (`pip3 show headroom-ai` → v0.30.0), contradicting an earlier claim in this same skill that none of the three optional tools were present — a reminder to verify real install state before documenting it. |
| 2026-07-13 | Documented Caveman's real post-install state, verified in practice: the user ran the installer themselves and it genuinely registered as a Claude Code plugin (`caveman@caveman` in `~/.claude/plugins/installed_plugins.json`), not a standalone CLI — `which caveman` correctly finds nothing. It is not active by default even once installed; needs `/caveman [level]` per session or `/caveman-init` (which itself runs another `curl \| node -` internally — expected, since it's the already-reviewed plugin's own mechanism invoked by the user, not an agent fetching an unreviewed script). Also discovered Ponytail was already installed on this machine, but scoped to a single project and disabled (`claude plugin list` showed `scope: project`, `enabled: false`) — not "available in any project" as its earlier documentation implied. Verified `claude plugin marketplace add`/`claude plugin install` are real, non-interactive CLI equivalents of the `/plugin` slash commands (`claude --help` genuinely lists `plugin` as a subcommand), and added `scripts/install-ponytail.sh` wrapping both idempotently at user scope — still user-run, not automatic. |
| 2026-07-12 | Corrected the framing that all four tools are equally-available defaults: verified each tool's real install method rather than assuming. RTK — `brew install`, low risk, likely already installed (check `rtk --version` first). Ponytail — real Claude Code plugin via `/plugin marketplace add`, low risk, user-run. Caveman — `curl \| bash` from an unverified source, elevated risk; recommend it, never run the installer yourself. Headroom — local proxy + user's own API keys + first-run model download, heaviest setup of the four, never enter credentials on the user's behalf. 3 new anti-patterns. |
| 2026-07-10 | Documented RTK's real two-phase install, verified in practice: `brew install rtk` is safe to run directly, but `rtk init -g` (global hook wiring) got blocked by the auto-mode classifier on a generic "go ahead" — needs specific confirmation of the exact `--dry-run` diff instead. Also documented that the hook doesn't apply retroactively (needs a fresh session) and the `rtk gain`/`rtk discover` tracking commands. 3 new anti-patterns. |
| 2026-07-09 | Initial release — token-saving routing for Ponytail, Caveman, RTK, and optional Headroom. |

Files in this skill

  • SKILL.md14.6 KB
  • agents/openai.yaml139 B
  • references/token-saving-tools.md8.3 KB
  • scripts/install-headroom.sh2.6 KB
  • scripts/install-ponytail.sh2.2 KB
  • scripts/install-rtk.sh1.8 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.