Nag112

Save Token — AI skill for Claude Code

AI community

save-token is a small Go CLI that runs a shell command, compresses its stdout/stderr with a rule-based engine, and prints condensed output while preserving the original exit code.

How to install Save Token

This entry records only its repository, not the path inside it, so there is no exact command to give. Open Nag112/save-token and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Save Token does

`save-token` is a small Go CLI that runs a shell command, compresses its stdout/stderr with a rule-based engine, and prints condensed output while preserving the original exit code. Point your AI agent (Copilot, Claude, etc.) at it and long command outputs cost far fewer tokens, without losing error messages, test failures, or other critical lines.

Alternatives in AI

  • Ralph For Claude Code — by Frank Bria - An autonomous AI development framework that enables Claude Code to work iteratively on project 8k ★
  • LongHorizon Harness — The long-horizon computer-use harness 1.3k ★
  • Ralph Claude Code — Autonomous AI development loop for Claude Code with intelligent exit detection 1k ★

README

save-token

**Terminal output compression for AI coding agents.**

`save-token` is a small Go CLI that runs a shell command, compresses its stdout/stderr with a rule-based engine, and prints condensed output — while preserving the original exit code. Point your AI agent (Copilot, Claude, etc.) at it and long command outputs cost far fewer tokens, without losing error messages, test failures, or other critical lines.

save-token 

How it works

  1. A safety gate inspects the command. Interactive, streaming, or unsafe commands (sudo, vim, ssh, tail -f, …) are refused and executed raw (fail-open) — output is never mangled when compression would be wrong.
  2. A processor router picks the first matching formatter for the command: git, test runners (pytest / jest / go test / cargo test), linters (eslint / ruff), build output, package installs (pip / npm / cargo / go), with a generic fallback for everything else.
  3. The engine applies compression gates (ratio checks, critical-line recovery) so that error lines, tracebacks, and failure summaries are never dropped.
  4. && / ; command chains are split and compressed per segment.

The stdout you see is the compressed output; the process exit code is exactly the original command's exit code. A timeout exits `124` with partial compressed output.

Install

One-line install (recommended)

curl -fsSL https://raw.githubusercontent.com/Nag112/save-token/main/install.sh | bash

Downloads the latest release for your OS/arch into `~/.local/bin` (override with `SAVE_TOKEN_INSTALL_DIR`). Make sure `~/.local/bin` is on your `PATH`.

From a local checkout

./install.sh            # builds with Go and installs to ~/.local/bin
./install.sh --from-release   # force download from GitHub Releases

VS Code extension

The [`vscode-extension/`](vscode-extension/) folder is a VS Code extension that:

  • Bundles the save-token binary and