Skip to content

How TokenShift works

TokenShift sits between a coding agent and the shell. When the agent runs a command — git diff, npm test, kubectl get pods — TokenShift intercepts the call, runs the real command, rewrites the output into a shorter form, and hands the trimmed text back to the agent. The full original is kept locally so the agent can fetch it back at any time.

agent runs: git diff
TokenShift recognizes the command
runs the real command
keeps the changes, trims the noise
caches the full output on disk
returns the short version to the agent

That’s all that happens. Five steps, every invocation. None of it requires configuration from the user — the rules ship in the binary.

Transparent, the default. A one-time install command writes hooks into the AI agent’s settings (today: Claude Code). From then on, every command the agent runs flows through TokenShift automatically. The agent has no idea compression is happening; it just sees shorter output.

Explicit, for scripts and shells. You can also call TokenShift directly — tokenshift git diff, tokenshift npm test. Useful for shell aliases or quick checks. Rarely needed in normal use.

Every compressed response ends with one extra line:

… tokenshift recover <hash>

That hash points to the full, uncompressed output, stored on the local machine. If the agent ever needs the original, it asks for it by hash and gets it back verbatim. The compressed view is a summary, not a truncation.

  • Command output, full and compressed: local only. Never leaves the device.
  • Local files: never touched. TokenShift only sees what commands print.
  • Telemetry: opt-in, encrypted, and contains no command output — just what compressed and by how much. See Security overview for the full breakdown.