Skip to content
Development
Skill

/tokf-discover

Find missed token savings in Claude Code sessions and create filters for unfiltered commands

From plugin
tokf
1994 skills1 command

Claude Code

$ npx -y skills add mpecan/tokf --skill tokf-discover --agent claude-code

SKILL.md

tokf-discover.SKILL.md
name: tokf-discover
description: Find missed token savings in Claude Code sessions and create filters for unfiltered commands
user_invocable: true

tokf discover — Find Missed Token Savings

Use this skill to analyze Claude Code sessions and find commands that are running without tokf filtering, wasting tokens on verbose output.

Quick Start

Run `tokf discover` in the project directory to scan recent sessions:

tokf discover

Options

  • `--all` — scan all projects, not just the current one
  • `--since 7d` — only scan sessions from the last 7 days (also `24h`, `30m`)
  • `--limit 0` — show all results (default: top 20)
  • `--json` — output as JSON for programmatic use
  • `--session <path>` — scan a specific session file
  • `--project <path>` — scan sessions for a specific project path

Interpreting Results

The output shows:

  • **COMMAND** — the shell command pattern being run without filtering
  • **FILTER** — the tokf filter that would handle it
  • **RUNS** — how many times it appeared in sessions
  • **TOKENS** — estimated token count of unfiltered output
  • **SAVINGS** — estimated tokens that filtering would save

Workflow

1. Run `tokf discover` to identify top savings opportunities 2. For commands with existing filters: run `tokf hook install` to set up automatic filtering 3. For commands without filters: use `/tokf-filter` skill to create a custom filter 4. Re-run `tokf discover` after changes to verify improvement

Creating Filters for Unfiltered Commands

If `tokf discover` shows commands with no matching filter, create one:

# See what a filter would look like
tokf which "the-command --args"

# Use the tokf-filter skill to create a proper filter
# /tokf-filter

JSON Output

Use `--json` for integration with other tools:

tokf discover --json | jq '.results[] | select(.estimated_savings > 1000)'

The JSON schema includes:

  • `sessions_scanned` — number of JSONL files processed
  • `total_commands` — all Bash commands found
  • `already_filtered` — commands already using tokf
  • `filterable_commands` — commands with available filters
  • `no_filter_commands` — commands with no matching filter
  • `estimated_total_savings` — total estimated token savings
  • `results[]` — per-command breakdown sorted by savings
Read more
@mpecan
Ships withtokf

tokf.net — reduce LLM context consumption from CLI commands by 60–90%. Commands like git push, cargo test, and docker build produce verbose output packed with progress bars, compile noise, and boilerplate.

Stars on GitHub

Momentum

stars in total
199
Star history of mpecan/tokf on GitHub, a chart by star-history.com

Other skills on tokf.

codex-discover

codex-discover

Find missed token savings by scanning AI coding session files for commands that ran without tokf filtering.

@mpecan@mpecanInstall Skill
codex-run

codex-run

Compress verbose CLI output with tokf before returning results. Activates for git, cargo, npm, docker, go, gradle, kubectl, and…

@mpecan@mpecanInstall Skill
tokf-filter

tokf-filter

This skill should be used when the user asks to "create a filter", "write a tokf filter", "add a filter for <tool>", "how do I…

@mpecan@mpecanInstall Skill

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills11d309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc12d293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react2d252k
@facebook@facebookInstall Skill

Questions about tokf-discover.

Which coding agents can use tokf-discover?
tokf-discover installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.