token-hygiene

Analyzes session token usage and generates a graded cost-reduction report with recommendations.

1|Updated Apr 8, 2026
One-click install
npx skills add https://github.com/jp5labs/forge-workflow --skill token-hygiene-jp5labs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: token-hygiene
Source: https://github.com/jp5labs/forge-workflow/tree/main/forge_workflow/templates/skills/token-hygiene
Command: npx skills add https://github.com/jp5labs/forge-workflow --skill token-hygiene-jp5labs

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? AI coding sessions consume tokens inefficiently through poor cache usage, oversized model selection, truncated outputs, and fragmented sessions, driving up costs without visibility into where the waste occurs. ## Core Features & Use Cases - Deterministic Metrics Analysis: Runs a Python analyzer over transcript JSONL and usage logs to compute cache efficiency, model routing, tool efficiency, and cost trends. - Graded Card Report: Produces a per-dimension graded report (A-F) with quantified savings impact and copy-paste-ready remediation snippets. - Historical Trends: Aggregates rolling session history from tmp/usage-log.jsonl with per-bot cost breakdowns and week-over-week trajectory. - Use Case: After a long coding session, invoke the skill to discover that Explore subagents ran on an expensive model and receive the exact model="haiku" snippet to cut future costs. ## Quick Start Ask the assistant to run a token hygiene analysis on the current session and show the graded cost report.

Frequently Asked Questions about token-hygiene

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I analyze token usage in a Claude Code session?

Run the token-hygiene analyzer script against the session transcript JSONL and tmp/usage-log.jsonl. It computes cache efficiency, model routing, tool efficiency, and stop-reason metrics, then outputs structured JSON for report generation.

How to reduce AI session costs from model routing?

Route research and exploration subagents to cheaper models by adding model: haiku to the subagent frontmatter or passing model="haiku" in Agent() calls. The report quantifies the savings impact of this change per session.

What data sources does token usage analysis need?

The analysis uses three sources: the session transcript JSONL for per-call token counts, tmp/usage-log.jsonl for rolling session history, and .claude/model-costs.csv for per-model pricing. Without a transcript it runs in trends-only mode.

Can token analysis run without a session transcript?

Yes, the analyzer supports a trends-only mode by omitting the --transcript flag. It then reports only historical cost trends, per-bot breakdowns, and session fragmentation from the usage log.

Why does output truncation increase token costs?

Responses stopped at max_tokens waste compute because truncated output must be regenerated on retry. The stop-reasons dimension flags truncation counts and recommends breaking complex responses into smaller steps.