More screenshots
Works with the AI Agents you already use
Cut Claude Code Cache-Read Tokens With Short Sessions
This skill moves the durable state of a task into a short file, so you can end a session and start a fresh one that resumes from a clear next step.
$25
Cut Claude Code Cache-Read Tokens With Short Sessions
Example session with this skill installed
Audit examples/sample_session.jsonl with scripts/session_token_audit.py using a 200000-token context window and tell me whether I should start a fresh session.
- Read your context and instructions
- Compiled the cut claude code
Summary
Ran python3 scripts/session_token_audit.py --input examples/sample_session.jsonl --context-window 200000 --format text on the synthetic 5-turn sample. Almost all input was replayed history, so the session should be split and restarted from its state file. Token counts only; this is not a cost figure.
Audit output (exact, from examples/expected_output.txt)
Session: sample_session.jsonl | turns=5 | cache_read=412000 (96.7%) | uncached_in=14200 | out=2650 | input_to_output=160.8:1 | searches=4 | latest_context=76000/200000 (38.0% remaining) | status=reset-at-50
Findings:
- [excessive-cache-replay] cache_read share is 96.7% across 5 turns; split long task loops into fresh sessions.
- [redundant-knowledge-search] 4 knowledge searches in one session (recommended cap: 1 per task).
- [context-below-50pct] remaining context 38.0% is below 50% planned reset threshold.
How to read it
| Finding | What it means | What to do |
|---|---|---|
| excessive-cache-replay | 96.7% of input was cache-read replay across 5 turns | Split the task into short sessions |
| redundant-knowledge-search | 4 knowledge searches in one session | Search once per task and write the result to the state file |
| context-below-50pct | 38.0% of the 200000-token window remains | Reset at the planned 50% threshold |
Next steps
- Run
python3 scripts/boot_state_slice.py --file examples/sample_state.mdto print the 14-line header (14 of 20 header lines used; 2403 saved bytes, 81.3%) that the next session reads instead of all 55 lines. - Update
current_stepandnext_action, check the handoff, then start a fresh session. - Verify cache-read pricing for your own plan before estimating any savings.
Connects securely to your tools. The creator never sees your data.
About this skill
If Claude Code keeps compacting or hitting limits even though your prompts are short, the cost is usually the long conversation: every turn replays the whole history as cache-read tokens. This skill moves the durable state of a task into a short file, so you can end a session and start a fresh one that resumes from a clear next step.
What you get
- Four short guides: replay mechanics, a compact state file and 20-line boot, targeted reads and search caps, and context thresholds with a clean reset.
- Templates: a 20-line state file, session rules to drop into your project, and a handoff checklist.
session_token_audit.py: reads an exported JSONL session and reports turns, cache-read share, uncached input, output, the input-to-output ratio, a search-call count and remaining context, with findings such as excessive cache replay.boot_state_slice.py: extracts the header above<!-- LOG -->(up to 20 lines) from a state file, with saved bytes and a SHA-256 fingerprint, so a new session reads the header instead of the full history.
How it works
- At task start, read only the first 20 lines of the state file and resume from
current_stepandnext_action. - At each milestone, update those fields and keep the details below
<!-- LOG -->. - Before you end a bounded task, check the handoff, then start a fresh session.
Both scripts use only Python's standard library, and the examples are synthetic, so nothing reads your personal session files.
Limits
In the author's own production multi-agent workflow, one measured day was 96.8% cache_read of 2.53 billion tokens; results may not generalize. The utilities count tokens and file bytes, not money: cache-read rates vary by provider and plan, so check current pricing and your own usage records. JSONL usage schemas vary, missing counters count as zero, and the search-call count is a heuristic. State files must be UTF-8; UTF-16 and NUL-containing input is rejected.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for LLM Ops.
Requires Python for audit scripts. Relies on the existence of a STATE.md file. Token counts are estimates and may not reflect real-time billing exactly.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 1 day ago
- Software
Python 3.9+